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