1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2 3.. planar-yuv: 4 5****************** 6Planar YUV formats 7****************** 8 9Planar formats split luma and chroma data in separate memory regions. They 10exist in two variants: 11 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. 15 16- Fully planar formats use three planes to store the Y, Cb and Cr components 17 separately. 18 19Within a plane, components are stored in pixel order, which may be linear or 20tiled. Padding may be supported at the end of the lines, and the line stride of 21the 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 in 25``V4L2_PIX_FMT_NV12M``). Those formats are intended to be used only in drivers 26and applications that support the multi-planar API, described in 27:ref:`planar-apis`. Unless explicitly documented as supporting non-contiguous 28planes, formats require the planes to follow each other immediately in memory. 29 30 31Semi-Planar YUV Formats 32======================= 33 34These formats are commonly referred to as NV formats (NV12, NV16, ...). They 35use two planes, and store the luma components in the first plane and the chroma 36components in the second plane. The Cb and Cr components are interleaved in the 37chroma plane, with Cb and Cr always stored in pairs. The chroma order is 38exposed as different formats. 39 40For memory contiguous formats, the number of padding pixels at the end of the 41chroma lines is identical to the padding of the luma lines. Without horizontal 42subsampling, the chroma line stride (in bytes) is thus equal to twice the luma 43line stride. With horizontal subsampling by 2, the chroma line stride is equal 44to 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 the 47relationship 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:: latex 52 53 \footnotesize 54 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 Formats 58 :header-rows: 1 59 :stub-columns: 0 60 61 * - Identifier 62 - Code 63 - Bits per component 64 - Subsampling 65 - Chroma order [1]_ 66 - Contiguous [2]_ 67 - Tiling [3]_ 68 * - V4L2_PIX_FMT_NV12 69 - 'NV12' 70 - 8 71 - 4:2:0 72 - Cb, Cr 73 - Yes 74 - Linear 75 * - V4L2_PIX_FMT_NV21 76 - 'NV21' 77 - 8 78 - 4:2:0 79 - Cr, Cb 80 - Yes 81 - Linear 82 * - V4L2_PIX_FMT_NV12M 83 - 'NM12' 84 - 8 85 - 4:2:0 86 - Cb, Cr 87 - No 88 - Linear 89 * - V4L2_PIX_FMT_NV21M 90 - 'NM21' 91 - 8 92 - 4:2:0 93 - Cr, Cb 94 - No 95 - Linear 96 * - V4L2_PIX_FMT_NV12MT 97 - 'TM12' 98 - 8 99 - 4:2:0 100 - Cb, Cr 101 - No 102 - 64x32 tiles 103 104 Horizontal Z order 105 * - V4L2_PIX_FMT_NV12MT_16X16 106 - 'VM12' 107 - 8 108 - 4:2:2 109 - Cb, Cr 110 - No 111 - 16x16 tiles 112 * - V4L2_PIX_FMT_P010 113 - 'P010' 114 - 10 115 - 4:2:0 116 - Cb, Cr 117 - Yes 118 - Linear 119 * - V4L2_PIX_FMT_P010_4L4 120 - 'T010' 121 - 10 122 - 4:2:0 123 - Cb, Cr 124 - Yes 125 - 4x4 tiles 126 * - V4L2_PIX_FMT_P012 127 - 'P012' 128 - 12 129 - 4:2:0 130 - Cb, Cr 131 - Yes 132 - Linear 133 * - V4L2_PIX_FMT_P012M 134 - 'PM12' 135 - 12 136 - 4:2:0 137 - Cb, Cr 138 - No 139 - Linear 140 * - V4L2_PIX_FMT_NV16 141 - 'NV16' 142 - 8 143 - 4:2:2 144 - Cb, Cr 145 - Yes 146 - Linear 147 * - V4L2_PIX_FMT_NV61 148 - 'NV61' 149 - 8 150 - 4:2:2 151 - Cr, Cb 152 - Yes 153 - Linear 154 * - V4L2_PIX_FMT_NV16M 155 - 'NM16' 156 - 8 157 - 4:2:2 158 - Cb, Cr 159 - No 160 - Linear 161 * - V4L2_PIX_FMT_NV61M 162 - 'NM61' 163 - 8 164 - 4:2:2 165 - Cr, Cb 166 - No 167 - Linear 168 * - V4L2_PIX_FMT_NV24 169 - 'NV24' 170 - 8 171 - 4:4:4 172 - Cb, Cr 173 - Yes 174 - Linear 175 * - V4L2_PIX_FMT_NV42 176 - 'NV42' 177 - 8 178 - 4:4:4 179 - Cr, Cb 180 - Yes 181 - Linear 182 183.. raw:: latex 184 185 \normalsize 186 187.. [1] Order of chroma samples in the second plane 188.. [2] Indicates if planes have to be contiguous in memory or can be 189 disjoint 190.. [3] Macroblock size in pixels 191 192 193**Color Sample Location:** 194Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` 195horizontally. 196 197 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: 203 204NV12, NV21, NV12M and NV21M 205--------------------------- 206 207Semi-planar YUV 4:2:0 formats. The chroma plane is subsampled by 2 in each 208direction. Chroma lines contain half the number of pixels and the same number 209of bytes as luma lines, and the chroma plane contains half the number of lines 210of the luma plane. 211 212.. flat-table:: Sample 4x4 NV12 Image 213 :header-rows: 0 214 :stub-columns: 0 215 216 * - start + 0: 217 - Y'\ :sub:`00` 218 - Y'\ :sub:`01` 219 - Y'\ :sub:`02` 220 - Y'\ :sub:`03` 221 * - start + 4: 222 - Y'\ :sub:`10` 223 - Y'\ :sub:`11` 224 - Y'\ :sub:`12` 225 - Y'\ :sub:`13` 226 * - start + 8: 227 - Y'\ :sub:`20` 228 - Y'\ :sub:`21` 229 - Y'\ :sub:`22` 230 - Y'\ :sub:`23` 231 * - start + 12: 232 - Y'\ :sub:`30` 233 - Y'\ :sub:`31` 234 - Y'\ :sub:`32` 235 - Y'\ :sub:`33` 236 * - start + 16: 237 - Cb\ :sub:`00` 238 - Cr\ :sub:`00` 239 - Cb\ :sub:`01` 240 - Cr\ :sub:`01` 241 * - start + 20: 242 - Cb\ :sub:`10` 243 - Cr\ :sub:`10` 244 - Cb\ :sub:`11` 245 - Cr\ :sub:`11` 246 247.. flat-table:: Sample 4x4 NV12M Image 248 :header-rows: 0 249 :stub-columns: 0 250 251 * - start0 + 0: 252 - Y'\ :sub:`00` 253 - Y'\ :sub:`01` 254 - Y'\ :sub:`02` 255 - Y'\ :sub:`03` 256 * - start0 + 4: 257 - Y'\ :sub:`10` 258 - Y'\ :sub:`11` 259 - Y'\ :sub:`12` 260 - Y'\ :sub:`13` 261 * - start0 + 8: 262 - Y'\ :sub:`20` 263 - Y'\ :sub:`21` 264 - Y'\ :sub:`22` 265 - Y'\ :sub:`23` 266 * - start0 + 12: 267 - Y'\ :sub:`30` 268 - Y'\ :sub:`31` 269 - Y'\ :sub:`32` 270 - Y'\ :sub:`33` 271 * - 272 * - start1 + 0: 273 - Cb\ :sub:`00` 274 - Cr\ :sub:`00` 275 - Cb\ :sub:`01` 276 - Cr\ :sub:`01` 277 * - start1 + 4: 278 - Cb\ :sub:`10` 279 - Cr\ :sub:`10` 280 - Cb\ :sub:`11` 281 - Cr\ :sub:`11` 282 283 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: 294 295Tiled NV12 296---------- 297 298Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is 299subsampled by 2 in each direction. Chroma lines contain half the number of 300pixels and the same number of bytes as luma lines, and the chroma plane 301contains half the number of lines of the luma plane. Each tile follows the 302previous one linearly in memory (from left to right, top to bottom). 303 304``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores 305pixels in 2D 16x16 tiles, and stores tiles linearly in memory. 306The line stride and image height must be aligned to a multiple of 16. 307The layouts of the luma and chroma planes are identical. 308 309``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores 310pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in 311Z-order in memory, alternating Z and mirrored Z shapes horizontally. 312The line stride must be a multiple of 128 pixels to ensure an 313integer number of Z shapes. The image height must be a multiple of 32 pixels. 314If the vertical resolution is an odd number of tiles, the last row of 315tiles is stored in linear order. The layouts of the luma and chroma 316planes are identical. 317 318``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores 319tiles linearly in memory. The line stride and image height must be 320aligned to a multiple of 4. The layouts of the luma and chroma planes are 321identical. 322 323``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores 324tiles linearly in memory. The line stride and image height must be 325aligned to a multiple of 16. The layouts of the luma and chroma planes are 326identical. 327 328``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores 329tiles linearly in memory. The line stride and image height must be 330aligned to a multiple of 32. The layouts of the luma and chroma planes are 331identical. 332 333``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores 334pixels in 2D 8x128 tiles, and stores tiles linearly in memory. 335The image height must be aligned to a multiple of 128. 336The layouts of the luma and chroma planes are identical. 337 338``V4L2_PIX_FMT_NV12_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_8L128`` but stores 339two planes in one memory. 340 341``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores 34210 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory. 343the data is arranged in big endian order. 344The image height must be aligned to a multiple of 128. 345The layouts of the luma and chroma planes are identical. 346Note the tile size is 8bytes multiplied by 128 bytes, 347it means that the low bits and high bits of one pixel may be in different tiles. 348The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like 349this (for luma): 350byte 0: Y0(bits 9-2) 351byte 1: Y0(bits 1-0) Y1(bits 9-4) 352byte 2: Y1(bits 3-0) Y2(bits 9-6) 353byte 3: Y2(bits 5-0) Y3(bits 9-8) 354byte 4: Y3(bits 7-0) 355 356``V4L2_PIX_FMT_NV12_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_10BE_8L128`` but stores 357two planes in one memory. 358 359``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels 360in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the 361image height must be aligned to a multiple of 32. The number of luma and chroma 362tiles are identical, even though the tile size differ. The image is formed of 363two non-contiguous planes. 364 365.. _nv12mt: 366 367.. kernel-figure:: nv12mt.svg 368 :alt: nv12mt.svg 369 :align: center 370 371 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout 372 373.. _nv12mt_ex: 374 375.. kernel-figure:: nv12mt_example.svg 376 :alt: nv12mt_example.svg 377 :align: center 378 379 Example V4L2_PIX_FMT_NV12MT memory layout of tiles 380 381 382.. _V4L2-PIX-FMT-NV16: 383.. _V4L2-PIX-FMT-NV61: 384.. _V4L2-PIX-FMT-NV16M: 385.. _V4L2-PIX-FMT-NV61M: 386 387NV16, NV61, NV16M and NV61M 388--------------------------- 389 390Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the 391horizontal direction. Chroma lines contain half the number of pixels and the 392same number of bytes as luma lines, and the chroma plane contains the same 393number of lines as the luma plane. 394 395.. flat-table:: Sample 4x4 NV16 Image 396 :header-rows: 0 397 :stub-columns: 0 398 399 * - start + 0: 400 - Y'\ :sub:`00` 401 - Y'\ :sub:`01` 402 - Y'\ :sub:`02` 403 - Y'\ :sub:`03` 404 * - start + 4: 405 - Y'\ :sub:`10` 406 - Y'\ :sub:`11` 407 - Y'\ :sub:`12` 408 - Y'\ :sub:`13` 409 * - start + 8: 410 - Y'\ :sub:`20` 411 - Y'\ :sub:`21` 412 - Y'\ :sub:`22` 413 - Y'\ :sub:`23` 414 * - start + 12: 415 - Y'\ :sub:`30` 416 - Y'\ :sub:`31` 417 - Y'\ :sub:`32` 418 - Y'\ :sub:`33` 419 * - start + 16: 420 - Cb\ :sub:`00` 421 - Cr\ :sub:`00` 422 - Cb\ :sub:`01` 423 - Cr\ :sub:`01` 424 * - start + 20: 425 - Cb\ :sub:`10` 426 - Cr\ :sub:`10` 427 - Cb\ :sub:`11` 428 - Cr\ :sub:`11` 429 * - start + 24: 430 - Cb\ :sub:`20` 431 - Cr\ :sub:`20` 432 - Cb\ :sub:`21` 433 - Cr\ :sub:`21` 434 * - start + 28: 435 - Cb\ :sub:`30` 436 - Cr\ :sub:`30` 437 - Cb\ :sub:`31` 438 - Cr\ :sub:`31` 439 440.. flat-table:: Sample 4x4 NV16M Image 441 :header-rows: 0 442 :stub-columns: 0 443 444 * - start0 + 0: 445 - Y'\ :sub:`00` 446 - Y'\ :sub:`01` 447 - Y'\ :sub:`02` 448 - Y'\ :sub:`03` 449 * - start0 + 4: 450 - Y'\ :sub:`10` 451 - Y'\ :sub:`11` 452 - Y'\ :sub:`12` 453 - Y'\ :sub:`13` 454 * - start0 + 8: 455 - Y'\ :sub:`20` 456 - Y'\ :sub:`21` 457 - Y'\ :sub:`22` 458 - Y'\ :sub:`23` 459 * - start0 + 12: 460 - Y'\ :sub:`30` 461 - Y'\ :sub:`31` 462 - Y'\ :sub:`32` 463 - Y'\ :sub:`33` 464 * - 465 * - start1 + 0: 466 - Cb\ :sub:`00` 467 - Cr\ :sub:`00` 468 - Cb\ :sub:`02` 469 - Cr\ :sub:`02` 470 * - start1 + 4: 471 - Cb\ :sub:`10` 472 - Cr\ :sub:`10` 473 - Cb\ :sub:`12` 474 - Cr\ :sub:`12` 475 * - start1 + 8: 476 - Cb\ :sub:`20` 477 - Cr\ :sub:`20` 478 - Cb\ :sub:`22` 479 - Cr\ :sub:`22` 480 * - start1 + 12: 481 - Cb\ :sub:`30` 482 - Cr\ :sub:`30` 483 - Cb\ :sub:`32` 484 - Cr\ :sub:`32` 485 486 487.. _V4L2-PIX-FMT-NV24: 488.. _V4L2-PIX-FMT-NV42: 489 490NV24 and NV42 491------------- 492 493Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled. 494Chroma lines contain the same number of pixels and twice the 495number of bytes as luma lines, and the chroma plane contains the same 496number of lines as the luma plane. 497 498.. flat-table:: Sample 4x4 NV24 Image 499 :header-rows: 0 500 :stub-columns: 0 501 502 * - start + 0: 503 - Y'\ :sub:`00` 504 - Y'\ :sub:`01` 505 - Y'\ :sub:`02` 506 - Y'\ :sub:`03` 507 * - start + 4: 508 - Y'\ :sub:`10` 509 - Y'\ :sub:`11` 510 - Y'\ :sub:`12` 511 - Y'\ :sub:`13` 512 * - start + 8: 513 - Y'\ :sub:`20` 514 - Y'\ :sub:`21` 515 - Y'\ :sub:`22` 516 - Y'\ :sub:`23` 517 * - start + 12: 518 - Y'\ :sub:`30` 519 - Y'\ :sub:`31` 520 - Y'\ :sub:`32` 521 - Y'\ :sub:`33` 522 * - start + 16: 523 - Cb\ :sub:`00` 524 - Cr\ :sub:`00` 525 - Cb\ :sub:`01` 526 - Cr\ :sub:`01` 527 - Cb\ :sub:`02` 528 - Cr\ :sub:`02` 529 - Cb\ :sub:`03` 530 - Cr\ :sub:`03` 531 * - start + 24: 532 - Cb\ :sub:`10` 533 - Cr\ :sub:`10` 534 - Cb\ :sub:`11` 535 - Cr\ :sub:`11` 536 - Cb\ :sub:`12` 537 - Cr\ :sub:`12` 538 - Cb\ :sub:`13` 539 - Cr\ :sub:`13` 540 * - start + 32: 541 - Cb\ :sub:`20` 542 - Cr\ :sub:`20` 543 - Cb\ :sub:`21` 544 - Cr\ :sub:`21` 545 - Cb\ :sub:`22` 546 - Cr\ :sub:`22` 547 - Cb\ :sub:`23` 548 - Cr\ :sub:`23` 549 * - start + 40: 550 - Cb\ :sub:`30` 551 - Cr\ :sub:`30` 552 - Cb\ :sub:`31` 553 - Cr\ :sub:`31` 554 - Cb\ :sub:`32` 555 - Cr\ :sub:`32` 556 - Cb\ :sub:`33` 557 - Cr\ :sub:`33` 558 559.. _V4L2_PIX_FMT_P010: 560.. _V4L2-PIX-FMT-P010-4L4: 561 562P010 and tiled P010 563------------------- 564 565P010 is like NV12 with 10 bits per component, expanded to 16 bits. 566Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order. 567 568.. flat-table:: Sample 4x4 P010 Image 569 :header-rows: 0 570 :stub-columns: 0 571 572 * - start + 0: 573 - Y'\ :sub:`00` 574 - Y'\ :sub:`01` 575 - Y'\ :sub:`02` 576 - Y'\ :sub:`03` 577 * - start + 8: 578 - Y'\ :sub:`10` 579 - Y'\ :sub:`11` 580 - Y'\ :sub:`12` 581 - Y'\ :sub:`13` 582 * - start + 16: 583 - Y'\ :sub:`20` 584 - Y'\ :sub:`21` 585 - Y'\ :sub:`22` 586 - Y'\ :sub:`23` 587 * - start + 24: 588 - Y'\ :sub:`30` 589 - Y'\ :sub:`31` 590 - Y'\ :sub:`32` 591 - Y'\ :sub:`33` 592 * - start + 32: 593 - Cb\ :sub:`00` 594 - Cr\ :sub:`00` 595 - Cb\ :sub:`01` 596 - Cr\ :sub:`01` 597 * - start + 40: 598 - Cb\ :sub:`10` 599 - Cr\ :sub:`10` 600 - Cb\ :sub:`11` 601 - Cr\ :sub:`11` 602 603.. _V4L2-PIX-FMT-P012: 604.. _V4L2-PIX-FMT-P012M: 605 606P012 and P012M 607-------------- 608 609P012 is like NV12 with 12 bits per component, expanded to 16 bits. 610Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. 611 612.. flat-table:: Sample 4x4 P012 Image 613 :header-rows: 0 614 :stub-columns: 0 615 616 * - start + 0: 617 - Y'\ :sub:`00` 618 - Y'\ :sub:`01` 619 - Y'\ :sub:`02` 620 - Y'\ :sub:`03` 621 * - start + 8: 622 - Y'\ :sub:`10` 623 - Y'\ :sub:`11` 624 - Y'\ :sub:`12` 625 - Y'\ :sub:`13` 626 * - start + 16: 627 - Y'\ :sub:`20` 628 - Y'\ :sub:`21` 629 - Y'\ :sub:`22` 630 - Y'\ :sub:`23` 631 * - start + 24: 632 - Y'\ :sub:`30` 633 - Y'\ :sub:`31` 634 - Y'\ :sub:`32` 635 - Y'\ :sub:`33` 636 * - start + 32: 637 - Cb\ :sub:`00` 638 - Cr\ :sub:`00` 639 - Cb\ :sub:`01` 640 - Cr\ :sub:`01` 641 * - start + 40: 642 - Cb\ :sub:`10` 643 - Cr\ :sub:`10` 644 - Cb\ :sub:`11` 645 - Cr\ :sub:`11` 646 647.. flat-table:: Sample 4x4 P012M Image 648 :header-rows: 0 649 :stub-columns: 0 650 651 * - start0 + 0: 652 - Y'\ :sub:`00` 653 - Y'\ :sub:`01` 654 - Y'\ :sub:`02` 655 - Y'\ :sub:`03` 656 * - start0 + 8: 657 - Y'\ :sub:`10` 658 - Y'\ :sub:`11` 659 - Y'\ :sub:`12` 660 - Y'\ :sub:`13` 661 * - start0 + 16: 662 - Y'\ :sub:`20` 663 - Y'\ :sub:`21` 664 - Y'\ :sub:`22` 665 - Y'\ :sub:`23` 666 * - start0 + 24: 667 - Y'\ :sub:`30` 668 - Y'\ :sub:`31` 669 - Y'\ :sub:`32` 670 - Y'\ :sub:`33` 671 * - 672 * - start1 + 0: 673 - Cb\ :sub:`00` 674 - Cr\ :sub:`00` 675 - Cb\ :sub:`01` 676 - Cr\ :sub:`01` 677 * - start1 + 8: 678 - Cb\ :sub:`10` 679 - Cr\ :sub:`10` 680 - Cb\ :sub:`11` 681 - Cr\ :sub:`11` 682 683 684Fully Planar YUV Formats 685======================== 686 687These formats store the Y, Cb and Cr components in three separate planes. The 688luma plane comes first, and the order of the two chroma planes varies between 689formats. The two chroma planes always use the same subsampling. 690 691For memory contiguous formats, the number of padding pixels at the end of the 692chroma lines is identical to the padding of the luma lines. The chroma line 693stride (in bytes) is thus equal to the luma line stride divided by the 694horizontal subsampling factor. Vertical subsampling doesn't affect the line 695stride. 696 697For non-contiguous formats, no constraints are enforced by the format on the 698relationship between the luma and chroma line padding and stride. 699 700All components are stored with the same number of bits per component. 701 702``V4L2_PIX_FMT_P010_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly 703in memory. The line stride must be aligned to multiple of 8 and image height to 704a multiple of 4. The layouts of the luma and chroma planes are identical. 705 706.. raw:: latex 707 708 \small 709 710.. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}| 711 712.. flat-table:: Overview of Fully Planar YUV Formats 713 :header-rows: 1 714 :stub-columns: 0 715 716 * - Identifier 717 - Code 718 - Bits per component 719 - Subsampling 720 - Planes order [4]_ 721 - Contiguous [5]_ 722 723 * - V4L2_PIX_FMT_YUV410 724 - 'YUV9' 725 - 8 726 - 4:1:0 727 - Y, Cb, Cr 728 - Yes 729 * - V4L2_PIX_FMT_YVU410 730 - 'YVU9' 731 - 8 732 - 4:1:0 733 - Y, Cr, Cb 734 - Yes 735 * - V4L2_PIX_FMT_YUV411P 736 - '411P' 737 - 8 738 - 4:1:1 739 - Y, Cb, Cr 740 - Yes 741 * - V4L2_PIX_FMT_YUV420M 742 - 'YM12' 743 - 8 744 - 4:2:0 745 - Y, Cb, Cr 746 - No 747 * - V4L2_PIX_FMT_YVU420M 748 - 'YM21' 749 - 8 750 - 4:2:0 751 - Y, Cr, Cb 752 - No 753 * - V4L2_PIX_FMT_YUV420 754 - 'YU12' 755 - 8 756 - 4:2:0 757 - Y, Cb, Cr 758 - Yes 759 * - V4L2_PIX_FMT_YVU420 760 - 'YV12' 761 - 8 762 - 4:2:0 763 - Y, Cr, Cb 764 - Yes 765 * - V4L2_PIX_FMT_YUV422P 766 - '422P' 767 - 8 768 - 4:2:2 769 - Y, Cb, Cr 770 - Yes 771 * - V4L2_PIX_FMT_YUV422M 772 - 'YM16' 773 - 8 774 - 4:2:2 775 - Y, Cb, Cr 776 - No 777 * - V4L2_PIX_FMT_YVU422M 778 - 'YM61' 779 - 8 780 - 4:2:2 781 - Y, Cr, Cb 782 - No 783 * - V4L2_PIX_FMT_YUV444M 784 - 'YM24' 785 - 8 786 - 4:4:4 787 - Y, Cb, Cr 788 - No 789 * - V4L2_PIX_FMT_YVU444M 790 - 'YM42' 791 - 8 792 - 4:4:4 793 - Y, Cr, Cb 794 - No 795 796.. raw:: latex 797 798 \normalsize 799 800.. [4] Order of luma and chroma planes 801.. [5] Indicates if planes have to be contiguous in memory or can be 802 disjoint 803 804 805**Color Sample Location:** 806Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` 807horizontally. 808 809.. _V4L2-PIX-FMT-YUV410: 810.. _V4L2-PIX-FMT-YVU410: 811 812YUV410 and YVU410 813----------------- 814 815Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each 816direction. Chroma lines contain a quarter of the number of pixels and bytes of 817the luma lines, and the chroma planes contain a quarter of the number of lines 818of the luma plane. 819 820.. flat-table:: Sample 4x4 YUV410 Image 821 :header-rows: 0 822 :stub-columns: 0 823 824 * - start + 0: 825 - Y'\ :sub:`00` 826 - Y'\ :sub:`01` 827 - Y'\ :sub:`02` 828 - Y'\ :sub:`03` 829 * - start + 4: 830 - Y'\ :sub:`10` 831 - Y'\ :sub:`11` 832 - Y'\ :sub:`12` 833 - Y'\ :sub:`13` 834 * - start + 8: 835 - Y'\ :sub:`20` 836 - Y'\ :sub:`21` 837 - Y'\ :sub:`22` 838 - Y'\ :sub:`23` 839 * - start + 12: 840 - Y'\ :sub:`30` 841 - Y'\ :sub:`31` 842 - Y'\ :sub:`32` 843 - Y'\ :sub:`33` 844 * - start + 16: 845 - Cr\ :sub:`00` 846 * - start + 17: 847 - Cb\ :sub:`00` 848 849 850.. _V4L2-PIX-FMT-YUV411P: 851 852YUV411P 853------- 854 855Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the 856horizontal direction. Chroma lines contain a quarter of the number of pixels 857and bytes of the luma lines, and the chroma planes contain the same number of 858lines as the luma plane. 859 860.. flat-table:: Sample 4x4 YUV411P Image 861 :header-rows: 0 862 :stub-columns: 0 863 864 * - start + 0: 865 - Y'\ :sub:`00` 866 - Y'\ :sub:`01` 867 - Y'\ :sub:`02` 868 - Y'\ :sub:`03` 869 * - start + 4: 870 - Y'\ :sub:`10` 871 - Y'\ :sub:`11` 872 - Y'\ :sub:`12` 873 - Y'\ :sub:`13` 874 * - start + 8: 875 - Y'\ :sub:`20` 876 - Y'\ :sub:`21` 877 - Y'\ :sub:`22` 878 - Y'\ :sub:`23` 879 * - start + 12: 880 - Y'\ :sub:`30` 881 - Y'\ :sub:`31` 882 - Y'\ :sub:`32` 883 - Y'\ :sub:`33` 884 * - start + 16: 885 - Cb\ :sub:`00` 886 * - start + 17: 887 - Cb\ :sub:`10` 888 * - start + 18: 889 - Cb\ :sub:`20` 890 * - start + 19: 891 - Cb\ :sub:`30` 892 * - start + 20: 893 - Cr\ :sub:`00` 894 * - start + 21: 895 - Cr\ :sub:`10` 896 * - start + 22: 897 - Cr\ :sub:`20` 898 * - start + 23: 899 - Cr\ :sub:`30` 900 901 902.. _V4L2-PIX-FMT-YUV420: 903.. _V4L2-PIX-FMT-YVU420: 904.. _V4L2-PIX-FMT-YUV420M: 905.. _V4L2-PIX-FMT-YVU420M: 906 907YUV420, YVU420, YUV420M and YVU420M 908----------------------------------- 909 910Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each 911direction. Chroma lines contain half of the number of pixels and bytes of the 912luma lines, and the chroma planes contain half of the number of lines of the 913luma plane. 914 915.. flat-table:: Sample 4x4 YUV420 Image 916 :header-rows: 0 917 :stub-columns: 0 918 919 * - start + 0: 920 - Y'\ :sub:`00` 921 - Y'\ :sub:`01` 922 - Y'\ :sub:`02` 923 - Y'\ :sub:`03` 924 * - start + 4: 925 - Y'\ :sub:`10` 926 - Y'\ :sub:`11` 927 - Y'\ :sub:`12` 928 - Y'\ :sub:`13` 929 * - start + 8: 930 - Y'\ :sub:`20` 931 - Y'\ :sub:`21` 932 - Y'\ :sub:`22` 933 - Y'\ :sub:`23` 934 * - start + 12: 935 - Y'\ :sub:`30` 936 - Y'\ :sub:`31` 937 - Y'\ :sub:`32` 938 - Y'\ :sub:`33` 939 * - start + 16: 940 - Cr\ :sub:`00` 941 - Cr\ :sub:`01` 942 * - start + 18: 943 - Cr\ :sub:`10` 944 - Cr\ :sub:`11` 945 * - start + 20: 946 - Cb\ :sub:`00` 947 - Cb\ :sub:`01` 948 * - start + 22: 949 - Cb\ :sub:`10` 950 - Cb\ :sub:`11` 951 952.. flat-table:: Sample 4x4 YUV420M Image 953 :header-rows: 0 954 :stub-columns: 0 955 956 * - start0 + 0: 957 - Y'\ :sub:`00` 958 - Y'\ :sub:`01` 959 - Y'\ :sub:`02` 960 - Y'\ :sub:`03` 961 * - start0 + 4: 962 - Y'\ :sub:`10` 963 - Y'\ :sub:`11` 964 - Y'\ :sub:`12` 965 - Y'\ :sub:`13` 966 * - start0 + 8: 967 - Y'\ :sub:`20` 968 - Y'\ :sub:`21` 969 - Y'\ :sub:`22` 970 - Y'\ :sub:`23` 971 * - start0 + 12: 972 - Y'\ :sub:`30` 973 - Y'\ :sub:`31` 974 - Y'\ :sub:`32` 975 - Y'\ :sub:`33` 976 * - 977 * - start1 + 0: 978 - Cb\ :sub:`00` 979 - Cb\ :sub:`01` 980 * - start1 + 2: 981 - Cb\ :sub:`10` 982 - Cb\ :sub:`11` 983 * - 984 * - start2 + 0: 985 - Cr\ :sub:`00` 986 - Cr\ :sub:`01` 987 * - start2 + 2: 988 - Cr\ :sub:`10` 989 - Cr\ :sub:`11` 990 991 992.. _V4L2-PIX-FMT-YUV422P: 993.. _V4L2-PIX-FMT-YUV422M: 994.. _V4L2-PIX-FMT-YVU422M: 995 996YUV422P, YUV422M and YVU422M 997---------------------------- 998 999Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the 1000horizontal direction. Chroma lines contain half of the number of pixels and 1001bytes of the luma lines, and the chroma planes contain the same number of lines 1002as the luma plane. 1003 1004.. flat-table:: Sample 4x4 YUV422P Image 1005 :header-rows: 0 1006 :stub-columns: 0 1007 1008 * - start + 0: 1009 - Y'\ :sub:`00` 1010 - Y'\ :sub:`01` 1011 - Y'\ :sub:`02` 1012 - Y'\ :sub:`03` 1013 * - start + 4: 1014 - Y'\ :sub:`10` 1015 - Y'\ :sub:`11` 1016 - Y'\ :sub:`12` 1017 - Y'\ :sub:`13` 1018 * - start + 8: 1019 - Y'\ :sub:`20` 1020 - Y'\ :sub:`21` 1021 - Y'\ :sub:`22` 1022 - Y'\ :sub:`23` 1023 * - start + 12: 1024 - Y'\ :sub:`30` 1025 - Y'\ :sub:`31` 1026 - Y'\ :sub:`32` 1027 - Y'\ :sub:`33` 1028 * - start + 16: 1029 - Cb\ :sub:`00` 1030 - Cb\ :sub:`01` 1031 * - start + 18: 1032 - Cb\ :sub:`10` 1033 - Cb\ :sub:`11` 1034 * - start + 20: 1035 - Cb\ :sub:`20` 1036 - Cb\ :sub:`21` 1037 * - start + 22: 1038 - Cb\ :sub:`30` 1039 - Cb\ :sub:`31` 1040 * - start + 24: 1041 - Cr\ :sub:`00` 1042 - Cr\ :sub:`01` 1043 * - start + 26: 1044 - Cr\ :sub:`10` 1045 - Cr\ :sub:`11` 1046 * - start + 28: 1047 - Cr\ :sub:`20` 1048 - Cr\ :sub:`21` 1049 * - start + 30: 1050 - Cr\ :sub:`30` 1051 - Cr\ :sub:`31` 1052 1053.. flat-table:: Sample 4x4 YUV422M Image 1054 :header-rows: 0 1055 :stub-columns: 0 1056 1057 * - start0 + 0: 1058 - Y'\ :sub:`00` 1059 - Y'\ :sub:`01` 1060 - Y'\ :sub:`02` 1061 - Y'\ :sub:`03` 1062 * - start0 + 4: 1063 - Y'\ :sub:`10` 1064 - Y'\ :sub:`11` 1065 - Y'\ :sub:`12` 1066 - Y'\ :sub:`13` 1067 * - start0 + 8: 1068 - Y'\ :sub:`20` 1069 - Y'\ :sub:`21` 1070 - Y'\ :sub:`22` 1071 - Y'\ :sub:`23` 1072 * - start0 + 12: 1073 - Y'\ :sub:`30` 1074 - Y'\ :sub:`31` 1075 - Y'\ :sub:`32` 1076 - Y'\ :sub:`33` 1077 * - 1078 * - start1 + 0: 1079 - Cb\ :sub:`00` 1080 - Cb\ :sub:`01` 1081 * - start1 + 2: 1082 - Cb\ :sub:`10` 1083 - Cb\ :sub:`11` 1084 * - start1 + 4: 1085 - Cb\ :sub:`20` 1086 - Cb\ :sub:`21` 1087 * - start1 + 6: 1088 - Cb\ :sub:`30` 1089 - Cb\ :sub:`31` 1090 * - 1091 * - start2 + 0: 1092 - Cr\ :sub:`00` 1093 - Cr\ :sub:`01` 1094 * - start2 + 2: 1095 - Cr\ :sub:`10` 1096 - Cr\ :sub:`11` 1097 * - start2 + 4: 1098 - Cr\ :sub:`20` 1099 - Cr\ :sub:`21` 1100 * - start2 + 6: 1101 - Cr\ :sub:`30` 1102 - Cr\ :sub:`31` 1103 1104 1105.. _V4L2-PIX-FMT-YUV444M: 1106.. _V4L2-PIX-FMT-YVU444M: 1107 1108YUV444M and YVU444M 1109------------------- 1110 1111Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines 1112contain the same number of pixels and bytes of the luma lines, and the chroma 1113planes contain the same number of lines as the luma plane. 1114 1115.. flat-table:: Sample 4x4 YUV444M Image 1116 :header-rows: 0 1117 :stub-columns: 0 1118 1119 * - start0 + 0: 1120 - Y'\ :sub:`00` 1121 - Y'\ :sub:`01` 1122 - Y'\ :sub:`02` 1123 - Y'\ :sub:`03` 1124 * - start0 + 4: 1125 - Y'\ :sub:`10` 1126 - Y'\ :sub:`11` 1127 - Y'\ :sub:`12` 1128 - Y'\ :sub:`13` 1129 * - start0 + 8: 1130 - Y'\ :sub:`20` 1131 - Y'\ :sub:`21` 1132 - Y'\ :sub:`22` 1133 - Y'\ :sub:`23` 1134 * - start0 + 12: 1135 - Y'\ :sub:`30` 1136 - Y'\ :sub:`31` 1137 - Y'\ :sub:`32` 1138 - Y'\ :sub:`33` 1139 * - 1140 * - start1 + 0: 1141 - Cb\ :sub:`00` 1142 - Cb\ :sub:`01` 1143 - Cb\ :sub:`02` 1144 - Cb\ :sub:`03` 1145 * - start1 + 4: 1146 - Cb\ :sub:`10` 1147 - Cb\ :sub:`11` 1148 - Cb\ :sub:`12` 1149 - Cb\ :sub:`13` 1150 * - start1 + 8: 1151 - Cb\ :sub:`20` 1152 - Cb\ :sub:`21` 1153 - Cb\ :sub:`22` 1154 - Cb\ :sub:`23` 1155 * - start1 + 12: 1156 - Cb\ :sub:`20` 1157 - Cb\ :sub:`21` 1158 - Cb\ :sub:`32` 1159 - Cb\ :sub:`33` 1160 * - 1161 * - start2 + 0: 1162 - Cr\ :sub:`00` 1163 - Cr\ :sub:`01` 1164 - Cr\ :sub:`02` 1165 - Cr\ :sub:`03` 1166 * - start2 + 4: 1167 - Cr\ :sub:`10` 1168 - Cr\ :sub:`11` 1169 - Cr\ :sub:`12` 1170 - Cr\ :sub:`13` 1171 * - start2 + 8: 1172 - Cr\ :sub:`20` 1173 - Cr\ :sub:`21` 1174 - Cr\ :sub:`22` 1175 - Cr\ :sub:`23` 1176 * - start2 + 12: 1177 - Cr\ :sub:`30` 1178 - Cr\ :sub:`31` 1179 - Cr\ :sub:`32` 1180 - Cr\ :sub:`33` 1181