Commit 5f3d32ec authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Mauro Carvalho Chehab

[media] Documentation: Add HSV encodings

Describe the hsv_enc field and its use.
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 8a0d62af
......@@ -121,6 +121,11 @@ Single-planar format structure
- This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output
streams, see :ref:`colorspaces`.
* - enum :c:type:`v4l2_hsv_encoding`
- ``hsv_enc``
- This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output
streams, see :ref:`colorspaces`.
* - enum :c:type:`v4l2_quantization`
- ``quantization``
- This information supplements the ``colorspace`` and must be set by
......
......@@ -78,6 +78,11 @@ describing all planes of that format.
- This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output
streams, see :ref:`colorspaces`.
* - enum :c:type:`v4l2_hsv_encoding`
- ``hsv_enc``
- This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output
streams, see :ref:`colorspaces`.
* - enum :c:type:`v4l2_quantization`
- ``quantization``
- This information supplements the ``colorspace`` and must be set by
......
......@@ -19,9 +19,16 @@ colorspace field of struct :c:type:`v4l2_pix_format`
or struct :c:type:`v4l2_pix_format_mplane`
needs to be filled in.
.. note::
.. _hsv-colorspace:
The default R'G'B' quantization is full range for all
On :ref:`HSV formats <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
:c:type:`v4l2_hsv_encoding` specifies which encoding is used.
.. note:: The default R'G'B' quantization is full range for all
colorspaces except for BT.2020 which uses limited range R'G'B'
quantization.
......@@ -123,6 +130,24 @@ needs to be filled in.
.. c:type:: v4l2_hsv_encoding
.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
.. flat-table:: V4L2 HSV Encodings
:header-rows: 1
:stub-columns: 0
* - Identifier
- Details
* - ``V4L2_HSV_ENC_180``
- For the Hue, each LSB is two degrees.
* - ``V4L2_HSV_ENC_256``
- For the Hue, the 360 degrees are mapped into 8 bits, i.e. each
LSB is roughly 1.41 degrees.
.. c:type:: v4l2_quantization
.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
......@@ -136,7 +161,7 @@ needs to be filled in.
* - ``V4L2_QUANTIZATION_DEFAULT``
- 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 usually limited range for Y'CbCr.
BT.2020 colorspace) and HSV. It is usually limited range for Y'CbCr.
* - ``V4L2_QUANTIZATION_FULL_RANGE``
- 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
......
......@@ -9,7 +9,8 @@ Packed HSV formats
Description
===========
The *hue* (h) is measured in degrees, one LSB represents two degrees.
The *hue* (h) is measured in degrees, the equivalence between degrees and LSBs
depends on the hsv-encoding used, see :ref:`colorspaces`.
The *saturation* (s) and the *value* (v) are measured in percentage of the
cylinder: 0 being the smallest value and 255 the maximum.
......
......@@ -87,6 +87,10 @@ replace symbol V4L2_YCBCR_ENC_XV601 :c:type:`v4l2_ycbcr_encoding`
replace symbol V4L2_YCBCR_ENC_XV709 :c:type:`v4l2_ycbcr_encoding`
replace symbol V4L2_YCBCR_ENC_SMPTE240M :c:type:`v4l2_ycbcr_encoding`
# Documented enum v4l2_hsv_encoding
replace symbol V4L2_HSV_ENC_180 :c:type:`v4l2_hsv_encoding`
replace symbol V4L2_HSV_ENC_256 :c:type:`v4l2_hsv_encoding`
# Documented enum v4l2_quantization
replace symbol V4L2_QUANTIZATION_DEFAULT :c:type:`v4l2_quantization`
replace symbol V4L2_QUANTIZATION_FULL_RANGE :c:type:`v4l2_quantization`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment