1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2 3.. _packed-yuv: 4 5****************** 6Packed YUV formats 7****************** 8 9Similarly to the packed RGB formats, the packed YUV formats store the Y, Cb and 10Cr components consecutively in memory. They may apply subsampling to the chroma 11components 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 as 17 '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 Subsampling 23================= 24 25These formats do not subsample the chroma components and store each pixels as a 26full triplet of Y, Cb and Cr values. 27 28The next table lists the packed YUV 4:4:4 formats with less than 8 bits per 29component. They are named based on the order of the Y, Cb and Cr components as 30seen in a 16-bit word, which is then stored in memory in little endian byte 31order, and on the number of bits for each component. For instance the YUV565 32format 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:: latex 37 38 \begingroup 39 \scriptsize 40 \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: 2 46 :stub-columns: 0 47 48 * - Identifier 49 - Code 50 51 - :cspan:`7` Byte 0 in memory 52 53 - :cspan:`7` Byte 1 54 55 * - 56 - 57 - 7 58 - 6 59 - 5 60 - 4 61 - 3 62 - 2 63 - 1 64 - 0 65 66 - 7 67 - 6 68 - 5 69 - 4 70 - 3 71 - 2 72 - 1 73 - 0 74 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 - a 113 - 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:: latex 145 146 \endgroup 147 148.. note:: 149 150 For the YUV444 and YUV555 formats, the value of alpha bits is undefined 151 when reading from the driver, ignored when writing to the driver, except 152 when alpha blending has been negotiated for a :ref:`Video Overlay 153 <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 in 158memory, and on the total number of bits per pixel. For instance, the VUYX32 159format stores a pixel with Cr\ :sub:`7-0` in the first byte, Cb\ :sub:`7-0` in 160the second byte and Y'\ :sub:`7-0` in the third byte. 161 162.. flat-table:: Packed YUV Image Formats (8bpc) 163 :header-rows: 1 164 :stub-columns: 0 165 166 * - Identifier 167 - Code 168 - Byte 0 169 - Byte 1 170 - Byte 2 171 - Byte 3 172 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 be 256 used by drivers and applications. 257 - The padding bits contain undefined values that must be ignored by all 258 applications and drivers. 259 260 2614:2:2 Subsampling 262================= 263 264These formats, commonly referred to as YUYV or YUY2, subsample the chroma 265components horizontally by 2, storing 2 pixels in a container. The container 266is 32-bits for 8-bit formats, and 64-bits for 10+-bit formats. 267 268The packed YUYV formats with more than 8 bits per component are stored as four 26916-bit little-endian words. Each word's most significant bits contain one 270component, and the least significant bits are zero padding. 271 272.. raw:: latex 273 274 \footnotesize 275 276.. 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}| 277 278.. flat-table:: Packed YUV 4:2:2 Formats in 32-bit container 279 :header-rows: 1 280 :stub-columns: 0 281 282 * - Identifier 283 - Code 284 - Byte 0 285 - Byte 1 286 - Byte 2 287 - Byte 3 288 - Byte 4 289 - Byte 5 290 - Byte 6 291 - Byte 7 292 * .. _V4L2-PIX-FMT-UYVY: 293 294 - ``V4L2_PIX_FMT_UYVY`` 295 - 'UYVY' 296 297 - Cb\ :sub:`0` 298 - Y'\ :sub:`0` 299 - Cr\ :sub:`0` 300 - Y'\ :sub:`1` 301 - Cb\ :sub:`2` 302 - Y'\ :sub:`2` 303 - Cr\ :sub:`2` 304 - Y'\ :sub:`3` 305 * .. _V4L2-PIX-FMT-VYUY: 306 307 - ``V4L2_PIX_FMT_VYUY`` 308 - 'VYUY' 309 310 - Cr\ :sub:`0` 311 - Y'\ :sub:`0` 312 - Cb\ :sub:`0` 313 - Y'\ :sub:`1` 314 - Cr\ :sub:`2` 315 - Y'\ :sub:`2` 316 - Cb\ :sub:`2` 317 - Y'\ :sub:`3` 318 * .. _V4L2-PIX-FMT-YUYV: 319 320 - ``V4L2_PIX_FMT_YUYV`` 321 - 'YUYV' 322 323 - Y'\ :sub:`0` 324 - Cb\ :sub:`0` 325 - Y'\ :sub:`1` 326 - Cr\ :sub:`0` 327 - Y'\ :sub:`2` 328 - Cb\ :sub:`2` 329 - Y'\ :sub:`3` 330 - Cr\ :sub:`2` 331 * .. _V4L2-PIX-FMT-YVYU: 332 333 - ``V4L2_PIX_FMT_YVYU`` 334 - 'YVYU' 335 336 - Y'\ :sub:`0` 337 - Cr\ :sub:`0` 338 - Y'\ :sub:`1` 339 - Cb\ :sub:`0` 340 - Y'\ :sub:`2` 341 - Cr\ :sub:`2` 342 - Y'\ :sub:`3` 343 - Cb\ :sub:`2` 344 345.. 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}| 346 347.. flat-table:: Packed YUV 4:2:2 Formats in 64-bit container 348 :header-rows: 1 349 :stub-columns: 0 350 351 * - Identifier 352 - Code 353 - Word 0 354 - Word 1 355 - Word 2 356 - Word 3 357 * .. _V4L2-PIX-FMT-Y210: 358 359 - ``V4L2_PIX_FMT_Y210`` 360 - 'Y210' 361 362 - Y'\ :sub:`0` (bits 15-6) 363 - Cb\ :sub:`0` (bits 15-6) 364 - Y'\ :sub:`1` (bits 15-6) 365 - Cr\ :sub:`0` (bits 15-6) 366 * .. _V4L2-PIX-FMT-Y212: 367 368 - ``V4L2_PIX_FMT_Y212`` 369 - 'Y212' 370 371 - Y'\ :sub:`0` (bits 15-4) 372 - Cb\ :sub:`0` (bits 15-4) 373 - Y'\ :sub:`1` (bits 15-4) 374 - Cr\ :sub:`0` (bits 15-4) 375 * .. _V4L2-PIX-FMT-Y216: 376 377 - ``V4L2_PIX_FMT_Y216`` 378 - 'Y216' 379 380 - Y'\ :sub:`0` (bits 15-0) 381 - Cb\ :sub:`0` (bits 15-0) 382 - Y'\ :sub:`1` (bits 15-0) 383 - Cr\ :sub:`0` (bits 15-0) 384 385.. raw:: latex 386 387 \normalsize 388 389**Color Sample Location:** 390Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` 391horizontally. 392 393 3944:1:1 Subsampling 395================= 396 397This format subsamples the chroma components horizontally by 4, storing 8 398pixels in 12 bytes. 399 400.. raw:: latex 401 402 \scriptsize 403 404.. 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}| 405 406.. flat-table:: Packed YUV 4:1:1 Formats 407 :header-rows: 1 408 :stub-columns: 0 409 410 * - Identifier 411 - Code 412 - Byte 0 413 - Byte 1 414 - Byte 2 415 - Byte 3 416 - Byte 4 417 - Byte 5 418 - Byte 6 419 - Byte 7 420 - Byte 8 421 - Byte 9 422 - Byte 10 423 - Byte 11 424 * .. _V4L2-PIX-FMT-Y41P: 425 426 - ``V4L2_PIX_FMT_Y41P`` 427 - 'Y41P' 428 429 - Cb\ :sub:`0` 430 - Y'\ :sub:`0` 431 - Cr\ :sub:`0` 432 - Y'\ :sub:`1` 433 - Cb\ :sub:`4` 434 - Y'\ :sub:`2` 435 - Cr\ :sub:`4` 436 - Y'\ :sub:`3` 437 - Y'\ :sub:`4` 438 - Y'\ :sub:`5` 439 - Y'\ :sub:`6` 440 - Y'\ :sub:`7` 441 442.. raw:: latex 443 444 \normalsize 445 446.. note:: 447 448 Do not confuse ``V4L2_PIX_FMT_Y41P`` with 449 :ref:`V4L2_PIX_FMT_YUV411P <V4L2-PIX-FMT-YUV411P>`. Y41P is derived from 450 "YUV 4:1:1 **packed**", while YUV411P stands for "YUV 4:1:1 **planar**". 451 452**Color Sample Location:** 453Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` 454horizontally. 455