1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _V4L2-PIX-FMT-YVU420:
4.. _V4L2-PIX-FMT-YUV420:
5
6**********************************************************
7V4L2_PIX_FMT_YVU420 ('YV12'), V4L2_PIX_FMT_YUV420 ('YU12')
8**********************************************************
9
10
11V4L2_PIX_FMT_YUV420
12Planar formats with ½ horizontal and vertical chroma resolution, also
13known as YUV 4:2:0
14
15
16Description
17===========
18
19These are planar formats, as opposed to a packed format. The three
20components are separated into three sub- images or planes. The Y plane
21is first. The Y plane has one byte per pixel. For
22``V4L2_PIX_FMT_YVU420``, the Cr plane immediately follows the Y plane in
23memory. The Cr plane is half the width and half the height of the Y
24plane (and of the image). Each Cr belongs to four pixels, a two-by-two
25square of the image. For example, Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
26Y'\ :sub:`01`, Y'\ :sub:`10`, and Y'\ :sub:`11`. Following the Cr plane
27is the Cb plane, just like the Cr plane. ``V4L2_PIX_FMT_YUV420`` is the
28same except the Cb plane comes first, then the Cr plane.
29
30If the Y plane has pad bytes after each row, then the Cr and Cb planes
31have half as many pad bytes after their rows. In other words, two Cx
32rows (including padding) is exactly as long as one Y row (including
33padding).
34
35**Byte Order.**
36Each cell is one byte.
37
38
39
40
41.. flat-table::
42    :header-rows:  0
43    :stub-columns: 0
44
45    * - start + 0:
46      - Y'\ :sub:`00`
47      - Y'\ :sub:`01`
48      - Y'\ :sub:`02`
49      - Y'\ :sub:`03`
50    * - start + 4:
51      - Y'\ :sub:`10`
52      - Y'\ :sub:`11`
53      - Y'\ :sub:`12`
54      - Y'\ :sub:`13`
55    * - start + 8:
56      - Y'\ :sub:`20`
57      - Y'\ :sub:`21`
58      - Y'\ :sub:`22`
59      - Y'\ :sub:`23`
60    * - start + 12:
61      - Y'\ :sub:`30`
62      - Y'\ :sub:`31`
63      - Y'\ :sub:`32`
64      - Y'\ :sub:`33`
65    * - start + 16:
66      - Cr\ :sub:`00`
67      - Cr\ :sub:`01`
68    * - start + 18:
69      - Cr\ :sub:`10`
70      - Cr\ :sub:`11`
71    * - start + 20:
72      - Cb\ :sub:`00`
73      - Cb\ :sub:`01`
74    * - start + 22:
75      - Cb\ :sub:`10`
76      - Cb\ :sub:`11`
77
78
79**Color Sample Location:**
80
81
82
83.. flat-table::
84    :header-rows:  0
85    :stub-columns: 0
86
87    * -
88      - 0
89      -
90      - 1
91      -
92      - 2
93      -
94      - 3
95    * - 0
96      - Y
97      -
98      - Y
99      -
100      - Y
101      -
102      - Y
103    * -
104      -
105      - C
106      -
107      -
108      -
109      - C
110      -
111    * - 1
112      - Y
113      -
114      - Y
115      -
116      - Y
117      -
118      - Y
119    * -
120    * - 2
121      - Y
122      -
123      - Y
124      -
125      - Y
126      -
127      - Y
128    * -
129      -
130      - C
131      -
132      -
133      -
134      - C
135      -
136    * - 3
137      - Y
138      -
139      - Y
140      -
141      - Y
142      -
143      - Y
144