Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster YUV -> RGBA conversion #122

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Conversation

Shnatsel
Copy link
Contributor

Apply the two-pixels-at-once optimization for YUV conversion to RGBA codepath. RGB was already using it, so this is just a port of the same algorithm to RGBA.

Most of the code was written by @okaneco and posted in a comment on #13, I've just wired up the function they shared on godbolt.

I'm seeing a 7% end-to-end performance improvement on the sample from #119. With YUV->RGBA conversion accounting for 16% of the time, the function must have gotten roughly twice faster.

…codepath. RGB was already using it, so this is just a port from RGBA.
@Shnatsel
Copy link
Contributor Author

Writing a quickcheck-like test was a hassle because I didn't know how to properly populate Frame, but I ran it on my corpus of 7500 WebP files scraped off the web and there were no divergences before and after this change. So I'm confident it's correct.

@kornelski kornelski merged commit 833e6e7 into image-rs:main Dec 19, 2024
7 checks passed
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