176 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2 3****************************4Defining Colorspaces in V4L25****************************6 7In V4L2 colorspaces are defined by four values. The first is the8colorspace identifier (enum :c:type:`v4l2_colorspace`)9which defines the chromaticities, the default transfer function, the10default Y'CbCr encoding and the default quantization method. The second11is the transfer function identifier (enum12:c:type:`v4l2_xfer_func`) to specify non-standard13transfer functions. The third is the Y'CbCr encoding identifier (enum14:c:type:`v4l2_ycbcr_encoding`) to specify15non-standard Y'CbCr encodings and the fourth is the quantization16identifier (enum :c:type:`v4l2_quantization`) to17specify non-standard quantization methods. Most of the time only the18colorspace field of struct :c:type:`v4l2_pix_format`19or struct :c:type:`v4l2_pix_format_mplane`20needs to be filled in.21 22.. _hsv-colorspace:23 24On :ref:`HSV formats <hsv-formats>` the *Hue* is defined as the angle on25the cylindrical color representation. Usually this angle is measured in26degrees, i.e. 0-360. When we map this angle value into 8 bits, there are27two basic ways to do it: Divide the angular value by 2 (0-179), or use the28whole range, 0-255, dividing the angular value by 1.41. The enum29:c:type:`v4l2_hsv_encoding` specifies which encoding is used.30 31.. note:: The default R'G'B' quantization is full range for all32 colorspaces. HSV formats are always full range.33 34.. tabularcolumns:: |p{6.7cm}|p{10.8cm}|35 36.. c:type:: v4l2_colorspace37 38.. flat-table:: V4L2 Colorspaces39 :header-rows: 140 :stub-columns: 041 42 * - Identifier43 - Details44 * - ``V4L2_COLORSPACE_DEFAULT``45 - The default colorspace. This can be used by applications to let46 the driver fill in the colorspace.47 * - ``V4L2_COLORSPACE_SMPTE170M``48 - See :ref:`col-smpte-170m`.49 * - ``V4L2_COLORSPACE_REC709``50 - See :ref:`col-rec709`.51 * - ``V4L2_COLORSPACE_SRGB``52 - See :ref:`col-srgb`.53 * - ``V4L2_COLORSPACE_OPRGB``54 - See :ref:`col-oprgb`.55 * - ``V4L2_COLORSPACE_BT2020``56 - See :ref:`col-bt2020`.57 * - ``V4L2_COLORSPACE_DCI_P3``58 - See :ref:`col-dcip3`.59 * - ``V4L2_COLORSPACE_SMPTE240M``60 - See :ref:`col-smpte-240m`.61 * - ``V4L2_COLORSPACE_470_SYSTEM_M``62 - See :ref:`col-sysm`.63 * - ``V4L2_COLORSPACE_470_SYSTEM_BG``64 - See :ref:`col-sysbg`.65 * - ``V4L2_COLORSPACE_JPEG``66 - See :ref:`col-jpeg`.67 * - ``V4L2_COLORSPACE_RAW``68 - The raw colorspace. This is used for raw image capture where the69 image is minimally processed and is using the internal colorspace70 of the device. The software that processes an image using this71 'colorspace' will have to know the internals of the capture72 device.73 74 75 76.. c:type:: v4l2_xfer_func77 78.. tabularcolumns:: |p{5.5cm}|p{12.0cm}|79 80.. flat-table:: V4L2 Transfer Function81 :header-rows: 182 :stub-columns: 083 84 * - Identifier85 - Details86 * - ``V4L2_XFER_FUNC_DEFAULT``87 - Use the default transfer function as defined by the colorspace.88 * - ``V4L2_XFER_FUNC_709``89 - Use the Rec. 709 transfer function.90 * - ``V4L2_XFER_FUNC_SRGB``91 - Use the sRGB transfer function.92 * - ``V4L2_XFER_FUNC_OPRGB``93 - Use the opRGB transfer function.94 * - ``V4L2_XFER_FUNC_SMPTE240M``95 - Use the SMPTE 240M transfer function.96 * - ``V4L2_XFER_FUNC_NONE``97 - Do not use a transfer function (i.e. use linear RGB values).98 * - ``V4L2_XFER_FUNC_DCI_P3``99 - Use the DCI-P3 transfer function.100 * - ``V4L2_XFER_FUNC_SMPTE2084``101 - Use the SMPTE 2084 transfer function. See :ref:`xf-smpte-2084`.102 103 104 105.. c:type:: v4l2_ycbcr_encoding106 107.. tabularcolumns:: |p{7.2cm}|p{10.3cm}|108 109.. flat-table:: V4L2 Y'CbCr Encodings110 :header-rows: 1111 :stub-columns: 0112 113 * - Identifier114 - Details115 * - ``V4L2_YCBCR_ENC_DEFAULT``116 - Use the default Y'CbCr encoding as defined by the colorspace.117 * - ``V4L2_YCBCR_ENC_601``118 - Use the BT.601 Y'CbCr encoding.119 * - ``V4L2_YCBCR_ENC_709``120 - Use the Rec. 709 Y'CbCr encoding.121 * - ``V4L2_YCBCR_ENC_XV601``122 - Use the extended gamut xvYCC BT.601 encoding.123 * - ``V4L2_YCBCR_ENC_XV709``124 - Use the extended gamut xvYCC Rec. 709 encoding.125 * - ``V4L2_YCBCR_ENC_BT2020``126 - Use the default non-constant luminance BT.2020 Y'CbCr encoding.127 * - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM``128 - Use the constant luminance BT.2020 Yc'CbcCrc encoding.129 * - ``V4L2_YCBCR_ENC_SMPTE_240M``130 - Use the SMPTE 240M Y'CbCr encoding.131 132 133 134.. c:type:: v4l2_hsv_encoding135 136.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|137 138.. flat-table:: V4L2 HSV Encodings139 :header-rows: 1140 :stub-columns: 0141 142 * - Identifier143 - Details144 * - ``V4L2_HSV_ENC_180``145 - For the Hue, each LSB is two degrees.146 * - ``V4L2_HSV_ENC_256``147 - For the Hue, the 360 degrees are mapped into 8 bits, i.e. each148 LSB is roughly 1.41 degrees.149 150 151 152.. c:type:: v4l2_quantization153 154.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|155 156.. flat-table:: V4L2 Quantization Methods157 :header-rows: 1158 :stub-columns: 0159 160 * - Identifier161 - Details162 * - ``V4L2_QUANTIZATION_DEFAULT``163 - Use the default quantization encoding as defined by the164 colorspace. This is always full range for R'G'B' and HSV.165 It is usually limited range for Y'CbCr.166 * - ``V4L2_QUANTIZATION_FULL_RANGE``167 - Use the full range quantization encoding. I.e. the range [0…1] is168 mapped to [0…255] (with possible clipping to [1…254] to avoid the169 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to170 [0…255] (with possible clipping to [1…254] to avoid the 0x00 and171 0xff values).172 * - ``V4L2_QUANTIZATION_LIM_RANGE``173 - Use the limited range quantization encoding. I.e. the range [0…1]174 is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to175 [16…240]. Limited Range cannot be used with HSV.176