mirror of
https://github.com/torvalds/linux.git
synced 2024-12-06 11:01:43 +00:00
[media] videodev2.h: add macros to map colorspace defaults
The mapping of COLORSPACE_DEFAULT, YCBCR_ENC_DEFAULT or QUANTIZATION_DEFAULT to proper non-default values is fairly complex, and it is something that needs to be done both in the kernel and in userspace. So add macros that can do this conversion, making this available to both kernel and userspace. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
ed9be0b104
commit
3818c4da43
@ -231,6 +231,15 @@ enum v4l2_colorspace {
|
||||
V4L2_COLORSPACE_RAW = 11,
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine how COLORSPACE_DEFAULT should map to a proper colorspace.
|
||||
* This depends on whether this is a SDTV image (use SMPTE 170M), an
|
||||
* HDTV image (use Rec. 709), or something else (use sRGB).
|
||||
*/
|
||||
#define V4L2_MAP_COLORSPACE_DEFAULT(is_sdtv, is_hdtv) \
|
||||
((is_sdtv) ? V4L2_COLORSPACE_SMPTE170M : \
|
||||
((is_hdtv) ? V4L2_COLORSPACE_REC709 : V4L2_COLORSPACE_SRGB))
|
||||
|
||||
enum v4l2_ycbcr_encoding {
|
||||
/*
|
||||
* Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
|
||||
@ -275,6 +284,16 @@ enum v4l2_ycbcr_encoding {
|
||||
V4L2_YCBCR_ENC_SMPTE240M = 8,
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding.
|
||||
* This depends on the colorspace.
|
||||
*/
|
||||
#define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \
|
||||
((colsp) == V4L2_COLORSPACE_REC709 ? V4L2_YCBCR_ENC_709 : \
|
||||
((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \
|
||||
((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \
|
||||
V4L2_YCBCR_ENC_601)))
|
||||
|
||||
enum v4l2_quantization {
|
||||
/*
|
||||
* The default for R'G'B' quantization is always full range, except
|
||||
@ -287,6 +306,17 @@ enum v4l2_quantization {
|
||||
V4L2_QUANTIZATION_LIM_RANGE = 2,
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine how QUANTIZATION_DEFAULT should map to a proper quantization.
|
||||
* This depends on whether the image is RGB or not, the colorspace and the
|
||||
* Y'CbCr encoding.
|
||||
*/
|
||||
#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \
|
||||
(((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \
|
||||
(((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
|
||||
(ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) ? \
|
||||
V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
|
||||
|
||||
enum v4l2_priority {
|
||||
V4L2_PRIORITY_UNSET = 0, /* not initialized */
|
||||
V4L2_PRIORITY_BACKGROUND = 1,
|
||||
|
Loading…
Reference in New Issue
Block a user