mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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).
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user