gallium/auxiliary/vl: Fix RGB->YCbCr full range matrix
authorDavid Rosca <nowrep@gmail.com>
Wed, 19 Jul 2023 10:10:21 +0000 (12:10 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 21 Jul 2023 15:16:26 +0000 (15:16 +0000)
Also rename it to bt_709_rev_full as there already
is bt_709 which is used for YCbCr->RGB.

Fixes: 8a21efce3a2 ("frontends/va: Add postproc support for converting to full range")

Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24238>

src/gallium/auxiliary/vl/vl_csc.c

index dccedf8..b015a44 100644 (file)
@@ -137,10 +137,10 @@ static const vl_csc_matrix bt_709_rev  = {
    { 0.439f, -0.399f, -0.040f, 0.5f   }
 };
 
-static const vl_csc_matrix bt_709_full  = {
-   { 0.0f,  1.0f, 0.0f, 0.0f },
-   { 0.0f, -0.5f, 0.5f, 0.5f },
-   { 0.5f, -0.5f, 0.0f, 0.5f }
+static const vl_csc_matrix bt_709_rev_full = {
+   { 0.213f,  0.715f,  0.072f, 0.0f },
+   {-0.115f, -0.385f,  0.5f,   0.5f },
+   { 0.5f,   -0.454f, -0.046f, 0.5f }
 };
 
 static const vl_csc_matrix identity =
@@ -197,7 +197,7 @@ void vl_csc_get_matrix(enum VL_CSC_COLOR_STANDARD cs,
          cstd = &smpte240m;
          break;
       case VL_CSC_COLOR_STANDARD_BT_709_REV:
-         memcpy(matrix, full_range ? bt_709_full : bt_709_rev, sizeof(vl_csc_matrix));
+         memcpy(matrix, full_range ? bt_709_rev_full : bt_709_rev, sizeof(vl_csc_matrix));
          return;
       case VL_CSC_COLOR_STANDARD_IDENTITY:
       default: