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

All videos are decoded from YUV/YCbCr as if they use a Rec. 601 color matrix. #216

Open
Tynach opened this issue Jun 4, 2024 · 0 comments

Comments

@Tynach
Copy link

Tynach commented Jun 4, 2024

This is because of lines 86 through 88 in /ui/gl/gl_shader.cpp. The formula there is an extremely approximate variation of the Rec. 601 color matrix (except done using a separate component assignments instead of a proper matrix multiply).

It would be much more robust if instead there were multiple YUV matrices that could be used, and use metadata stored in the video files themselves to determine which to use. As a fallback, HD videos that are not tagged should be decoded with the Rec. 709 matrix, and non-HD videos that are not tagged should continue to be decoded with the Rec. 601 matrix.

As an aside, there's a typo in line 88; that second term should be 2.017, not 2.17. Or, well, technically it should be 2.0172321429, but I did say that these were very approximate. Apparently, back in 2022 I had written a few comments to the commit that introduced that typo. I'm a little short on time while I type this bug report, but I apparently wasn't back then and went into a lot more detail.

I will say that I'm noticing that I put .a at the end of the bits that read from the YUV texture planes, when I think that should probably be .r. I don't know what I was thinking.

Anyway, I figure it'd be more visible if I put this in a bug report instead of just some comments on an old commit.

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

1 participant