NV12 and YV12 can represent the same 4:2:0 sample counts while arranging their bytes differently. NV12 interleaves its U and V samples after the luma plane. YV12 stores separate V and U planes. Exchanging only the format label leaves the bytes unchanged and gives the receiving stage the wrong layout.
Count samples before locating bytes
For an illustrative four-by-four image with no row padding, there are sixteen eight-bit Y samples and four samples of each chroma component. That is twenty-four sample bytes altogether. The 4:2:0 ratio establishes those counts, but does not tell the receiver whether the eight chroma bytes are grouped by component or interleaved in pairs. A buffer-length check alone can therefore pass even when its interpretation is wrong.
Walk through YV12
Microsoft describes YV12 as a Y array followed by the V plane and then the U plane. In the unpadded example, Y occupies the first sixteen bytes, V occupies the next four and U the final four. Each chroma plane has half the luma stride and half its line count in the documented arrangement. The order matters: assuming a Y-U-V layout would exchange the color-difference components without changing the total allocation.
Walk through NV12
NV12 also puts Y first, but its following array contains alternating U and V bytes. For the same example, the eight chroma bytes form four U-V pairs. Microsoft describes a little-endian word view in which U is the low byte and V the high byte. Treating the first four of those bytes as a complete V plane would mix components and sample locations. The correct conversion rearranges actual sample data using the source and destination contracts.
Keep memory layout separate from color interpretation
A processing record needs the format identifier, plane starts, line strides and sample dimensions alongside matrix, range and chroma location. These are different parts of the interpretation. A successful layout rearrangement does not by itself change color primaries or restore chroma detail lost earlier. Real surfaces may also contain padding, so the compact twenty-four-byte example explains component order rather than prescribing every buffer’s allocation size. Use the provided stride and plane information when accessing an actual surface.
