Chroma subsampling (source code)

= Chroma subsampling

\b[Chroma subsampling] represents colour-difference components on a coarser spatial grid than <luma (video)>. In <YCbCr> video, <4:4:4 chroma sampling> keeps full sample counts for every component; <4:2:2 chroma subsampling> halves the colour-difference count horizontally; <4:2:0 chroma subsampling> halves it horizontally and vertically.<Recommended 8-Bit YUV Formats for Video Rendering by Gary Sullivan and Stephen Estrop>[YUV Sampling, definitions of4:4:4,4:2:2 and4:2:0]{ref}

For an original eight-bit $4\times2$ image with no padding or alpha, full sampling uses eight samples in each of three components: 24 <bytes>. With horizontal halving, the count becomes $8+4+4=16$ bytes. Halving in both directions gives $8+2+2=12$ bytes. These count active samples, not the allocation overhead of a particular <pixel format>.

The reduction loses information unless the discarded variations are otherwise constrained. For a stipulated pair of neighbouring samples with constant luma, let one colour-difference channel have values $+0.1$ and $-0.1$. Averaging the pair and retaining only the average stores zero. Reconstructing both positions as zero cannot recover which one was originally positive. Fine colour variation can therefore disappear even though both luma samples remain intact.

A <low-pass filter> before reducing the sampling rate controls <aliasing>; merely dropping alternate samples need not. Later <chroma reconstruction> estimates the missing positions. It must respect <chroma sample location>: equal sample counts do not determine where those samples lie relative to the luma grid. The Microsoft primary guide explicitly distinguishes different 4:2:0 grids and discusses interpolation during format conversion.<Recommended 8-Bit YUV Formats for Video Rendering by Gary Sullivan and Stephen Estrop>[YUV Sampling diagrams; Converting4:2:0 YUV to4:2:2 YUV]{ref}

Storage organization is independent of this sampling ratio. <NV12> interleaves the two reduced components in a second plane, while a fully <planar pixel format> can store them in separate planes. Rearranging the same samples changes layout, not sampling resolution.