1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Defining Colorspaces in V4L2</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="pixfmt.html" title="Chapter 2. Image Formats"><link rel="prev" href="colorspaces.html" title="Colorspaces"><link rel="next" href="ch02s06.html" title="Detailed Colorspace Descriptions"></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">Defining Colorspaces in V4L2</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="colorspaces.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Image Formats</th><td width="20%" align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1100477812"></a>Defining Colorspaces in V4L2</h2></div></div></div><p>In V4L2 colorspaces are defined by three values. The first is the colorspace 2identifier (enum <a class="link" href="ch02s05.html#v4l2-colorspace" title="Table 2.4. V4L2 Colorspaces">v4l2_colorspace</a>) which defines the chromaticities, the transfer 3function, the default Y'CbCr encoding and the default quantization method. The second 4is the Y'CbCr encoding identifier (enum <a class="link" href="ch02s05.html#v4l2-ycbcr-encoding" title="Table 2.5. V4L2 Y'CbCr Encodings">v4l2_ycbcr_encoding</a>) to specify non-standard 5Y'CbCr encodings and the third is the quantization identifier (enum <a class="link" href="ch02s05.html#v4l2-quantization" title="Table 2.6. V4L2 Quantization Methods">v4l2_quantization</a>) 6to specify non-standard quantization methods. Most of the time only the colorspace 7field of struct <a class="link" href="pixfmt.html#v4l2-pix-format" title="Table 2.1. struct v4l2_pix_format">v4l2_pix_format</a> or struct <a class="link" href="ch02s02.html#v4l2-pix-format-mplane" title="Table 2.3. struct v4l2_pix_format_mplane">v4l2_pix_format_mplane</a> needs to be filled in. Note 8that the default R'G'B' quantization is full range for all colorspaces except for 9BT.2020 which uses limited range R'G'B' quantization.</p><div class="table"><a name="v4l2-colorspace"></a><p class="title"><b>Table 2.4. V4L2 Colorspaces</b></p><div class="table-contents"><table summary="V4L2 Colorspaces" width="100%" border="0"><colgroup><col align="left" class="c1"><col align="left" class="c2"></colgroup><thead><tr><th align="left">Identifier</th><th align="left">Details</th></tr></thead><tbody valign="top"><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_SMPTE170M</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-smpte-170m" title="Colorspace SMPTE 170M (V4L2_COLORSPACE_SMPTE170M)">the section called “Colorspace SMPTE 170M (<code class="constant">V4L2_COLORSPACE_SMPTE170M</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_REC709</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-rec709" title="Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)">the section called “Colorspace Rec. 709 (<code class="constant">V4L2_COLORSPACE_REC709</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_SRGB</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-srgb" title="Colorspace sRGB (V4L2_COLORSPACE_SRGB)">the section called “Colorspace sRGB (<code class="constant">V4L2_COLORSPACE_SRGB</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_ADOBERGB</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-adobergb" title="Colorspace Adobe RGB (V4L2_COLORSPACE_ADOBERGB)">the section called “Colorspace Adobe RGB (<code class="constant">V4L2_COLORSPACE_ADOBERGB</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_BT2020</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-bt2020" title="Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)">the section called “Colorspace BT.2020 (<code class="constant">V4L2_COLORSPACE_BT2020</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_SMPTE240M</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-smpte-240m" title="Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)">the section called “Colorspace SMPTE 240M (<code class="constant">V4L2_COLORSPACE_SMPTE240M</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_470_SYSTEM_M</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-sysm" title="Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)">the section called “Colorspace NTSC 1953 (<code class="constant">V4L2_COLORSPACE_470_SYSTEM_M</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_470_SYSTEM_BG</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-sysbg" title="Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)">the section called “Colorspace EBU Tech. 3213 (<code class="constant">V4L2_COLORSPACE_470_SYSTEM_BG</code>)”</a>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_JPEG</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-jpeg" title="Colorspace JPEG (V4L2_COLORSPACE_JPEG)">the section called “Colorspace JPEG (<code class="constant">V4L2_COLORSPACE_JPEG</code>)”</a>.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-ycbcr-encoding"></a><p class="title"><b>Table 2.5. V4L2 Y'CbCr Encodings</b></p><div class="table-contents"><table summary="V4L2 Y'CbCr Encodings" width="100%" border="0"><colgroup><col align="left" class="c1"><col align="left" class="c2"></colgroup><thead><tr><th align="left">Identifier</th><th align="left">Details</th></tr></thead><tbody valign="top"><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_DEFAULT</code></td><td align="left" valign="top">Use the default Y'CbCr encoding as defined by the colorspace.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_601</code></td><td align="left" valign="top">Use the BT.601 Y'CbCr encoding.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_709</code></td><td align="left" valign="top">Use the Rec. 709 Y'CbCr encoding.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_XV601</code></td><td align="left" valign="top">Use the extended gamut xvYCC BT.601 encoding.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_XV709</code></td><td align="left" valign="top">Use the extended gamut xvYCC Rec. 709 encoding.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_SYCC</code></td><td align="left" valign="top">Use the extended gamut sYCC encoding.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_BT2020</code></td><td align="left" valign="top">Use the default non-constant luminance BT.2020 Y'CbCr encoding.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_YCBCR_ENC_BT2020_CONST_LUM</code></td><td align="left" valign="top">Use the constant luminance BT.2020 Yc'CbcCrc encoding.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-quantization"></a><p class="title"><b>Table 2.6. V4L2 Quantization Methods</b></p><div class="table-contents"><table summary="V4L2 Quantization Methods" width="100%" border="0"><colgroup><col align="left" class="c1"><col align="left" class="c2"></colgroup><thead><tr><th align="left">Identifier</th><th align="left">Details</th></tr></thead><tbody valign="top"><tr><td align="left" valign="top"><code class="constant">V4L2_QUANTIZATION_DEFAULT</code></td><td align="left" valign="top">Use the default quantization encoding as defined by the colorspace. 10This is always full range for R'G'B' (except for the BT.2020 colorspace) and usually 11limited range for Y'CbCr.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_QUANTIZATION_FULL_RANGE</code></td><td align="left" valign="top">Use the full range quantization encoding. I.e. the range [0…1] 12is mapped to [0…255] (with possible clipping to [1…254] to avoid the 130x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to [0…255] 14(with possible clipping to [1…254] to avoid the 0x00 and 0xff values).</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_QUANTIZATION_LIM_RANGE</code></td><td align="left" valign="top">Use the limited range quantization encoding. I.e. the range [0…1] 15is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to [16…240]. 16</td></tr></tbody></table></div></div><br class="table-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="colorspaces.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pixfmt.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Colorspaces </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Detailed Colorspace Descriptions</td></tr></table></div></body></html> 17