4:2:0 chroma subsampling 2026-11-05
4:2:0 chroma subsampling keeps the full luma grid while halving each colour-difference component's sampling rate horizontally and vertically. For even width and height , it retains Y samples and samples each of Cb and Cr.[ref] The zero in the notation does not mean that one colour-difference component has disappeared.
For an original six-by-four eight-bit image, the active payload is
compared with 72 bytes for 4:4:4 chroma sampling and 48 bytes for 4:2:2 chroma subsampling. Thus the 4:2:0 payload is half the 4:4:4 payload and three quarters of the 4:2:2 payload under these declared assumptions. It averages 12 bits per original pixel, without row padding or alpha.
Figure 1. . Black crosses mark 16 luma positions. Each blue circle marks one Cb sample and one Cr sample. The reduced grids are deliberately centered between luma positions in the directions being reduced; these illustrative locations are not a universal rule for every video format. Details.
Both colour components have fewer samples, so chroma reconstruction must estimate values at additional positions before a full-resolution colour conversion. It cannot generally reverse information discarded during downsampling. The chroma sample location also matters: identical counts can correspond to different spatial offsets.
NV12 stores the reduced components as interleaved Cb/Cr pairs after a luma plane; NV21 reverses each pair. A fully planar pixel format can keep the two colour-difference arrays separate. All can carry 4:2:0 sampling, so plane count and pair order must be specified in addition to the sampling ratio.
NV21M 2026-11-05
NV21M is a two-memory-plane semiplanar pixel format for eight-bit YCbCr with 4:2:0 chroma subsampling. Like NV21, its colour-difference plane stores Cr before Cb in each pair. Unlike ordinary contiguous NV21, the two image memory planes can have independent allocations.[ref]
For an original example, stipulate an accepted width-four, height-four layout whose luma plane begins at 1000 with an eight-byte framebuffer stride, while its Cr/Cb plane begins at 5000 with a four-byte stride. Luma position is at . The corresponding subsampled cell has Cr at and Cb at 5007. This ordering is the reverse of NV12M.
The active sample count is bytes. The declared allocation sizes are bytes because luma rows have padding. Neither 40 nor 24 is an offset that can replace the explicitly supplied second-plane base.
A layout conversion to NV12M can exchange the two bytes in each active colour-difference pair while respecting each plane's stride. It does not require changing luma values or reducing the colour sample count. By contrast, choosing a different YCbCr matrix would be a colour conversion.
The distinction between a multi-planar format and the V4L2 multi-planar API matters here: the interface can carry formats with different memory organizations, while the format identifies which organization the supplied descriptors represent.[ref]
Semiplanar pixel format 2026-11-05
A semiplanar pixel format combines a separate sample plane with another plane containing interleaved components. A common YCbCr arrangement stores luma samples in one plane and pairs of colour-difference samples in another. It therefore has two planes while representing three components. Linux's video API distinguishes this from the three separate planes of a fully planar pixel format.[ref]
In NV12, one byte represents each sample. Chroma subsampling halves the colour-difference sampling count in both directions, and the second plane stores Cb followed by Cr in each pair. NV21 reverses that pair order. For even width and height , tightly stored active samples occupy
Thus a stipulated image contains eight Y samples and two Cb/Cr pairs: 12 active bytes. The eight Y bytes can be followed by Cb00 Cr00 Cb01 Cr01. The component names identify stored codes; their colour interpretation also requires the declared YCbCr conventions.[ref]
Active sample count differs from allocated storage. With an eight-byte framebuffer stride for both planes in this example, two Y rows and one interleaved row occupy bytes including padding. A consumer needs dimensions, strides, component order and whether planes are adjacent or separately allocated. Reinterpreting NV21 as NV12 swaps the two colour-difference components; it does not recover the intended colours merely because the buffer size matches.
YCbCr 2026-11-05
YCbCr represents colour using a luma component and two scaled colour-difference components. It is a family of encodings: the matrix coefficients, numerical ranges and color space must be specified. Recommendation ITU-R BT.709-6 defines one important set of signal and digital-coding conventions.
For its normalized nonlinear RGB signals , define
Here denote normalized colour differences before digital scaling. For nominal eight-bit video codes, the corresponding relationships are
These are the recommendation's signal equations and quantization scales, with nearest-integer rounding applied at the end and half-integers rounded upward.[ref]
For an original red example, gives , and . The rounded code triple is approximately . Neutral gray instead gives , hence neutral colour-difference codes 128 regardless of gray level. An RGB triple cannot simply be copied into the YCbCr component slots.
This conversion alone need not reduce the number of samples. Chroma subsampling separately reduces the spatial sampling of the colour-difference components. NV12 and NV21 additionally specify how those samples occupy computer memory. A colour conversion, a sampling choice and a storage layout therefore describe three different operations.