mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
media: v4l2-ctrls: Allow unknown HDR10 white point and luminance
SMPTE ST 2086 defines the nominal ranges for mastering display
chromaticity and luminance values. Its Annex A also documents that
CTA 861-G uses zero maximum and minimum luminance values to signal
that the corresponding values are unknown, and the xy chromaticity
coordinate (0, 0) to signal that the white point chromaticity is
unknown.
The V4L2 HDR10 mastering display compound control currently rejects
these values. Consequently, an unknown white point or luminance value
prevents the entire compound control from being updated, making the
other valid mastering display metadata unavailable to userspace.
Accept (0, 0) as an unknown white point and zero as an unknown maximum
or minimum mastering luminance. Continue to reject partially zero white
point coordinates and non-zero values outside the nominal ranges.
Display primary validation remains unchanged.
Document the newly accepted unknown values in the V4L2 userspace API.
Fixes: 1ad0de78e7 ("media: v4l: Add HDR10 static metadata controls")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
466a78e1c9
commit
49af0c7cad
|
|
@ -80,15 +80,25 @@ Colorimetry Control IDs
|
|||
- ``white_point_x``
|
||||
- Specifies the normalized x chromaticity coordinate of the white
|
||||
point of the mastering display in increments of 0.00002.
|
||||
When both ``white_point_x`` and ``white_point_y`` are zero,
|
||||
the white point chromaticity is unknown. If either coordinate is
|
||||
non-zero, both coordinates shall be within their valid ranges.
|
||||
* - __u16
|
||||
- ``white_point_y``
|
||||
- Specifies the normalized y chromaticity coordinate of the white
|
||||
point of the mastering display in increments of 0.00002.
|
||||
When both ``white_point_x`` and ``white_point_y`` are zero,
|
||||
the white point chromaticity is unknown. If either coordinate is
|
||||
non-zero, both coordinates shall be within their valid ranges.
|
||||
* - __u32
|
||||
- ``max_luminance``
|
||||
- Specifies the nominal maximum display luminance of the mastering
|
||||
display in units of 0.0001 cd/m\ :sup:`2`.
|
||||
A value of zero indicates that the nominal maximum display
|
||||
luminance is unknown.
|
||||
* - __u32
|
||||
- ``min_luminance``
|
||||
- specifies the nominal minimum display luminance of the mastering
|
||||
- Specifies the nominal minimum display luminance of the mastering
|
||||
display in units of 0.0001 cd/m\ :sup:`2`.
|
||||
A value of zero indicates that the nominal minimum display
|
||||
luminance is unknown.
|
||||
|
|
|
|||
|
|
@ -1322,24 +1322,41 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (p_hdr10_mastering->white_point_x <
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW ||
|
||||
p_hdr10_mastering->white_point_x >
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH ||
|
||||
p_hdr10_mastering->white_point_y <
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW ||
|
||||
p_hdr10_mastering->white_point_y >
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH)
|
||||
/*
|
||||
* SMPTE ST 2086 Annex A documents that CTA 861-G uses
|
||||
* (0, 0) to indicate that the white point chromaticity
|
||||
* is unknown.
|
||||
*/
|
||||
if (p_hdr10_mastering->white_point_x ||
|
||||
p_hdr10_mastering->white_point_y) {
|
||||
if (p_hdr10_mastering->white_point_x <
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW ||
|
||||
p_hdr10_mastering->white_point_x >
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH ||
|
||||
p_hdr10_mastering->white_point_y <
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW ||
|
||||
p_hdr10_mastering->white_point_y >
|
||||
V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* SMPTE ST 2086 Annex A documents that CTA 861-G uses zero
|
||||
* maximum and minimum luminance values to indicate that
|
||||
* the corresponding values are unknown.
|
||||
*/
|
||||
if (p_hdr10_mastering->max_display_mastering_luminance &&
|
||||
(p_hdr10_mastering->max_display_mastering_luminance <
|
||||
V4L2_HDR10_MASTERING_MAX_LUMA_LOW ||
|
||||
p_hdr10_mastering->max_display_mastering_luminance >
|
||||
V4L2_HDR10_MASTERING_MAX_LUMA_HIGH))
|
||||
return -EINVAL;
|
||||
|
||||
if (p_hdr10_mastering->max_display_mastering_luminance <
|
||||
V4L2_HDR10_MASTERING_MAX_LUMA_LOW ||
|
||||
p_hdr10_mastering->max_display_mastering_luminance >
|
||||
V4L2_HDR10_MASTERING_MAX_LUMA_HIGH ||
|
||||
p_hdr10_mastering->min_display_mastering_luminance <
|
||||
V4L2_HDR10_MASTERING_MIN_LUMA_LOW ||
|
||||
p_hdr10_mastering->min_display_mastering_luminance >
|
||||
V4L2_HDR10_MASTERING_MIN_LUMA_HIGH)
|
||||
if (p_hdr10_mastering->min_display_mastering_luminance &&
|
||||
(p_hdr10_mastering->min_display_mastering_luminance <
|
||||
V4L2_HDR10_MASTERING_MIN_LUMA_LOW ||
|
||||
p_hdr10_mastering->min_display_mastering_luminance >
|
||||
V4L2_HDR10_MASTERING_MIN_LUMA_HIGH))
|
||||
return -EINVAL;
|
||||
|
||||
/* The following restriction comes from ITU-T Rec. H.265 spec */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user