diff options
author | Dafna Hirschfeld <dafna.hirschfeld@collabora.com> | 2020-08-27 21:46:09 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-26 10:21:34 +0200 |
commit | 2f491463497ad43bc06968a334747c6b6b20fc74 (patch) | |
tree | 54253229cbae001bb6e1892ccd2a8b9abbcae4ba /include/media | |
parent | b38c73ca1c213bbf8a872b334a6bb835becfaba5 (diff) | |
download | linux-2f491463497ad43bc06968a334747c6b6b20fc74.tar.gz linux-2f491463497ad43bc06968a334747c6b6b20fc74.tar.bz2 linux-2f491463497ad43bc06968a334747c6b6b20fc74.zip |
media: vivid: Add support to the CSC API
The CSC API (Colorspace conversion) allows userspace to try
to configure the colorspace, transfer function, Y'CbCr/HSV encoding
and the quantization for capture devices. This patch adds support
to the CSC API in vivid.
Using the CSC API, userspace is allowed to do the following:
- Set the colorspace.
- Set the xfer_func.
- Set the ycbcr_enc function for YUV formats.
- Set the hsv_enc function for HSV formats
- Set the quantization for YUV and RGB formats.
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-common.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 150ee16ebd81..a3083529b698 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -539,4 +539,33 @@ static inline void v4l2_buffer_set_timestamp(struct v4l2_buffer *buf, buf->timestamp.tv_usec = ts.tv_nsec / NSEC_PER_USEC; } +static inline bool v4l2_is_colorspace_valid(__u32 colorspace) +{ + return colorspace > V4L2_COLORSPACE_DEFAULT && + colorspace <= V4L2_COLORSPACE_DCI_P3; +} + +static inline bool v4l2_is_xfer_func_valid(__u32 xfer_func) +{ + return xfer_func > V4L2_XFER_FUNC_DEFAULT && + xfer_func <= V4L2_XFER_FUNC_SMPTE2084; +} + +static inline bool v4l2_is_ycbcr_enc_valid(__u8 ycbcr_enc) +{ + return ycbcr_enc > V4L2_YCBCR_ENC_DEFAULT && + ycbcr_enc <= V4L2_YCBCR_ENC_SMPTE240M; +} + +static inline bool v4l2_is_hsv_enc_valid(__u8 hsv_enc) +{ + return hsv_enc == V4L2_HSV_ENC_180 || hsv_enc == V4L2_HSV_ENC_256; +} + +static inline bool v4l2_is_quant_valid(__u8 quantization) +{ + return quantization == V4L2_QUANTIZATION_FULL_RANGE || + quantization == V4L2_QUANTIZATION_LIM_RANGE; +} + #endif /* V4L2_COMMON_H_ */ |