mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
a0519f1d18
commit
47f2f554a3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue