1.. Permission is granted to copy, distribute and/or modify this
2.. document under the terms of the GNU Free Documentation License,
3.. Version 1.1 or any later version published by the Free Software
4.. Foundation, with no Invariant Sections, no Front-Cover Texts
5.. and no Back-Cover Texts. A copy of the license is included at
6.. Documentation/userspace-api/media/fdl-appendix.rst.
7..
8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10.. _packed-yuv:
11
12******************
13Packed YUV formats
14******************
15
16Description
17===========
18
19Similar to the packed RGB formats these formats store the Y, Cb and Cr
20component of each pixel in one 16 or 32 bit word.
21
22
23.. raw:: latex
24
25    \begingroup
26    \tiny
27    \setlength{\tabcolsep}{2pt}
28
29.. _packed-yuv-formats:
30
31.. tabularcolumns:: |p{2.5cm}|p{0.69cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|p{0.31cm}|
32
33.. flat-table:: Packed YUV Image Formats
34    :header-rows:  2
35    :stub-columns: 0
36
37    * - Identifier
38      - Code
39
40      - :cspan:`7` Byte 0 in memory
41
42      - :cspan:`7` Byte 1
43
44      - :cspan:`7` Byte 2
45
46      - :cspan:`7` Byte 3
47
48    * -
49      -
50      - 7
51      - 6
52      - 5
53      - 4
54      - 3
55      - 2
56      - 1
57      - 0
58
59      - 7
60      - 6
61      - 5
62      - 4
63      - 3
64      - 2
65      - 1
66      - 0
67
68      - 7
69      - 6
70      - 5
71      - 4
72      - 3
73      - 2
74      - 1
75      - 0
76
77      - 7
78      - 6
79      - 5
80      - 4
81      - 3
82      - 2
83      - 1
84      - 0
85
86    * .. _V4L2-PIX-FMT-YUV444:
87
88      - ``V4L2_PIX_FMT_YUV444``
89      - 'Y444'
90
91      - Cb\ :sub:`3`
92      - Cb\ :sub:`2`
93      - Cb\ :sub:`1`
94      - Cb\ :sub:`0`
95      - Cr\ :sub:`3`
96      - Cr\ :sub:`2`
97      - Cr\ :sub:`1`
98      - Cr\ :sub:`0`
99
100      - a\ :sub:`3`
101      - a\ :sub:`2`
102      - a\ :sub:`1`
103      - a\ :sub:`0`
104      - Y'\ :sub:`3`
105      - Y'\ :sub:`2`
106      - Y'\ :sub:`1`
107      - Y'\ :sub:`0`
108
109      -  :cspan:`15`
110
111    * .. _V4L2-PIX-FMT-YUV555:
112
113      - ``V4L2_PIX_FMT_YUV555``
114      - 'YUVO'
115
116      - Cb\ :sub:`2`
117      - Cb\ :sub:`1`
118      - Cb\ :sub:`0`
119      - Cr\ :sub:`4`
120      - Cr\ :sub:`3`
121      - Cr\ :sub:`2`
122      - Cr\ :sub:`1`
123      - Cr\ :sub:`0`
124
125      - a
126      - Y'\ :sub:`4`
127      - Y'\ :sub:`3`
128      - Y'\ :sub:`2`
129      - Y'\ :sub:`1`
130      - Y'\ :sub:`0`
131      - Cb\ :sub:`4`
132      - Cb\ :sub:`3`
133
134      -  :cspan:`15`
135    * .. _V4L2-PIX-FMT-YUV565:
136
137      - ``V4L2_PIX_FMT_YUV565``
138      - 'YUVP'
139
140      - Cb\ :sub:`2`
141      - Cb\ :sub:`1`
142      - Cb\ :sub:`0`
143      - Cr\ :sub:`4`
144      - Cr\ :sub:`3`
145      - Cr\ :sub:`2`
146      - Cr\ :sub:`1`
147      - Cr\ :sub:`0`
148
149      - Y'\ :sub:`4`
150      - Y'\ :sub:`3`
151      - Y'\ :sub:`2`
152      - Y'\ :sub:`1`
153      - Y'\ :sub:`0`
154      - Cb\ :sub:`5`
155      - Cb\ :sub:`4`
156      - Cb\ :sub:`3`
157
158      -  :cspan:`15`
159
160    * .. _V4L2-PIX-FMT-YUV32:
161
162      - ``V4L2_PIX_FMT_YUV32``
163      - 'YUV4'
164
165      - a\ :sub:`7`
166      - a\ :sub:`6`
167      - a\ :sub:`5`
168      - a\ :sub:`4`
169      - a\ :sub:`3`
170      - a\ :sub:`2`
171      - a\ :sub:`1`
172      - a\ :sub:`0`
173
174      - Y'\ :sub:`7`
175      - Y'\ :sub:`6`
176      - Y'\ :sub:`5`
177      - Y'\ :sub:`4`
178      - Y'\ :sub:`3`
179      - Y'\ :sub:`2`
180      - Y'\ :sub:`1`
181      - Y'\ :sub:`0`
182
183      - Cb\ :sub:`7`
184      - Cb\ :sub:`6`
185      - Cb\ :sub:`5`
186      - Cb\ :sub:`4`
187      - Cb\ :sub:`3`
188      - Cb\ :sub:`2`
189      - Cb\ :sub:`1`
190      - Cb\ :sub:`0`
191
192      - Cr\ :sub:`7`
193      - Cr\ :sub:`6`
194      - Cr\ :sub:`5`
195      - Cr\ :sub:`4`
196      - Cr\ :sub:`3`
197      - Cr\ :sub:`2`
198      - Cr\ :sub:`1`
199      - Cr\ :sub:`0`
200
201    * .. _V4L2-PIX-FMT-AYUV32:
202
203      - ``V4L2_PIX_FMT_AYUV32``
204      - 'AYUV'
205
206      - a\ :sub:`7`
207      - a\ :sub:`6`
208      - a\ :sub:`5`
209      - a\ :sub:`4`
210      - a\ :sub:`3`
211      - a\ :sub:`2`
212      - a\ :sub:`1`
213      - a\ :sub:`0`
214
215      - Y'\ :sub:`7`
216      - Y'\ :sub:`6`
217      - Y'\ :sub:`5`
218      - Y'\ :sub:`4`
219      - Y'\ :sub:`3`
220      - Y'\ :sub:`2`
221      - Y'\ :sub:`1`
222      - Y'\ :sub:`0`
223
224      - Cb\ :sub:`7`
225      - Cb\ :sub:`6`
226      - Cb\ :sub:`5`
227      - Cb\ :sub:`4`
228      - Cb\ :sub:`3`
229      - Cb\ :sub:`2`
230      - Cb\ :sub:`1`
231      - Cb\ :sub:`0`
232
233      - Cr\ :sub:`7`
234      - Cr\ :sub:`6`
235      - Cr\ :sub:`5`
236      - Cr\ :sub:`4`
237      - Cr\ :sub:`3`
238      - Cr\ :sub:`2`
239      - Cr\ :sub:`1`
240      - Cr\ :sub:`0`
241
242    * .. _V4L2-PIX-FMT-XYUV32:
243
244      - ``V4L2_PIX_FMT_XYUV32``
245      - 'XYUV'
246
247      -
248      -
249      -
250      -
251      -
252      -
253      -
254      -
255
256      - Y'\ :sub:`7`
257      - Y'\ :sub:`6`
258      - Y'\ :sub:`5`
259      - Y'\ :sub:`4`
260      - Y'\ :sub:`3`
261      - Y'\ :sub:`2`
262      - Y'\ :sub:`1`
263      - Y'\ :sub:`0`
264
265      - Cb\ :sub:`7`
266      - Cb\ :sub:`6`
267      - Cb\ :sub:`5`
268      - Cb\ :sub:`4`
269      - Cb\ :sub:`3`
270      - Cb\ :sub:`2`
271      - Cb\ :sub:`1`
272      - Cb\ :sub:`0`
273
274      - Cr\ :sub:`7`
275      - Cr\ :sub:`6`
276      - Cr\ :sub:`5`
277      - Cr\ :sub:`4`
278      - Cr\ :sub:`3`
279      - Cr\ :sub:`2`
280      - Cr\ :sub:`1`
281      - Cr\ :sub:`0`
282
283    * .. _V4L2-PIX-FMT-VUYA32:
284
285      - ``V4L2_PIX_FMT_VUYA32``
286      - 'VUYA'
287
288      - Cr\ :sub:`7`
289      - Cr\ :sub:`6`
290      - Cr\ :sub:`5`
291      - Cr\ :sub:`4`
292      - Cr\ :sub:`3`
293      - Cr\ :sub:`2`
294      - Cr\ :sub:`1`
295      - Cr\ :sub:`0`
296
297      - Cb\ :sub:`7`
298      - Cb\ :sub:`6`
299      - Cb\ :sub:`5`
300      - Cb\ :sub:`4`
301      - Cb\ :sub:`3`
302      - Cb\ :sub:`2`
303      - Cb\ :sub:`1`
304      - Cb\ :sub:`0`
305
306      - Y'\ :sub:`7`
307      - Y'\ :sub:`6`
308      - Y'\ :sub:`5`
309      - Y'\ :sub:`4`
310      - Y'\ :sub:`3`
311      - Y'\ :sub:`2`
312      - Y'\ :sub:`1`
313      - Y'\ :sub:`0`
314
315      - a\ :sub:`7`
316      - a\ :sub:`6`
317      - a\ :sub:`5`
318      - a\ :sub:`4`
319      - a\ :sub:`3`
320      - a\ :sub:`2`
321      - a\ :sub:`1`
322      - a\ :sub:`0`
323
324    * .. _V4L2-PIX-FMT-VUYX32:
325
326      - ``V4L2_PIX_FMT_VUYX32``
327      - 'VUYX'
328
329      - Cr\ :sub:`7`
330      - Cr\ :sub:`6`
331      - Cr\ :sub:`5`
332      - Cr\ :sub:`4`
333      - Cr\ :sub:`3`
334      - Cr\ :sub:`2`
335      - Cr\ :sub:`1`
336      - Cr\ :sub:`0`
337
338      - Cb\ :sub:`7`
339      - Cb\ :sub:`6`
340      - Cb\ :sub:`5`
341      - Cb\ :sub:`4`
342      - Cb\ :sub:`3`
343      - Cb\ :sub:`2`
344      - Cb\ :sub:`1`
345      - Cb\ :sub:`0`
346
347      - Y'\ :sub:`7`
348      - Y'\ :sub:`6`
349      - Y'\ :sub:`5`
350      - Y'\ :sub:`4`
351      - Y'\ :sub:`3`
352      - Y'\ :sub:`2`
353      - Y'\ :sub:`1`
354      - Y'\ :sub:`0`
355
356      -
357      -
358      -
359      -
360      -
361      -
362      -
363      -
364
365.. raw:: latex
366
367    \endgroup
368
369.. note::
370
371    #) Bit 7 is the most significant bit;
372
373    #) The value of a = alpha bits is undefined when reading from the driver,
374       ignored when writing to the driver, except when alpha blending has
375       been negotiated for a :ref:`Video Overlay <overlay>` or
376       :ref:`Video Output Overlay <osd>` for the formats Y444, YUV555 and
377       YUV4. However, for formats AYUV32 and VUYA32, the alpha component is
378       expected to contain a meaningful value that can be used by drivers
379       and applications. And, the formats XYUV32 and VUYX32 contain undefined
380       alpha values that must be ignored by all applications and drivers.
381