Some hardware maps the Hue between 0 and 255 instead of 0-179. Support this format with a new field hsv_enc.
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -334,6 +334,19 @@ enum v4l2_ycbcr_encoding { · 333 unmodified lines | ||
| 334 | 334 | V4L2_YCBCR_ENC_SMPTE240M = 8, |
| 335 | 335 | }; |
| 336 | 336 | |
| 337 | +/* | |
| 338 | + * enum v4l2_hsv_encoding values should not collide with the ones from | |
| 339 | + * enum v4l2_ycbcr_encoding. | |
| 340 | + */ | |
| 341 | +enum v4l2_hsv_encoding { | |
| 342 | + | |
| 343 | + /* Hue mapped to 0 - 179 */ | |
| 344 | + V4L2_HSV_ENC_180 = 128, | |
| 345 | + | |
| 346 | + /* Hue mapped to 0-255 */ | |
| 347 | + V4L2_HSV_ENC_256 = 129, | |
| 348 | +}; | |
| 349 | + | |
| 337 | 350 | /* |
| 338 | 351 | * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding. |
| 339 | 352 | * This depends on the colorspace. |
| @@ -362,9 +375,10 @@ enum v4l2_quantization { · 22 unmodified lines | ||
| 362 | 375 | * This depends on whether the image is RGB or not, the colorspace and the |
| 363 | 376 | * Y'CbCr encoding. |
| 364 | 377 | */ |
| 365 | −#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \ | |
| 366 | − (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \ | |
| 367 | − (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ | |
| 378 | +#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv, colsp, ycbcr_enc) \ | |
| 379 | + (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ | |
| 380 | + V4L2_QUANTIZATION_LIM_RANGE : \ | |
| 381 | + (((is_rgb_or_hsv) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ | |
| 368 | 382 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ |
| 369 | 383 | (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ |
| 370 | 384 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) |
| @@ -462,7 +476,12 @@ struct v4l2_pix_format { · 91 unmodified lines | ||
| 462 | 476 | __u32 colorspace; /* enum v4l2_colorspace */ |
| 463 | 477 | __u32 priv; /* private data, depends on pixelformat */ |
| 464 | 478 | __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ |
| 465 | − __u32 ycbcr_enc; /* enum v4l2_ycbcr_encoding */ | |
| 479 | + union { | |
| 480 | + /* enum v4l2_ycbcr_encoding */ | |
| 481 | + __u32 ycbcr_enc; | |
| 482 | + /* enum v4l2_hsv_encoding */ | |
| 483 | + __u32 hsv_enc; | |
| 484 | + }; | |
| 466 | 485 | __u32 quantization; /* enum v4l2_quantization */ |
| 467 | 486 | __u32 xfer_func; /* enum v4l2_xfer_func */ |
| 468 | 487 | }; |
| @@ -2012,7 +2031,10 @@ struct v4l2_pix_format_mplane { · 1543 unmodified lines | ||
| 2012 | 2031 | struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; |
| 2013 | 2032 | __u8 num_planes; |
| 2014 | 2033 | __u8 flags; |
| 2015 | − __u8 ycbcr_enc; | |
| 2034 | + union { | |
| 2035 | + __u8 ycbcr_enc; | |
| 2036 | + __u8 hsv_enc; | |
| 2037 | + }; | |
| 2016 | 2038 | __u8 quantization; |
| 2017 | 2039 | __u8 xfer_func; |
| 2018 | 2040 | __u8 reserved[7]; |