brintos

brintos / linux-shallow public Read only

0
0
Text · 10.4 KiB · 9f111ed Raw
483 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2 3.. _packed-yuv:4 5******************6Packed YUV formats7******************8 9Similarly to the packed RGB formats, the packed YUV formats store the Y, Cb and10Cr components consecutively in memory. They may apply subsampling to the chroma11components and thus differ in how they interlave the three components.12 13.. note::14 15   - In all the tables that follow, bit 7 is the most significant bit in a byte.16   - 'Y', 'Cb' and 'Cr' denote bits of the luma, blue chroma (also known as17     'U') and red chroma (also known as 'V') components respectively. 'A'18     denotes bits of the alpha component (if supported by the format), and 'X'19     denotes padding bits.20 21 224:4:4 Subsampling23=================24 25These formats do not subsample the chroma components and store each pixels as a26full triplet of Y, Cb and Cr values.27 28The next table lists the packed YUV 4:4:4 formats with less than 8 bits per29component. They are named based on the order of the Y, Cb and Cr components as30seen in a 16-bit word, which is then stored in memory in little endian byte31order, and on the number of bits for each component. For instance the YUV56532format stores a pixel in a 16-bit word [15:0] laid out at as [Y'\ :sub:`4-0`33Cb\ :sub:`5-0` Cr\ :sub:`4-0`], and stored in memory in two bytes,34[Cb\ :sub:`2-0` Cr\ :sub:`4-0`] followed by [Y'\ :sub:`4-0` Cb\ :sub:`5-3`].35 36.. raw:: latex37 38    \begingroup39    \scriptsize40    \setlength{\tabcolsep}{2pt}41 42.. tabularcolumns:: |p{3.5cm}|p{0.96cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|p{0.52cm}|43 44.. flat-table:: Packed YUV 4:4:4 Image Formats (less than 8bpc)45    :header-rows:  246    :stub-columns: 047 48    * - Identifier49      - Code50 51      - :cspan:`7` Byte 0 in memory52 53      - :cspan:`7` Byte 154 55    * -56      -57      - 758      - 659      - 560      - 461      - 362      - 263      - 164      - 065 66      - 767      - 668      - 569      - 470      - 371      - 272      - 173      - 074 75    * .. _V4L2-PIX-FMT-YUV444:76 77      - ``V4L2_PIX_FMT_YUV444``78      - 'Y444'79 80      - Cb\ :sub:`3`81      - Cb\ :sub:`2`82      - Cb\ :sub:`1`83      - Cb\ :sub:`0`84      - Cr\ :sub:`3`85      - Cr\ :sub:`2`86      - Cr\ :sub:`1`87      - Cr\ :sub:`0`88 89      - a\ :sub:`3`90      - a\ :sub:`2`91      - a\ :sub:`1`92      - a\ :sub:`0`93      - Y'\ :sub:`3`94      - Y'\ :sub:`2`95      - Y'\ :sub:`1`96      - Y'\ :sub:`0`97 98    * .. _V4L2-PIX-FMT-YUV555:99 100      - ``V4L2_PIX_FMT_YUV555``101      - 'YUVO'102 103      - Cb\ :sub:`2`104      - Cb\ :sub:`1`105      - Cb\ :sub:`0`106      - Cr\ :sub:`4`107      - Cr\ :sub:`3`108      - Cr\ :sub:`2`109      - Cr\ :sub:`1`110      - Cr\ :sub:`0`111 112      - a113      - Y'\ :sub:`4`114      - Y'\ :sub:`3`115      - Y'\ :sub:`2`116      - Y'\ :sub:`1`117      - Y'\ :sub:`0`118      - Cb\ :sub:`4`119      - Cb\ :sub:`3`120 121    * .. _V4L2-PIX-FMT-YUV565:122 123      - ``V4L2_PIX_FMT_YUV565``124      - 'YUVP'125 126      - Cb\ :sub:`2`127      - Cb\ :sub:`1`128      - Cb\ :sub:`0`129      - Cr\ :sub:`4`130      - Cr\ :sub:`3`131      - Cr\ :sub:`2`132      - Cr\ :sub:`1`133      - Cr\ :sub:`0`134 135      - Y'\ :sub:`4`136      - Y'\ :sub:`3`137      - Y'\ :sub:`2`138      - Y'\ :sub:`1`139      - Y'\ :sub:`0`140      - Cb\ :sub:`5`141      - Cb\ :sub:`4`142      - Cb\ :sub:`3`143 144.. raw:: latex145 146    \endgroup147 148.. note::149 150    For the YUV444 and YUV555 formats, the value of alpha bits is undefined151    when reading from the driver, ignored when writing to the driver, except152    when alpha blending has been negotiated for a :ref:`Video Overlay153    <overlay>` or :ref:`Video Output Overlay <osd>`.154 155 156The next table lists the packed YUV 4:4:4 formats with 8 bits per component.157They are named based on the order of the Y, Cb and Cr components as stored in158memory, and on the total number of bits per pixel. For instance, the VUYX32159format stores a pixel with Cr\ :sub:`7-0` in the first byte, Cb\ :sub:`7-0` in160the second byte and Y'\ :sub:`7-0` in the third byte.161 162.. flat-table:: Packed YUV Image Formats (8bpc)163    :header-rows: 1164    :stub-columns: 0165 166    * - Identifier167      - Code168      - Byte 0169      - Byte 1170      - Byte 2171      - Byte 3172 173    * .. _V4L2-PIX-FMT-YUV32:174 175      - ``V4L2_PIX_FMT_YUV32``176      - 'YUV4'177 178      - A\ :sub:`7-0`179      - Y'\ :sub:`7-0`180      - Cb\ :sub:`7-0`181      - Cr\ :sub:`7-0`182 183    * .. _V4L2-PIX-FMT-AYUV32:184 185      - ``V4L2_PIX_FMT_AYUV32``186      - 'AYUV'187 188      - A\ :sub:`7-0`189      - Y'\ :sub:`7-0`190      - Cb\ :sub:`7-0`191      - Cr\ :sub:`7-0`192 193    * .. _V4L2-PIX-FMT-XYUV32:194 195      - ``V4L2_PIX_FMT_XYUV32``196      - 'XYUV'197 198      - X\ :sub:`7-0`199      - Y'\ :sub:`7-0`200      - Cb\ :sub:`7-0`201      - Cr\ :sub:`7-0`202 203    * .. _V4L2-PIX-FMT-VUYA32:204 205      - ``V4L2_PIX_FMT_VUYA32``206      - 'VUYA'207 208      - Cr\ :sub:`7-0`209      - Cb\ :sub:`7-0`210      - Y'\ :sub:`7-0`211      - A\ :sub:`7-0`212 213    * .. _V4L2-PIX-FMT-VUYX32:214 215      - ``V4L2_PIX_FMT_VUYX32``216      - 'VUYX'217 218      - Cr\ :sub:`7-0`219      - Cb\ :sub:`7-0`220      - Y'\ :sub:`7-0`221      - X\ :sub:`7-0`222 223    * .. _V4L2-PIX-FMT-YUVA32:224 225      - ``V4L2_PIX_FMT_YUVA32``226      - 'YUVA'227 228      - Y'\ :sub:`7-0`229      - Cb\ :sub:`7-0`230      - Cr\ :sub:`7-0`231      - A\ :sub:`7-0`232 233    * .. _V4L2-PIX-FMT-YUVX32:234 235      - ``V4L2_PIX_FMT_YUVX32``236      - 'YUVX'237 238      - Y'\ :sub:`7-0`239      - Cb\ :sub:`7-0`240      - Cr\ :sub:`7-0`241      - X\ :sub:`7-0`242 243    * .. _V4L2-PIX-FMT-YUV24:244 245      - ``V4L2_PIX_FMT_YUV24``246      - 'YUV3'247 248      - Y'\ :sub:`7-0`249      - Cb\ :sub:`7-0`250      - Cr\ :sub:`7-0`251      - -\252 253.. note::254 255    - The alpha component is expected to contain a meaningful value that can be256      used by drivers and applications.257    - The padding bits contain undefined values that must be ignored by all258      applications and drivers.259 260The next table lists the packed YUV 4:4:4 formats with 12 bits per component.261Expand the bits per component to 16 bits, data in the high bits, zeros in the low bits,262arranged in little endian order, storing 1 pixel in 6 bytes.263 264.. flat-table:: Packed YUV 4:4:4 Image Formats (12bpc)265    :header-rows: 1266    :stub-columns: 0267 268    * - Identifier269      - Code270      - Byte 1-0271      - Byte 3-2272      - Byte 5-4273      - Byte 7-6274      - Byte 9-8275      - Byte 11-10276 277    * .. _V4L2-PIX-FMT-YUV48-12:278 279      - ``V4L2_PIX_FMT_YUV48_12``280      - 'Y312'281 282      - Y'\ :sub:`0`283      - Cb\ :sub:`0`284      - Cr\ :sub:`0`285      - Y'\ :sub:`1`286      - Cb\ :sub:`1`287      - Cr\ :sub:`1`288 2894:2:2 Subsampling290=================291 292These formats, commonly referred to as YUYV or YUY2, subsample the chroma293components horizontally by 2, storing 2 pixels in a container. The container294is 32-bits for 8-bit formats, and 64-bits for 10+-bit formats.295 296The packed YUYV formats with more than 8 bits per component are stored as four29716-bit little-endian words. Each word's most significant bits contain one298component, and the least significant bits are zero padding.299 300.. raw:: latex301 302    \footnotesize303 304.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|305 306.. flat-table:: Packed YUV 4:2:2 Formats in 32-bit container307    :header-rows: 1308    :stub-columns: 0309 310    * - Identifier311      - Code312      - Byte 0313      - Byte 1314      - Byte 2315      - Byte 3316      - Byte 4317      - Byte 5318      - Byte 6319      - Byte 7320    * .. _V4L2-PIX-FMT-UYVY:321 322      - ``V4L2_PIX_FMT_UYVY``323      - 'UYVY'324 325      - Cb\ :sub:`0`326      - Y'\ :sub:`0`327      - Cr\ :sub:`0`328      - Y'\ :sub:`1`329      - Cb\ :sub:`2`330      - Y'\ :sub:`2`331      - Cr\ :sub:`2`332      - Y'\ :sub:`3`333    * .. _V4L2-PIX-FMT-VYUY:334 335      - ``V4L2_PIX_FMT_VYUY``336      - 'VYUY'337 338      - Cr\ :sub:`0`339      - Y'\ :sub:`0`340      - Cb\ :sub:`0`341      - Y'\ :sub:`1`342      - Cr\ :sub:`2`343      - Y'\ :sub:`2`344      - Cb\ :sub:`2`345      - Y'\ :sub:`3`346    * .. _V4L2-PIX-FMT-YUYV:347 348      - ``V4L2_PIX_FMT_YUYV``349      - 'YUYV'350 351      - Y'\ :sub:`0`352      - Cb\ :sub:`0`353      - Y'\ :sub:`1`354      - Cr\ :sub:`0`355      - Y'\ :sub:`2`356      - Cb\ :sub:`2`357      - Y'\ :sub:`3`358      - Cr\ :sub:`2`359    * .. _V4L2-PIX-FMT-YVYU:360 361      - ``V4L2_PIX_FMT_YVYU``362      - 'YVYU'363 364      - Y'\ :sub:`0`365      - Cr\ :sub:`0`366      - Y'\ :sub:`1`367      - Cb\ :sub:`0`368      - Y'\ :sub:`2`369      - Cr\ :sub:`2`370      - Y'\ :sub:`3`371      - Cb\ :sub:`2`372 373.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|374 375.. flat-table:: Packed YUV 4:2:2 Formats in 64-bit container376    :header-rows: 1377    :stub-columns: 0378 379    * - Identifier380      - Code381      - Word 0382      - Word 1383      - Word 2384      - Word 3385    * .. _V4L2-PIX-FMT-Y210:386 387      - ``V4L2_PIX_FMT_Y210``388      - 'Y210'389 390      - Y'\ :sub:`0` (bits 15-6)391      - Cb\ :sub:`0` (bits 15-6)392      - Y'\ :sub:`1` (bits 15-6)393      - Cr\ :sub:`0` (bits 15-6)394    * .. _V4L2-PIX-FMT-Y212:395 396      - ``V4L2_PIX_FMT_Y212``397      - 'Y212'398 399      - Y'\ :sub:`0` (bits 15-4)400      - Cb\ :sub:`0` (bits 15-4)401      - Y'\ :sub:`1` (bits 15-4)402      - Cr\ :sub:`0` (bits 15-4)403    * .. _V4L2-PIX-FMT-Y216:404 405      - ``V4L2_PIX_FMT_Y216``406      - 'Y216'407 408      - Y'\ :sub:`0` (bits 15-0)409      - Cb\ :sub:`0` (bits 15-0)410      - Y'\ :sub:`1` (bits 15-0)411      - Cr\ :sub:`0` (bits 15-0)412 413.. raw:: latex414 415    \normalsize416 417**Color Sample Location:**418Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`419horizontally.420 421 4224:1:1 Subsampling423=================424 425This format subsamples the chroma components horizontally by 4, storing 8426pixels in 12 bytes.427 428.. raw:: latex429 430    \scriptsize431 432.. tabularcolumns:: |p{2.9cm}|p{0.8cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|433 434.. flat-table:: Packed YUV 4:1:1 Formats435    :header-rows: 1436    :stub-columns: 0437 438    * - Identifier439      - Code440      - Byte 0441      - Byte 1442      - Byte 2443      - Byte 3444      - Byte 4445      - Byte 5446      - Byte 6447      - Byte 7448      - Byte 8449      - Byte 9450      - Byte 10451      - Byte 11452    * .. _V4L2-PIX-FMT-Y41P:453 454      - ``V4L2_PIX_FMT_Y41P``455      - 'Y41P'456 457      - Cb\ :sub:`0`458      - Y'\ :sub:`0`459      - Cr\ :sub:`0`460      - Y'\ :sub:`1`461      - Cb\ :sub:`4`462      - Y'\ :sub:`2`463      - Cr\ :sub:`4`464      - Y'\ :sub:`3`465      - Y'\ :sub:`4`466      - Y'\ :sub:`5`467      - Y'\ :sub:`6`468      - Y'\ :sub:`7`469 470.. raw:: latex471 472    \normalsize473 474.. note::475 476    Do not confuse ``V4L2_PIX_FMT_Y41P`` with477    :ref:`V4L2_PIX_FMT_YUV411P <V4L2-PIX-FMT-YUV411P>`. Y41P is derived from478    "YUV 4:1:1 **packed**", while YUV411P stands for "YUV 4:1:1 **planar**".479 480**Color Sample Location:**481Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`482horizontally.483