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