summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-07-18 11:28:37 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-07-18 13:11:17 -0400
commit4f7fefe7efa411e828e7655b8f406f4462d97d81 (patch)
tree02c0c4595ecf7d3da2e702f99955431b8da6938d
parent620f6dc1ef51779c251eeb1de8beb2a8c0db0773 (diff)
downloadgstreamer-plugins-good-4f7fefe7efa411e828e7655b8f406f4462d97d81.tar.gz
v4l2: Fix 4K colorimetry
Since 1.6, the transfer function for BT2020 has been changed from BT709 to BT2020_12. It's the same function, but with more precision. As a side effect, the V4L2 colorpsace didn't match GStreamer colorspace. When GStreamer ended up making a guess, it would not match anything supported by V4L2 anymore. This this by using BT2020_12 for BT2020 colorspace and BT2020 transfer function in replacement of BT709 whenever a 4K resolution is detected.
-rw-r--r--sys/v4l2/gstv4l2object.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index ac06b1fbd..6334a61c0 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -1964,7 +1964,7 @@ gst_v4l2_object_get_colorspace (struct v4l2_format *fmt,
case V4L2_COLORSPACE_BT2020:
cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT2020;
- cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
+ cinfo->transfer = GST_VIDEO_TRANSFER_BT2020_12;
cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT2020;
break;
case V4L2_COLORSPACE_SMPTE240M:
@@ -2066,7 +2066,10 @@ gst_v4l2_object_get_colorspace (struct v4l2_format *fmt,
switch (transfer) {
case V4L2_XFER_FUNC_709:
- cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
+ if (fmt->fmt.pix.height > 2160)
+ cinfo->transfer = GST_VIDEO_TRANSFER_BT2020_12;
+ else
+ cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
break;
case V4L2_XFER_FUNC_SRGB:
cinfo->transfer = GST_VIDEO_TRANSFER_SRGB;