Merge tag 'docs-next' of git://git.lwn.net/linux.git into patchwork
[cascardo/linux.git] / Documentation / media / uapi / v4l / pixfmt-yuv420m.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _V4L2-PIX-FMT-YUV420M:
4 .. _v4l2-pix-fmt-yvu420m:
5
6 ************************************************************
7 V4L2_PIX_FMT_YUV420M ('YM12'), V4L2_PIX_FMT_YVU420M ('YM21')
8 ************************************************************
9
10
11 V4L2_PIX_FMT_YVU420M
12 Variation of ``V4L2_PIX_FMT_YUV420`` and ``V4L2_PIX_FMT_YVU420`` with
13 planes non contiguous in memory.
14
15
16 Description
17 ===========
18
19 This is a multi-planar format, as opposed to a packed format. The three
20 components are separated into three sub-images or planes.
21
22 The Y plane is first. The Y plane has one byte per pixel. For
23 ``V4L2_PIX_FMT_YUV420M`` the Cb data constitutes the second plane which
24 is half the width and half the height of the Y plane (and of the image).
25 Each Cb belongs to four pixels, a two-by-two square of the image. For
26 example, Cb\ :sub:`0` belongs to Y'\ :sub:`00`, Y'\ :sub:`01`,
27 Y'\ :sub:`10`, and Y'\ :sub:`11`. The Cr data, just like the Cb plane,
28 is in the third plane.
29
30 ``V4L2_PIX_FMT_YVU420M`` is the same except the Cr data is stored in the
31 second plane and the Cb data in the third plane.
32
33 If the Y plane has pad bytes after each row, then the Cb and Cr planes
34 have half as many pad bytes after their rows. In other words, two Cx
35 rows (including padding) is exactly as long as one Y row (including
36 padding).
37
38 ``V4L2_PIX_FMT_YUV420M`` and ``V4L2_PIX_FMT_YVU420M`` are intended to be
39 used only in drivers and applications that support the multi-planar API,
40 described in :ref:`planar-apis`.
41
42 **Byte Order.**
43 Each cell is one byte.
44
45
46
47
48 .. flat-table::
49     :header-rows:  0
50     :stub-columns: 0
51
52
53     -  .. row 1
54
55        -  start0 + 0:
56
57        -  Y'\ :sub:`00`
58
59        -  Y'\ :sub:`01`
60
61        -  Y'\ :sub:`02`
62
63        -  Y'\ :sub:`03`
64
65     -  .. row 2
66
67        -  start0 + 4:
68
69        -  Y'\ :sub:`10`
70
71        -  Y'\ :sub:`11`
72
73        -  Y'\ :sub:`12`
74
75        -  Y'\ :sub:`13`
76
77     -  .. row 3
78
79        -  start0 + 8:
80
81        -  Y'\ :sub:`20`
82
83        -  Y'\ :sub:`21`
84
85        -  Y'\ :sub:`22`
86
87        -  Y'\ :sub:`23`
88
89     -  .. row 4
90
91        -  start0 + 12:
92
93        -  Y'\ :sub:`30`
94
95        -  Y'\ :sub:`31`
96
97        -  Y'\ :sub:`32`
98
99        -  Y'\ :sub:`33`
100
101     -  .. row 5
102
103        -
104
105     -  .. row 6
106
107        -  start1 + 0:
108
109        -  Cb\ :sub:`00`
110
111        -  Cb\ :sub:`01`
112
113     -  .. row 7
114
115        -  start1 + 2:
116
117        -  Cb\ :sub:`10`
118
119        -  Cb\ :sub:`11`
120
121     -  .. row 8
122
123        -
124
125     -  .. row 9
126
127        -  start2 + 0:
128
129        -  Cr\ :sub:`00`
130
131        -  Cr\ :sub:`01`
132
133     -  .. row 10
134
135        -  start2 + 2:
136
137        -  Cr\ :sub:`10`
138
139        -  Cr\ :sub:`11`
140
141
142 **Color Sample Location..**
143
144
145
146 .. flat-table::
147     :header-rows:  0
148     :stub-columns: 0
149
150
151     -  .. row 1
152
153        -
154        -  0
155
156        -
157        -  1
158
159        -
160        -  2
161
162        -
163        -  3
164
165     -  .. row 2
166
167        -  0
168
169        -  Y
170
171        -
172        -  Y
173
174        -
175        -  Y
176
177        -
178        -  Y
179
180     -  .. row 3
181
182        -
183        -
184        -  C
185
186        -
187        -
188        -
189        -  C
190
191        -
192
193     -  .. row 4
194
195        -  1
196
197        -  Y
198
199        -
200        -  Y
201
202        -
203        -  Y
204
205        -
206        -  Y
207
208     -  .. row 5
209
210        -
211
212     -  .. row 6
213
214        -  2
215
216        -  Y
217
218        -
219        -  Y
220
221        -
222        -  Y
223
224        -
225        -  Y
226
227     -  .. row 7
228
229        -
230        -
231        -  C
232
233        -
234        -
235        -
236        -  C
237
238        -
239
240     -  .. row 8
241
242        -  3
243
244        -  Y
245
246        -
247        -  Y
248
249        -
250        -  Y
251
252        -
253        -  Y