[libcamera-devel] libcamera: v4l2_device: Map YCbCrEncoding::None to V4L2
diff mbox series

Message ID 20220903230643.19284-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit a03ce60cf969b7b26b25c785f64cb5662635b702
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_device: Map YCbCrEncoding::None to V4L2
Related show

Commit Message

Laurent Pinchart Sept. 3, 2022, 11:06 p.m. UTC
The ycbcrEncodingToV4l2 map is missing the YCbCrEncoding::None encoding,
which results in a failure of V4L2Device::fromColorSpace() to convert
color spaces from libcamera to V4L2 for RGB formats. Fix it by adding
the missing encoding. As V4L2 has no such encoding, use
V4L2_YCBCR_ENC_DEFAULT as the value doesn't matter.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_device.cpp | 2 ++
 1 file changed, 2 insertions(+)

Comments

Nicolas Dufresne via libcamera-devel Sept. 5, 2022, 1:19 a.m. UTC | #1
On Sun, Sep 04, 2022 at 02:06:43AM +0300, Laurent Pinchart via libcamera-devel wrote:
> The ycbcrEncodingToV4l2 map is missing the YCbCrEncoding::None encoding,
> which results in a failure of V4L2Device::fromColorSpace() to convert
> color spaces from libcamera to V4L2 for RGB formats. Fix it by adding
> the missing encoding. As V4L2 has no such encoding, use
> V4L2_YCBCR_ENC_DEFAULT as the value doesn't matter.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/v4l2_device.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 1d899657bf7d..7f251bd820a0 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -796,6 +796,8 @@ static const std::map<ColorSpace::TransferFunction, v4l2_xfer_func> transferFunc
>  };
>  
>  static const std::map<ColorSpace::YcbcrEncoding, v4l2_ycbcr_encoding> ycbcrEncodingToV4l2 = {
> +	/* V4L2 has no "none" encoding. */
> +	{ ColorSpace::YcbcrEncoding::None, V4L2_YCBCR_ENC_DEFAULT },
>  	{ ColorSpace::YcbcrEncoding::Rec601, V4L2_YCBCR_ENC_601 },
>  	{ ColorSpace::YcbcrEncoding::Rec709, V4L2_YCBCR_ENC_709 },
>  	{ ColorSpace::YcbcrEncoding::Rec2020, V4L2_YCBCR_ENC_BT2020 },
Umang Jain Sept. 5, 2022, 10:36 a.m. UTC | #2
Hi Laurent,

Thank you for the patch.

On 9/4/22 4:36 AM, Laurent Pinchart wrote:
> The ycbcrEncodingToV4l2 map is missing the YCbCrEncoding::None encoding,
> which results in a failure of V4L2Device::fromColorSpace() to convert
> color spaces from libcamera to V4L2 for RGB formats. Fix it by adding
> the missing encoding. As V4L2 has no such encoding, use
> V4L2_YCBCR_ENC_DEFAULT as the value doesn't matter.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   src/libcamera/v4l2_device.cpp | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 1d899657bf7d..7f251bd820a0 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -796,6 +796,8 @@ static const std::map<ColorSpace::TransferFunction, v4l2_xfer_func> transferFunc
>   };
>   
>   static const std::map<ColorSpace::YcbcrEncoding, v4l2_ycbcr_encoding> ycbcrEncodingToV4l2 = {
> +	/* V4L2 has no "none" encoding. */
> +	{ ColorSpace::YcbcrEncoding::None, V4L2_YCBCR_ENC_DEFAULT },
>   	{ ColorSpace::YcbcrEncoding::Rec601, V4L2_YCBCR_ENC_601 },
>   	{ ColorSpace::YcbcrEncoding::Rec709, V4L2_YCBCR_ENC_709 },
>   	{ ColorSpace::YcbcrEncoding::Rec2020, V4L2_YCBCR_ENC_BT2020 },

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 1d899657bf7d..7f251bd820a0 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -796,6 +796,8 @@  static const std::map<ColorSpace::TransferFunction, v4l2_xfer_func> transferFunc
 };
 
 static const std::map<ColorSpace::YcbcrEncoding, v4l2_ycbcr_encoding> ycbcrEncodingToV4l2 = {
+	/* V4L2 has no "none" encoding. */
+	{ ColorSpace::YcbcrEncoding::None, V4L2_YCBCR_ENC_DEFAULT },
 	{ ColorSpace::YcbcrEncoding::Rec601, V4L2_YCBCR_ENC_601 },
 	{ ColorSpace::YcbcrEncoding::Rec709, V4L2_YCBCR_ENC_709 },
 	{ ColorSpace::YcbcrEncoding::Rec2020, V4L2_YCBCR_ENC_BT2020 },