1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
9 Planar formats split luma and chroma data in separate memory regions. They
10 exist in two variants:
12 - Semi-planar formats use two planes. The first plane is the luma plane and
13 stores the Y components. The second plane is the chroma plane and stores the
14 Cb and Cr components interleaved.
16 - Fully planar formats use three planes to store the Y, Cb and Cr components
19 Within a plane, components are stored in pixel order, which may be linear or
20 tiled. Padding may be supported at the end of the lines, and the line stride of
21 the chroma planes may be constrained by the line stride of the luma plane.
23 Some planar formats allow planes to be placed in independent memory locations.
24 They are identified by an 'M' suffix in their name (such as in
25 ``V4L2_PIX_FMT_NV12M``). Those formats are intended to be used only in drivers
26 and applications that support the multi-planar API, described in
27 :ref:`planar-apis`. Unless explicitly documented as supporting non-contiguous
28 planes, formats require the planes to follow each other immediately in memory.
31 Semi-Planar YUV Formats
32 =======================
34 These formats are commonly referred to as NV formats (NV12, NV16, ...). They
35 use two planes, and store the luma components in the first plane and the chroma
36 components in the second plane. The Cb and Cr components are interleaved in the
37 chroma plane, with Cb and Cr always stored in pairs. The chroma order is
38 exposed as different formats.
40 For memory contiguous formats, the number of padding pixels at the end of the
41 chroma lines is identical to the padding of the luma lines. Without horizontal
42 subsampling, the chroma line stride (in bytes) is thus equal to twice the luma
43 line stride. With horizontal subsampling by 2, the chroma line stride is equal
44 to the luma line stride. Vertical subsampling doesn't affect the line stride.
46 For non-contiguous formats, no constraints are enforced by the format on the
47 relationship between the luma and chroma line padding and stride.
49 All components are stored with the same number of bits per component.
55 .. tabularcolumns:: |p{5.2cm}|p{1.0cm}|p{1.5cm}|p{1.9cm}|p{1.2cm}|p{1.8cm}|p{2.7cm}|
57 .. flat-table:: Overview of Semi-Planar YUV Formats
82 * - V4L2_PIX_FMT_NV12M
89 * - V4L2_PIX_FMT_NV21M
96 * - V4L2_PIX_FMT_NV12MT
105 * - V4L2_PIX_FMT_NV12MT_16X16
112 * - V4L2_PIX_FMT_P010
119 * - V4L2_PIX_FMT_P010_4L4
126 * - V4L2_PIX_FMT_P012
133 * - V4L2_PIX_FMT_P012M
140 * - V4L2_PIX_FMT_NV15_4L4
147 * - V4L2_PIX_FMT_NV16
154 * - V4L2_PIX_FMT_NV61
161 * - V4L2_PIX_FMT_NV16M
168 * - V4L2_PIX_FMT_NV61M
175 * - V4L2_PIX_FMT_NV24
182 * - V4L2_PIX_FMT_NV42
194 .. [1] Order of chroma samples in the second plane
195 .. [2] Indicates if planes have to be contiguous in memory or can be
197 .. [3] Macroblock size in pixels
200 **Color Sample Location:**
201 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
205 .. _V4L2-PIX-FMT-NV12:
206 .. _V4L2-PIX-FMT-NV21:
207 .. _V4L2-PIX-FMT-NV12M:
208 .. _V4L2-PIX-FMT-NV21M:
209 .. _V4L2-PIX-FMT-P010:
211 NV12, NV21, NV12M and NV21M
212 ---------------------------
214 Semi-planar YUV 4:2:0 formats. The chroma plane is subsampled by 2 in each
215 direction. Chroma lines contain half the number of pixels and the same number
216 of bytes as luma lines, and the chroma plane contains half the number of lines
219 .. flat-table:: Sample 4x4 NV12 Image
254 .. flat-table:: Sample 4x4 NV12M Image
291 .. _V4L2-PIX-FMT-NV12MT:
292 .. _V4L2-PIX-FMT-NV12MT-16X16:
293 .. _V4L2-PIX-FMT-NV12-4L4:
294 .. _V4L2-PIX-FMT-NV12-16L16:
295 .. _V4L2-PIX-FMT-NV12-32L32:
296 .. _V4L2-PIX-FMT-NV12M-8L128:
297 .. _V4L2-PIX-FMT-NV12-8L128:
298 .. _V4L2-PIX-FMT-NV12M-10BE-8L128:
299 .. _V4L2-PIX-FMT-NV12-10BE-8L128:
300 .. _V4L2-PIX-FMT-MM21:
305 Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is
306 subsampled by 2 in each direction. Chroma lines contain half the number of
307 pixels and the same number of bytes as luma lines, and the chroma plane
308 contains half the number of lines of the luma plane. Each tile follows the
309 previous one linearly in memory (from left to right, top to bottom).
311 ``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
312 pixels in 2D 16x16 tiles, and stores tiles linearly in memory.
313 The line stride and image height must be aligned to a multiple of 16.
314 The layouts of the luma and chroma planes are identical.
316 ``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
317 pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in
318 Z-order in memory, alternating Z and mirrored Z shapes horizontally.
319 The line stride must be a multiple of 128 pixels to ensure an
320 integer number of Z shapes. The image height must be a multiple of 32 pixels.
321 If the vertical resolution is an odd number of tiles, the last row of
322 tiles is stored in linear order. The layouts of the luma and chroma
323 planes are identical.
325 ``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores
326 tiles linearly in memory. The line stride and image height must be
327 aligned to a multiple of 4. The layouts of the luma and chroma planes are
330 ``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores
331 tiles linearly in memory. The line stride and image height must be
332 aligned to a multiple of 16. The layouts of the luma and chroma planes are
335 ``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores
336 tiles linearly in memory. The line stride and image height must be
337 aligned to a multiple of 32. The layouts of the luma and chroma planes are
340 ``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
341 pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
342 The image height must be aligned to a multiple of 128.
343 The layouts of the luma and chroma planes are identical.
345 ``V4L2_PIX_FMT_NV12_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_8L128`` but stores
346 two planes in one memory.
348 ``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
349 10 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
350 the data is arranged in big endian order.
351 The image height must be aligned to a multiple of 128.
352 The layouts of the luma and chroma planes are identical.
353 Note the tile size is 8bytes multiplied by 128 bytes,
354 it means that the low bits and high bits of one pixel may be in different tiles.
355 The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like
358 byte 1: Y0(bits 1-0) Y1(bits 9-4)
359 byte 2: Y1(bits 3-0) Y2(bits 9-6)
360 byte 3: Y2(bits 5-0) Y3(bits 9-8)
363 ``V4L2_PIX_FMT_NV12_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_10BE_8L128`` but stores
364 two planes in one memory.
366 ``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels
367 in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the
368 image height must be aligned to a multiple of 32. The number of luma and chroma
369 tiles are identical, even though the tile size differ. The image is formed of
370 two non-contiguous planes.
374 .. kernel-figure:: nv12mt.svg
378 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
382 .. kernel-figure:: nv12mt_example.svg
383 :alt: nv12mt_example.svg
386 Example V4L2_PIX_FMT_NV12MT memory layout of tiles
388 .. _V4L2-PIX-FMT-NV15-4L4:
393 Semi-planar 10-bit YUV 4:2:0 formats, using 4x4 tiling.
394 All components are packed without any padding between each other.
395 As a side-effect, each group of 4 components are stored over 5 bytes
396 (YYYY or UVUV = 4 * 10 bits = 40 bits = 5 bytes).
398 .. _V4L2-PIX-FMT-NV16:
399 .. _V4L2-PIX-FMT-NV61:
400 .. _V4L2-PIX-FMT-NV16M:
401 .. _V4L2-PIX-FMT-NV61M:
403 NV16, NV61, NV16M and NV61M
404 ---------------------------
406 Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the
407 horizontal direction. Chroma lines contain half the number of pixels and the
408 same number of bytes as luma lines, and the chroma plane contains the same
409 number of lines as the luma plane.
411 .. flat-table:: Sample 4x4 NV16 Image
456 .. flat-table:: Sample 4x4 NV16M Image
503 .. _V4L2-PIX-FMT-NV24:
504 .. _V4L2-PIX-FMT-NV42:
509 Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled.
510 Chroma lines contain the same number of pixels and twice the
511 number of bytes as luma lines, and the chroma plane contains the same
512 number of lines as the luma plane.
514 .. flat-table:: Sample 4x4 NV24 Image
575 .. _V4L2_PIX_FMT_P010:
576 .. _V4L2-PIX-FMT-P010-4L4:
581 P010 is like NV12 with 10 bits per component, expanded to 16 bits.
582 Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order.
584 .. flat-table:: Sample 4x4 P010 Image
619 .. _V4L2-PIX-FMT-P012:
620 .. _V4L2-PIX-FMT-P012M:
625 P012 is like NV12 with 12 bits per component, expanded to 16 bits.
626 Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
628 .. flat-table:: Sample 4x4 P012 Image
663 .. flat-table:: Sample 4x4 P012M Image
700 Fully Planar YUV Formats
701 ========================
703 These formats store the Y, Cb and Cr components in three separate planes. The
704 luma plane comes first, and the order of the two chroma planes varies between
705 formats. The two chroma planes always use the same subsampling.
707 For memory contiguous formats, the number of padding pixels at the end of the
708 chroma lines is identical to the padding of the luma lines. The chroma line
709 stride (in bytes) is thus equal to the luma line stride divided by the
710 horizontal subsampling factor. Vertical subsampling doesn't affect the line
713 For non-contiguous formats, no constraints are enforced by the format on the
714 relationship between the luma and chroma line padding and stride.
716 All components are stored with the same number of bits per component.
718 ``V4L2_PIX_FMT_P010_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly
719 in memory. The line stride must be aligned to multiple of 8 and image height to
720 a multiple of 4. The layouts of the luma and chroma planes are identical.
726 .. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}|
728 .. flat-table:: Overview of Fully Planar YUV Formats
739 * - V4L2_PIX_FMT_YUV410
745 * - V4L2_PIX_FMT_YVU410
751 * - V4L2_PIX_FMT_YUV411P
757 * - V4L2_PIX_FMT_YUV420M
763 * - V4L2_PIX_FMT_YVU420M
769 * - V4L2_PIX_FMT_YUV420
775 * - V4L2_PIX_FMT_YVU420
781 * - V4L2_PIX_FMT_YUV422P
787 * - V4L2_PIX_FMT_YUV422M
793 * - V4L2_PIX_FMT_YVU422M
799 * - V4L2_PIX_FMT_YUV444M
805 * - V4L2_PIX_FMT_YVU444M
816 .. [4] Order of luma and chroma planes
817 .. [5] Indicates if planes have to be contiguous in memory or can be
821 **Color Sample Location:**
822 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
825 .. _V4L2-PIX-FMT-YUV410:
826 .. _V4L2-PIX-FMT-YVU410:
831 Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each
832 direction. Chroma lines contain a quarter of the number of pixels and bytes of
833 the luma lines, and the chroma planes contain a quarter of the number of lines
836 .. flat-table:: Sample 4x4 YUV410 Image
866 .. _V4L2-PIX-FMT-YUV411P:
871 Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the
872 horizontal direction. Chroma lines contain a quarter of the number of pixels
873 and bytes of the luma lines, and the chroma planes contain the same number of
874 lines as the luma plane.
876 .. flat-table:: Sample 4x4 YUV411P Image
918 .. _V4L2-PIX-FMT-YUV420:
919 .. _V4L2-PIX-FMT-YVU420:
920 .. _V4L2-PIX-FMT-YUV420M:
921 .. _V4L2-PIX-FMT-YVU420M:
923 YUV420, YVU420, YUV420M and YVU420M
924 -----------------------------------
926 Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each
927 direction. Chroma lines contain half of the number of pixels and bytes of the
928 luma lines, and the chroma planes contain half of the number of lines of the
931 .. flat-table:: Sample 4x4 YUV420 Image
968 .. flat-table:: Sample 4x4 YUV420M Image
1008 .. _V4L2-PIX-FMT-YUV422P:
1009 .. _V4L2-PIX-FMT-YUV422M:
1010 .. _V4L2-PIX-FMT-YVU422M:
1012 YUV422P, YUV422M and YVU422M
1013 ----------------------------
1015 Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the
1016 horizontal direction. Chroma lines contain half of the number of pixels and
1017 bytes of the luma lines, and the chroma planes contain the same number of lines
1020 .. flat-table:: Sample 4x4 YUV422P Image
1069 .. flat-table:: Sample 4x4 YUV422M Image
1121 .. _V4L2-PIX-FMT-YUV444M:
1122 .. _V4L2-PIX-FMT-YVU444M:
1127 Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines
1128 contain the same number of pixels and bytes of the luma lines, and the chroma
1129 planes contain the same number of lines as the luma plane.
1131 .. flat-table:: Sample 4x4 YUV444M Image