libvpx codec operations use vpx_image_t structure for exchanging uncompressed frame data.
I got through understanding what majority of the members mean, but I'm stuck with x_chroma_shift
and y_chroma_shift
. The only explanation provided in the documentation is that it's "sub-sampling order". I am a newbie in YUV image formats, but I believe I understand what chroma sub-sampling is, but I can't quite figure out what does order of it mean.
Consider (w, h) YUV image (w and h are even numbers). Y plane size is also (w, h) but U/V plane size is (w << x_chroma_shift, h << y_chroma_shift) which is equivalent to (w / (1 << x_chroma_shift), h / (1 << y_chroma_shift)). Different chroma shift combinations define different YUV sub-samplings:
YUV | x_chroma_shift | y_chroma_shift
======+================+===============
4:2:0 | 1 | 1
4:2:2 | 1 | 0
4:4:4 | 0 | 0