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_NV16
147 * - V4L2_PIX_FMT_NV61
154 * - V4L2_PIX_FMT_NV16M
161 * - V4L2_PIX_FMT_NV61M
168 * - V4L2_PIX_FMT_NV24
175 * - V4L2_PIX_FMT_NV42
187 .. [1] Order of chroma samples in the second plane
188 .. [2] Indicates if planes have to be contiguous in memory or can be
190 .. [3] Macroblock size in pixels
193 **Color Sample Location:**
194 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
198 .. _V4L2-PIX-FMT-NV12:
199 .. _V4L2-PIX-FMT-NV21:
200 .. _V4L2-PIX-FMT-NV12M:
201 .. _V4L2-PIX-FMT-NV21M:
202 .. _V4L2-PIX-FMT-P010:
204 NV12, NV21, NV12M and NV21M
205 ---------------------------
207 Semi-planar YUV 4:2:0 formats. The chroma plane is subsampled by 2 in each
208 direction. Chroma lines contain half the number of pixels and the same number
209 of bytes as luma lines, and the chroma plane contains half the number of lines
212 .. flat-table:: Sample 4x4 NV12 Image
247 .. flat-table:: Sample 4x4 NV12M Image
284 .. _V4L2-PIX-FMT-NV12MT:
285 .. _V4L2-PIX-FMT-NV12MT-16X16:
286 .. _V4L2-PIX-FMT-NV12-4L4:
287 .. _V4L2-PIX-FMT-NV12-16L16:
288 .. _V4L2-PIX-FMT-NV12-32L32:
289 .. _V4L2-PIX-FMT-NV12M-8L128:
290 .. _V4L2-PIX-FMT-NV12-8L128:
291 .. _V4L2-PIX-FMT-NV12M-10BE-8L128:
292 .. _V4L2-PIX-FMT-NV12-10BE-8L128:
293 .. _V4L2-PIX-FMT-MM21:
298 Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is
299 subsampled by 2 in each direction. Chroma lines contain half the number of
300 pixels and the same number of bytes as luma lines, and the chroma plane
301 contains half the number of lines of the luma plane. Each tile follows the
302 previous one linearly in memory (from left to right, top to bottom).
304 ``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
305 pixels in 2D 16x16 tiles, and stores tiles linearly in memory.
306 The line stride and image height must be aligned to a multiple of 16.
307 The layouts of the luma and chroma planes are identical.
309 ``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
310 pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in
311 Z-order in memory, alternating Z and mirrored Z shapes horizontally.
312 The line stride must be a multiple of 128 pixels to ensure an
313 integer number of Z shapes. The image height must be a multiple of 32 pixels.
314 If the vertical resolution is an odd number of tiles, the last row of
315 tiles is stored in linear order. The layouts of the luma and chroma
316 planes are identical.
318 ``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores
319 tiles linearly in memory. The line stride and image height must be
320 aligned to a multiple of 4. The layouts of the luma and chroma planes are
323 ``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores
324 tiles linearly in memory. The line stride and image height must be
325 aligned to a multiple of 16. The layouts of the luma and chroma planes are
328 ``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores
329 tiles linearly in memory. The line stride and image height must be
330 aligned to a multiple of 32. The layouts of the luma and chroma planes are
333 ``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
334 pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
335 The image height must be aligned to a multiple of 128.
336 The layouts of the luma and chroma planes are identical.
338 ``V4L2_PIX_FMT_NV12_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_8L128`` but stores
339 two planes in one memory.
341 ``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
342 10 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
343 the data is arranged in big endian order.
344 The image height must be aligned to a multiple of 128.
345 The layouts of the luma and chroma planes are identical.
346 Note the tile size is 8bytes multiplied by 128 bytes,
347 it means that the low bits and high bits of one pixel may be in different tiles.
348 The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like
351 byte 1: Y0(bits 1-0) Y1(bits 9-4)
352 byte 2: Y1(bits 3-0) Y2(bits 9-6)
353 byte 3: Y2(bits 5-0) Y3(bits 9-8)
356 ``V4L2_PIX_FMT_NV12_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_10BE_8L128`` but stores
357 two planes in one memory.
359 ``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels
360 in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the
361 image height must be aligned to a multiple of 32. The number of luma and chroma
362 tiles are identical, even though the tile size differ. The image is formed of
363 two non-contiguous planes.
367 .. kernel-figure:: nv12mt.svg
371 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
375 .. kernel-figure:: nv12mt_example.svg
376 :alt: nv12mt_example.svg
379 Example V4L2_PIX_FMT_NV12MT memory layout of tiles
382 .. _V4L2-PIX-FMT-NV16:
383 .. _V4L2-PIX-FMT-NV61:
384 .. _V4L2-PIX-FMT-NV16M:
385 .. _V4L2-PIX-FMT-NV61M:
387 NV16, NV61, NV16M and NV61M
388 ---------------------------
390 Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the
391 horizontal direction. Chroma lines contain half the number of pixels and the
392 same number of bytes as luma lines, and the chroma plane contains the same
393 number of lines as the luma plane.
395 .. flat-table:: Sample 4x4 NV16 Image
440 .. flat-table:: Sample 4x4 NV16M Image
487 .. _V4L2-PIX-FMT-NV24:
488 .. _V4L2-PIX-FMT-NV42:
493 Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled.
494 Chroma lines contain the same number of pixels and twice the
495 number of bytes as luma lines, and the chroma plane contains the same
496 number of lines as the luma plane.
498 .. flat-table:: Sample 4x4 NV24 Image
559 .. _V4L2_PIX_FMT_P010:
560 .. _V4L2-PIX-FMT-P010-4L4:
565 P010 is like NV12 with 10 bits per component, expanded to 16 bits.
566 Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order.
568 .. flat-table:: Sample 4x4 P010 Image
603 .. _V4L2-PIX-FMT-P012:
604 .. _V4L2-PIX-FMT-P012M:
609 P012 is like NV12 with 12 bits per component, expanded to 16 bits.
610 Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
612 .. flat-table:: Sample 4x4 P012 Image
647 .. flat-table:: Sample 4x4 P012M Image
684 Fully Planar YUV Formats
685 ========================
687 These formats store the Y, Cb and Cr components in three separate planes. The
688 luma plane comes first, and the order of the two chroma planes varies between
689 formats. The two chroma planes always use the same subsampling.
691 For memory contiguous formats, the number of padding pixels at the end of the
692 chroma lines is identical to the padding of the luma lines. The chroma line
693 stride (in bytes) is thus equal to the luma line stride divided by the
694 horizontal subsampling factor. Vertical subsampling doesn't affect the line
697 For non-contiguous formats, no constraints are enforced by the format on the
698 relationship between the luma and chroma line padding and stride.
700 All components are stored with the same number of bits per component.
702 ``V4L2_PIX_FMT_P010_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly
703 in memory. The line stride must be aligned to multiple of 8 and image height to
704 a multiple of 4. The layouts of the luma and chroma planes are identical.
710 .. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}|
712 .. flat-table:: Overview of Fully Planar YUV Formats
723 * - V4L2_PIX_FMT_YUV410
729 * - V4L2_PIX_FMT_YVU410
735 * - V4L2_PIX_FMT_YUV411P
741 * - V4L2_PIX_FMT_YUV420M
747 * - V4L2_PIX_FMT_YVU420M
753 * - V4L2_PIX_FMT_YUV420
759 * - V4L2_PIX_FMT_YVU420
765 * - V4L2_PIX_FMT_YUV422P
771 * - V4L2_PIX_FMT_YUV422M
777 * - V4L2_PIX_FMT_YVU422M
783 * - V4L2_PIX_FMT_YUV444M
789 * - V4L2_PIX_FMT_YVU444M
800 .. [4] Order of luma and chroma planes
801 .. [5] Indicates if planes have to be contiguous in memory or can be
805 **Color Sample Location:**
806 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
809 .. _V4L2-PIX-FMT-YUV410:
810 .. _V4L2-PIX-FMT-YVU410:
815 Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each
816 direction. Chroma lines contain a quarter of the number of pixels and bytes of
817 the luma lines, and the chroma planes contain a quarter of the number of lines
820 .. flat-table:: Sample 4x4 YUV410 Image
850 .. _V4L2-PIX-FMT-YUV411P:
855 Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the
856 horizontal direction. Chroma lines contain a quarter of the number of pixels
857 and bytes of the luma lines, and the chroma planes contain the same number of
858 lines as the luma plane.
860 .. flat-table:: Sample 4x4 YUV411P Image
902 .. _V4L2-PIX-FMT-YUV420:
903 .. _V4L2-PIX-FMT-YVU420:
904 .. _V4L2-PIX-FMT-YUV420M:
905 .. _V4L2-PIX-FMT-YVU420M:
907 YUV420, YVU420, YUV420M and YVU420M
908 -----------------------------------
910 Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each
911 direction. Chroma lines contain half of the number of pixels and bytes of the
912 luma lines, and the chroma planes contain half of the number of lines of the
915 .. flat-table:: Sample 4x4 YUV420 Image
952 .. flat-table:: Sample 4x4 YUV420M Image
992 .. _V4L2-PIX-FMT-YUV422P:
993 .. _V4L2-PIX-FMT-YUV422M:
994 .. _V4L2-PIX-FMT-YVU422M:
996 YUV422P, YUV422M and YVU422M
997 ----------------------------
999 Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the
1000 horizontal direction. Chroma lines contain half of the number of pixels and
1001 bytes of the luma lines, and the chroma planes contain the same number of lines
1004 .. flat-table:: Sample 4x4 YUV422P Image
1053 .. flat-table:: Sample 4x4 YUV422M Image
1105 .. _V4L2-PIX-FMT-YUV444M:
1106 .. _V4L2-PIX-FMT-YVU444M:
1111 Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines
1112 contain the same number of pixels and bytes of the luma lines, and the chroma
1113 planes contain the same number of lines as the luma plane.
1115 .. flat-table:: Sample 4x4 YUV444M Image