summaryrefslogtreecommitdiffstats
path: root/video/img_format.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-04-21 23:11:23 +0200
committerwm4 <wm4@nowhere>2020-04-23 13:24:35 +0200
commit0f8f6a665b7bf7fc8786541eff518bacddbe1442 (patch)
treebb47ac337b6a249c2036910c599aaeb27728efa3 /video/img_format.h
parent7cb83593c2a032e91f82a90d0a9de8cf4d0fb158 (diff)
downloadmpv-0f8f6a665b7bf7fc8786541eff518bacddbe1442.tar.bz2
mpv-0f8f6a665b7bf7fc8786541eff518bacddbe1442.tar.xz
video: change chroma_w/chroma_h fields to use shift instead of size
When I added mp_regular_imgfmt, I made the chroma subsampling use the actual chroma division factor, instead of a shift (log2 of the actual value). I had some ideas about how this was (probably?) more intuitive and general. But nothing ever uses non-power of 2 subsampling (except jpeg in rare cases apparently, because the world is a bad place). Change the fields back to use shifts and rename them to avoid mistakes.
Diffstat (limited to 'video/img_format.h')
-rw-r--r--video/img_format.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/video/img_format.h b/video/img_format.h
index 4080e2f2fb..2bd448899b 100644
--- a/video/img_format.h
+++ b/video/img_format.h
@@ -130,8 +130,10 @@ struct mp_regular_imgfmt {
uint8_t num_planes;
struct mp_regular_imgfmt_plane planes[MP_MAX_PLANES];
- // Chroma pixel size (1x1 is 4:4:4)
- uint8_t chroma_w, chroma_h;
+ // Chroma shifts for chroma planes. 0/0 is 4:4:4 YUV or RGB. If not 0/0,
+ // then this is always a yuv format, with components 2/3 on separate planes
+ // (reduced by the shift), and planes for components 1/4 are full sized.
+ uint8_t chroma_xs, chroma_ys;
};
bool mp_get_regular_imgfmt(struct mp_regular_imgfmt *dst, int imgfmt);