Skip to content

[imageio] Update QOI format implementation code from upstream #18917

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

victoryforce
Copy link
Collaborator

This PR updates the single-header implementation of QOI format (we use an upstream copy in our source tree) to the current version. The author of the upstream enhancement claims that it makes QOI encoding 1.4% faster by replacing modulo with mask. We don't use encoding because we don't export to that format, but an identical change was made to the decoding code as well, so we can expect decoding to be faster by a comparable amount.

@TurboGit TurboGit added this to the 5.4 milestone Jun 3, 2025
@TurboGit
Copy link
Member

TurboGit commented Jun 3, 2025

This seems ultra safe and QOI is not a widely used format, yet I'm not sure we should have this late in 5.2 release cycle. What's your take @victoryforce?

@victoryforce
Copy link
Collaborator Author

The decoding speedup due to the faster operation (maybe around 1%) is too small to be noticeable. So it's perfectly OK to leave this change for the 5.4 release cycle.

OTOH, I don't see any danger of introducing bugs, since for unsigned integers x % 64 is equivalent to x & 63, and the values ​​to which these operations are applied in qoi.h are unsigned.

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