aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/videodev2.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 81045aaabec9..003a91292a4f 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -231,6 +231,15 @@ enum v4l2_colorspace {
231 V4L2_COLORSPACE_RAW = 11, 231 V4L2_COLORSPACE_RAW = 11,
232}; 232};
233 233
234/*
235 * Determine how COLORSPACE_DEFAULT should map to a proper colorspace.
236 * This depends on whether this is a SDTV image (use SMPTE 170M), an
237 * HDTV image (use Rec. 709), or something else (use sRGB).
238 */
239#define V4L2_MAP_COLORSPACE_DEFAULT(is_sdtv, is_hdtv) \
240 ((is_sdtv) ? V4L2_COLORSPACE_SMPTE170M : \
241 ((is_hdtv) ? V4L2_COLORSPACE_REC709 : V4L2_COLORSPACE_SRGB))
242
234enum v4l2_ycbcr_encoding { 243enum v4l2_ycbcr_encoding {
235 /* 244 /*
236 * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the 245 * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
@@ -275,6 +284,16 @@ enum v4l2_ycbcr_encoding {
275 V4L2_YCBCR_ENC_SMPTE240M = 8, 284 V4L2_YCBCR_ENC_SMPTE240M = 8,
276}; 285};
277 286
287/*
288 * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding.
289 * This depends on the colorspace.
290 */
291#define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \
292 ((colsp) == V4L2_COLORSPACE_REC709 ? V4L2_YCBCR_ENC_709 : \
293 ((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \
294 ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \
295 V4L2_YCBCR_ENC_601)))
296
278enum v4l2_quantization { 297enum v4l2_quantization {
279 /* 298 /*
280 * The default for R'G'B' quantization is always full range, except 299 * The default for R'G'B' quantization is always full range, except
@@ -287,6 +306,17 @@ enum v4l2_quantization {
287 V4L2_QUANTIZATION_LIM_RANGE = 2, 306 V4L2_QUANTIZATION_LIM_RANGE = 2,
288}; 307};
289 308
309/*
310 * Determine how QUANTIZATION_DEFAULT should map to a proper quantization.
311 * This depends on whether the image is RGB or not, the colorspace and the
312 * Y'CbCr encoding.
313 */
314#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \
315 (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \
316 (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
317 (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) ? \
318 V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
319
290enum v4l2_priority { 320enum v4l2_priority {
291 V4L2_PRIORITY_UNSET = 0, /* not initialized */ 321 V4L2_PRIORITY_UNSET = 0, /* not initialized */
292 V4L2_PRIORITY_BACKGROUND = 1, 322 V4L2_PRIORITY_BACKGROUND = 1,