diff options
author | wm4 <wm4@nowhere> | 2015-01-21 19:29:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-21 19:29:18 +0100 |
commit | a0caadd512a6f531fd01638570883e629f9dc6e5 (patch) | |
tree | 9023c03a9229b1ef2e7c5fee0aea778fbf0c2edc /video/img_format.c | |
parent | 30ca30c0a16a7ee034d9e05280ba221427d48ba1 (diff) | |
download | mpv-a0caadd512a6f531fd01638570883e629f9dc6e5.tar.bz2 mpv-a0caadd512a6f531fd01638570883e629f9dc6e5.tar.xz |
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).
Diffstat (limited to 'video/img_format.c')
-rw-r--r-- | video/img_format.c | 8 |
1 files changed, 6 insertions, 2 deletions
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]); |