NV21M (source code)
= NV21M
{c}
\b[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 \b[Cr before Cb] in each pair. Unlike ordinary contiguous <NV21>, the two <image memory planes> can have independent allocations.<Planar YUV formats in the Linux Kernel documentation>[Semi-Planar table and NV12/NV21/NV12M/NV21M subsection]{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 $(3,3)$ is at $1000+3(8)+3=1027$. The corresponding subsampled cell $(1,1)$ has Cr at $5000+1(4)+2(1)=5006$ and Cb at 5007. This ordering is the reverse of <NV12M>.
The active sample count is $4(4)+2(2)(2)=24$ <bytes>. The declared allocation sizes are $4(8)+2(4)=40$ 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.<Single- and multi-planar APIs in the Linux Kernel documentation>[§1.26.1, API versus format]{ref}
Back to article page