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.
This commit is contained in:
Seungha Yang 2019-05-05 19:08:55 +09:00
parent b87f830700
commit 9d2f9d16a1
2 changed files with 10 additions and 1 deletions

View file

@ -76,6 +76,7 @@ static const ColorimetryInfo colorimetry[] = {
MAKE_COLORIMETRY (SMPTE240M, _16_235, SMPTE240M, SMPTE240M, SMPTE240M), MAKE_COLORIMETRY (SMPTE240M, _16_235, SMPTE240M, SMPTE240M, SMPTE240M),
MAKE_COLORIMETRY (SRGB, _0_255, RGB, SRGB, BT709), MAKE_COLORIMETRY (SRGB, _0_255, RGB, SRGB, BT709),
MAKE_COLORIMETRY (BT2020, _16_235, BT2020, BT2020_12, BT2020), 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, _0_255, BT601, UNKNOWN, UNKNOWN),
MAKE_COLORIMETRY (NONAME, _UNKNOWN, UNKNOWN, 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); res = pow (val, 1.0 / 2.2);
break; break;
case GST_VIDEO_TRANSFER_BT709: case GST_VIDEO_TRANSFER_BT709:
case GST_VIDEO_TRANSFER_BT2020_10:
if (val < 0.018) if (val < 0.018)
res = 4.5 * val; res = 4.5 * val;
else else
@ -522,6 +524,7 @@ gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val)
res = pow (val, 2.2); res = pow (val, 2.2);
break; break;
case GST_VIDEO_TRANSFER_BT709: case GST_VIDEO_TRANSFER_BT709:
case GST_VIDEO_TRANSFER_BT2020_10:
if (val < 0.081) if (val < 0.081)
res = val / 4.5; res = val / 4.5;
else else

View file

@ -90,6 +90,10 @@ gboolean gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble *
* range. Used for BT.2020 with 12 bits per * range. Used for BT.2020 with 12 bits per
* component. Since: 1.6 * component. Since: 1.6
* @GST_VIDEO_TRANSFER_ADOBERGB: Gamma 2.19921875. Since: 1.8 * @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 * The video transfer function defines the formula for converting between
* non-linear RGB (R'G'B') and linear RGB * non-linear RGB (R'G'B') and linear RGB
@ -107,7 +111,8 @@ typedef enum {
GST_VIDEO_TRANSFER_LOG100, GST_VIDEO_TRANSFER_LOG100,
GST_VIDEO_TRANSFER_LOG316, GST_VIDEO_TRANSFER_LOG316,
GST_VIDEO_TRANSFER_BT2020_12, GST_VIDEO_TRANSFER_BT2020_12,
GST_VIDEO_TRANSFER_ADOBERGB GST_VIDEO_TRANSFER_ADOBERGB,
GST_VIDEO_TRANSFER_BT2020_10
} GstVideoTransferFunction; } GstVideoTransferFunction;
GST_VIDEO_API GST_VIDEO_API
@ -205,6 +210,7 @@ typedef struct {
#define GST_VIDEO_COLORIMETRY_SMPTE240M "smpte240m" #define GST_VIDEO_COLORIMETRY_SMPTE240M "smpte240m"
#define GST_VIDEO_COLORIMETRY_SRGB "sRGB" #define GST_VIDEO_COLORIMETRY_SRGB "sRGB"
#define GST_VIDEO_COLORIMETRY_BT2020 "bt2020" #define GST_VIDEO_COLORIMETRY_BT2020 "bt2020"
#define GST_VIDEO_COLORIMETRY_BT2020_10 "bt2020-10"
GST_VIDEO_API GST_VIDEO_API
gboolean gst_video_colorimetry_matches (const GstVideoColorimetry *cinfo, const gchar *color); gboolean gst_video_colorimetry_matches (const GstVideoColorimetry *cinfo, const gchar *color);