1328 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2 3.. planar-yuv:4 5******************6Planar YUV formats7******************8 9Planar formats split luma and chroma data in separate memory regions. They10exist in two variants:11 12- Semi-planar formats use two planes. The first plane is the luma plane and13 stores the Y components. The second plane is the chroma plane and stores the14 Cb and Cr components interleaved.15 16- Fully planar formats use three planes to store the Y, Cb and Cr components17 separately.18 19Within a plane, components are stored in pixel order, which may be linear or20tiled. Padding may be supported at the end of the lines, and the line stride of21the chroma planes may be constrained by the line stride of the luma plane.22 23Some planar formats allow planes to be placed in independent memory locations.24They are identified by an 'M' suffix in their name (such as in25``V4L2_PIX_FMT_NV12M``). Those formats are intended to be used only in drivers26and applications that support the multi-planar API, described in27:ref:`planar-apis`. Unless explicitly documented as supporting non-contiguous28planes, formats require the planes to follow each other immediately in memory.29 30 31Semi-Planar YUV Formats32=======================33 34These formats are commonly referred to as NV formats (NV12, NV16, ...). They35use two planes, and store the luma components in the first plane and the chroma36components in the second plane. The Cb and Cr components are interleaved in the37chroma plane, with Cb and Cr always stored in pairs. The chroma order is38exposed as different formats.39 40For memory contiguous formats, the number of padding pixels at the end of the41chroma lines is identical to the padding of the luma lines. Without horizontal42subsampling, the chroma line stride (in bytes) is thus equal to twice the luma43line stride. With horizontal subsampling by 2, the chroma line stride is equal44to the luma line stride. Vertical subsampling doesn't affect the line stride.45 46For non-contiguous formats, no constraints are enforced by the format on the47relationship between the luma and chroma line padding and stride.48 49All components are stored with the same number of bits per component.50 51.. raw:: latex52 53 \footnotesize54 55.. tabularcolumns:: |p{5.2cm}|p{1.0cm}|p{1.5cm}|p{1.9cm}|p{1.2cm}|p{1.8cm}|p{2.7cm}|56 57.. flat-table:: Overview of Semi-Planar YUV Formats58 :header-rows: 159 :stub-columns: 060 61 * - Identifier62 - Code63 - Bits per component64 - Subsampling65 - Chroma order [1]_66 - Contiguous [2]_67 - Tiling [3]_68 * - V4L2_PIX_FMT_NV1269 - 'NV12'70 - 871 - 4:2:072 - Cb, Cr73 - Yes74 - Linear75 * - V4L2_PIX_FMT_NV2176 - 'NV21'77 - 878 - 4:2:079 - Cr, Cb80 - Yes81 - Linear82 * - V4L2_PIX_FMT_NV12M83 - 'NM12'84 - 885 - 4:2:086 - Cb, Cr87 - No88 - Linear89 * - V4L2_PIX_FMT_NV21M90 - 'NM21'91 - 892 - 4:2:093 - Cr, Cb94 - No95 - Linear96 * - V4L2_PIX_FMT_NV12MT97 - 'TM12'98 - 899 - 4:2:0100 - Cb, Cr101 - No102 - 64x32 tiles103 104 Horizontal Z order105 * - V4L2_PIX_FMT_NV12MT_16X16106 - 'VM12'107 - 8108 - 4:2:2109 - Cb, Cr110 - No111 - 16x16 tiles112 * - V4L2_PIX_FMT_P010113 - 'P010'114 - 10115 - 4:2:0116 - Cb, Cr117 - Yes118 - Linear119 * - V4L2_PIX_FMT_P010_4L4120 - 'T010'121 - 10122 - 4:2:0123 - Cb, Cr124 - Yes125 - 4x4 tiles126 * - V4L2_PIX_FMT_P012127 - 'P012'128 - 12129 - 4:2:0130 - Cb, Cr131 - Yes132 - Linear133 * - V4L2_PIX_FMT_P012M134 - 'PM12'135 - 12136 - 4:2:0137 - Cb, Cr138 - No139 - Linear140 * - V4L2_PIX_FMT_NV15_4L4141 - 'VT15'142 - 15143 - 4:2:0144 - Cb, Cr145 - Yes146 - 4x4 tiles147 * - V4L2_PIX_FMT_MT2110T148 - 'MT2T'149 - 15150 - 4:2:0151 - Cb, Cr152 - No153 - 16x32 / 16x16 tiles tiled low bits154 * - V4L2_PIX_FMT_MT2110R155 - 'MT2R'156 - 15157 - 4:2:0158 - Cb, Cr159 - No160 - 16x32 / 16x16 tiles raster low bits161 * - V4L2_PIX_FMT_NV16162 - 'NV16'163 - 8164 - 4:2:2165 - Cb, Cr166 - Yes167 - Linear168 * - V4L2_PIX_FMT_NV61169 - 'NV61'170 - 8171 - 4:2:2172 - Cr, Cb173 - Yes174 - Linear175 * - V4L2_PIX_FMT_NV16M176 - 'NM16'177 - 8178 - 4:2:2179 - Cb, Cr180 - No181 - Linear182 * - V4L2_PIX_FMT_NV61M183 - 'NM61'184 - 8185 - 4:2:2186 - Cr, Cb187 - No188 - Linear189 * - V4L2_PIX_FMT_NV24190 - 'NV24'191 - 8192 - 4:4:4193 - Cb, Cr194 - Yes195 - Linear196 * - V4L2_PIX_FMT_NV42197 - 'NV42'198 - 8199 - 4:4:4200 - Cr, Cb201 - Yes202 - Linear203 204.. raw:: latex205 206 \normalsize207 208.. [1] Order of chroma samples in the second plane209.. [2] Indicates if planes have to be contiguous in memory or can be210 disjoint211.. [3] Macroblock size in pixels212 213 214**Color Sample Location:**215Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`216horizontally.217 218 219.. _V4L2-PIX-FMT-NV12:220.. _V4L2-PIX-FMT-NV21:221.. _V4L2-PIX-FMT-NV12M:222.. _V4L2-PIX-FMT-NV21M:223.. _V4L2-PIX-FMT-P010:224 225NV12, NV21, NV12M and NV21M226---------------------------227 228Semi-planar YUV 4:2:0 formats. The chroma plane is subsampled by 2 in each229direction. Chroma lines contain half the number of pixels and the same number230of bytes as luma lines, and the chroma plane contains half the number of lines231of the luma plane.232 233.. flat-table:: Sample 4x4 NV12 Image234 :header-rows: 0235 :stub-columns: 0236 237 * - start + 0:238 - Y'\ :sub:`00`239 - Y'\ :sub:`01`240 - Y'\ :sub:`02`241 - Y'\ :sub:`03`242 * - start + 4:243 - Y'\ :sub:`10`244 - Y'\ :sub:`11`245 - Y'\ :sub:`12`246 - Y'\ :sub:`13`247 * - start + 8:248 - Y'\ :sub:`20`249 - Y'\ :sub:`21`250 - Y'\ :sub:`22`251 - Y'\ :sub:`23`252 * - start + 12:253 - Y'\ :sub:`30`254 - Y'\ :sub:`31`255 - Y'\ :sub:`32`256 - Y'\ :sub:`33`257 * - start + 16:258 - Cb\ :sub:`00`259 - Cr\ :sub:`00`260 - Cb\ :sub:`01`261 - Cr\ :sub:`01`262 * - start + 20:263 - Cb\ :sub:`10`264 - Cr\ :sub:`10`265 - Cb\ :sub:`11`266 - Cr\ :sub:`11`267 268.. flat-table:: Sample 4x4 NV12M Image269 :header-rows: 0270 :stub-columns: 0271 272 * - start0 + 0:273 - Y'\ :sub:`00`274 - Y'\ :sub:`01`275 - Y'\ :sub:`02`276 - Y'\ :sub:`03`277 * - start0 + 4:278 - Y'\ :sub:`10`279 - Y'\ :sub:`11`280 - Y'\ :sub:`12`281 - Y'\ :sub:`13`282 * - start0 + 8:283 - Y'\ :sub:`20`284 - Y'\ :sub:`21`285 - Y'\ :sub:`22`286 - Y'\ :sub:`23`287 * - start0 + 12:288 - Y'\ :sub:`30`289 - Y'\ :sub:`31`290 - Y'\ :sub:`32`291 - Y'\ :sub:`33`292 * -293 * - start1 + 0:294 - Cb\ :sub:`00`295 - Cr\ :sub:`00`296 - Cb\ :sub:`01`297 - Cr\ :sub:`01`298 * - start1 + 4:299 - Cb\ :sub:`10`300 - Cr\ :sub:`10`301 - Cb\ :sub:`11`302 - Cr\ :sub:`11`303 304 305.. _V4L2-PIX-FMT-NV12MT:306.. _V4L2-PIX-FMT-NV12MT-16X16:307.. _V4L2-PIX-FMT-NV12-4L4:308.. _V4L2-PIX-FMT-NV12-16L16:309.. _V4L2-PIX-FMT-NV12-32L32:310.. _V4L2-PIX-FMT-NV12M-8L128:311.. _V4L2-PIX-FMT-NV12-8L128:312.. _V4L2-PIX-FMT-MM21:313 314Tiled NV12315----------316 317Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is318subsampled by 2 in each direction. Chroma lines contain half the number of319pixels and the same number of bytes as luma lines, and the chroma plane320contains half the number of lines of the luma plane. Each tile follows the321previous one linearly in memory (from left to right, top to bottom).322 323``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores324pixels in 2D 16x16 tiles, and stores tiles linearly in memory.325The line stride and image height must be aligned to a multiple of 16.326The layouts of the luma and chroma planes are identical.327 328``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores329pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in330Z-order in memory, alternating Z and mirrored Z shapes horizontally.331The line stride must be a multiple of 128 pixels to ensure an332integer number of Z shapes. The image height must be a multiple of 32 pixels.333If the vertical resolution is an odd number of tiles, the last row of334tiles is stored in linear order. The layouts of the luma and chroma335planes are identical.336 337.. _nv12mt:338 339.. kernel-figure:: nv12mt.svg340 :alt: nv12mt.svg341 :align: center342 343 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout344 345.. _nv12mt_ex:346 347.. kernel-figure:: nv12mt_example.svg348 :alt: nv12mt_example.svg349 :align: center350 351 Example V4L2_PIX_FMT_NV12MT memory layout of tiles352 353``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores354tiles linearly in memory. The line stride and image height must be355aligned to a multiple of 4. The layouts of the luma and chroma planes are356identical.357 358``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores359tiles linearly in memory. The line stride and image height must be360aligned to a multiple of 16. The layouts of the luma and chroma planes are361identical.362 363``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores364tiles linearly in memory. The line stride and image height must be365aligned to a multiple of 32. The layouts of the luma and chroma planes are366identical.367 368``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores369pixels in 2D 8x128 tiles, and stores tiles linearly in memory.370The image height must be aligned to a multiple of 128.371The layouts of the luma and chroma planes are identical.372 373``V4L2_PIX_FMT_NV12_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_8L128`` but stores374two planes in one memory.375 376``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels377in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the378image height must be aligned to a multiple of 32. The number of luma and chroma379tiles are identical, even though the tile size differ. The image is formed of380two non-contiguous planes.381 382 383.. _V4L2-PIX-FMT-NV15-4L4:384.. _V4L2-PIX-FMT-NV12M-10BE-8L128:385.. _V4L2-PIX-FMT-NV12-10BE-8L128:386.. _V4L2-PIX-FMT-MT2110T:387.. _V4L2-PIX-FMT-MT2110R:388 389Tiled NV15390----------391 392``V4L2_PIX_FMT_NV15_4L4`` Semi-planar 10-bit YUV 4:2:0 formats, using 4x4 tiling.393All components are packed without any padding between each other.394As a side-effect, each group of 4 components are stored over 5 bytes395(YYYY or UVUV = 4 * 10 bits = 40 bits = 5 bytes).396 397``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores39810 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.399the data is arranged in big endian order.400The image height must be aligned to a multiple of 128.401The layouts of the luma and chroma planes are identical.402Note the tile size is 8bytes multiplied by 128 bytes,403it means that the low bits and high bits of one pixel may be in different tiles.404The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like405this (for luma):406byte 0: Y0(bits 9-2)407byte 1: Y0(bits 1-0) Y1(bits 9-4)408byte 2: Y1(bits 3-0) Y2(bits 9-6)409byte 3: Y2(bits 5-0) Y3(bits 9-8)410byte 4: Y3(bits 7-0)411 412``V4L2_PIX_FMT_NV12_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_10BE_8L128`` but stores413two planes in one memory.414 415``V4L2_PIX_FMT_MT2110T`` is one of Mediatek packed 10bit YUV 4:2:0 formats.416It is fully packed 10bit 4:2:0 format like NV15 (15 bits per pixel), except417that the lower two bits data is stored in separate partitions. The format is418composed of 16x32 luma tiles, and 16x16 chroma tiles. Each tiles is 640 bytes419long, divided into 8 partitions of 80 bytes. The first 16 bytes of the420partition represent the 2 least significant bits of pixel data. The remaining42164 bytes represent the 8 most significant bits of pixel data.422 423.. kernel-figure:: mt2110t.svg424 :alt: mt2110t.svg425 :align: center426 427 Layout of MT2110T Chroma Tile428 429Filtering out the upper part of each partitions results in a valid430``V4L2_PIX_FMT_MM21`` frame. A partition is a sub-tile of size 16 x 4. The431lower two bits is said to be tiled since each bytes contains the lower two432bits of the column of for pixel matching the same index. The chroma tiles433only have 4 partitions.434 435.. flat-table:: MT2110T LSB bits layout436 :header-rows: 1437 :stub-columns: 1438 439 * -440 - start + 0:441 - start + 1:442 - . . .443 - start\ +\ 15:444 * - Bits 1:0445 - Y'\ :sub:`0:0`446 - Y'\ :sub:`0:1`447 - . . .448 - Y'\ :sub:`0:15`449 * - Bit 3:2450 - Y'\ :sub:`1:0`451 - Y'\ :sub:`1:1`452 - . . .453 - Y'\ :sub:`1:15`454 * - Bits 5:4455 - Y'\ :sub:`2:0`456 - Y'\ :sub:`2:1`457 - . . .458 - Y'\ :sub:`2:15`459 * - Bits 7:6460 - Y'\ :sub:`3:0`461 - Y'\ :sub:`3:1`462 - . . .463 - Y'\ :sub:`3:15`464 465``V4L2_PIX_FMT_MT2110R`` is identical to ``V4L2_PIX_FMT_MT2110T`` except that466the least significant two bits layout is in raster order. This means the first byte467contains 4 pixels of the first row, with 4 bytes per line.468 469.. flat-table:: MT2110R LSB bits layout470 :header-rows: 2471 :stub-columns: 1472 473 * -474 - :cspan:`3` Byte 0475 - ...476 - :cspan:`3` Byte 3477 * -478 - 7:6479 - 5:4480 - 3:2481 - 1:0482 - ...483 - 7:6484 - 5:4485 - 3:2486 - 1:0487 * - start + 0:488 - Y'\ :sub:`0:3`489 - Y'\ :sub:`0:2`490 - Y'\ :sub:`0:1`491 - Y'\ :sub:`0:0`492 - ...493 - Y'\ :sub:`0:15`494 - Y'\ :sub:`0:14`495 - Y'\ :sub:`0:13`496 - Y'\ :sub:`0:12`497 * - start + 4:498 - Y'\ :sub:`1:3`499 - Y'\ :sub:`1:2`500 - Y'\ :sub:`1:1`501 - Y'\ :sub:`1:0`502 - ...503 - Y'\ :sub:`1:15`504 - Y'\ :sub:`1:14`505 - Y'\ :sub:`1:13`506 - Y'\ :sub:`1:12`507 * - start + 8:508 - Y'\ :sub:`2:3`509 - Y'\ :sub:`2:2`510 - Y'\ :sub:`2:1`511 - Y'\ :sub:`2:0`512 - ...513 - Y'\ :sub:`2:15`514 - Y'\ :sub:`2:14`515 - Y'\ :sub:`2:13`516 - Y'\ :sub:`2:12`517 * - start\ +\ 12:518 - Y'\ :sub:`3:3`519 - Y'\ :sub:`3:2`520 - Y'\ :sub:`3:1`521 - Y'\ :sub:`3:0`522 - ...523 - Y'\ :sub:`3:15`524 - Y'\ :sub:`3:14`525 - Y'\ :sub:`3:13`526 - Y'\ :sub:`3:12`527 528 529.. _V4L2-PIX-FMT-NV16:530.. _V4L2-PIX-FMT-NV61:531.. _V4L2-PIX-FMT-NV16M:532.. _V4L2-PIX-FMT-NV61M:533 534NV16, NV61, NV16M and NV61M535---------------------------536 537Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the538horizontal direction. Chroma lines contain half the number of pixels and the539same number of bytes as luma lines, and the chroma plane contains the same540number of lines as the luma plane.541 542.. flat-table:: Sample 4x4 NV16 Image543 :header-rows: 0544 :stub-columns: 0545 546 * - start + 0:547 - Y'\ :sub:`00`548 - Y'\ :sub:`01`549 - Y'\ :sub:`02`550 - Y'\ :sub:`03`551 * - start + 4:552 - Y'\ :sub:`10`553 - Y'\ :sub:`11`554 - Y'\ :sub:`12`555 - Y'\ :sub:`13`556 * - start + 8:557 - Y'\ :sub:`20`558 - Y'\ :sub:`21`559 - Y'\ :sub:`22`560 - Y'\ :sub:`23`561 * - start + 12:562 - Y'\ :sub:`30`563 - Y'\ :sub:`31`564 - Y'\ :sub:`32`565 - Y'\ :sub:`33`566 * - start + 16:567 - Cb\ :sub:`00`568 - Cr\ :sub:`00`569 - Cb\ :sub:`01`570 - Cr\ :sub:`01`571 * - start + 20:572 - Cb\ :sub:`10`573 - Cr\ :sub:`10`574 - Cb\ :sub:`11`575 - Cr\ :sub:`11`576 * - start + 24:577 - Cb\ :sub:`20`578 - Cr\ :sub:`20`579 - Cb\ :sub:`21`580 - Cr\ :sub:`21`581 * - start + 28:582 - Cb\ :sub:`30`583 - Cr\ :sub:`30`584 - Cb\ :sub:`31`585 - Cr\ :sub:`31`586 587.. flat-table:: Sample 4x4 NV16M Image588 :header-rows: 0589 :stub-columns: 0590 591 * - start0 + 0:592 - Y'\ :sub:`00`593 - Y'\ :sub:`01`594 - Y'\ :sub:`02`595 - Y'\ :sub:`03`596 * - start0 + 4:597 - Y'\ :sub:`10`598 - Y'\ :sub:`11`599 - Y'\ :sub:`12`600 - Y'\ :sub:`13`601 * - start0 + 8:602 - Y'\ :sub:`20`603 - Y'\ :sub:`21`604 - Y'\ :sub:`22`605 - Y'\ :sub:`23`606 * - start0 + 12:607 - Y'\ :sub:`30`608 - Y'\ :sub:`31`609 - Y'\ :sub:`32`610 - Y'\ :sub:`33`611 * -612 * - start1 + 0:613 - Cb\ :sub:`00`614 - Cr\ :sub:`00`615 - Cb\ :sub:`02`616 - Cr\ :sub:`02`617 * - start1 + 4:618 - Cb\ :sub:`10`619 - Cr\ :sub:`10`620 - Cb\ :sub:`12`621 - Cr\ :sub:`12`622 * - start1 + 8:623 - Cb\ :sub:`20`624 - Cr\ :sub:`20`625 - Cb\ :sub:`22`626 - Cr\ :sub:`22`627 * - start1 + 12:628 - Cb\ :sub:`30`629 - Cr\ :sub:`30`630 - Cb\ :sub:`32`631 - Cr\ :sub:`32`632 633 634.. _V4L2-PIX-FMT-NV24:635.. _V4L2-PIX-FMT-NV42:636 637NV24 and NV42638-------------639 640Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled.641Chroma lines contain the same number of pixels and twice the642number of bytes as luma lines, and the chroma plane contains the same643number of lines as the luma plane.644 645.. flat-table:: Sample 4x4 NV24 Image646 :header-rows: 0647 :stub-columns: 0648 649 * - start + 0:650 - Y'\ :sub:`00`651 - Y'\ :sub:`01`652 - Y'\ :sub:`02`653 - Y'\ :sub:`03`654 * - start + 4:655 - Y'\ :sub:`10`656 - Y'\ :sub:`11`657 - Y'\ :sub:`12`658 - Y'\ :sub:`13`659 * - start + 8:660 - Y'\ :sub:`20`661 - Y'\ :sub:`21`662 - Y'\ :sub:`22`663 - Y'\ :sub:`23`664 * - start + 12:665 - Y'\ :sub:`30`666 - Y'\ :sub:`31`667 - Y'\ :sub:`32`668 - Y'\ :sub:`33`669 * - start + 16:670 - Cb\ :sub:`00`671 - Cr\ :sub:`00`672 - Cb\ :sub:`01`673 - Cr\ :sub:`01`674 - Cb\ :sub:`02`675 - Cr\ :sub:`02`676 - Cb\ :sub:`03`677 - Cr\ :sub:`03`678 * - start + 24:679 - Cb\ :sub:`10`680 - Cr\ :sub:`10`681 - Cb\ :sub:`11`682 - Cr\ :sub:`11`683 - Cb\ :sub:`12`684 - Cr\ :sub:`12`685 - Cb\ :sub:`13`686 - Cr\ :sub:`13`687 * - start + 32:688 - Cb\ :sub:`20`689 - Cr\ :sub:`20`690 - Cb\ :sub:`21`691 - Cr\ :sub:`21`692 - Cb\ :sub:`22`693 - Cr\ :sub:`22`694 - Cb\ :sub:`23`695 - Cr\ :sub:`23`696 * - start + 40:697 - Cb\ :sub:`30`698 - Cr\ :sub:`30`699 - Cb\ :sub:`31`700 - Cr\ :sub:`31`701 - Cb\ :sub:`32`702 - Cr\ :sub:`32`703 - Cb\ :sub:`33`704 - Cr\ :sub:`33`705 706.. _V4L2_PIX_FMT_P010:707.. _V4L2-PIX-FMT-P010-4L4:708 709P010 and tiled P010710-------------------711 712P010 is like NV12 with 10 bits per component, expanded to 16 bits.713Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order.714 715.. flat-table:: Sample 4x4 P010 Image716 :header-rows: 0717 :stub-columns: 0718 719 * - start + 0:720 - Y'\ :sub:`00`721 - Y'\ :sub:`01`722 - Y'\ :sub:`02`723 - Y'\ :sub:`03`724 * - start + 8:725 - Y'\ :sub:`10`726 - Y'\ :sub:`11`727 - Y'\ :sub:`12`728 - Y'\ :sub:`13`729 * - start + 16:730 - Y'\ :sub:`20`731 - Y'\ :sub:`21`732 - Y'\ :sub:`22`733 - Y'\ :sub:`23`734 * - start + 24:735 - Y'\ :sub:`30`736 - Y'\ :sub:`31`737 - Y'\ :sub:`32`738 - Y'\ :sub:`33`739 * - start + 32:740 - Cb\ :sub:`00`741 - Cr\ :sub:`00`742 - Cb\ :sub:`01`743 - Cr\ :sub:`01`744 * - start + 40:745 - Cb\ :sub:`10`746 - Cr\ :sub:`10`747 - Cb\ :sub:`11`748 - Cr\ :sub:`11`749 750.. _V4L2-PIX-FMT-P012:751.. _V4L2-PIX-FMT-P012M:752 753P012 and P012M754--------------755 756P012 is like NV12 with 12 bits per component, expanded to 16 bits.757Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.758 759.. flat-table:: Sample 4x4 P012 Image760 :header-rows: 0761 :stub-columns: 0762 763 * - start + 0:764 - Y'\ :sub:`00`765 - Y'\ :sub:`01`766 - Y'\ :sub:`02`767 - Y'\ :sub:`03`768 * - start + 8:769 - Y'\ :sub:`10`770 - Y'\ :sub:`11`771 - Y'\ :sub:`12`772 - Y'\ :sub:`13`773 * - start + 16:774 - Y'\ :sub:`20`775 - Y'\ :sub:`21`776 - Y'\ :sub:`22`777 - Y'\ :sub:`23`778 * - start + 24:779 - Y'\ :sub:`30`780 - Y'\ :sub:`31`781 - Y'\ :sub:`32`782 - Y'\ :sub:`33`783 * - start + 32:784 - Cb\ :sub:`00`785 - Cr\ :sub:`00`786 - Cb\ :sub:`01`787 - Cr\ :sub:`01`788 * - start + 40:789 - Cb\ :sub:`10`790 - Cr\ :sub:`10`791 - Cb\ :sub:`11`792 - Cr\ :sub:`11`793 794.. flat-table:: Sample 4x4 P012M Image795 :header-rows: 0796 :stub-columns: 0797 798 * - start0 + 0:799 - Y'\ :sub:`00`800 - Y'\ :sub:`01`801 - Y'\ :sub:`02`802 - Y'\ :sub:`03`803 * - start0 + 8:804 - Y'\ :sub:`10`805 - Y'\ :sub:`11`806 - Y'\ :sub:`12`807 - Y'\ :sub:`13`808 * - start0 + 16:809 - Y'\ :sub:`20`810 - Y'\ :sub:`21`811 - Y'\ :sub:`22`812 - Y'\ :sub:`23`813 * - start0 + 24:814 - Y'\ :sub:`30`815 - Y'\ :sub:`31`816 - Y'\ :sub:`32`817 - Y'\ :sub:`33`818 * -819 * - start1 + 0:820 - Cb\ :sub:`00`821 - Cr\ :sub:`00`822 - Cb\ :sub:`01`823 - Cr\ :sub:`01`824 * - start1 + 8:825 - Cb\ :sub:`10`826 - Cr\ :sub:`10`827 - Cb\ :sub:`11`828 - Cr\ :sub:`11`829 830 831Fully Planar YUV Formats832========================833 834These formats store the Y, Cb and Cr components in three separate planes. The835luma plane comes first, and the order of the two chroma planes varies between836formats. The two chroma planes always use the same subsampling.837 838For memory contiguous formats, the number of padding pixels at the end of the839chroma lines is identical to the padding of the luma lines. The chroma line840stride (in bytes) is thus equal to the luma line stride divided by the841horizontal subsampling factor. Vertical subsampling doesn't affect the line842stride.843 844For non-contiguous formats, no constraints are enforced by the format on the845relationship between the luma and chroma line padding and stride.846 847All components are stored with the same number of bits per component.848 849``V4L2_PIX_FMT_P010_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly850in memory. The line stride must be aligned to multiple of 8 and image height to851a multiple of 4. The layouts of the luma and chroma planes are identical.852 853.. raw:: latex854 855 \small856 857.. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}|858 859.. flat-table:: Overview of Fully Planar YUV Formats860 :header-rows: 1861 :stub-columns: 0862 863 * - Identifier864 - Code865 - Bits per component866 - Subsampling867 - Planes order [4]_868 - Contiguous [5]_869 870 * - V4L2_PIX_FMT_YUV410871 - 'YUV9'872 - 8873 - 4:1:0874 - Y, Cb, Cr875 - Yes876 * - V4L2_PIX_FMT_YVU410877 - 'YVU9'878 - 8879 - 4:1:0880 - Y, Cr, Cb881 - Yes882 * - V4L2_PIX_FMT_YUV411P883 - '411P'884 - 8885 - 4:1:1886 - Y, Cb, Cr887 - Yes888 * - V4L2_PIX_FMT_YUV420M889 - 'YM12'890 - 8891 - 4:2:0892 - Y, Cb, Cr893 - No894 * - V4L2_PIX_FMT_YVU420M895 - 'YM21'896 - 8897 - 4:2:0898 - Y, Cr, Cb899 - No900 * - V4L2_PIX_FMT_YUV420901 - 'YU12'902 - 8903 - 4:2:0904 - Y, Cb, Cr905 - Yes906 * - V4L2_PIX_FMT_YVU420907 - 'YV12'908 - 8909 - 4:2:0910 - Y, Cr, Cb911 - Yes912 * - V4L2_PIX_FMT_YUV422P913 - '422P'914 - 8915 - 4:2:2916 - Y, Cb, Cr917 - Yes918 * - V4L2_PIX_FMT_YUV422M919 - 'YM16'920 - 8921 - 4:2:2922 - Y, Cb, Cr923 - No924 * - V4L2_PIX_FMT_YVU422M925 - 'YM61'926 - 8927 - 4:2:2928 - Y, Cr, Cb929 - No930 * - V4L2_PIX_FMT_YUV444M931 - 'YM24'932 - 8933 - 4:4:4934 - Y, Cb, Cr935 - No936 * - V4L2_PIX_FMT_YVU444M937 - 'YM42'938 - 8939 - 4:4:4940 - Y, Cr, Cb941 - No942 943.. raw:: latex944 945 \normalsize946 947.. [4] Order of luma and chroma planes948.. [5] Indicates if planes have to be contiguous in memory or can be949 disjoint950 951 952**Color Sample Location:**953Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`954horizontally.955 956.. _V4L2-PIX-FMT-YUV410:957.. _V4L2-PIX-FMT-YVU410:958 959YUV410 and YVU410960-----------------961 962Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each963direction. Chroma lines contain a quarter of the number of pixels and bytes of964the luma lines, and the chroma planes contain a quarter of the number of lines965of the luma plane.966 967.. flat-table:: Sample 4x4 YUV410 Image968 :header-rows: 0969 :stub-columns: 0970 971 * - start + 0:972 - Y'\ :sub:`00`973 - Y'\ :sub:`01`974 - Y'\ :sub:`02`975 - Y'\ :sub:`03`976 * - start + 4:977 - Y'\ :sub:`10`978 - Y'\ :sub:`11`979 - Y'\ :sub:`12`980 - Y'\ :sub:`13`981 * - start + 8:982 - Y'\ :sub:`20`983 - Y'\ :sub:`21`984 - Y'\ :sub:`22`985 - Y'\ :sub:`23`986 * - start + 12:987 - Y'\ :sub:`30`988 - Y'\ :sub:`31`989 - Y'\ :sub:`32`990 - Y'\ :sub:`33`991 * - start + 16:992 - Cr\ :sub:`00`993 * - start + 17:994 - Cb\ :sub:`00`995 996 997.. _V4L2-PIX-FMT-YUV411P:998 999YUV411P1000-------1001 1002Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the1003horizontal direction. Chroma lines contain a quarter of the number of pixels1004and bytes of the luma lines, and the chroma planes contain the same number of1005lines as the luma plane.1006 1007.. flat-table:: Sample 4x4 YUV411P Image1008 :header-rows: 01009 :stub-columns: 01010 1011 * - start + 0:1012 - Y'\ :sub:`00`1013 - Y'\ :sub:`01`1014 - Y'\ :sub:`02`1015 - Y'\ :sub:`03`1016 * - start + 4:1017 - Y'\ :sub:`10`1018 - Y'\ :sub:`11`1019 - Y'\ :sub:`12`1020 - Y'\ :sub:`13`1021 * - start + 8:1022 - Y'\ :sub:`20`1023 - Y'\ :sub:`21`1024 - Y'\ :sub:`22`1025 - Y'\ :sub:`23`1026 * - start + 12:1027 - Y'\ :sub:`30`1028 - Y'\ :sub:`31`1029 - Y'\ :sub:`32`1030 - Y'\ :sub:`33`1031 * - start + 16:1032 - Cb\ :sub:`00`1033 * - start + 17:1034 - Cb\ :sub:`10`1035 * - start + 18:1036 - Cb\ :sub:`20`1037 * - start + 19:1038 - Cb\ :sub:`30`1039 * - start + 20:1040 - Cr\ :sub:`00`1041 * - start + 21:1042 - Cr\ :sub:`10`1043 * - start + 22:1044 - Cr\ :sub:`20`1045 * - start + 23:1046 - Cr\ :sub:`30`1047 1048 1049.. _V4L2-PIX-FMT-YUV420:1050.. _V4L2-PIX-FMT-YVU420:1051.. _V4L2-PIX-FMT-YUV420M:1052.. _V4L2-PIX-FMT-YVU420M:1053 1054YUV420, YVU420, YUV420M and YVU420M1055-----------------------------------1056 1057Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each1058direction. Chroma lines contain half of the number of pixels and bytes of the1059luma lines, and the chroma planes contain half of the number of lines of the1060luma plane.1061 1062.. flat-table:: Sample 4x4 YUV420 Image1063 :header-rows: 01064 :stub-columns: 01065 1066 * - start + 0:1067 - Y'\ :sub:`00`1068 - Y'\ :sub:`01`1069 - Y'\ :sub:`02`1070 - Y'\ :sub:`03`1071 * - start + 4:1072 - Y'\ :sub:`10`1073 - Y'\ :sub:`11`1074 - Y'\ :sub:`12`1075 - Y'\ :sub:`13`1076 * - start + 8:1077 - Y'\ :sub:`20`1078 - Y'\ :sub:`21`1079 - Y'\ :sub:`22`1080 - Y'\ :sub:`23`1081 * - start + 12:1082 - Y'\ :sub:`30`1083 - Y'\ :sub:`31`1084 - Y'\ :sub:`32`1085 - Y'\ :sub:`33`1086 * - start + 16:1087 - Cr\ :sub:`00`1088 - Cr\ :sub:`01`1089 * - start + 18:1090 - Cr\ :sub:`10`1091 - Cr\ :sub:`11`1092 * - start + 20:1093 - Cb\ :sub:`00`1094 - Cb\ :sub:`01`1095 * - start + 22:1096 - Cb\ :sub:`10`1097 - Cb\ :sub:`11`1098 1099.. flat-table:: Sample 4x4 YUV420M Image1100 :header-rows: 01101 :stub-columns: 01102 1103 * - start0 + 0:1104 - Y'\ :sub:`00`1105 - Y'\ :sub:`01`1106 - Y'\ :sub:`02`1107 - Y'\ :sub:`03`1108 * - start0 + 4:1109 - Y'\ :sub:`10`1110 - Y'\ :sub:`11`1111 - Y'\ :sub:`12`1112 - Y'\ :sub:`13`1113 * - start0 + 8:1114 - Y'\ :sub:`20`1115 - Y'\ :sub:`21`1116 - Y'\ :sub:`22`1117 - Y'\ :sub:`23`1118 * - start0 + 12:1119 - Y'\ :sub:`30`1120 - Y'\ :sub:`31`1121 - Y'\ :sub:`32`1122 - Y'\ :sub:`33`1123 * -1124 * - start1 + 0:1125 - Cb\ :sub:`00`1126 - Cb\ :sub:`01`1127 * - start1 + 2:1128 - Cb\ :sub:`10`1129 - Cb\ :sub:`11`1130 * -1131 * - start2 + 0:1132 - Cr\ :sub:`00`1133 - Cr\ :sub:`01`1134 * - start2 + 2:1135 - Cr\ :sub:`10`1136 - Cr\ :sub:`11`1137 1138 1139.. _V4L2-PIX-FMT-YUV422P:1140.. _V4L2-PIX-FMT-YUV422M:1141.. _V4L2-PIX-FMT-YVU422M:1142 1143YUV422P, YUV422M and YVU422M1144----------------------------1145 1146Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the1147horizontal direction. Chroma lines contain half of the number of pixels and1148bytes of the luma lines, and the chroma planes contain the same number of lines1149as the luma plane.1150 1151.. flat-table:: Sample 4x4 YUV422P Image1152 :header-rows: 01153 :stub-columns: 01154 1155 * - start + 0:1156 - Y'\ :sub:`00`1157 - Y'\ :sub:`01`1158 - Y'\ :sub:`02`1159 - Y'\ :sub:`03`1160 * - start + 4:1161 - Y'\ :sub:`10`1162 - Y'\ :sub:`11`1163 - Y'\ :sub:`12`1164 - Y'\ :sub:`13`1165 * - start + 8:1166 - Y'\ :sub:`20`1167 - Y'\ :sub:`21`1168 - Y'\ :sub:`22`1169 - Y'\ :sub:`23`1170 * - start + 12:1171 - Y'\ :sub:`30`1172 - Y'\ :sub:`31`1173 - Y'\ :sub:`32`1174 - Y'\ :sub:`33`1175 * - start + 16:1176 - Cb\ :sub:`00`1177 - Cb\ :sub:`01`1178 * - start + 18:1179 - Cb\ :sub:`10`1180 - Cb\ :sub:`11`1181 * - start + 20:1182 - Cb\ :sub:`20`1183 - Cb\ :sub:`21`1184 * - start + 22:1185 - Cb\ :sub:`30`1186 - Cb\ :sub:`31`1187 * - start + 24:1188 - Cr\ :sub:`00`1189 - Cr\ :sub:`01`1190 * - start + 26:1191 - Cr\ :sub:`10`1192 - Cr\ :sub:`11`1193 * - start + 28:1194 - Cr\ :sub:`20`1195 - Cr\ :sub:`21`1196 * - start + 30:1197 - Cr\ :sub:`30`1198 - Cr\ :sub:`31`1199 1200.. flat-table:: Sample 4x4 YUV422M Image1201 :header-rows: 01202 :stub-columns: 01203 1204 * - start0 + 0:1205 - Y'\ :sub:`00`1206 - Y'\ :sub:`01`1207 - Y'\ :sub:`02`1208 - Y'\ :sub:`03`1209 * - start0 + 4:1210 - Y'\ :sub:`10`1211 - Y'\ :sub:`11`1212 - Y'\ :sub:`12`1213 - Y'\ :sub:`13`1214 * - start0 + 8:1215 - Y'\ :sub:`20`1216 - Y'\ :sub:`21`1217 - Y'\ :sub:`22`1218 - Y'\ :sub:`23`1219 * - start0 + 12:1220 - Y'\ :sub:`30`1221 - Y'\ :sub:`31`1222 - Y'\ :sub:`32`1223 - Y'\ :sub:`33`1224 * -1225 * - start1 + 0:1226 - Cb\ :sub:`00`1227 - Cb\ :sub:`01`1228 * - start1 + 2:1229 - Cb\ :sub:`10`1230 - Cb\ :sub:`11`1231 * - start1 + 4:1232 - Cb\ :sub:`20`1233 - Cb\ :sub:`21`1234 * - start1 + 6:1235 - Cb\ :sub:`30`1236 - Cb\ :sub:`31`1237 * -1238 * - start2 + 0:1239 - Cr\ :sub:`00`1240 - Cr\ :sub:`01`1241 * - start2 + 2:1242 - Cr\ :sub:`10`1243 - Cr\ :sub:`11`1244 * - start2 + 4:1245 - Cr\ :sub:`20`1246 - Cr\ :sub:`21`1247 * - start2 + 6:1248 - Cr\ :sub:`30`1249 - Cr\ :sub:`31`1250 1251 1252.. _V4L2-PIX-FMT-YUV444M:1253.. _V4L2-PIX-FMT-YVU444M:1254 1255YUV444M and YVU444M1256-------------------1257 1258Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines1259contain the same number of pixels and bytes of the luma lines, and the chroma1260planes contain the same number of lines as the luma plane.1261 1262.. flat-table:: Sample 4x4 YUV444M Image1263 :header-rows: 01264 :stub-columns: 01265 1266 * - start0 + 0:1267 - Y'\ :sub:`00`1268 - Y'\ :sub:`01`1269 - Y'\ :sub:`02`1270 - Y'\ :sub:`03`1271 * - start0 + 4:1272 - Y'\ :sub:`10`1273 - Y'\ :sub:`11`1274 - Y'\ :sub:`12`1275 - Y'\ :sub:`13`1276 * - start0 + 8:1277 - Y'\ :sub:`20`1278 - Y'\ :sub:`21`1279 - Y'\ :sub:`22`1280 - Y'\ :sub:`23`1281 * - start0 + 12:1282 - Y'\ :sub:`30`1283 - Y'\ :sub:`31`1284 - Y'\ :sub:`32`1285 - Y'\ :sub:`33`1286 * -1287 * - start1 + 0:1288 - Cb\ :sub:`00`1289 - Cb\ :sub:`01`1290 - Cb\ :sub:`02`1291 - Cb\ :sub:`03`1292 * - start1 + 4:1293 - Cb\ :sub:`10`1294 - Cb\ :sub:`11`1295 - Cb\ :sub:`12`1296 - Cb\ :sub:`13`1297 * - start1 + 8:1298 - Cb\ :sub:`20`1299 - Cb\ :sub:`21`1300 - Cb\ :sub:`22`1301 - Cb\ :sub:`23`1302 * - start1 + 12:1303 - Cb\ :sub:`20`1304 - Cb\ :sub:`21`1305 - Cb\ :sub:`32`1306 - Cb\ :sub:`33`1307 * -1308 * - start2 + 0:1309 - Cr\ :sub:`00`1310 - Cr\ :sub:`01`1311 - Cr\ :sub:`02`1312 - Cr\ :sub:`03`1313 * - start2 + 4:1314 - Cr\ :sub:`10`1315 - Cr\ :sub:`11`1316 - Cr\ :sub:`12`1317 - Cr\ :sub:`13`1318 * - start2 + 8:1319 - Cr\ :sub:`20`1320 - Cr\ :sub:`21`1321 - Cr\ :sub:`22`1322 - Cr\ :sub:`23`1323 * - start2 + 12:1324 - Cr\ :sub:`30`1325 - Cr\ :sub:`31`1326 - Cr\ :sub:`32`1327 - Cr\ :sub:`33`1328