diff options
author | wm4 <wm4@nowhere> | 2015-12-19 16:11:28 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-12-19 16:11:34 +0100 |
commit | 47f2f554a3734078dabac2e740c22ad403e6a2c4 (patch) | |
tree | cc80a52f57949b9c7813a2cc6a5797cc2365110b | |
parent | a0519f1d188e3d3be8f0e78a71868d7cbf1cc11d (diff) |
vo_opengl: handle alpha with odd bit widths too
Since alpha isn't pulled through the colormatrix (maybe it should?), we
reject alpha formats with odd sizes, such as yuva444p10.
But the awful tex_mul path in vo_opengl does this anyway (at some points
even explicitly), which means there will be a subtle difference in
handling of 16 bit yuv alpha formats. Make it consistent and always
apply the range adjustment to the alpha component. This also means odd
sizes like 10 bit are supported now.
This assumes alpha uses the same "shifted" range as the yuv color
channels for depths larger than 8 bit. I'm not sure whether this is
actually the case.
-rw-r--r-- | video/out/opengl/video.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index fb7f9ee882..b2dd4564d0 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -1491,6 +1491,14 @@ static void pass_convert_yuv(struct gl_video *p) GLSL(color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;) + if (!p->use_normalized_range && p->has_alpha) { + float tex_mul = 1 / mp_get_csp_mul(p->image_params.colorspace, + p->image_desc.component_bits, + p->image_desc.component_full_bits); + gl_sc_uniform_f(p->sc, "tex_mul_alpha", tex_mul); + GLSL(color.a *= tex_mul_alpha;) + } + if (p->image_params.colorspace == MP_CSP_BT_2020_C) { // Conversion for C'rcY'cC'bc via the BT.2020 CL system: // C'bc = (B'-Y'c) / 1.9404 | C'bc <= 0 @@ -2697,10 +2705,6 @@ static bool init_format(int fmt, struct gl_video *init) supported: - // Stuff like IMGFMT_420AP10. Untested, most likely insane. - if (desc.num_planes == 4 && (desc.component_bits % 8) != 0) - return false; - if (desc.component_bits > 8 && desc.component_bits < 16) { if (init->texture_16bit_depth < 16) return false; |