summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-09 23:56:11 +0100
committerwm4 <wm4@nowhere>2019-11-09 23:56:44 +0100
commit35de8ea0a8a665321e814efe5e59b7dd6c237cd1 (patch)
tree016a77dc853db8177a089c94bc0d4d70d70e7f1c
parent05f018b81aa3aec27dc61cbc7308b91cc858dfd8 (diff)
downloadmpv-35de8ea0a8a665321e814efe5e59b7dd6c237cd1.tar.bz2
mpv-35de8ea0a8a665321e814efe5e59b7dd6c237cd1.tar.xz
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.
-rw-r--r--video/out/gpu/video.c14
1 files changed, 6 insertions, 8 deletions
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,