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 | V4L2_YCBCR_ENC_SMPTE240M = 8, | 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 | * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding. | 351 | * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding. |
| 339 | * This depends on the colorspace. | 352 | * This depends on the colorspace. |
| @@ -362,9 +375,10 @@ enum v4l2_quantization { · 22 unmodified lines | |||
| 362 | * This depends on whether the image is RGB or not, the colorspace and the | 375 | * This depends on whether the image is RGB or not, the colorspace and the |
| 363 | * Y'CbCr encoding. | 376 | * Y'CbCr encoding. |
| 364 | */ | 377 | */ |
| 365 | #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \ | 378 | #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv, colsp, ycbcr_enc) \ |
| 366 | (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \ | 379 | (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ |
| 367 | (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ | 380 | V4L2_QUANTIZATION_LIM_RANGE : \ |
| 381 | (((is_rgb_or_hsv) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ | ||
| 368 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ | 382 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ |
| 369 | (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ | 383 | (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ |
| 370 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) | 384 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) |
| @@ -462,7 +476,12 @@ struct v4l2_pix_format { · 91 unmodified lines | |||
| 462 | __u32 colorspace; /* enum v4l2_colorspace */ | 476 | __u32 colorspace; /* enum v4l2_colorspace */ |
| 463 | __u32 priv; /* private data, depends on pixelformat */ | 477 | __u32 priv; /* private data, depends on pixelformat */ |
| 464 | __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ | 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 | __u32 quantization; /* enum v4l2_quantization */ | 485 | __u32 quantization; /* enum v4l2_quantization */ |
| 467 | __u32 xfer_func; /* enum v4l2_xfer_func */ | 486 | __u32 xfer_func; /* enum v4l2_xfer_func */ |
| 468 | }; | 487 | }; |
| @@ -2012,7 +2031,10 @@ struct v4l2_pix_format_mplane { · 1543 unmodified lines | |||
| 2012 | struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; | 2031 | struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; |
| 2013 | __u8 num_planes; | 2032 | __u8 num_planes; |
| 2014 | __u8 flags; | 2033 | __u8 flags; |
| 2015 | __u8 ycbcr_enc; | 2034 | union { |
| 2035 | __u8 ycbcr_enc; | ||
| 2036 | __u8 hsv_enc; | ||
| 2037 | }; | ||
| 2016 | __u8 quantization; | 2038 | __u8 quantization; |
| 2017 | __u8 xfer_func; | 2039 | __u8 xfer_func; |
| 2018 | __u8 reserved[7]; | 2040 | __u8 reserved[7]; |