From a0caadd512a6f531fd01638570883e629f9dc6e5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 21 Jan 2015 19:29:18 +0100 Subject: vo_opengl: handle grayscale input better, add YA16 support Simply clamp off the U/V components in the colormatrix, instead of doing something special in the shader. Also, since YA8/YA16 gave a plane_bits value of 16/32, and a colormatrix calculation overflowed with 32, add a component_bits field to the image format descriptor, which for YA8/YA16 returns 8/16 (the wrong value had no bad consequences otherwise). --- video/img_format.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'video/img_format.c') diff --git a/video/img_format.c b/video/img_format.c index 92851c0339..db130ad67e 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -142,6 +142,7 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt) .avformat = fmt, .chroma_xs = pd->log2_chroma_w, .chroma_ys = pd->log2_chroma_h, + .component_bits = pd->comp[0].depth_minus1 + 1, }; int planedepth[4] = {0}; @@ -154,6 +155,8 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt) desc.bpp[d.plane] = (d.step_minus1 + 1) * el_size; planedepth[d.plane] += d.depth_minus1 + 1; need_endian |= (d.depth_minus1 + 1 + d.shift) > 8; + if (d.depth_minus1 + 1 != desc.component_bits) + desc.component_bits = 0; } for (int p = 0; p < 4; p++) { @@ -315,8 +318,9 @@ int main(int argc, char **argv) FLAG(MP_IMGFLAG_PAL, "pal") FLAG(MP_IMGFLAG_HWACCEL, "hw") printf("\n"); - printf(" planes=%d, chroma=%d:%d align=%d:%d bits=%d\n", d.num_planes, - d.chroma_xs, d.chroma_ys, d.align_x, d.align_y, d.plane_bits); + printf(" planes=%d, chroma=%d:%d align=%d:%d bits=%d cbits=%d\n", + d.num_planes, d.chroma_xs, d.chroma_ys, d.align_x, d.align_y, + d.plane_bits, d.component_bits); printf(" {"); for (int n = 0; n < MP_MAX_PLANES; n++) printf("%d/%d/[%d:%d] ", d.bytes[n], d.bpp[n], d.xs[n], d.ys[n]); -- cgit v1.2.3