diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2022-08-30 13:17:22 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2022-09-01 16:49:59 +0530 |
commit | d09c2bb127d5f96f4f397bd3ca11839840888b46 (patch) | |
tree | 489e3cb376e280a6d76dfe7ed5a658a258590495 /src/libcamera/color_space.cpp | |
parent | e52729e7ec3f735b0078b70e25e5daf2e051c429 (diff) |
libcamera: colorspace: Rectify the ColorSpace::Srgb preset
Rectify the ColorSpace::Srgb to denote that it does not use
any Y'Cbcr encoding and uses full range.
The kernel on the other hand, recommends to use Rec601 as the encoding
for V4L2_COLORSPACE_SRGB. It is not very explicit but it can be
inferred that the kernel assumes V4L2_COLORSPACE_SRGB is a YUV-encoded
one. However, when the data is in RGB, no encoding is required (and
this is denoted by YcbcrEncoding::None in libcamera).
Hence, to be clear on the libcamera colorspace API, rectify the
ColorSpace::Srgb preset to use YcbcrEncoding::None and full range.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/libcamera/color_space.cpp')
-rw-r--r-- | src/libcamera/color_space.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libcamera/color_space.cpp b/src/libcamera/color_space.cpp index 944d0e98..ec34620a 100644 --- a/src/libcamera/color_space.cpp +++ b/src/libcamera/color_space.cpp @@ -49,8 +49,13 @@ namespace libcamera { * - <a href="https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/colorspaces-details.html#col-bt2020">Rec.2020</a> * * Note that there is no guarantee of a 1:1 mapping between color space names - * and definitions in libcamera and V4L2. A notable difference is that the sYCC - * libcamera color space is called JPEG in V4L2 due to historical reasons. + * and definitions in libcamera and V4L2. Two notable differences are + * + * - The sRGB libcamera color space is defined for RGB formats only with no + * Y'CbCr encoding and a full quantization range, while the V4L2 SRGB color + * space has a Y'CbCr encoding and a limited quantization range. + * - The sYCC libcamera color space is called JPEG in V4L2 due to historical + * reasons. * * \todo Define the color space fully in the libcamera API to avoid referencing * V4L2 @@ -138,16 +143,13 @@ const ColorSpace ColorSpace::Raw = { }; /** - * \brief A constant representing the sRGB color space - * - * This is identical to the sYCC color space except that the Y'CbCr - * range is limited rather than full. + * \brief A constant representing the sRGB color space (RGB formats only) */ const ColorSpace ColorSpace::Srgb = { Primaries::Rec709, TransferFunction::Srgb, - YcbcrEncoding::Rec601, - Range::Limited + YcbcrEncoding::None, + Range::Full }; /** |