2.16. Defining Colorspaces in V4L2¶
In V4L2 colorspaces are defined by four values. The first is the
colorspace identifier (enum v4l2_colorspace
)
which defines the chromaticities, the default transfer function, the
default Y'CbCr encoding and the default quantization method. The second
is the transfer function identifier (enum
v4l2_xfer_func
) to specify non-standard
transfer functions. The third is the Y'CbCr encoding identifier (enum
v4l2_ycbcr_encoding
) to specify
non-standard Y'CbCr encodings and the fourth is the quantization
identifier (enum v4l2_quantization
) to
specify non-standard quantization methods. Most of the time only the
colorspace field of struct v4l2_pix_format
or struct v4l2_pix_format_mplane
needs to be filled in.
On HSV formats the Hue is defined as the angle on
the cylindrical color representation. Usually this angle is measured in
degrees, i.e. 0-360. When we map this angle value into 8 bits, there are
two basic ways to do it: Divide the angular value by 2 (0-179), or use the
whole range, 0-255, dividing the angular value by 1.41. The enum
v4l2_hsv_encoding
specifies which encoding is used.
注釈
The default R'G'B' quantization is full range for all colorspaces except for BT.2020 which uses limited range R'G'B' quantization.
-
v4l2_colorspace
¶
Identifier |
Details |
---|---|
|
The default colorspace. This can be used by applications to let the driver fill in the colorspace. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG). |
|
|
|
The raw colorspace. This is used for raw image capture where the image is minimally processed and is using the internal colorspace of the device. The software that processes an image using this 'colorspace' will have to know the internals of the capture device. |
-
v4l2_xfer_func
¶
Identifier |
Details |
---|---|
|
Use the default transfer function as defined by the colorspace. |
|
Use the Rec. 709 transfer function. |
|
Use the sRGB transfer function. |
|
Use the opRGB transfer function. |
|
Use the SMPTE 240M transfer function. |
|
Do not use a transfer function (i.e. use linear RGB values). |
|
Use the DCI-P3 transfer function. |
|
Use the SMPTE 2084 transfer function. See Transfer Function SMPTE 2084 (V4L2_XFER_FUNC_SMPTE2084). |
-
v4l2_ycbcr_encoding
¶
Identifier |
Details |
---|---|
|
Use the default Y'CbCr encoding as defined by the colorspace. |
|
Use the BT.601 Y'CbCr encoding. |
|
Use the Rec. 709 Y'CbCr encoding. |
|
Use the extended gamut xvYCC BT.601 encoding. |
|
Use the extended gamut xvYCC Rec. 709 encoding. |
|
Use the default non-constant luminance BT.2020 Y'CbCr encoding. |
|
Use the constant luminance BT.2020 Yc'CbcCrc encoding. |
|
Use the SMPTE 240M Y'CbCr encoding. |
-
v4l2_hsv_encoding
¶
Identifier |
Details |
---|---|
|
For the Hue, each LSB is two degrees. |
|
For the Hue, the 360 degrees are mapped into 8 bits, i.e. each LSB is roughly 1.41 degrees. |
-
v4l2_quantization
¶
Identifier |
Details |
---|---|
|
Use the default quantization encoding as defined by the colorspace. This is always full range for R'G'B' (except for the BT.2020 colorspace) and HSV. It is usually limited range for Y'CbCr. |
|
Use the full range quantization encoding. I.e. the range [0…1] is mapped to [0…255] (with possible clipping to [1…254] to avoid the 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to [0…255] (with possible clipping to [1…254] to avoid the 0x00 and 0xff values). |
|
Use the limited range quantization encoding. I.e. the range [0…1] is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to [16…240]. |