Merge branch 'async-scsi-resume' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / Documentation / DocBook / media / v4l / pixfmt.xml
1   <title>Image Formats</title>
2
3   <para>The V4L2 API was primarily designed for devices exchanging
4 image data with applications. The
5 <structname>v4l2_pix_format</structname> and <structname>v4l2_pix_format_mplane
6 </structname> structures define the format and layout of an image in memory.
7 The former is used with the single-planar API, while the latter is used with the
8 multi-planar version (see <xref linkend="planar-apis"/>). Image formats are
9 negotiated with the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video
10 capturing and output, for overlay frame buffer formats see also
11 &VIDIOC-G-FBUF;.)</para>
12
13 <section>
14   <title>Single-planar format structure</title>
15   <table pgwide="1" frame="none" id="v4l2-pix-format">
16     <title>struct <structname>v4l2_pix_format</structname></title>
17     <tgroup cols="3">
18       &cs-str;
19       <tbody valign="top">
20         <row>
21           <entry>__u32</entry>
22           <entry><structfield>width</structfield></entry>
23           <entry>Image width in pixels.</entry>
24         </row>
25         <row>
26           <entry>__u32</entry>
27           <entry><structfield>height</structfield></entry>
28           <entry>Image height in pixels. If <structfield>field</structfield> is
29           one of <constant>V4L2_FIELD_TOP</constant>, <constant>V4L2_FIELD_BOTTOM</constant>
30           or <constant>V4L2_FIELD_ALTERNATE</constant> then height refers to the
31           number of lines in the field, otherwise it refers to the number of
32           lines in the frame (which is twice the field height for interlaced
33           formats).</entry>
34         </row>
35         <row>
36           <entry spanname="hspan">Applications set these fields to
37 request an image size, drivers return the closest possible values. In
38 case of planar formats the <structfield>width</structfield> and
39 <structfield>height</structfield> applies to the largest plane. To
40 avoid ambiguities drivers must return values rounded up to a multiple
41 of the scale factor of any smaller planes. For example when the image
42 format is YUV 4:2:0, <structfield>width</structfield> and
43 <structfield>height</structfield> must be multiples of two.</entry>
44         </row>
45         <row>
46           <entry>__u32</entry>
47           <entry><structfield>pixelformat</structfield></entry>
48           <entry>The pixel format or type of compression, set by the
49 application. This is a little endian <link
50 linkend="v4l2-fourcc">four character code</link>. V4L2 defines
51 standard RGB formats in <xref linkend="rgb-formats" />, YUV formats in <xref
52 linkend="yuv-formats" />, and reserved codes in <xref
53 linkend="reserved-formats" /></entry>
54         </row>
55         <row>
56           <entry>&v4l2-field;</entry>
57           <entry><structfield>field</structfield></entry>
58           <entry>Video images are typically interlaced. Applications
59 can request to capture or output only the top or bottom field, or both
60 fields interlaced or sequentially stored in one buffer or alternating
61 in separate buffers. Drivers return the actual field order selected.
62 For more details on fields see <xref linkend="field-order" />.</entry>
63         </row>
64         <row>
65           <entry>__u32</entry>
66           <entry><structfield>bytesperline</structfield></entry>
67           <entry>Distance in bytes between the leftmost pixels in two
68 adjacent lines.</entry>
69         </row>
70         <row>
71           <entry spanname="hspan"><para>Both applications and drivers
72 can set this field to request padding bytes at the end of each line.
73 Drivers however may ignore the value requested by the application,
74 returning <structfield>width</structfield> times bytes per pixel or a
75 larger value required by the hardware. That implies applications can
76 just set this field to zero to get a reasonable
77 default.</para><para>Video hardware may access padding bytes,
78 therefore they must reside in accessible memory. Consider cases where
79 padding bytes after the last line of an image cross a system page
80 boundary. Input devices may write padding bytes, the value is
81 undefined. Output devices ignore the contents of padding
82 bytes.</para><para>When the image format is planar the
83 <structfield>bytesperline</structfield> value applies to the largest
84 plane and is divided by the same factor as the
85 <structfield>width</structfield> field for any smaller planes. For
86 example the Cb and Cr planes of a YUV 4:2:0 image have half as many
87 padding bytes following each line as the Y plane. To avoid ambiguities
88 drivers must return a <structfield>bytesperline</structfield> value
89 rounded up to a multiple of the scale factor.</para>
90 <para>For compressed formats the <structfield>bytesperline</structfield>
91 value makes no sense. Applications and drivers must set this to 0 in
92 that case.</para></entry>
93         </row>
94         <row>
95           <entry>__u32</entry>
96           <entry><structfield>sizeimage</structfield></entry>
97           <entry>Size in bytes of the buffer to hold a complete image,
98 set by the driver. Usually this is
99 <structfield>bytesperline</structfield> times
100 <structfield>height</structfield>. When the image consists of variable
101 length compressed data this is the maximum number of bytes required to
102 hold an image.</entry>
103         </row>
104         <row>
105           <entry>&v4l2-colorspace;</entry>
106           <entry><structfield>colorspace</structfield></entry>
107           <entry>This information supplements the
108 <structfield>pixelformat</structfield> and must be set by the driver for
109 capture streams and by the application for output streams,
110 see <xref linkend="colorspaces" />.</entry>
111         </row>
112         <row>
113           <entry>__u32</entry>
114           <entry><structfield>priv</structfield></entry>
115           <entry>Reserved for custom (driver defined) additional
116 information about formats. When not used drivers and applications must
117 set this field to zero.</entry>
118         </row>
119       </tbody>
120     </tgroup>
121   </table>
122 </section>
123
124 <section>
125   <title>Multi-planar format structures</title>
126   <para>The <structname>v4l2_plane_pix_format</structname> structures define
127     size and layout for each of the planes in a multi-planar format.
128     The <structname>v4l2_pix_format_mplane</structname> structure contains
129     information common to all planes (such as image width and height) and
130     an array of <structname>v4l2_plane_pix_format</structname> structures,
131     describing all planes of that format.</para>
132   <table pgwide="1" frame="none" id="v4l2-plane-pix-format">
133     <title>struct <structname>v4l2_plane_pix_format</structname></title>
134     <tgroup cols="3">
135       &cs-str;
136       <tbody valign="top">
137         <row>
138           <entry>__u32</entry>
139           <entry><structfield>sizeimage</structfield></entry>
140           <entry>Maximum size in bytes required for image data in this plane.
141           </entry>
142         </row>
143         <row>
144           <entry>__u16</entry>
145           <entry><structfield>bytesperline</structfield></entry>
146           <entry>Distance in bytes between the leftmost pixels in two adjacent
147             lines. See &v4l2-pix-format;.</entry>
148         </row>
149         <row>
150           <entry>__u16</entry>
151           <entry><structfield>reserved[7]</structfield></entry>
152           <entry>Reserved for future extensions. Should be zeroed by the
153            application.</entry>
154         </row>
155       </tbody>
156     </tgroup>
157   </table>
158   <table pgwide="1" frame="none" id="v4l2-pix-format-mplane">
159     <title>struct <structname>v4l2_pix_format_mplane</structname></title>
160     <tgroup cols="3">
161       &cs-str;
162       <tbody valign="top">
163         <row>
164           <entry>__u32</entry>
165           <entry><structfield>width</structfield></entry>
166           <entry>Image width in pixels. See &v4l2-pix-format;.</entry>
167         </row>
168         <row>
169           <entry>__u32</entry>
170           <entry><structfield>height</structfield></entry>
171           <entry>Image height in pixels. See &v4l2-pix-format;.</entry>
172         </row>
173         <row>
174           <entry>__u32</entry>
175           <entry><structfield>pixelformat</structfield></entry>
176           <entry>The pixel format. Both single- and multi-planar four character
177 codes can be used.</entry>
178         </row>
179         <row>
180           <entry>&v4l2-field;</entry>
181           <entry><structfield>field</structfield></entry>
182           <entry>See &v4l2-pix-format;.</entry>
183         </row>
184         <row>
185           <entry>&v4l2-colorspace;</entry>
186           <entry><structfield>colorspace</structfield></entry>
187           <entry>See &v4l2-pix-format;.</entry>
188         </row>
189         <row>
190           <entry>&v4l2-plane-pix-format;</entry>
191           <entry><structfield>plane_fmt[VIDEO_MAX_PLANES]</structfield></entry>
192           <entry>An array of structures describing format of each plane this
193           pixel format consists of. The number of valid entries in this array
194           has to be put in the <structfield>num_planes</structfield>
195           field.</entry>
196         </row>
197         <row>
198           <entry>__u8</entry>
199           <entry><structfield>num_planes</structfield></entry>
200           <entry>Number of planes (i.e. separate memory buffers) for this format
201           and the number of valid entries in the
202           <structfield>plane_fmt</structfield> array.</entry>
203         </row>
204         <row>
205           <entry>__u8</entry>
206           <entry><structfield>reserved[11]</structfield></entry>
207           <entry>Reserved for future extensions. Should be zeroed by the
208            application.</entry>
209         </row>
210       </tbody>
211     </tgroup>
212   </table>
213 </section>
214
215   <section>
216     <title>Standard Image Formats</title>
217
218     <para>In order to exchange images between drivers and
219 applications, it is necessary to have standard image data formats
220 which both sides will interpret the same way. V4L2 includes several
221 such formats, and this section is intended to be an unambiguous
222 specification of the standard image data formats in V4L2.</para>
223
224     <para>V4L2 drivers are not limited to these formats, however.
225 Driver-specific formats are possible. In that case the application may
226 depend on a codec to convert images to one of the standard formats
227 when needed. But the data can still be stored and retrieved in the
228 proprietary format. For example, a device may support a proprietary
229 compressed format. Applications can still capture and save the data in
230 the compressed format, saving much disk space, and later use a codec
231 to convert the images to the X Windows screen format when the video is
232 to be displayed.</para>
233
234     <para>Even so, ultimately, some standard formats are needed, so
235 the V4L2 specification would not be complete without well-defined
236 standard formats.</para>
237
238     <para>The V4L2 standard formats are mainly uncompressed formats. The
239 pixels are always arranged in memory from left to right, and from top
240 to bottom. The first byte of data in the image buffer is always for
241 the leftmost pixel of the topmost row. Following that is the pixel
242 immediately to its right, and so on until the end of the top row of
243 pixels. Following the rightmost pixel of the row there may be zero or
244 more bytes of padding to guarantee that each row of pixel data has a
245 certain alignment. Following the pad bytes, if any, is data for the
246 leftmost pixel of the second row from the top, and so on. The last row
247 has just as many pad bytes after it as the other rows.</para>
248
249     <para>In V4L2 each format has an identifier which looks like
250 <constant>PIX_FMT_XXX</constant>, defined in the <link
251 linkend="videodev">videodev.h</link> header file. These identifiers
252 represent <link linkend="v4l2-fourcc">four character (FourCC) codes</link>
253 which are also listed below, however they are not the same as those
254 used in the Windows world.</para>
255
256     <para>For some formats, data is stored in separate, discontiguous
257 memory buffers. Those formats are identified by a separate set of FourCC codes
258 and are referred to as "multi-planar formats". For example, a YUV422 frame is
259 normally stored in one memory buffer, but it can also be placed in two or three
260 separate buffers, with Y component in one buffer and CbCr components in another
261 in the 2-planar version or with each component in its own buffer in the
262 3-planar case. Those sub-buffers are referred to as "planes".</para>
263   </section>
264
265   <section id="colorspaces">
266     <title>Colorspaces</title>
267
268     <para>[intro]</para>
269
270     <!-- See proposal by Billy Biggs, video4linux-list@redhat.com
271 on 11 Oct 2002, subject: "Re: [V4L] Re: v4l2 api", and
272 http://vektor.theorem.ca/graphics/ycbcr/ and
273 http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html -->
274
275     <para>
276       <variablelist>
277         <varlistentry>
278           <term>Gamma Correction</term>
279           <listitem>
280             <para>[to do]</para>
281             <para>E'<subscript>R</subscript> = f(R)</para>
282             <para>E'<subscript>G</subscript> = f(G)</para>
283             <para>E'<subscript>B</subscript> = f(B)</para>
284           </listitem>
285         </varlistentry>
286         <varlistentry>
287           <term>Construction of luminance and color-difference
288 signals</term>
289           <listitem>
290             <para>[to do]</para>
291             <para>E'<subscript>Y</subscript> =
292 Coeff<subscript>R</subscript> E'<subscript>R</subscript>
293 + Coeff<subscript>G</subscript> E'<subscript>G</subscript>
294 + Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
295             <para>(E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = E'<subscript>R</subscript>
296 - Coeff<subscript>R</subscript> E'<subscript>R</subscript>
297 - Coeff<subscript>G</subscript> E'<subscript>G</subscript>
298 - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
299             <para>(E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = E'<subscript>B</subscript>
300 - Coeff<subscript>R</subscript> E'<subscript>R</subscript>
301 - Coeff<subscript>G</subscript> E'<subscript>G</subscript>
302 - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
303           </listitem>
304         </varlistentry>
305         <varlistentry>
306           <term>Re-normalized color-difference signals</term>
307           <listitem>
308             <para>The color-difference signals are scaled back to unity
309 range [-0.5;+0.5]:</para>
310             <para>K<subscript>B</subscript> = 0.5 / (1 - Coeff<subscript>B</subscript>)</para>
311             <para>K<subscript>R</subscript> = 0.5 / (1 - Coeff<subscript>R</subscript>)</para>
312             <para>P<subscript>B</subscript> =
313 K<subscript>B</subscript> (E'<subscript>B</subscript> - E'<subscript>Y</subscript>) =
314   0.5 (Coeff<subscript>R</subscript> / Coeff<subscript>B</subscript>) E'<subscript>R</subscript>
315 + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>B</subscript>) E'<subscript>G</subscript>
316 + 0.5 E'<subscript>B</subscript></para>
317             <para>P<subscript>R</subscript> =
318 K<subscript>R</subscript> (E'<subscript>R</subscript> - E'<subscript>Y</subscript>) =
319   0.5 E'<subscript>R</subscript>
320 + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>R</subscript>) E'<subscript>G</subscript>
321 + 0.5 (Coeff<subscript>B</subscript> / Coeff<subscript>R</subscript>) E'<subscript>B</subscript></para>
322           </listitem>
323         </varlistentry>
324         <varlistentry>
325           <term>Quantization</term>
326           <listitem>
327             <para>[to do]</para>
328             <para>Y' = (Lum. Levels - 1) &middot; E'<subscript>Y</subscript> + Lum. Offset</para>
329             <para>C<subscript>B</subscript> = (Chrom. Levels - 1)
330 &middot; P<subscript>B</subscript> + Chrom. Offset</para>
331             <para>C<subscript>R</subscript> = (Chrom. Levels - 1)
332 &middot; P<subscript>R</subscript> + Chrom. Offset</para>
333             <para>Rounding to the nearest integer and clamping to the range
334 [0;255] finally yields the digital color components Y'CbCr
335 stored in YUV images.</para>
336           </listitem>
337         </varlistentry>
338       </variablelist>
339     </para>
340
341     <example>
342       <title>ITU-R Rec. BT.601 color conversion</title>
343
344       <para>Forward Transformation</para>
345
346       <programlisting>
347 int ER, EG, EB;         /* gamma corrected RGB input [0;255] */
348 int Y1, Cb, Cr;         /* output [0;255] */
349
350 double r, g, b;         /* temporaries */
351 double y1, pb, pr;
352
353 int
354 clamp (double x)
355 {
356         int r = x;      /* round to nearest */
357
358         if (r &lt; 0)         return 0;
359         else if (r &gt; 255)  return 255;
360         else               return r;
361 }
362
363 r = ER / 255.0;
364 g = EG / 255.0;
365 b = EB / 255.0;
366
367 y1  =  0.299  * r + 0.587 * g + 0.114  * b;
368 pb  = -0.169  * r - 0.331 * g + 0.5    * b;
369 pr  =  0.5    * r - 0.419 * g - 0.081  * b;
370
371 Y1 = clamp (219 * y1 + 16);
372 Cb = clamp (224 * pb + 128);
373 Cr = clamp (224 * pr + 128);
374
375 /* or shorter */
376
377 y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB;
378
379 Y1 = clamp ( (219 / 255.0)                    *       y1  + 16);
380 Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128);
381 Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128);
382       </programlisting>
383
384       <para>Inverse Transformation</para>
385
386       <programlisting>
387 int Y1, Cb, Cr;         /* gamma pre-corrected input [0;255] */
388 int ER, EG, EB;         /* output [0;255] */
389
390 double r, g, b;         /* temporaries */
391 double y1, pb, pr;
392
393 int
394 clamp (double x)
395 {
396         int r = x;      /* round to nearest */
397
398         if (r &lt; 0)         return 0;
399         else if (r &gt; 255)  return 255;
400         else               return r;
401 }
402
403 y1 = (Y1 - 16) / 219.0;
404 pb = (Cb - 128) / 224.0;
405 pr = (Cr - 128) / 224.0;
406
407 r = 1.0 * y1 + 0     * pb + 1.402 * pr;
408 g = 1.0 * y1 - 0.344 * pb - 0.714 * pr;
409 b = 1.0 * y1 + 1.772 * pb + 0     * pr;
410
411 ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */
412 EG = clamp (g * 255);
413 EB = clamp (b * 255);
414       </programlisting>
415     </example>
416
417     <table pgwide="1" id="v4l2-colorspace" orient="land">
418       <title>enum v4l2_colorspace</title>
419       <tgroup cols="11" align="center">
420         <colspec align="left" />
421         <colspec align="center" />
422         <colspec align="left" />
423         <colspec colname="cr" />
424         <colspec colname="cg" />
425         <colspec colname="cb" />
426         <colspec colname="wp" />
427         <colspec colname="gc" />
428         <colspec colname="lum" />
429         <colspec colname="qy" />
430         <colspec colname="qc" />
431         <spanspec namest="cr" nameend="cb" spanname="chrom" />
432         <spanspec namest="qy" nameend="qc" spanname="quant" />
433         <spanspec namest="lum" nameend="qc" spanname="spam" />
434         <thead>
435           <row>
436             <entry morerows="1">Identifier</entry>
437             <entry morerows="1">Value</entry>
438             <entry morerows="1">Description</entry>
439             <entry spanname="chrom">Chromaticities<footnote>
440                 <para>The coordinates of the color primaries are
441 given in the CIE system (1931)</para>
442               </footnote></entry>
443             <entry morerows="1">White Point</entry>
444             <entry morerows="1">Gamma Correction</entry>
445             <entry morerows="1">Luminance E'<subscript>Y</subscript></entry>
446             <entry spanname="quant">Quantization</entry>
447           </row>
448           <row>
449             <entry>Red</entry>
450             <entry>Green</entry>
451             <entry>Blue</entry>
452             <entry>Y'</entry>
453             <entry>Cb, Cr</entry>
454           </row>
455         </thead>
456         <tbody valign="top">
457           <row>
458             <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry>
459             <entry>1</entry>
460             <entry>NTSC/PAL according to <xref linkend="smpte170m" />,
461 <xref linkend="itu601" /></entry>
462             <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
463             <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
464             <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
465             <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
466             Illuminant D<subscript>65</subscript></entry>
467             <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
468 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
469             <entry>0.299&nbsp;E'<subscript>R</subscript>
470 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
471 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
472             <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
473             <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
474           </row>
475           <row>
476             <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry>
477             <entry>2</entry>
478             <entry>1125-Line (US) HDTV, see <xref
479 linkend="smpte240m" /></entry>
480             <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
481             <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
482             <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
483             <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
484             Illuminant D<subscript>65</subscript></entry>
485             <entry>E' = 4&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.0228,
486 1.1115&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&lt;&nbsp;I</entry>
487             <entry>0.212&nbsp;E'<subscript>R</subscript>
488 +&nbsp;0.701&nbsp;E'<subscript>G</subscript>
489 +&nbsp;0.087&nbsp;E'<subscript>B</subscript></entry>
490             <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
491             <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
492           </row>
493           <row>
494             <entry><constant>V4L2_COLORSPACE_REC709</constant></entry>
495             <entry>3</entry>
496             <entry>HDTV and modern devices, see <xref
497 linkend="itu709" /></entry>
498             <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
499             <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
500             <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
501             <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
502             Illuminant D<subscript>65</subscript></entry>
503             <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
504 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
505             <entry>0.2125&nbsp;E'<subscript>R</subscript>
506 +&nbsp;0.7154&nbsp;E'<subscript>G</subscript>
507 +&nbsp;0.0721&nbsp;E'<subscript>B</subscript></entry>
508             <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
509             <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
510           </row>
511           <row>
512             <entry><constant>V4L2_COLORSPACE_BT878</constant></entry>
513             <entry>4</entry>
514             <entry>Broken Bt878 extents<footnote>
515                 <para>The ubiquitous Bt878 video capture chip
516 quantizes E'<subscript>Y</subscript> to 238 levels, yielding a range
517 of Y' = 16 &hellip; 253, unlike Rec. 601 Y' = 16 &hellip;
518 235. This is not a typo in the Bt878 documentation, it has been
519 implemented in silicon. The chroma extents are unclear.</para>
520               </footnote>, <xref linkend="itu601" /></entry>
521             <entry>?</entry>
522             <entry>?</entry>
523             <entry>?</entry>
524             <entry>?</entry>
525             <entry>?</entry>
526             <entry>0.299&nbsp;E'<subscript>R</subscript>
527 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
528 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
529             <entry><emphasis>237</emphasis>&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
530             <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128 (probably)</entry>
531           </row>
532           <row>
533             <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry>
534             <entry>5</entry>
535             <entry>M/NTSC<footnote>
536                 <para>No identifier exists for M/PAL which uses
537 the chromaticities of M/NTSC, the remaining parameters are equal to B and
538 G/PAL.</para>
539               </footnote> according to <xref linkend="itu470" />, <xref
540                 linkend="itu601" /></entry>
541             <entry>x&nbsp;=&nbsp;0.67, y&nbsp;=&nbsp;0.33</entry>
542             <entry>x&nbsp;=&nbsp;0.21, y&nbsp;=&nbsp;0.71</entry>
543             <entry>x&nbsp;=&nbsp;0.14, y&nbsp;=&nbsp;0.08</entry>
544             <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.316, Illuminant C</entry>
545             <entry>?</entry>
546             <entry>0.299&nbsp;E'<subscript>R</subscript>
547 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
548 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
549             <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
550             <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
551           </row>
552           <row>
553             <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry>
554             <entry>6</entry>
555             <entry>625-line PAL and SECAM systems according to <xref
556 linkend="itu470" />, <xref linkend="itu601" /></entry>
557             <entry>x&nbsp;=&nbsp;0.64, y&nbsp;=&nbsp;0.33</entry>
558             <entry>x&nbsp;=&nbsp;0.29, y&nbsp;=&nbsp;0.60</entry>
559             <entry>x&nbsp;=&nbsp;0.15, y&nbsp;=&nbsp;0.06</entry>
560             <entry>x&nbsp;=&nbsp;0.313, y&nbsp;=&nbsp;0.329,
561 Illuminant D<subscript>65</subscript></entry>
562             <entry>?</entry>
563             <entry>0.299&nbsp;E'<subscript>R</subscript>
564 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
565 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
566             <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
567             <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
568           </row>
569           <row>
570             <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry>
571             <entry>7</entry>
572             <entry>JPEG Y'CbCr, see <xref linkend="jfif" />, <xref linkend="itu601" /></entry>
573             <entry>?</entry>
574             <entry>?</entry>
575             <entry>?</entry>
576             <entry>?</entry>
577             <entry>?</entry>
578             <entry>0.299&nbsp;E'<subscript>R</subscript>
579 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
580 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
581             <entry>256&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16<footnote>
582                 <para>Note JFIF quantizes
583 Y'P<subscript>B</subscript>P<subscript>R</subscript> in range [0;+1] and
584 [-0.5;+0.5] to <emphasis>257</emphasis> levels, however Y'CbCr signals
585 are still clamped to [0;255].</para>
586               </footnote></entry>
587             <entry>256&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
588           </row>
589           <row>
590             <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry>
591             <entry>8</entry>
592             <entry>[?]</entry>
593             <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
594             <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
595             <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
596             <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
597             Illuminant D<subscript>65</subscript></entry>
598             <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
599 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
600             <entry spanname="spam">n/a</entry>
601           </row>
602         </tbody>
603       </tgroup>
604     </table>
605   </section>
606
607   <section id="pixfmt-indexed">
608     <title>Indexed Format</title>
609
610     <para>In this format each pixel is represented by an 8 bit index
611 into a 256 entry ARGB palette. It is intended for <link
612 linkend="osd">Video Output Overlays</link> only. There are no ioctls to
613 access the palette, this must be done with ioctls of the Linux framebuffer API.</para>
614
615     <table pgwide="0" frame="none">
616       <title>Indexed Image Format</title>
617       <tgroup cols="37" align="center">
618         <colspec colname="id" align="left" />
619         <colspec colname="fourcc" />
620         <colspec colname="bit" />
621
622         <colspec colnum="4" colname="b07" align="center" />
623         <colspec colnum="5" colname="b06" align="center" />
624         <colspec colnum="6" colname="b05" align="center" />
625         <colspec colnum="7" colname="b04" align="center" />
626         <colspec colnum="8" colname="b03" align="center" />
627         <colspec colnum="9" colname="b02" align="center" />
628         <colspec colnum="10" colname="b01" align="center" />
629         <colspec colnum="11" colname="b00" align="center" />
630
631         <spanspec namest="b07" nameend="b00" spanname="b0" />
632         <spanspec namest="b17" nameend="b10" spanname="b1" />
633         <spanspec namest="b27" nameend="b20" spanname="b2" />
634         <spanspec namest="b37" nameend="b30" spanname="b3" />
635         <thead>
636           <row>
637             <entry>Identifier</entry>
638             <entry>Code</entry>
639             <entry>&nbsp;</entry>
640             <entry spanname="b0">Byte&nbsp;0</entry>
641           </row>
642           <row>
643             <entry>&nbsp;</entry>
644             <entry>&nbsp;</entry>
645             <entry>Bit</entry>
646             <entry>7</entry>
647             <entry>6</entry>
648             <entry>5</entry>
649             <entry>4</entry>
650             <entry>3</entry>
651             <entry>2</entry>
652             <entry>1</entry>
653             <entry>0</entry>
654           </row>
655         </thead>
656         <tbody valign="top">
657           <row id="V4L2-PIX-FMT-PAL8">
658             <entry><constant>V4L2_PIX_FMT_PAL8</constant></entry>
659             <entry>'PAL8'</entry>
660             <entry></entry>
661             <entry>i<subscript>7</subscript></entry>
662             <entry>i<subscript>6</subscript></entry>
663             <entry>i<subscript>5</subscript></entry>
664             <entry>i<subscript>4</subscript></entry>
665             <entry>i<subscript>3</subscript></entry>
666             <entry>i<subscript>2</subscript></entry>
667             <entry>i<subscript>1</subscript></entry>
668             <entry>i<subscript>0</subscript></entry>
669           </row>
670         </tbody>
671       </tgroup>
672     </table>
673   </section>
674
675   <section id="pixfmt-rgb">
676     <title>RGB Formats</title>
677
678     &sub-packed-rgb;
679     &sub-sbggr8;
680     &sub-sgbrg8;
681     &sub-sgrbg8;
682     &sub-srggb8;
683     &sub-sbggr16;
684     &sub-srggb10;
685     &sub-srggb10alaw8;
686     &sub-srggb10dpcm8;
687     &sub-srggb12;
688   </section>
689
690   <section id="yuv-formats">
691     <title>YUV Formats</title>
692
693     <para>YUV is the format native to TV broadcast and composite video
694 signals. It separates the brightness information (Y) from the color
695 information (U and V or Cb and Cr). The color information consists of
696 red and blue <emphasis>color difference</emphasis> signals, this way
697 the green component can be reconstructed by subtracting from the
698 brightness component. See <xref linkend="colorspaces" /> for conversion
699 examples. YUV was chosen because early television would only transmit
700 brightness information. To add color in a way compatible with existing
701 receivers a new signal carrier was added to transmit the color
702 difference signals. Secondary in the YUV format the U and V components
703 usually have lower resolution than the Y component. This is an analog
704 video compression technique taking advantage of a property of the
705 human visual system, being more sensitive to brightness
706 information.</para>
707
708     &sub-packed-yuv;
709     &sub-grey;
710     &sub-y10;
711     &sub-y12;
712     &sub-y10b;
713     &sub-y16;
714     &sub-uv8;
715     &sub-yuyv;
716     &sub-uyvy;
717     &sub-yvyu;
718     &sub-vyuy;
719     &sub-y41p;
720     &sub-yuv420;
721     &sub-yuv420m;
722     &sub-yvu420m;
723     &sub-yuv410;
724     &sub-yuv422p;
725     &sub-yuv411p;
726     &sub-nv12;
727     &sub-nv12m;
728     &sub-nv12mt;
729     &sub-nv16;
730     &sub-nv16m;
731     &sub-nv24;
732     &sub-m420;
733   </section>
734
735   <section>
736     <title>Compressed Formats</title>
737
738     <table pgwide="1" frame="none" id="compressed-formats">
739       <title>Compressed Image Formats</title>
740       <tgroup cols="3" align="left">
741         &cs-def;
742         <thead>
743           <row>
744             <entry>Identifier</entry>
745             <entry>Code</entry>
746             <entry>Details</entry>
747           </row>
748         </thead>
749         <tbody valign="top">
750          <row id="V4L2-PIX-FMT-JPEG">
751             <entry><constant>V4L2_PIX_FMT_JPEG</constant></entry>
752             <entry>'JPEG'</entry>
753             <entry>TBD. See also &VIDIOC-G-JPEGCOMP;,
754             &VIDIOC-S-JPEGCOMP;.</entry>
755           </row>
756           <row id="V4L2-PIX-FMT-MPEG">
757             <entry><constant>V4L2_PIX_FMT_MPEG</constant></entry>
758             <entry>'MPEG'</entry>
759             <entry>MPEG multiplexed stream. The actual format is determined by
760 extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see
761 <xref linkend="mpeg-control-id" />.</entry>
762           </row>
763           <row id="V4L2-PIX-FMT-H264">
764                 <entry><constant>V4L2_PIX_FMT_H264</constant></entry>
765                 <entry>'H264'</entry>
766                 <entry>H264 video elementary stream with start codes.</entry>
767           </row>
768           <row id="V4L2-PIX-FMT-H264-NO-SC">
769                 <entry><constant>V4L2_PIX_FMT_H264_NO_SC</constant></entry>
770                 <entry>'AVC1'</entry>
771                 <entry>H264 video elementary stream without start codes.</entry>
772           </row>
773           <row id="V4L2-PIX-FMT-H264-MVC">
774                 <entry><constant>V4L2_PIX_FMT_H264_MVC</constant></entry>
775                 <entry>'MVC'</entry>
776                 <entry>H264 MVC video elementary stream.</entry>
777           </row>
778           <row id="V4L2-PIX-FMT-H263">
779                 <entry><constant>V4L2_PIX_FMT_H263</constant></entry>
780                 <entry>'H263'</entry>
781                 <entry>H263 video elementary stream.</entry>
782           </row>
783           <row id="V4L2-PIX-FMT-MPEG1">
784                 <entry><constant>V4L2_PIX_FMT_MPEG1</constant></entry>
785                 <entry>'MPG1'</entry>
786                 <entry>MPEG1 video elementary stream.</entry>
787           </row>
788           <row id="V4L2-PIX-FMT-MPEG2">
789                 <entry><constant>V4L2_PIX_FMT_MPEG2</constant></entry>
790                 <entry>'MPG2'</entry>
791                 <entry>MPEG2 video elementary stream.</entry>
792           </row>
793           <row id="V4L2-PIX-FMT-MPEG4">
794                 <entry><constant>V4L2_PIX_FMT_MPEG4</constant></entry>
795                 <entry>'MPG4'</entry>
796                 <entry>MPEG4 video elementary stream.</entry>
797           </row>
798           <row id="V4L2-PIX-FMT-XVID">
799                 <entry><constant>V4L2_PIX_FMT_XVID</constant></entry>
800                 <entry>'XVID'</entry>
801                 <entry>Xvid video elementary stream.</entry>
802           </row>
803           <row id="V4L2-PIX-FMT-VC1-ANNEX-G">
804                 <entry><constant>V4L2_PIX_FMT_VC1_ANNEX_G</constant></entry>
805                 <entry>'VC1G'</entry>
806                 <entry>VC1, SMPTE 421M Annex G compliant stream.</entry>
807           </row>
808           <row id="V4L2-PIX-FMT-VC1-ANNEX-L">
809                 <entry><constant>V4L2_PIX_FMT_VC1_ANNEX_L</constant></entry>
810                 <entry>'VC1L'</entry>
811                 <entry>VC1, SMPTE 421M Annex L compliant stream.</entry>
812           </row>
813           <row id="V4L2-PIX-FMT-VP8">
814                 <entry><constant>V4L2_PIX_FMT_VP8</constant></entry>
815                 <entry>'VP8'</entry>
816                 <entry>VP8 video elementary stream.</entry>
817           </row>
818         </tbody>
819       </tgroup>
820     </table>
821   </section>
822
823   <section id="sdr-formats">
824     <title>SDR Formats</title>
825
826     <para>These formats are used for <link linkend="sdr">SDR Capture</link>
827 interface only.</para>
828
829     &sub-sdr-cu08;
830     &sub-sdr-cu16le;
831
832   </section>
833
834   <section id="pixfmt-reserved">
835     <title>Reserved Format Identifiers</title>
836
837     <para>These formats are not defined by this specification, they
838 are just listed for reference and to avoid naming conflicts. If you
839 want to register your own format, send an e-mail to the linux-media mailing
840 list &v4l-ml; for inclusion in the <filename>videodev2.h</filename>
841 file. If you want to share your format with other developers add a
842 link to your documentation and send a copy to the linux-media mailing list
843 for inclusion in this section. If you think your format should be listed
844 in a standard format section please make a proposal on the linux-media mailing
845 list.</para>
846
847     <table pgwide="1" frame="none" id="reserved-formats">
848       <title>Reserved Image Formats</title>
849       <tgroup cols="3" align="left">
850         &cs-def;
851         <thead>
852           <row>
853             <entry>Identifier</entry>
854             <entry>Code</entry>
855             <entry>Details</entry>
856           </row>
857         </thead>
858         <tbody valign="top">
859           <row id="V4L2-PIX-FMT-DV">
860             <entry><constant>V4L2_PIX_FMT_DV</constant></entry>
861             <entry>'dvsd'</entry>
862             <entry>unknown</entry>
863           </row>
864           <row id="V4L2-PIX-FMT-ET61X251">
865             <entry><constant>V4L2_PIX_FMT_ET61X251</constant></entry>
866             <entry>'E625'</entry>
867             <entry>Compressed format of the ET61X251 driver.</entry>
868           </row>
869           <row id="V4L2-PIX-FMT-HI240">
870             <entry><constant>V4L2_PIX_FMT_HI240</constant></entry>
871             <entry>'HI24'</entry>
872             <entry><para>8 bit RGB format used by the BTTV driver.</para></entry>
873           </row>
874           <row id="V4L2-PIX-FMT-HM12">
875             <entry><constant>V4L2_PIX_FMT_HM12</constant></entry>
876             <entry>'HM12'</entry>
877             <entry><para>YUV 4:2:0 format used by the
878 IVTV driver, <ulink url="http://www.ivtvdriver.org/">
879 http://www.ivtvdriver.org/</ulink></para><para>The format is documented in the
880 kernel sources in the file <filename>Documentation/video4linux/cx2341x/README.hm12</filename>
881 </para></entry>
882           </row>
883           <row id="V4L2-PIX-FMT-CPIA1">
884             <entry><constant>V4L2_PIX_FMT_CPIA1</constant></entry>
885             <entry>'CPIA'</entry>
886             <entry>YUV format used by the gspca cpia1 driver.</entry>
887           </row>
888           <row id="V4L2-PIX-FMT-JPGL">
889             <entry><constant>V4L2_PIX_FMT_JPGL</constant></entry>
890             <entry>'JPGL'</entry>
891             <entry>JPEG-Light format (Pegasus Lossless JPEG)
892                         used in Divio webcams NW 80x.</entry>
893           </row>
894           <row id="V4L2-PIX-FMT-SPCA501">
895             <entry><constant>V4L2_PIX_FMT_SPCA501</constant></entry>
896             <entry>'S501'</entry>
897             <entry>YUYV per line used by the gspca driver.</entry>
898           </row>
899           <row id="V4L2-PIX-FMT-SPCA505">
900             <entry><constant>V4L2_PIX_FMT_SPCA505</constant></entry>
901             <entry>'S505'</entry>
902             <entry>YYUV per line used by the gspca driver.</entry>
903           </row>
904           <row id="V4L2-PIX-FMT-SPCA508">
905             <entry><constant>V4L2_PIX_FMT_SPCA508</constant></entry>
906             <entry>'S508'</entry>
907             <entry>YUVY per line used by the gspca driver.</entry>
908           </row>
909           <row id="V4L2-PIX-FMT-SPCA561">
910             <entry><constant>V4L2_PIX_FMT_SPCA561</constant></entry>
911             <entry>'S561'</entry>
912             <entry>Compressed GBRG Bayer format used by the gspca driver.</entry>
913           </row>
914           <row id="V4L2-PIX-FMT-PAC207">
915             <entry><constant>V4L2_PIX_FMT_PAC207</constant></entry>
916             <entry>'P207'</entry>
917             <entry>Compressed BGGR Bayer format used by the gspca driver.</entry>
918           </row>
919           <row id="V4L2-PIX-FMT-MR97310A">
920             <entry><constant>V4L2_PIX_FMT_MR97310A</constant></entry>
921             <entry>'M310'</entry>
922             <entry>Compressed BGGR Bayer format used by the gspca driver.</entry>
923           </row>
924           <row id="V4L2-PIX-FMT-JL2005BCD">
925             <entry><constant>V4L2_PIX_FMT_JL2005BCD</constant></entry>
926             <entry>'JL20'</entry>
927             <entry>JPEG compressed RGGB Bayer format used by the gspca driver.</entry>
928           </row>
929           <row id="V4L2-PIX-FMT-OV511">
930             <entry><constant>V4L2_PIX_FMT_OV511</constant></entry>
931             <entry>'O511'</entry>
932             <entry>OV511 JPEG format used by the gspca driver.</entry>
933           </row>
934           <row id="V4L2-PIX-FMT-OV518">
935             <entry><constant>V4L2_PIX_FMT_OV518</constant></entry>
936             <entry>'O518'</entry>
937             <entry>OV518 JPEG format used by the gspca driver.</entry>
938           </row>
939           <row id="V4L2-PIX-FMT-PJPG">
940             <entry><constant>V4L2_PIX_FMT_PJPG</constant></entry>
941             <entry>'PJPG'</entry>
942             <entry>Pixart 73xx JPEG format used by the gspca driver.</entry>
943           </row>
944           <row id="V4L2-PIX-FMT-SE401">
945             <entry><constant>V4L2_PIX_FMT_SE401</constant></entry>
946             <entry>'S401'</entry>
947             <entry>Compressed RGB format used by the gspca se401 driver</entry>
948           </row>
949           <row id="V4L2-PIX-FMT-SQ905C">
950             <entry><constant>V4L2_PIX_FMT_SQ905C</constant></entry>
951             <entry>'905C'</entry>
952             <entry>Compressed RGGB bayer format used by the gspca driver.</entry>
953           </row>
954           <row id="V4L2-PIX-FMT-MJPEG">
955             <entry><constant>V4L2_PIX_FMT_MJPEG</constant></entry>
956             <entry>'MJPG'</entry>
957             <entry>Compressed format used by the Zoran driver</entry>
958           </row>
959           <row id="V4L2-PIX-FMT-PWC1">
960             <entry><constant>V4L2_PIX_FMT_PWC1</constant></entry>
961             <entry>'PWC1'</entry>
962             <entry>Compressed format of the PWC driver.</entry>
963           </row>
964           <row id="V4L2-PIX-FMT-PWC2">
965             <entry><constant>V4L2_PIX_FMT_PWC2</constant></entry>
966             <entry>'PWC2'</entry>
967             <entry>Compressed format of the PWC driver.</entry>
968           </row>
969           <row id="V4L2-PIX-FMT-SN9C10X">
970             <entry><constant>V4L2_PIX_FMT_SN9C10X</constant></entry>
971             <entry>'S910'</entry>
972             <entry>Compressed format of the SN9C102 driver.</entry>
973           </row>
974           <row id="V4L2-PIX-FMT-SN9C20X-I420">
975             <entry><constant>V4L2_PIX_FMT_SN9C20X_I420</constant></entry>
976             <entry>'S920'</entry>
977             <entry>YUV 4:2:0 format of the gspca sn9c20x driver.</entry>
978           </row>
979           <row id="V4L2-PIX-FMT-SN9C2028">
980             <entry><constant>V4L2_PIX_FMT_SN9C2028</constant></entry>
981             <entry>'SONX'</entry>
982             <entry>Compressed GBRG bayer format of the gspca sn9c2028 driver.</entry>
983           </row>
984           <row id="V4L2-PIX-FMT-STV0680">
985             <entry><constant>V4L2_PIX_FMT_STV0680</constant></entry>
986             <entry>'S680'</entry>
987             <entry>Bayer format of the gspca stv0680 driver.</entry>
988           </row>
989           <row id="V4L2-PIX-FMT-WNVA">
990             <entry><constant>V4L2_PIX_FMT_WNVA</constant></entry>
991             <entry>'WNVA'</entry>
992             <entry><para>Used by the Winnov Videum driver, <ulink
993 url="http://www.thedirks.org/winnov/">
994 http://www.thedirks.org/winnov/</ulink></para></entry>
995           </row>
996           <row id="V4L2-PIX-FMT-TM6000">
997             <entry><constant>V4L2_PIX_FMT_TM6000</constant></entry>
998             <entry>'TM60'</entry>
999             <entry><para>Used by Trident tm6000</para></entry>
1000           </row>
1001           <row id="V4L2-PIX-FMT-CIT-YYVYUY">
1002             <entry><constant>V4L2_PIX_FMT_CIT_YYVYUY</constant></entry>
1003             <entry>'CITV'</entry>
1004             <entry><para>Used by xirlink CIT, found at IBM webcams.</para>
1005                    <para>Uses one line of Y then 1 line of VYUY</para>
1006             </entry>
1007           </row>
1008           <row id="V4L2-PIX-FMT-KONICA420">
1009             <entry><constant>V4L2_PIX_FMT_KONICA420</constant></entry>
1010             <entry>'KONI'</entry>
1011             <entry><para>Used by Konica webcams.</para>
1012                    <para>YUV420 planar in blocks of 256 pixels.</para>
1013             </entry>
1014           </row>
1015           <row id="V4L2-PIX-FMT-YYUV">
1016             <entry><constant>V4L2_PIX_FMT_YYUV</constant></entry>
1017             <entry>'YYUV'</entry>
1018             <entry>unknown</entry>
1019           </row>
1020           <row id="V4L2-PIX-FMT-Y4">
1021             <entry><constant>V4L2_PIX_FMT_Y4</constant></entry>
1022             <entry>'Y04 '</entry>
1023             <entry>Old 4-bit greyscale format. Only the most significant 4 bits of each byte are used,
1024 the other bits are set to 0.</entry>
1025           </row>
1026           <row id="V4L2-PIX-FMT-Y6">
1027             <entry><constant>V4L2_PIX_FMT_Y6</constant></entry>
1028             <entry>'Y06 '</entry>
1029             <entry>Old 6-bit greyscale format. Only the most significant 6 bits of each byte are used,
1030 the other bits are set to 0.</entry>
1031           </row>
1032           <row id="V4L2-PIX-FMT-S5C-UYVY-JPG">
1033             <entry><constant>V4L2_PIX_FMT_S5C_UYVY_JPG</constant></entry>
1034             <entry>'S5CI'</entry>
1035             <entry>Two-planar format used by Samsung S5C73MX cameras. The
1036 first plane contains interleaved JPEG and UYVY image data, followed by meta data
1037 in form of an array of offsets to the UYVY data blocks. The actual pointer array
1038 follows immediately the interleaved JPEG/UYVY data, the number of entries in
1039 this array equals the height of the UYVY image. Each entry is a 4-byte unsigned
1040 integer in big endian order and it's an offset to a single pixel line of the
1041 UYVY image. The first plane can start either with JPEG or UYVY data chunk. The
1042 size of a single UYVY block equals the UYVY image's width multiplied by 2. The
1043 size of a JPEG chunk depends on the image and can vary with each line.
1044 <para>The second plane, at an offset of 4084 bytes, contains a 4-byte offset to
1045 the pointer array in the first plane. This offset is followed by a 4-byte value
1046 indicating size of the pointer array. All numbers in the second plane are also
1047 in big endian order. Remaining data in the second plane is undefined. The
1048 information in the second plane allows to easily find location of the pointer
1049 array, which can be different for each frame. The size of the pointer array is
1050 constant for given UYVY image height.</para>
1051 <para>In order to extract UYVY and JPEG frames an application can initially set
1052 a data pointer to the start of first plane and then add an offset from the first
1053 entry of the pointers table. Such a pointer indicates start of an UYVY image
1054 pixel line. Whole UYVY line can be copied to a separate buffer. These steps
1055 should be repeated for each line, i.e. the number of entries in the pointer
1056 array. Anything what's in between the UYVY lines is JPEG data and should be
1057 concatenated to form the JPEG stream. </para>
1058 </entry>
1059           </row>
1060         </tbody>
1061       </tgroup>
1062     </table>
1063   </section>