From 3ce0aa0303fe904fbb5b4e5d8887f1d39a95fbed Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Thu, 24 Aug 2017 14:26:26 +0200 Subject: [PATCH] gl: fix packed YUV422 fragment shaders Fixes #18671 --- 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"); -- 2.11.4.GIT