Skip to content

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

@Tynach

Description

@Tynach

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions