NV12M (source code)

= NV12M
{c}

\b[NV12M] is the non-contiguous-memory variant of <NV12> in the Linux video API. It stores eight-bit <luma (video)> separately from an interleaved Cb, Cr plane, using <4:2:0 chroma subsampling>. Its two <image memory planes> can occupy independent allocations; the second plane's address is not inferred by adding the first plane's size.<Planar YUV formats in the Linux Kernel documentation>[Semi-Planar table and NV12/NV21/NV12M/NV21M subsection]{ref}

For an original address example, stipulate an accepted width-six, height-four layout. Let the luma base be 1000 with <framebuffer stride> eight bytes, and the colour-difference base be 8000 with stride 12 bytes. The allocations occupy $4(8)=32$ and $2(12)=24$ <bytes>, respectively. Their 56 allocated bytes contain 36 active samples, with padding accounting for the difference.

At zero-based luma position $(r,c)=(3,5)$, the address is $1000+3(8)+5=1029$. In the declared subsampling grid, its associated colour-difference cell is $(1,2)$. The Cb address is $8000+1(12)+2(2)=8016$, and Cr is at 8017. Substituting 1032 for the second base would access an unrelated region under these stipulated allocations.

The <V4L2 multi-planar API> describes each memory plane explicitly. It also supports single-planar formats, so using that API does not itself prove that a buffer is NV12M. The negotiated <pixel format>, plane addresses, sizes and strides must agree.<Single- and multi-planar APIs in the Linux Kernel documentation>[§1.26, especially Multi-planar formats]{ref}

This separation changes buffer organization, not the <YCbCr> matrix, code ranges or <chroma sample location>. Those remain additional information needed for colour interpretation and <chroma reconstruction>.