A semi-planar layout has two blocks: all the Y samples, then one block where Cb and Cr alternate. Hardware decoders and capture devices often produce these.
8-bit layouts
| FourCC | Subsampling | Chroma order | Chroma block size | Bytes per frame |
|---|---|---|---|---|
NV12 | 4:2:0 | Cb, Cr | W × H/2 | W × H × 3/2 |
NV21 | 4:2:0 | Cr, Cb | W × H/2 | W × H × 3/2 |
NV16 | 4:2:2 | Cb, Cr | W × H | W × H × 2 |
NV61 | 4:2:2 | Cr, Cb | W × H | W × H × 2 |
NV24 | 4:4:4 | Cb, Cr | 2W × H | W × H × 3 |
NV42 | 4:4:4 | Cr, Cb | 2W × H | W × H × 3 |
NV11 | 4:1:1 | Cb, Cr | W/2 × H | W × H × 3/2 |
Microsoft notes that NV12 is the preferred 4:2:0 format for DirectX Video Acceleration. When its chroma block is read as little-endian 16-bit words, U is in the low byte and V in the high byte.
P010, P012 and P016
These are the 16-bit versions of NV12: each sample takes a 16-bit little-endian word,
with the Y plane, then alternating Cb and Cr. Unlike the planar yuv420p10le,
the value sits in the high bits of the word.
| FourCC | Bits of value | Value position |
|---|---|---|
P010 | 10 | bits 15 to 6 |
P012 | 12 | bits 15 to 4 |
P016 | 16 | all 16 bits |
A frame takes W × H × 3 bytes.
Worked examples
A 4 × 4 frame of NV12, 24 bytes:
Offset 0 Y00 Y01 Y02 Y03
Offset 4 Y10 Y11 Y12 Y13
Offset 8 Y20 Y21 Y22 Y23
Offset 12 Y30 Y31 Y32 Y33
Offset 16 Cb00 Cr00 Cb01 Cr01
Offset 20 Cb10 Cr10 Cb11 Cr11
NV21 has each pair in the order Cr, Cb. P010 has the same
pattern with every sample a 16-bit word, 48 bytes in all, with the Cb and Cr words
starting at offset 32.