summaryrefslogtreecommitdiffstats
path: root/video/img_format.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-07 23:41:29 +0100
committerwm4 <wm4@nowhere>2015-12-07 23:48:59 +0100
commit663415b914d48ea996a9b770f57b14f9ec8136db (patch)
treea38b685bc2f646b5012e6b4d58fce0f50120cf33 /video/img_format.c
parentc569d4f6ed7f8395d8c399bde048234065f0c65a (diff)
downloadmpv-663415b914d48ea996a9b770f57b14f9ec8136db.tar.bz2
mpv-663415b914d48ea996a9b770f57b14f9ec8136db.tar.xz
vo_opengl: fix issues with some obscure pixel formats
The computation of the tex_mul variable was broken in multiple ways. This variable is used e.g. by debanding for moving expansion of 10 bit fixed-point input to normalized range to another stage of processing. One obvious bug was that the rgb555 pixel format was broken. This format has component_bits=5, but obviously it's already sampled in normalized range, and does not need expansion. The tex_mul-free code path avoids this by not using the colormatrix. (The code was originally designed to work around dealing with the generally complicated pixel formats by only using the colormatrix in the YUV case.) Another possible bug was with 10 bit input. It expanded the input by bringing the [0,2^10) range to [0,1], and then treating the expanded input as 16 bit input. I didn't bother to check what this actually computed, but it's somewhat likely it was wrong anyway. Now it uses mp_get_csp_mul(), and disables expansion when computing the YUV matrix.
Diffstat (limited to 'video/img_format.c')
-rw-r--r--video/img_format.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/img_format.c b/video/img_format.c
index 332bf3676f..42b4df45ab 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -174,6 +174,7 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt)
}
desc.plane_bits = planedepth[0];
+ desc.component_full_bits = desc.component_bits;
// Check whether any components overlap other components (per plane).
// We're cheating/simplifying here: we assume that this happens if a shift
@@ -241,6 +242,7 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt)
desc.bpp[p] == desc.bpp[0];
}
if (same_depth && pd->nb_components == desc.num_planes) {
+ desc.component_full_bits = (desc.component_bits + 7) / 8 * 8;
if (desc.flags & MP_IMGFLAG_YUV) {
desc.flags |= MP_IMGFLAG_YUV_P;
} else {
@@ -262,7 +264,9 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt)
if (pd->flags & AV_PIX_FMT_FLAG_HWACCEL) {
desc.flags |= MP_IMGFLAG_HWACCEL;
- desc.plane_bits = 8; // usually restricted to 8 bit; may change
+ desc.component_bits = 8; // usually restricted to 8 bit; may change
+ desc.component_full_bits = desc.component_bits;
+ desc.plane_bits = desc.component_bits;
}
if (desc.chroma_xs || desc.chroma_ys)