Skip to content

Don't use f32::round for Cicp#2837

Merged
197g merged 1 commit intoimage-rs:mainfrom
RunDevelopment:faster-cicp
Mar 10, 2026
Merged

Don't use f32::round for Cicp#2837
197g merged 1 commit intoimage-rs:mainfrom
RunDevelopment:faster-cicp

Conversation

@RunDevelopment
Copy link
Member

Found another 2 uses of f32::round for f32 -> u8/u16 conversion. Just like in #2834, I replaced them with a + 0.5 to make them faster on x86. How much faster I don't know, since we don't have benchmarks for color space conversions. But since clamp_from_f32 is often used in tight loops, I suspect that those loops are probably at least 2x faster now.

@197g 197g merged commit 3a92b1e into image-rs:main Mar 10, 2026
31 checks passed
@RunDevelopment RunDevelopment deleted the faster-cicp branch March 10, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants