From 35de8ea0a8a665321e814efe5e59b7dd6c237cd1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 Nov 2019 23:56:11 +0100 Subject: vo_gpu: yuv alpha is always full range Probably. It's not like these pixel formats are formally specified - FFmpeg added them because _some_ file format or decoder supports it, and while that format/codec may define it precisely, the pixel format is sort of disconnected and just a FFmpeg thing. In any case, the yuva sample I had at hand uses the full range the component data type can provide. The old code used the same "shifted" range as for Y/U/V components, which must have been wrong. This will not work correctly for packed YUVA formats, but fortunately they matter even less. --- video/out/gpu/video.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'video/out/gpu') diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index d6dd7ed8aa..a6db4ebaa9 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -756,14 +756,6 @@ static void pass_get_images(struct gl_video *p, struct video_image *vimg, chroma.t[1] = ls_h < 1 ? ls_h * -cy / 2 : 0; } - int msb_valid_bits = - p->ra_format.component_bits + MPMIN(p->ra_format.component_pad, 0); - // The existing code assumes we just have a single tex multiplier for - // all of the planes. This may change in the future - float tex_mul = 1.0 / mp_get_csp_mul(p->image_params.color.space, - msb_valid_bits, - p->ra_format.component_bits); - memset(img, 0, 4 * sizeof(img[0])); for (int n = 0; n < p->plane_count; n++) { struct texplane *t = &vimg->planes[n]; @@ -789,6 +781,12 @@ static void pass_get_images(struct gl_video *p, struct video_image *vimg, padding = i + 1; } + int msb_valid_bits = + p->ra_format.component_bits + MPMIN(p->ra_format.component_pad, 0); + int csp = type == PLANE_ALPHA ? MP_CSP_RGB : p->image_params.color.space; + float tex_mul = + 1.0 / mp_get_csp_mul(csp, msb_valid_bits, p->ra_format.component_bits); + img[n] = (struct image){ .type = type, .tex = t->tex, -- cgit v1.2.3