Mesa (master): st/vdpau: fix GenerateCSCMatrix with NULL procamp

Christian König deathsimple at kemper.freedesktop.org
Wed Oct 9 11:56:33 UTC 2013


Module: Mesa
Branch: master
Commit: 1a5bac2149fa2c6224b40c0b40839c2025414e79
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a5bac2149fa2c6224b40c0b40839c2025414e79

Author: Grigori Goronzy <greg at chown.ath.cx>
Date:   Wed Oct  9 02:23:50 2013 +0200

st/vdpau: fix GenerateCSCMatrix with NULL procamp

As per API specification, it is legal to supply a NULL procamp. In this
case, a CSC matrix according to the colorspace should be generated,
but no further adjustments are made.

Addresses:
https://trac.videolan.org/vlc/ticket/9281
https://bugs.freedesktop.org/show_bug.cgi?id=68792

Reviewed-by: Christian König <christian.koenig at amd.com>

---

 src/gallium/state_trackers/vdpau/mixer.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index 8476329..f9b413e 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -768,22 +768,25 @@ vlVdpGenerateCSCMatrix(VdpProcamp *procamp,
    enum VL_CSC_COLOR_STANDARD vl_std;
    struct vl_procamp camp;
 
-   if (!(csc_matrix && procamp))
+   if (!csc_matrix)
       return VDP_STATUS_INVALID_POINTER;
 
-   if (procamp->struct_version > VDP_PROCAMP_VERSION)
-      return VDP_STATUS_INVALID_STRUCT_VERSION;
-
    switch (standard) {
       case VDP_COLOR_STANDARD_ITUR_BT_601: vl_std = VL_CSC_COLOR_STANDARD_BT_601; break;
       case VDP_COLOR_STANDARD_ITUR_BT_709: vl_std = VL_CSC_COLOR_STANDARD_BT_709; break;
       case VDP_COLOR_STANDARD_SMPTE_240M:  vl_std = VL_CSC_COLOR_STANDARD_SMPTE_240M; break;
       default: return VDP_STATUS_INVALID_COLOR_STANDARD;
    }
-   camp.brightness = procamp->brightness;
-   camp.contrast = procamp->contrast;
-   camp.saturation = procamp->saturation;
-   camp.hue = procamp->hue;
-   vl_csc_get_matrix(vl_std, &camp, true, csc_matrix);
+
+   if (procamp) {
+      if (procamp->struct_version > VDP_PROCAMP_VERSION)
+         return VDP_STATUS_INVALID_STRUCT_VERSION;
+      camp.brightness = procamp->brightness;
+      camp.contrast = procamp->contrast;
+      camp.saturation = procamp->saturation;
+      camp.hue = procamp->hue;
+   }
+
+   vl_csc_get_matrix(vl_std, procamp ? &camp : NULL, true, csc_matrix);
    return VDP_STATUS_OK;
 }




More information about the mesa-commit mailing list