[vlc-commits] gl: fix packed YUV422 fragment shaders

Thomas Guillem git at videolan.org
Thu Aug 24 15:16:03 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Aug 24 14:26:26 2017 +0200| [3ce0aa0303fe904fbb5b4e5d8887f1d39a95fbed] | committer: Thomas Guillem

gl: fix packed YUV422 fragment shaders

Fixes #18671

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

 modules/video_output/opengl/converters.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/opengl/converters.c b/modules/video_output/opengl/converters.c
index 15176e8bab..bd71fbe73f 100644
--- a/modules/video_output/opengl/converters.c
+++ b/modules/video_output/opengl/converters.c
@@ -204,23 +204,33 @@ tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
     }
     else if (desc->plane_count == 1)
     {
+        /* Y1 U Y2 V fits in R G B A */
         tc->tex_count = 1;
         tc->texs[0] = (struct opengl_tex_cfg) {
-            { 1, 1 }, { 1, 1 }, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE
+            { 1, 2 }, { 1, 2 }, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE
         };
+
+        /*
+         * Set swizzling in Y1 U V order
+         * R  G  B  A
+         * U  Y1 V  Y2 => GRB
+         * Y1 U  Y2 V  => RGA
+         * V  Y1 U  Y2 => GBR
+         * Y1 V  Y2 U  => RAG
+         */
         switch (chroma)
         {
             case VLC_CODEC_UYVY:
-                swizzle_per_tex[0] = "gbr";
+                swizzle_per_tex[0] = "grb";
                 break;
             case VLC_CODEC_YUYV:
-                swizzle_per_tex[0] = "rgb";
+                swizzle_per_tex[0] = "rga";
                 break;
             case VLC_CODEC_VYUY:
-                swizzle_per_tex[0] = "bgr";
+                swizzle_per_tex[0] = "gbr";
                 break;
             case VLC_CODEC_YVYU:
-                swizzle_per_tex[0] = "rbg";
+                swizzle_per_tex[0] = "rag";
                 break;
             default:
                 assert(!"missing chroma");



More information about the vlc-commits mailing list