From 9d2f9d16a14e00489f8b8b22f12031836e64f282 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sun, 5 May 2019 19:08:55 +0900 Subject: [PATCH] video-color: Define bt2020-10 transfer characteristics for clarity bt707, bt2020-10, and bt2020-12 transfer characteristics are functionally identical but have their own unique values by specification. --- gst-libs/gst/video/video-color.c | 3 +++ gst-libs/gst/video/video-color.h | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/video-color.c b/gst-libs/gst/video/video-color.c index e2cac8203d..c23033daae 100644 --- a/gst-libs/gst/video/video-color.c +++ b/gst-libs/gst/video/video-color.c @@ -76,6 +76,7 @@ static const ColorimetryInfo colorimetry[] = { MAKE_COLORIMETRY (SMPTE240M, _16_235, SMPTE240M, SMPTE240M, SMPTE240M), MAKE_COLORIMETRY (SRGB, _0_255, RGB, SRGB, BT709), MAKE_COLORIMETRY (BT2020, _16_235, BT2020, BT2020_12, BT2020), + MAKE_COLORIMETRY (BT2020_10, _16_235, BT2020, BT2020_10, BT2020), MAKE_COLORIMETRY (NONAME, _0_255, BT601, UNKNOWN, UNKNOWN), MAKE_COLORIMETRY (NONAME, _UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN), }; @@ -434,6 +435,7 @@ gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val) res = pow (val, 1.0 / 2.2); break; case GST_VIDEO_TRANSFER_BT709: + case GST_VIDEO_TRANSFER_BT2020_10: if (val < 0.018) res = 4.5 * val; else @@ -522,6 +524,7 @@ gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val) res = pow (val, 2.2); break; case GST_VIDEO_TRANSFER_BT709: + case GST_VIDEO_TRANSFER_BT2020_10: if (val < 0.081) res = val / 4.5; else diff --git a/gst-libs/gst/video/video-color.h b/gst-libs/gst/video/video-color.h index 31a7fab081..4dc6b912ff 100644 --- a/gst-libs/gst/video/video-color.h +++ b/gst-libs/gst/video/video-color.h @@ -90,6 +90,10 @@ gboolean gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * * range. Used for BT.2020 with 12 bits per * component. Since: 1.6 * @GST_VIDEO_TRANSFER_ADOBERGB: Gamma 2.19921875. Since: 1.8 + * @GST_VIDEO_TRANSFER_BT2020_10: Rec. ITU-R BT.2020-2 with 10 bits per component. + * (functionally the same as the values + * GST_VIDEO_TRANSFER_BT709 and GST_VIDEO_TRANSFER_BT2020_12). + * Since: 1.18 * * The video transfer function defines the formula for converting between * non-linear RGB (R'G'B') and linear RGB @@ -107,7 +111,8 @@ typedef enum { GST_VIDEO_TRANSFER_LOG100, GST_VIDEO_TRANSFER_LOG316, GST_VIDEO_TRANSFER_BT2020_12, - GST_VIDEO_TRANSFER_ADOBERGB + GST_VIDEO_TRANSFER_ADOBERGB, + GST_VIDEO_TRANSFER_BT2020_10 } GstVideoTransferFunction; GST_VIDEO_API @@ -205,6 +210,7 @@ typedef struct { #define GST_VIDEO_COLORIMETRY_SMPTE240M "smpte240m" #define GST_VIDEO_COLORIMETRY_SRGB "sRGB" #define GST_VIDEO_COLORIMETRY_BT2020 "bt2020" +#define GST_VIDEO_COLORIMETRY_BT2020_10 "bt2020-10" GST_VIDEO_API gboolean gst_video_colorimetry_matches (const GstVideoColorimetry *cinfo, const gchar *color);