From 59c18dc73d66142e71393fc411ef1e72e6d96a9e Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 13 Mar 2015 21:29:04 +0100 Subject: vo_opengl: apply alpha after conversion to rgb Currently this was done before conversion, which could fuck up a hypothetical YUVA stream. --- video/out/gl_video.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index c731c3f38d..54c303b431 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1211,7 +1211,7 @@ static void pass_read_video(struct gl_video *p) if (p->plane_count == 1) { GLSL(vec4 color = texture(texture0, texcoord0);) - goto fixalpha; + return; } const char *cscale = p->opts.scalers[1]; @@ -1253,16 +1253,8 @@ static void pass_read_video(struct gl_video *p) } GLSL(color = vec4(texture(texture0, texcoord0).r, chroma, 1.0);) - -fixalpha: - if (p->has_alpha) { - if (p->plane_count >= 4) - GLSL(color.a = texture(texture3, texcoord3).r;) - if (p->opts.alpha_mode == 0) // none - GLSL(color.a = 1.0;) - if (p->opts.alpha_mode == 2) // blend - GLSL(color = vec4(color.rgb * color.a, 1.0);) - } + if (p->has_alpha && p->plane_count >= 4) + GLSL(color.a = texture(texture3, texcoord3).r;) } // yuv conversion, and any other conversions before main up/down-scaling @@ -1352,8 +1344,11 @@ static void pass_convert_yuv(struct gl_video *p) GLSL(color.rgb = pow(color.rgb, vec3(1.0 / user_gamma));) } - if (!p->has_alpha) + if (!p->has_alpha || p->opts.alpha_mode == 0) { // none GLSL(color.a = 1.0;) + } else if (p->opts.alpha_mode == 2) { // blend + GLSL(color = vec4(color.rgb * color.a, 1.0);) + } } static void get_scale_factors(struct gl_video *p, double xy[2]) -- cgit v1.2.3