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

jo-mpeg-in-c/ #5

Open
utterances-bot opened this issue Jan 20, 2025 · 2 comments
Open

jo-mpeg-in-c/ #5

utterances-bot opened this issue Jan 20, 2025 · 2 comments

Comments

@utterances-bot
Copy link

Jo_MPEG converted to C

Single-header MPEG-1 Video library ported to C

https://blog.frost.kiwi/jo-mpeg-in-c/

Copy link

r-lyeh commented Jan 20, 2025

Clarification for the 1.02 fix: colors were washed out because R/G components were swapped.

Original code:

float r = c[0], g = c[1], b = c[2];
Y[i] = (0.59f*r + 0.30f*g + 0.11f*b) * (219.f/255) + 16;

Proposed fix, per https://en.wikipedia.org/wiki/YUV formulas:

float r = c[0], g = c[1], b = c[2];
Y[i] = (0.59f*g + 0.30f*r + 0.11f*b) * (219.f/255) + 16;

Not sure what happened after.

Copy link
Owner

@r-lyeh Thx for clarifying!
Using Big Buck Bunny, scenes with very few reds, I missed the color mismatch. Now with your correction in place, it really does looks identical now in terms of color. I added an addendum, included the changes in the code and inserted a sample with lots of red in the scene, where the color mismatch is very apparent.

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

No branches or pull requests

3 participants