1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><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="id-1.4.5.7"></a>Defining Colorspaces in V4L2</h2></div></div></div><p>In V4L2 colorspaces are defined by four 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 default transfer
3function, the default Y'CbCr encoding and the default quantization method. The second
4is the transfer function identifier (enum <a class="link" href="ch02s05.html#v4l2-xfer-func" title="Table 2.5. V4L2 Transfer Function">v4l2_xfer_func</a>) to specify non-standard
5transfer functions. The third is the Y'CbCr encoding identifier (enum <a class="link" href="ch02s05.html#v4l2-ycbcr-encoding" title="Table 2.6. V4L2 Y'CbCr Encodings">v4l2_ycbcr_encoding</a>)
6to specify non-standard Y'CbCr encodings and the fourth is the quantization identifier
7(enum <a class="link" href="ch02s05.html#v4l2-quantization" title="Table 2.7. V4L2 Quantization Methods">v4l2_quantization</a>) to specify non-standard quantization methods. Most of the time
8only the colorspace field 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
9be filled in. Note that the default R'G'B' quantization is full range for all
10colorspaces except for BT.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_DEFAULT</code></td><td align="left" valign="top">The default colorspace. This can be used by applications to let the
11	    driver fill in the colorspace.</td></tr><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_DCI_P3</code></td><td align="left" valign="top">See <a class="xref" href="ch02s06.html#col-dcip3" title="Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3)">the section called “Colorspace DCI-P3 (<code class="constant">V4L2_COLORSPACE_DCI_P3</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><tr><td align="left" valign="top"><code class="constant">V4L2_COLORSPACE_RAW</code></td><td align="left" valign="top">The raw colorspace. This is used for raw image capture where
12	    the image is minimally processed and is using the internal colorspace
13	    of the device. The software that processes an image using this
14	    'colorspace' will have to know the internals of the capture device.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-xfer-func"></a><p class="title"><b>Table 2.5. V4L2 Transfer Function</b></p><div class="table-contents"><table summary="V4L2 Transfer Function" 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_XFER_FUNC_DEFAULT</code></td><td align="left" valign="top">Use the default transfer function as defined by the colorspace.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_709</code></td><td align="left" valign="top">Use the Rec. 709 transfer function.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_SRGB</code></td><td align="left" valign="top">Use the sRGB transfer function.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_ADOBERGB</code></td><td align="left" valign="top">Use the AdobeRGB transfer function.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_SMPTE240M</code></td><td align="left" valign="top">Use the SMPTE 240M transfer function.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_NONE</code></td><td align="left" valign="top">Do not use a transfer function (i.e. use linear RGB values).</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_DCI_P3</code></td><td align="left" valign="top">Use the DCI-P3 transfer function.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_XFER_FUNC_SMPTE2084</code></td><td align="left" valign="top">Use the SMPTE 2084 transfer function.</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.6. 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.7. 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.
15This is always full range for R'G'B' (except for the BT.2020 colorspace) and usually
16limited 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]
17is mapped to [0…255] (with possible clipping to [1…254] to avoid the
180x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to [0…255]
19(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]
20is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to [16…240].
21</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>
22