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