1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter&#160;2.&#160;Image Formats</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="v4l2spec.html" title="Part&#160;I.&#160;Video for Linux Two API Specification"><link rel="prev" href="streaming-par.html" title="Streaming Parameters"><link rel="next" href="ch02s02.html" title="Multi-planar format structures"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;2.&#160;Image Formats</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="streaming-par.html">Prev</a>&#160;</td><th width="60%" align="center">Part&#160;I.&#160;Video for Linux Two API Specification</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch02s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="pixfmt"></a>Chapter&#160;2.&#160;Image Formats</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="pixfmt.html#idp1100345860">Single-planar format structure</a></span></dt><dt><span class="section"><a href="ch02s02.html">Multi-planar format structures</a></span></dt><dt><span class="section"><a href="ch02s03.html">Standard Image Formats</a></span></dt><dt><span class="section"><a href="colorspaces.html">Colorspaces</a></span></dt><dt><span class="section"><a href="ch02s05.html">Defining Colorspaces in V4L2</a></span></dt><dt><span class="section"><a href="ch02s06.html">Detailed Colorspace Descriptions</a></span></dt><dd><dl><dt><span class="section"><a href="ch02s06.html#col-smpte-170m">Colorspace SMPTE 170M (<code class="constant">V4L2_COLORSPACE_SMPTE170M</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-rec709">Colorspace Rec. 709 (<code class="constant">V4L2_COLORSPACE_REC709</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-srgb">Colorspace sRGB (<code class="constant">V4L2_COLORSPACE_SRGB</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-adobergb">Colorspace Adobe RGB (<code class="constant">V4L2_COLORSPACE_ADOBERGB</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-bt2020">Colorspace BT.2020 (<code class="constant">V4L2_COLORSPACE_BT2020</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-smpte-240m">Colorspace SMPTE 240M (<code class="constant">V4L2_COLORSPACE_SMPTE240M</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-sysm">Colorspace NTSC 1953 (<code class="constant">V4L2_COLORSPACE_470_SYSTEM_M</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-sysbg">Colorspace EBU Tech. 3213 (<code class="constant">V4L2_COLORSPACE_470_SYSTEM_BG</code>)</a></span></dt><dt><span class="section"><a href="ch02s06.html#col-jpeg">Colorspace JPEG (<code class="constant">V4L2_COLORSPACE_JPEG</code>)</a></span></dt></dl></dd><dt><span class="section"><a href="pixfmt-indexed.html">Indexed Format</a></span></dt><dt><span class="section"><a href="pixfmt-rgb.html">RGB Formats</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="packed-rgb.html">Packed RGB formats</a></span><span class="refpurpose"> &#8212; Packed RGB formats</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-SBGGR8.html">V4L2_PIX_FMT_SBGGR8 ('BA81')</a></span><span class="refpurpose"> &#8212; Bayer RGB format</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-SGBRG8.html">V4L2_PIX_FMT_SGBRG8 ('GBRG')</a></span><span class="refpurpose"> &#8212; Bayer RGB format</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-SGRBG8.html">V4L2_PIX_FMT_SGRBG8 ('GRBG')</a></span><span class="refpurpose"> &#8212; Bayer RGB format</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-SRGGB8.html">V4L2_PIX_FMT_SRGGB8 ('RGGB')</a></span><span class="refpurpose"> &#8212; Bayer RGB format</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-SBGGR16.html">V4L2_PIX_FMT_SBGGR16 ('BYR2')</a></span><span class="refpurpose"> &#8212; Bayer RGB format</span></dt><dt><span class="refentrytitle"><a href="pixfmt-srggb10.html">V4L2_PIX_FMT_SRGGB10 ('RG10'),
2	 V4L2_PIX_FMT_SGRBG10 ('BA10'),
3	 V4L2_PIX_FMT_SGBRG10 ('GB10'),
4	 V4L2_PIX_FMT_SBGGR10 ('BG10'),
5	 </a></span><span class="refpurpose"> &#8212; 10-bit Bayer formats expanded to 16 bits</span></dt><dt><span class="refentrytitle"><a href="pixfmt-srggb10p.html">V4L2_PIX_FMT_SRGGB10P ('pRAA'),
6	 V4L2_PIX_FMT_SGRBG10P ('pgAA'),
7	 V4L2_PIX_FMT_SGBRG10P ('pGAA'),
8	 V4L2_PIX_FMT_SBGGR10P ('pBAA'),
9	 </a></span><span class="refpurpose"> &#8212; 10-bit packed Bayer formats</span></dt><dt><span class="refentrytitle"><a href="re09.html">
10	      V4L2_PIX_FMT_SBGGR10ALAW8 ('aBA8'),
11	      V4L2_PIX_FMT_SGBRG10ALAW8 ('aGA8'),
12	      V4L2_PIX_FMT_SGRBG10ALAW8 ('agA8'),
13	      V4L2_PIX_FMT_SRGGB10ALAW8 ('aRA8'),
14	    </a></span><span class="refpurpose"> &#8212; 10-bit Bayer formats compressed to 8 bits</span></dt><dt><span class="refentrytitle"><a href="pixfmt-srggb10dpcm8.html">
15	 V4L2_PIX_FMT_SBGGR10DPCM8 ('bBA8'),
16	 V4L2_PIX_FMT_SGBRG10DPCM8 ('bGA8'),
17	 V4L2_PIX_FMT_SGRBG10DPCM8 ('BD10'),
18	 V4L2_PIX_FMT_SRGGB10DPCM8 ('bRA8'),
19	 </a></span><span class="refpurpose"> &#8212; 10-bit Bayer formats compressed to 8 bits</span></dt><dt><span class="refentrytitle"><a href="re11.html">V4L2_PIX_FMT_SRGGB12 ('RG12'),
20	 V4L2_PIX_FMT_SGRBG12 ('BA12'),
21	 V4L2_PIX_FMT_SGBRG12 ('GB12'),
22	 V4L2_PIX_FMT_SBGGR12 ('BG12'),
23	 </a></span><span class="refpurpose"> &#8212; 12-bit Bayer formats expanded to 16 bits</span></dt></dl></dd><dt><span class="section"><a href="yuv-formats.html">YUV Formats</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="packed-yuv.html">Packed YUV formats</a></span><span class="refpurpose"> &#8212; Packed YUV formats</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-GREY.html">V4L2_PIX_FMT_GREY ('GREY')</a></span><span class="refpurpose"> &#8212; Grey-scale image</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-Y10.html">V4L2_PIX_FMT_Y10 ('Y10 ')</a></span><span class="refpurpose"> &#8212; Grey-scale image</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-Y12.html">V4L2_PIX_FMT_Y12 ('Y12 ')</a></span><span class="refpurpose"> &#8212; Grey-scale image</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-Y10BPACK.html">V4L2_PIX_FMT_Y10BPACK ('Y10B')</a></span><span class="refpurpose"> &#8212; Grey-scale image as a bit-packed array</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-Y16.html">V4L2_PIX_FMT_Y16 ('Y16 ')</a></span><span class="refpurpose"> &#8212; Grey-scale image</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-UV8.html">V4L2_PIX_FMT_UV8  ('UV8')</a></span><span class="refpurpose"> &#8212; UV plane interleaved</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-YUYV.html">V4L2_PIX_FMT_YUYV ('YUYV')</a></span><span class="refpurpose"> &#8212; Packed format with &#189; horizontal chroma
24resolution, also known as YUV 4:2:2</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-UYVY.html">V4L2_PIX_FMT_UYVY ('UYVY')</a></span><span class="refpurpose"> &#8212; Variation of
25<code class="constant">V4L2_PIX_FMT_YUYV</code> with different order of samples
26in memory</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-YVYU.html">V4L2_PIX_FMT_YVYU ('YVYU')</a></span><span class="refpurpose"> &#8212; Variation of
27<code class="constant">V4L2_PIX_FMT_YUYV</code> with different order of samples
28in memory</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-VYUY.html">V4L2_PIX_FMT_VYUY ('VYUY')</a></span><span class="refpurpose"> &#8212; Variation of
29<code class="constant">V4L2_PIX_FMT_YUYV</code> with different order of samples
30in memory</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-Y41P.html">V4L2_PIX_FMT_Y41P ('Y41P')</a></span><span class="refpurpose"> &#8212; Format with &#188; horizontal chroma
31resolution, also known as YUV 4:1:1</span></dt><dt><span class="refentrytitle"><a href="re24.html">V4L2_PIX_FMT_YVU420 ('YV12'), V4L2_PIX_FMT_YUV420 ('YU12')</a></span><span class="refpurpose"> &#8212; Planar formats with &#189; horizontal and
32vertical chroma resolution, also known as YUV 4:2:0</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-YUV420M.html">V4L2_PIX_FMT_YUV420M ('YM12')</a></span><span class="refpurpose"> &#8212; Variation of <code class="constant">V4L2_PIX_FMT_YUV420</code>
33	  with planes non contiguous in memory. </span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-YVU420M.html">V4L2_PIX_FMT_YVU420M ('YM21')</a></span><span class="refpurpose"> &#8212; Variation of <code class="constant">V4L2_PIX_FMT_YVU420</code>
34	  with planes non contiguous in memory. </span></dt><dt><span class="refentrytitle"><a href="re27.html">V4L2_PIX_FMT_YVU410 ('YVU9'), V4L2_PIX_FMT_YUV410 ('YUV9')</a></span><span class="refpurpose"> &#8212; Planar formats with &#188; horizontal and
35vertical chroma resolution, also known as YUV 4:1:0</span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-YUV422P.html">V4L2_PIX_FMT_YUV422P ('422P')</a></span><span class="refpurpose"> &#8212; Format with &#189; horizontal chroma resolution,
36also known as YUV 4:2:2. Planar layout as opposed to
37<code class="constant">V4L2_PIX_FMT_YUYV</code></span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-YUV411P.html">V4L2_PIX_FMT_YUV411P ('411P')</a></span><span class="refpurpose"> &#8212; Format with &#188; horizontal chroma resolution,
38also known as YUV 4:1:1. Planar layout as opposed to
39<code class="constant">V4L2_PIX_FMT_Y41P</code></span></dt><dt><span class="refentrytitle"><a href="re30.html">V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')</a></span><span class="refpurpose"> &#8212; Formats with &#189; horizontal and vertical
40chroma resolution, also known as YUV 4:2:0. One luminance and one
41chrominance plane with alternating chroma samples as opposed to
42<code class="constant">V4L2_PIX_FMT_YVU420</code></span></dt><dt><span class="refentrytitle"><a href="re31.html">V4L2_PIX_FMT_NV12M ('NM12'), V4L2_PIX_FMT_NV21M ('NM21'), V4L2_PIX_FMT_NV12MT_16X16</a></span><span class="refpurpose"> &#8212; Variation of <code class="constant">V4L2_PIX_FMT_NV12</code> and <code class="constant">V4L2_PIX_FMT_NV21</code> with planes
43	  non contiguous in memory. </span></dt><dt><span class="refentrytitle"><a href="re32.html">V4L2_PIX_FMT_NV12MT ('TM12')</a></span><span class="refpurpose"> &#8212; Formats with &#189; horizontal and vertical
44chroma resolution. This format has two planes - one for luminance and one for
45chrominance. Chroma samples are interleaved. The difference to
46<code class="constant">V4L2_PIX_FMT_NV12</code> is the memory layout. Pixels are
47grouped in macroblocks of 64x32 size. The order of macroblocks in memory is
48also not standard.
49	</span></dt><dt><span class="refentrytitle"><a href="re33.html">V4L2_PIX_FMT_NV16 ('NV16'), V4L2_PIX_FMT_NV61 ('NV61')</a></span><span class="refpurpose"> &#8212; Formats with &#189; horizontal
50chroma resolution, also known as YUV 4:2:2. One luminance and one
51chrominance plane with alternating chroma samples as opposed to
52<code class="constant">V4L2_PIX_FMT_YVU420</code></span></dt><dt><span class="refentrytitle"><a href="re34.html">V4L2_PIX_FMT_NV16M ('NM16'), V4L2_PIX_FMT_NV61M ('NM61')</a></span><span class="refpurpose"> &#8212; Variation of <code class="constant">V4L2_PIX_FMT_NV16</code> and <code class="constant">V4L2_PIX_FMT_NV61</code> with planes
53	  non contiguous in memory. </span></dt><dt><span class="refentrytitle"><a href="re35.html">V4L2_PIX_FMT_NV24 ('NV24'), V4L2_PIX_FMT_NV42 ('NV42')</a></span><span class="refpurpose"> &#8212; Formats with full horizontal and vertical
54chroma resolutions, also known as YUV 4:4:4. One luminance and one
55chrominance plane with alternating chroma samples as opposed to
56<code class="constant">V4L2_PIX_FMT_YVU420</code></span></dt><dt><span class="refentrytitle"><a href="V4L2-PIX-FMT-M420.html">V4L2_PIX_FMT_M420 ('M420')</a></span><span class="refpurpose"> &#8212; Format with &#189; horizontal and vertical chroma
57	resolution, also known as YUV 4:2:0. Hybrid plane line-interleaved
58	layout.</span></dt></dl></dd><dt><span class="section"><a href="ch02s10.html">Compressed Formats</a></span></dt><dt><span class="section"><a href="sdr-formats.html">SDR Formats</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="V4L2-SDR-FMT-CU08.html">V4L2_SDR_FMT_CU8 ('CU08')</a></span><span class="refpurpose"> &#8212; Complex unsigned 8-bit IQ sample</span></dt><dt><span class="refentrytitle"><a href="V4L2-SDR-FMT-CU16LE.html">V4L2_SDR_FMT_CU16LE ('CU16')</a></span><span class="refpurpose"> &#8212; Complex unsigned 16-bit little endian IQ sample</span></dt><dt><span class="refentrytitle"><a href="V4L2-SDR-FMT-CS08.html">V4L2_SDR_FMT_CS8 ('CS08')</a></span><span class="refpurpose"> &#8212; Complex signed 8-bit IQ sample</span></dt><dt><span class="refentrytitle"><a href="V4L2-SDR-FMT-CS14LE.html">V4L2_SDR_FMT_CS14LE ('CS14')</a></span><span class="refpurpose"> &#8212; Complex signed 14-bit little endian IQ sample</span></dt><dt><span class="refentrytitle"><a href="V4L2-SDR-FMT-RU12LE.html">V4L2_SDR_FMT_RU12LE ('RU12')</a></span><span class="refpurpose"> &#8212; Real unsigned 12-bit little endian sample</span></dt></dl></dd><dt><span class="section"><a href="pixfmt-reserved.html">Reserved Format Identifiers</a></span></dt></dl></div><p>The V4L2 API was primarily designed for devices exchanging
59image data with applications. The
60<span class="structname">v4l2_pix_format</span> and <span class="structname">v4l2_pix_format_mplane
61</span> structures define the format and layout of an image in memory.
62The former is used with the single-planar API, while the latter is used with the
63multi-planar version (see <a class="xref" href="planar-apis.html" title="Single- and multi-planar APIs">the section called &#8220;Single- and multi-planar APIs&#8221;</a>). Image formats are
64negotiated with the <a class="link" href="vidioc-g-fmt.html" title="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT"><code class="constant">VIDIOC_S_FMT</code></a> ioctl. (The explanations here focus on video
65capturing and output, for overlay frame buffer formats see also
66<a class="link" href="vidioc-g-fbuf.html" title="ioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF"><code class="constant">VIDIOC_G_FBUF</code></a>.)</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1100345860"></a>Single-planar format structure</h2></div></div></div><div class="table"><a name="v4l2-pix-format"></a><p class="title"><b>Table&#160;2.1.&#160;struct <span class="structname">v4l2_pix_format</span></b></p><div class="table-contents"><table summary="struct v4l2_pix_format" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>width</code></em></td><td valign="top">Image width in pixels.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>height</code></em></td><td valign="top">Image height in pixels. If <em class="structfield"><code>field</code></em> is
67	  one of <code class="constant">V4L2_FIELD_TOP</code>, <code class="constant">V4L2_FIELD_BOTTOM</code>
68	  or <code class="constant">V4L2_FIELD_ALTERNATE</code> then height refers to the
69	  number of lines in the field, otherwise it refers to the number of
70	  lines in the frame (which is twice the field height for interlaced
71	  formats).</td></tr><tr><td colspan="3" valign="top">Applications set these fields to
72request an image size, drivers return the closest possible values. In
73case of planar formats the <em class="structfield"><code>width</code></em> and
74<em class="structfield"><code>height</code></em> applies to the largest plane. To
75avoid ambiguities drivers must return values rounded up to a multiple
76of the scale factor of any smaller planes. For example when the image
77format is YUV 4:2:0, <em class="structfield"><code>width</code></em> and
78<em class="structfield"><code>height</code></em> must be multiples of two.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>pixelformat</code></em></td><td valign="top">The pixel format or type of compression, set by the
79application. This is a little endian <a class="link" href="vidioc-enum-fmt.html#v4l2-fourcc">four character code</a>. V4L2 defines
80standard RGB formats in <a class="xref" href="packed-rgb.html#rgb-formats" title="Table&#160;2.16.&#160;Packed RGB Image Formats">Table&#160;2.16, &#8220;Packed RGB Image Formats&#8221;</a>, YUV formats in <a class="xref" href="yuv-formats.html" title="YUV Formats">the section called &#8220;YUV Formats&#8221;</a>, and reserved codes in <a class="xref" href="pixfmt-reserved.html#reserved-formats" title="Table&#160;2.20.&#160;Reserved Image Formats">Table&#160;2.20, &#8220;Reserved Image Formats&#8221;</a></td></tr><tr><td valign="top">enum&#160;<a class="link" href="field-order.html#v4l2-field" title="Table&#160;3.9.&#160;enum v4l2_field">v4l2_field</a></td><td valign="top"><em class="structfield"><code>field</code></em></td><td valign="top">Video images are typically interlaced. Applications
81can request to capture or output only the top or bottom field, or both
82fields interlaced or sequentially stored in one buffer or alternating
83in separate buffers. Drivers return the actual field order selected.
84For more details on fields see <a class="xref" href="field-order.html" title="Field Order">the section called &#8220;Field Order&#8221;</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>bytesperline</code></em></td><td valign="top">Distance in bytes between the leftmost pixels in two
85adjacent lines.</td></tr><tr><td colspan="3" valign="top"><p>Both applications and drivers
86can set this field to request padding bytes at the end of each line.
87Drivers however may ignore the value requested by the application,
88returning <em class="structfield"><code>width</code></em> times bytes per pixel or a
89larger value required by the hardware. That implies applications can
90just set this field to zero to get a reasonable
91default.</p><p>Video hardware may access padding bytes,
92therefore they must reside in accessible memory. Consider cases where
93padding bytes after the last line of an image cross a system page
94boundary. Input devices may write padding bytes, the value is
95undefined. Output devices ignore the contents of padding
96bytes.</p><p>When the image format is planar the
97<em class="structfield"><code>bytesperline</code></em> value applies to the first
98plane and is divided by the same factor as the
99<em class="structfield"><code>width</code></em> field for the other planes. For
100example the Cb and Cr planes of a YUV 4:2:0 image have half as many
101padding bytes following each line as the Y plane. To avoid ambiguities
102drivers must return a <em class="structfield"><code>bytesperline</code></em> value
103rounded up to a multiple of the scale factor.</p>
104<p>For compressed formats the <em class="structfield"><code>bytesperline</code></em>
105value makes no sense. Applications and drivers must set this to 0 in
106that case.</p></td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>sizeimage</code></em></td><td valign="top">Size in bytes of the buffer to hold a complete image,
107set by the driver. Usually this is
108<em class="structfield"><code>bytesperline</code></em> times
109<em class="structfield"><code>height</code></em>. When the image consists of variable
110length compressed data this is the maximum number of bytes required to
111hold an image.</td></tr><tr><td valign="top">enum&#160;<a class="link" href="ch02s05.html#v4l2-colorspace" title="Table&#160;2.4.&#160;V4L2 Colorspaces">v4l2_colorspace</a></td><td valign="top"><em class="structfield"><code>colorspace</code></em></td><td valign="top">This information supplements the
112<em class="structfield"><code>pixelformat</code></em> and must be set by the driver for
113capture streams and by the application for output streams,
114see <a class="xref" href="colorspaces.html" title="Colorspaces">the section called &#8220;Colorspaces&#8221;</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>priv</code></em></td><td valign="top"><p>This field indicates whether the remaining fields of the
115<span class="structname">v4l2_pix_format</span> structure, also called the extended
116fields, are valid. When set to <code class="constant">V4L2_PIX_FMT_PRIV_MAGIC</code>, it
117indicates that the extended fields have been correctly initialized. When set to
118any other value it indicates that the extended fields contain undefined values.
119</p>
120<p>Applications that wish to use the pixel format extended fields must first
121ensure that the feature is supported by querying the device for the
122<a class="link" href="querycap.html" title="Querying Capabilities"><code class="constant">V4L2_CAP_EXT_PIX_FORMAT</code></a>
123capability. If the capability isn't set the pixel format extended fields are not
124supported and using the extended fields will lead to undefined results.</p>
125<p>To use the extended fields, applications must set the
126<em class="structfield"><code>priv</code></em> field to
127<code class="constant">V4L2_PIX_FMT_PRIV_MAGIC</code>, initialize all the extended fields
128and zero the unused bytes of the <span class="structname">v4l2_format</span>
129<em class="structfield"><code>raw_data</code></em> field.</p>
130<p>When the <em class="structfield"><code>priv</code></em> field isn't set to
131<code class="constant">V4L2_PIX_FMT_PRIV_MAGIC</code> drivers must act as if all the
132extended fields were set to zero. On return drivers must set the
133<em class="structfield"><code>priv</code></em> field to
134<code class="constant">V4L2_PIX_FMT_PRIV_MAGIC</code> and all the extended fields to
135applicable values.</p></td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Flags set by the application or driver, see <a class="xref" href="pixfmt-reserved.html#format-flags" title="Table&#160;2.21.&#160;Format Flags">Table&#160;2.21, &#8220;Format Flags&#8221;</a>.</td></tr><tr><td valign="top">enum&#160;<a class="link" href="ch02s05.html#v4l2-ycbcr-encoding" title="Table&#160;2.5.&#160;V4L2 Y'CbCr Encodings">v4l2_ycbcr_encoding</a></td><td valign="top"><em class="structfield"><code>ycbcr_enc</code></em></td><td valign="top">This information supplements the
136<em class="structfield"><code>colorspace</code></em> and must be set by the driver for
137capture streams and by the application for output streams,
138see <a class="xref" href="colorspaces.html" title="Colorspaces">the section called &#8220;Colorspaces&#8221;</a>.</td></tr><tr><td valign="top">enum&#160;<a class="link" href="ch02s05.html#v4l2-quantization" title="Table&#160;2.6.&#160;V4L2 Quantization Methods">v4l2_quantization</a></td><td valign="top"><em class="structfield"><code>quantization</code></em></td><td valign="top">This information supplements the
139<em class="structfield"><code>colorspace</code></em> and must be set by the driver for
140capture streams and by the application for output streams,
141see <a class="xref" href="colorspaces.html" title="Colorspaces">the section called &#8220;Colorspaces&#8221;</a>.</td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="streaming-par.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="v4l2spec.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch02s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Streaming Parameters&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Multi-planar format structures</td></tr></table></div></body></html>
142