0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002
0003 .. _packed-yuv:
0004
0005 ******************
0006 Packed YUV formats
0007 ******************
0008
0009 Similarly to the packed RGB formats, the packed YUV formats store the Y, Cb and
0010 Cr components consecutively in memory. They may apply subsampling to the chroma
0011 components and thus differ in how they interlave the three components.
0012
0013 .. note::
0014
0015 - In all the tables that follow, bit 7 is the most significant bit in a byte.
0016 - 'Y', 'Cb' and 'Cr' denote bits of the luma, blue chroma (also known as
0017 'U') and red chroma (also known as 'V') components respectively. 'A'
0018 denotes bits of the alpha component (if supported by the format), and 'X'
0019 denotes padding bits.
0020
0021
0022 4:4:4 Subsampling
0023 =================
0024
0025 These formats do not subsample the chroma components and store each pixels as a
0026 full triplet of Y, Cb and Cr values.
0027
0028 The next table lists the packed YUV 4:4:4 formats with less than 8 bits per
0029 component. They are named based on the order of the Y, Cb and Cr components as
0030 seen in a 16-bit word, which is then stored in memory in little endian byte
0031 order, and on the number of bits for each component. For instance the YUV565
0032 format stores a pixel in a 16-bit word [15:0] laid out at as [Y'\ :sub:`4-0`
0033 Cb\ :sub:`5-0` Cr\ :sub:`4-0`], and stored in memory in two bytes,
0034 [Cb\ :sub:`2-0` Cr\ :sub:`4-0`] followed by [Y'\ :sub:`4-0` Cb\ :sub:`5-3`].
0035
0036 .. raw:: latex
0037
0038 \begingroup
0039 \scriptsize
0040 \setlength{\tabcolsep}{2pt}
0041
0042 .. 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}|
0043
0044 .. flat-table:: Packed YUV 4:4:4 Image Formats (less than 8bpc)
0045 :header-rows: 2
0046 :stub-columns: 0
0047
0048 * - Identifier
0049 - Code
0050
0051 - :cspan:`7` Byte 0 in memory
0052
0053 - :cspan:`7` Byte 1
0054
0055 * -
0056 -
0057 - 7
0058 - 6
0059 - 5
0060 - 4
0061 - 3
0062 - 2
0063 - 1
0064 - 0
0065
0066 - 7
0067 - 6
0068 - 5
0069 - 4
0070 - 3
0071 - 2
0072 - 1
0073 - 0
0074
0075 * .. _V4L2-PIX-FMT-YUV444:
0076
0077 - ``V4L2_PIX_FMT_YUV444``
0078 - 'Y444'
0079
0080 - Cb\ :sub:`3`
0081 - Cb\ :sub:`2`
0082 - Cb\ :sub:`1`
0083 - Cb\ :sub:`0`
0084 - Cr\ :sub:`3`
0085 - Cr\ :sub:`2`
0086 - Cr\ :sub:`1`
0087 - Cr\ :sub:`0`
0088
0089 - a\ :sub:`3`
0090 - a\ :sub:`2`
0091 - a\ :sub:`1`
0092 - a\ :sub:`0`
0093 - Y'\ :sub:`3`
0094 - Y'\ :sub:`2`
0095 - Y'\ :sub:`1`
0096 - Y'\ :sub:`0`
0097
0098 * .. _V4L2-PIX-FMT-YUV555:
0099
0100 - ``V4L2_PIX_FMT_YUV555``
0101 - 'YUVO'
0102
0103 - Cb\ :sub:`2`
0104 - Cb\ :sub:`1`
0105 - Cb\ :sub:`0`
0106 - Cr\ :sub:`4`
0107 - Cr\ :sub:`3`
0108 - Cr\ :sub:`2`
0109 - Cr\ :sub:`1`
0110 - Cr\ :sub:`0`
0111
0112 - a
0113 - Y'\ :sub:`4`
0114 - Y'\ :sub:`3`
0115 - Y'\ :sub:`2`
0116 - Y'\ :sub:`1`
0117 - Y'\ :sub:`0`
0118 - Cb\ :sub:`4`
0119 - Cb\ :sub:`3`
0120
0121 * .. _V4L2-PIX-FMT-YUV565:
0122
0123 - ``V4L2_PIX_FMT_YUV565``
0124 - 'YUVP'
0125
0126 - Cb\ :sub:`2`
0127 - Cb\ :sub:`1`
0128 - Cb\ :sub:`0`
0129 - Cr\ :sub:`4`
0130 - Cr\ :sub:`3`
0131 - Cr\ :sub:`2`
0132 - Cr\ :sub:`1`
0133 - Cr\ :sub:`0`
0134
0135 - Y'\ :sub:`4`
0136 - Y'\ :sub:`3`
0137 - Y'\ :sub:`2`
0138 - Y'\ :sub:`1`
0139 - Y'\ :sub:`0`
0140 - Cb\ :sub:`5`
0141 - Cb\ :sub:`4`
0142 - Cb\ :sub:`3`
0143
0144 .. raw:: latex
0145
0146 \endgroup
0147
0148 .. note::
0149
0150 For the YUV444 and YUV555 formats, the value of alpha bits is undefined
0151 when reading from the driver, ignored when writing to the driver, except
0152 when alpha blending has been negotiated for a :ref:`Video Overlay
0153 <overlay>` or :ref:`Video Output Overlay <osd>`.
0154
0155
0156 The next table lists the packed YUV 4:4:4 formats with 8 bits per component.
0157 They are named based on the order of the Y, Cb and Cr components as stored in
0158 memory, and on the total number of bits per pixel. For instance, the VUYX32
0159 format stores a pixel with Cr\ :sub:`7-0` in the first byte, Cb\ :sub:`7-0` in
0160 the second byte and Y'\ :sub:`7-0` in the third byte.
0161
0162 .. flat-table:: Packed YUV Image Formats (8bpc)
0163 :header-rows: 1
0164 :stub-columns: 0
0165
0166 * - Identifier
0167 - Code
0168 - Byte 0
0169 - Byte 1
0170 - Byte 2
0171 - Byte 3
0172
0173 * .. _V4L2-PIX-FMT-YUV32:
0174
0175 - ``V4L2_PIX_FMT_YUV32``
0176 - 'YUV4'
0177
0178 - A\ :sub:`7-0`
0179 - Y'\ :sub:`7-0`
0180 - Cb\ :sub:`7-0`
0181 - Cr\ :sub:`7-0`
0182
0183 * .. _V4L2-PIX-FMT-AYUV32:
0184
0185 - ``V4L2_PIX_FMT_AYUV32``
0186 - 'AYUV'
0187
0188 - A\ :sub:`7-0`
0189 - Y'\ :sub:`7-0`
0190 - Cb\ :sub:`7-0`
0191 - Cr\ :sub:`7-0`
0192
0193 * .. _V4L2-PIX-FMT-XYUV32:
0194
0195 - ``V4L2_PIX_FMT_XYUV32``
0196 - 'XYUV'
0197
0198 - X\ :sub:`7-0`
0199 - Y'\ :sub:`7-0`
0200 - Cb\ :sub:`7-0`
0201 - Cr\ :sub:`7-0`
0202
0203 * .. _V4L2-PIX-FMT-VUYA32:
0204
0205 - ``V4L2_PIX_FMT_VUYA32``
0206 - 'VUYA'
0207
0208 - Cr\ :sub:`7-0`
0209 - Cb\ :sub:`7-0`
0210 - Y'\ :sub:`7-0`
0211 - A\ :sub:`7-0`
0212
0213 * .. _V4L2-PIX-FMT-VUYX32:
0214
0215 - ``V4L2_PIX_FMT_VUYX32``
0216 - 'VUYX'
0217
0218 - Cr\ :sub:`7-0`
0219 - Cb\ :sub:`7-0`
0220 - Y'\ :sub:`7-0`
0221 - X\ :sub:`7-0`
0222
0223 * .. _V4L2-PIX-FMT-YUVA32:
0224
0225 - ``V4L2_PIX_FMT_YUVA32``
0226 - 'YUVA'
0227
0228 - Y'\ :sub:`7-0`
0229 - Cb\ :sub:`7-0`
0230 - Cr\ :sub:`7-0`
0231 - A\ :sub:`7-0`
0232
0233 * .. _V4L2-PIX-FMT-YUVX32:
0234
0235 - ``V4L2_PIX_FMT_YUVX32``
0236 - 'YUVX'
0237
0238 - Y'\ :sub:`7-0`
0239 - Cb\ :sub:`7-0`
0240 - Cr\ :sub:`7-0`
0241 - X\ :sub:`7-0`
0242
0243 * .. _V4L2-PIX-FMT-YUV24:
0244
0245 - ``V4L2_PIX_FMT_YUV24``
0246 - 'YUV3'
0247
0248 - Y'\ :sub:`7-0`
0249 - Cb\ :sub:`7-0`
0250 - Cr\ :sub:`7-0`
0251 - -\
0252
0253 .. note::
0254
0255 - The alpha component is expected to contain a meaningful value that can be
0256 used by drivers and applications.
0257 - The padding bits contain undefined values that must be ignored by all
0258 applications and drivers.
0259
0260
0261 4:2:2 Subsampling
0262 =================
0263
0264 These formats, commonly referred to as YUYV or YUY2, subsample the chroma
0265 components horizontally by 2, storing 2 pixels in 4 bytes.
0266
0267 .. raw:: latex
0268
0269 \footnotesize
0270
0271 .. 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}|
0272
0273 .. flat-table:: Packed YUV 4:2:2 Formats
0274 :header-rows: 1
0275 :stub-columns: 0
0276
0277 * - Identifier
0278 - Code
0279 - Byte 0
0280 - Byte 1
0281 - Byte 2
0282 - Byte 3
0283 - Byte 4
0284 - Byte 5
0285 - Byte 6
0286 - Byte 7
0287 * .. _V4L2-PIX-FMT-UYVY:
0288
0289 - ``V4L2_PIX_FMT_UYVY``
0290 - 'UYVY'
0291
0292 - Cb\ :sub:`0`
0293 - Y'\ :sub:`0`
0294 - Cr\ :sub:`0`
0295 - Y'\ :sub:`1`
0296 - Cb\ :sub:`2`
0297 - Y'\ :sub:`2`
0298 - Cr\ :sub:`2`
0299 - Y'\ :sub:`3`
0300 * .. _V4L2-PIX-FMT-VYUY:
0301
0302 - ``V4L2_PIX_FMT_VYUY``
0303 - 'VYUY'
0304
0305 - Cr\ :sub:`0`
0306 - Y'\ :sub:`0`
0307 - Cb\ :sub:`0`
0308 - Y'\ :sub:`1`
0309 - Cr\ :sub:`2`
0310 - Y'\ :sub:`2`
0311 - Cb\ :sub:`2`
0312 - Y'\ :sub:`3`
0313 * .. _V4L2-PIX-FMT-YUYV:
0314
0315 - ``V4L2_PIX_FMT_YUYV``
0316 - 'YUYV'
0317
0318 - Y'\ :sub:`0`
0319 - Cb\ :sub:`0`
0320 - Y'\ :sub:`1`
0321 - Cr\ :sub:`0`
0322 - Y'\ :sub:`2`
0323 - Cb\ :sub:`2`
0324 - Y'\ :sub:`3`
0325 - Cr\ :sub:`2`
0326 * .. _V4L2-PIX-FMT-YVYU:
0327
0328 - ``V4L2_PIX_FMT_YVYU``
0329 - 'YVYU'
0330
0331 - Y'\ :sub:`0`
0332 - Cr\ :sub:`0`
0333 - Y'\ :sub:`1`
0334 - Cb\ :sub:`0`
0335 - Y'\ :sub:`2`
0336 - Cr\ :sub:`2`
0337 - Y'\ :sub:`3`
0338 - Cb\ :sub:`2`
0339
0340 .. raw:: latex
0341
0342 \normalsize
0343
0344 **Color Sample Location:**
0345 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
0346 horizontally.
0347
0348
0349 4:1:1 Subsampling
0350 =================
0351
0352 This format subsamples the chroma components horizontally by 4, storing 8
0353 pixels in 12 bytes.
0354
0355 .. raw:: latex
0356
0357 \scriptsize
0358
0359 .. 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}|
0360
0361 .. flat-table:: Packed YUV 4:1:1 Formats
0362 :header-rows: 1
0363 :stub-columns: 0
0364
0365 * - Identifier
0366 - Code
0367 - Byte 0
0368 - Byte 1
0369 - Byte 2
0370 - Byte 3
0371 - Byte 4
0372 - Byte 5
0373 - Byte 6
0374 - Byte 7
0375 - Byte 8
0376 - Byte 9
0377 - Byte 10
0378 - Byte 11
0379 * .. _V4L2-PIX-FMT-Y41P:
0380
0381 - ``V4L2_PIX_FMT_Y41P``
0382 - 'Y41P'
0383
0384 - Cb\ :sub:`0`
0385 - Y'\ :sub:`0`
0386 - Cr\ :sub:`0`
0387 - Y'\ :sub:`1`
0388 - Cb\ :sub:`4`
0389 - Y'\ :sub:`2`
0390 - Cr\ :sub:`4`
0391 - Y'\ :sub:`3`
0392 - Y'\ :sub:`4`
0393 - Y'\ :sub:`5`
0394 - Y'\ :sub:`6`
0395 - Y'\ :sub:`7`
0396
0397 .. raw:: latex
0398
0399 \normalsize
0400
0401 .. note::
0402
0403 Do not confuse ``V4L2_PIX_FMT_Y41P`` with
0404 :ref:`V4L2_PIX_FMT_YUV411P <V4L2-PIX-FMT-YUV411P>`. Y41P is derived from
0405 "YUV 4:1:1 **packed**", while YUV411P stands for "YUV 4:1:1 **planar**".
0406
0407 **Color Sample Location:**
0408 Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
0409 horizontally.