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