diff options
author | Niklas Haas <git@nand.wakku.to> | 2015-03-13 21:29:04 +0100 |
---|---|---|
committer | Niklas Haas <git@nand.wakku.to> | 2015-03-13 21:30:38 +0100 |
commit | 59c18dc73d66142e71393fc411ef1e72e6d96a9e (patch) | |
tree | 9de178e433bac9c7d8f47bcc6fc04181752389b5 | |
parent | add208c58ac566827b7a32dd613bd68f56704ff3 (diff) | |
download | mpv-59c18dc73d66142e71393fc411ef1e72e6d96a9e.tar.bz2 mpv-59c18dc73d66142e71393fc411ef1e72e6d96a9e.tar.xz |
vo_opengl: apply alpha after conversion to rgb
Currently this was done before conversion, which could fuck up a
hypothetical YUVA stream.
-rw-r--r-- | video/out/gl_video.c | 19 |
1 files 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]) |