[vlc-commits] vdpau/chroma: select CSC matrix from input video format

Rémi Denis-Courmont git at videolan.org
Sat Apr 16 16:16:42 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 16 17:16:11 2016 +0300| [5a1eca7aabf3160c7af5aacba3374df4f9856f3e] | committer: Rémi Denis-Courmont

vdpau/chroma: select CSC matrix from input video format

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5a1eca7aabf3160c7af5aacba3374df4f9856f3e
---

 modules/hw/vdpau/chroma.c |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index be0816b..ffdd649 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -66,9 +66,24 @@ static VdpStatus MixerSetupColors(filter_t *filter, const VdpProcamp *procamp,
     filter_sys_t *sys = filter->p_sys;
     VdpStatus err;
     /* XXX: add some margin for padding... */
-    VdpColorStandard std = (filter->fmt_in.video.i_height > 576 + 16)
-                         ? VDP_COLOR_STANDARD_ITUR_BT_709
-                         : VDP_COLOR_STANDARD_ITUR_BT_601;
+    VdpColorStandard std;
+
+    switch (filter->fmt_in.video.space)
+    {
+        case COLOR_SPACE_BT601:
+        case COLOR_SPACE_BT601_FULL: /* FIXME: wrong, use custom CSC */
+            std = VDP_COLOR_STANDARD_ITUR_BT_601;
+            break;
+        case COLOR_SPACE_BT709:
+        case COLOR_SPACE_BT709_FULL: /* FIXME: same as above */
+            std = VDP_COLOR_STANDARD_ITUR_BT_709;
+            break;
+        default:
+            if (filter->fmt_in.video.i_height >= 720)
+                std = VDP_COLOR_STANDARD_ITUR_BT_709;
+            else
+                std = VDP_COLOR_STANDARD_ITUR_BT_601;
+    }
 
     err = vdp_generate_csc_matrix(sys->vdp, procamp, std, csc);
     if (err != VDP_STATUS_OK)



More information about the vlc-commits mailing list