• Niklas Haas's avatar
    video_output: opengl: add BT.2020 decoding matrices · a4ef9238
    Niklas Haas authored and Thomas Guillem's avatar Thomas Guillem committed
    Generated the matrices using the following small program:
        #include <stdio.h>
        #include <libplacebo/colorspace.h>
        void main()
            struct pl_color_repr repr = {
                .sys    = PL_COLOR_SYSTEM_BT_2020_NC,
                .levels = PL_COLOR_LEVELS_TV,
            struct pl_transform3x3 tf = pl_color_repr_decode(&repr, NULL);
            for (int i = 0; i < 3; i++) {
                printf("% .15f, % .15f, % .15f, % .15f ,\n",
                      tf.mat.m[i][0], tf.mat.m[i][1], tf.mat.m[i][2], tf.c[i]);
    I've also verified that the BT.709 and BT.601 matrices are identical
    within an error margin of several orders of magnitude. (Probably due to
    floating point inaccuracy)
    P.s. VLC doesn't seem to distinguish between BT.2020-NC and BT.2020-CL,
    which I believe is a bug. But anyway, we can only easily handle
    BT.2020-NC anyway, so hard-code it as that. (BT.2020-CL support would
    require some more libplacebo integration)
    Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
fragment_shaders.c 22.4 KB