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_NV16
133 * - V4L2_PIX_FMT_NV61
140 * - V4L2_PIX_FMT_NV16M
147 * - V4L2_PIX_FMT_NV61M
154 * - V4L2_PIX_FMT_NV24
161 * - V4L2_PIX_FMT_NV42
173 .. [1] Order of chroma samples in the second plane
174 .. [2] Indicates if planes have to be contiguous in memory or can be
176 .. [3] Macroblock size in pixels
179 **Color Sample Location:**
180 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
184 .. _V4L2-PIX-FMT-NV12:
185 .. _V4L2-PIX-FMT-NV21:
186 .. _V4L2-PIX-FMT-NV12M:
187 .. _V4L2-PIX-FMT-NV21M:
188 .. _V4L2-PIX-FMT-P010:
190 NV12, NV21, NV12M and NV21M
191 ---------------------------
193 Semi-planar YUV 4:2:0 formats. The chroma plane is subsampled by 2 in each
194 direction. Chroma lines contain half the number of pixels and the same number
195 of bytes as luma lines, and the chroma plane contains half the number of lines
198 .. flat-table:: Sample 4x4 NV12 Image
233 .. flat-table:: Sample 4x4 NV12M Image
270 .. _V4L2-PIX-FMT-NV12MT:
271 .. _V4L2-PIX-FMT-NV12MT-16X16:
272 .. _V4L2-PIX-FMT-NV12-4L4:
273 .. _V4L2-PIX-FMT-NV12-16L16:
274 .. _V4L2-PIX-FMT-NV12-32L32:
275 .. _V4L2-PIX-FMT-NV12M-8L128:
276 .. _V4L2-PIX-FMT-NV12M-10BE-8L128:
277 .. _V4L2-PIX-FMT-MM21:
282 Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is
283 subsampled by 2 in each direction. Chroma lines contain half the number of
284 pixels and the same number of bytes as luma lines, and the chroma plane
285 contains half the number of lines of the luma plane. Each tile follows the
286 previous one linearly in memory (from left to right, top to bottom).
288 ``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
289 pixels in 2D 16x16 tiles, and stores tiles linearly in memory.
290 The line stride and image height must be aligned to a multiple of 16.
291 The layouts of the luma and chroma planes are identical.
293 ``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
294 pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in
295 Z-order in memory, alternating Z and mirrored Z shapes horizontally.
296 The line stride must be a multiple of 128 pixels to ensure an
297 integer number of Z shapes. The image height must be a multiple of 32 pixels.
298 If the vertical resolution is an odd number of tiles, the last row of
299 tiles is stored in linear order. The layouts of the luma and chroma
300 planes are identical.
302 ``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores
303 tiles linearly in memory. The line stride and image height must be
304 aligned to a multiple of 4. The layouts of the luma and chroma planes are
307 ``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores
308 tiles linearly in memory. The line stride and image height must be
309 aligned to a multiple of 16. The layouts of the luma and chroma planes are
312 ``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores
313 tiles linearly in memory. The line stride and image height must be
314 aligned to a multiple of 32. The layouts of the luma and chroma planes are
317 ``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
318 pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
319 The image height must be aligned to a multiple of 128.
320 The layouts of the luma and chroma planes are identical.
322 ``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
323 10 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
324 the data is arranged in big endian order.
325 The image height must be aligned to a multiple of 128.
326 The layouts of the luma and chroma planes are identical.
327 Note the tile size is 8bytes multiplied by 128 bytes,
328 it means that the low bits and high bits of one pixel may be in different tiles.
329 The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like
332 byte 1: Y0(bits 1-0) Y1(bits 9-4)
333 byte 2: Y1(bits 3-0) Y2(bits 9-6)
334 byte 3: Y2(bits 5-0) Y3(bits 9-8)
337 ``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels
338 in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the
339 image height must be aligned to a multiple of 32. The number of luma and chroma
340 tiles are identical, even though the tile size differ. The image is formed of
341 two non-contiguous planes.
345 .. kernel-figure:: nv12mt.svg
349 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
353 .. kernel-figure:: nv12mt_example.svg
354 :alt: nv12mt_example.svg
357 Example V4L2_PIX_FMT_NV12MT memory layout of tiles
360 .. _V4L2-PIX-FMT-NV16:
361 .. _V4L2-PIX-FMT-NV61:
362 .. _V4L2-PIX-FMT-NV16M:
363 .. _V4L2-PIX-FMT-NV61M:
365 NV16, NV61, NV16M and NV61M
366 ---------------------------
368 Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the
369 horizontal direction. Chroma lines contain half the number of pixels and the
370 same number of bytes as luma lines, and the chroma plane contains the same
371 number of lines as the luma plane.
373 .. flat-table:: Sample 4x4 NV16 Image
418 .. flat-table:: Sample 4x4 NV16M Image
465 .. _V4L2-PIX-FMT-NV24:
466 .. _V4L2-PIX-FMT-NV42:
471 Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled.
472 Chroma lines contain the same number of pixels and twice the
473 number of bytes as luma lines, and the chroma plane contains the same
474 number of lines as the luma plane.
476 .. flat-table:: Sample 4x4 NV24 Image
537 .. _V4L2_PIX_FMT_P010:
538 .. _V4L2-PIX-FMT-P010-4L4:
543 P010 is like NV12 with 10 bits per component, expanded to 16 bits.
544 Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order.
546 .. flat-table:: Sample 4x4 P010 Image
582 Fully Planar YUV Formats
583 ========================
585 These formats store the Y, Cb and Cr components in three separate planes. The
586 luma plane comes first, and the order of the two chroma planes varies between
587 formats. The two chroma planes always use the same subsampling.
589 For memory contiguous formats, the number of padding pixels at the end of the
590 chroma lines is identical to the padding of the luma lines. The chroma line
591 stride (in bytes) is thus equal to the luma line stride divided by the
592 horizontal subsampling factor. Vertical subsampling doesn't affect the line
595 For non-contiguous formats, no constraints are enforced by the format on the
596 relationship between the luma and chroma line padding and stride.
598 All components are stored with the same number of bits per component.
600 ``V4L2_PIX_FMT_P010_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly
601 in memory. The line stride must be aligned to multiple of 8 and image height to
602 a multiple of 4. The layouts of the luma and chroma planes are identical.
608 .. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}|
610 .. flat-table:: Overview of Fully Planar YUV Formats
621 * - V4L2_PIX_FMT_YUV410
627 * - V4L2_PIX_FMT_YVU410
633 * - V4L2_PIX_FMT_YUV411P
639 * - V4L2_PIX_FMT_YUV420M
645 * - V4L2_PIX_FMT_YVU420M
651 * - V4L2_PIX_FMT_YUV420
657 * - V4L2_PIX_FMT_YVU420
663 * - V4L2_PIX_FMT_YUV422P
669 * - V4L2_PIX_FMT_YUV422M
675 * - V4L2_PIX_FMT_YVU422M
681 * - V4L2_PIX_FMT_YUV444M
687 * - V4L2_PIX_FMT_YVU444M
698 .. [4] Order of luma and chroma planes
699 .. [5] Indicates if planes have to be contiguous in memory or can be
703 **Color Sample Location:**
704 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
707 .. _V4L2-PIX-FMT-YUV410:
708 .. _V4L2-PIX-FMT-YVU410:
713 Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each
714 direction. Chroma lines contain a quarter of the number of pixels and bytes of
715 the luma lines, and the chroma planes contain a quarter of the number of lines
718 .. flat-table:: Sample 4x4 YUV410 Image
748 .. _V4L2-PIX-FMT-YUV411P:
753 Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the
754 horizontal direction. Chroma lines contain a quarter of the number of pixels
755 and bytes of the luma lines, and the chroma planes contain the same number of
756 lines as the luma plane.
758 .. flat-table:: Sample 4x4 YUV411P Image
800 .. _V4L2-PIX-FMT-YUV420:
801 .. _V4L2-PIX-FMT-YVU420:
802 .. _V4L2-PIX-FMT-YUV420M:
803 .. _V4L2-PIX-FMT-YVU420M:
805 YUV420, YVU420, YUV420M and YVU420M
806 -----------------------------------
808 Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each
809 direction. Chroma lines contain half of the number of pixels and bytes of the
810 luma lines, and the chroma planes contain half of the number of lines of the
813 .. flat-table:: Sample 4x4 YUV420 Image
850 .. flat-table:: Sample 4x4 YUV420M Image
890 .. _V4L2-PIX-FMT-YUV422P:
891 .. _V4L2-PIX-FMT-YUV422M:
892 .. _V4L2-PIX-FMT-YVU422M:
894 YUV422P, YUV422M and YVU422M
895 ----------------------------
897 Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the
898 horizontal direction. Chroma lines contain half of the number of pixels and
899 bytes of the luma lines, and the chroma planes contain the same number of lines
902 .. flat-table:: Sample 4x4 YUV422P Image
951 .. flat-table:: Sample 4x4 YUV422M Image
1003 .. _V4L2-PIX-FMT-YUV444M:
1004 .. _V4L2-PIX-FMT-YVU444M:
1009 Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines
1010 contain the same number of pixels and bytes of the luma lines, and the chroma
1011 planes contain the same number of lines as the luma plane.
1013 .. flat-table:: Sample 4x4 YUV444M Image