Commit c99caa6b authored by Wim Taymans's avatar Wim Taymans

video-color: add Adobe RGB primaries and transfer function

parent 773e2476
...@@ -282,7 +282,9 @@ static const GstVideoColorPrimariesInfo color_primaries[] = { ...@@ -282,7 +282,9 @@ static const GstVideoColorPrimariesInfo color_primaries[] = {
{GST_VIDEO_COLOR_PRIMARIES_FILM, WP_C, 0.681, 0.319, 0.243, 0.692, 0.145, {GST_VIDEO_COLOR_PRIMARIES_FILM, WP_C, 0.681, 0.319, 0.243, 0.692, 0.145,
0.049}, 0.049},
{GST_VIDEO_COLOR_PRIMARIES_BT2020, WP_D65, 0.708, 0.292, 0.170, 0.797, 0.131, {GST_VIDEO_COLOR_PRIMARIES_BT2020, WP_D65, 0.708, 0.292, 0.170, 0.797, 0.131,
0.046} 0.046},
{GST_VIDEO_COLOR_PRIMARIES_ADOBERGB, WP_D65, 0.64, 0.33, 0.21, 0.71, 0.15,
0.06}
}; };
/** /**
...@@ -459,6 +461,9 @@ gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val) ...@@ -459,6 +461,9 @@ gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
else else
res = 1.0993 * pow (val, 0.45) - 0.0993; res = 1.0993 * pow (val, 0.45) - 0.0993;
break; break;
case GST_VIDEO_TRANSFER_ADOBERGB:
res = pow (val, 1.0 / 2.19921875);
break;
} }
return res; return res;
} }
...@@ -544,6 +549,9 @@ gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val) ...@@ -544,6 +549,9 @@ gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val)
else else
res = pow ((val + 0.0993) / 1.0993, 1.0 / 0.45); res = pow ((val + 0.0993) / 1.0993, 1.0 / 0.45);
break; break;
case GST_VIDEO_TRANSFER_ADOBERGB:
res = pow (val, 2.19921875);
break;
} }
return res; return res;
} }
...@@ -88,6 +88,7 @@ gboolean gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * ...@@ -88,6 +88,7 @@ gboolean gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble *
* @GST_VIDEO_TRANSFER_BT2020_12: Gamma 2.2 curve with a linear segment in the lower * @GST_VIDEO_TRANSFER_BT2020_12: Gamma 2.2 curve with a linear segment in the lower
* 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
* *
* 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
...@@ -104,7 +105,8 @@ typedef enum { ...@@ -104,7 +105,8 @@ typedef enum {
GST_VIDEO_TRANSFER_GAMMA28, GST_VIDEO_TRANSFER_GAMMA28,
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
} GstVideoTransferFunction; } GstVideoTransferFunction;
gdouble gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val); gdouble gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val);
...@@ -120,6 +122,7 @@ gdouble gst_video_color_transfer_decode (GstVideoTransferFunction func, gdo ...@@ -120,6 +122,7 @@ gdouble gst_video_color_transfer_decode (GstVideoTransferFunction func, gdo
* @GST_VIDEO_COLOR_PRIMARIES_SMPTE240M: SMPTE240M primaries * @GST_VIDEO_COLOR_PRIMARIES_SMPTE240M: SMPTE240M primaries
* @GST_VIDEO_COLOR_PRIMARIES_FILM: Generic film * @GST_VIDEO_COLOR_PRIMARIES_FILM: Generic film
* @GST_VIDEO_COLOR_PRIMARIES_BT2020: BT2020 primaries. Since: 1.6. * @GST_VIDEO_COLOR_PRIMARIES_BT2020: BT2020 primaries. Since: 1.6.
* @GST_VIDEO_COLOR_PRIMARIES_ADOBERGB: Adobe RGB primaries. Since: 1.8
* *
* The color primaries define the how to transform linear RGB values to and from * The color primaries define the how to transform linear RGB values to and from
* the CIE XYZ colorspace. * the CIE XYZ colorspace.
...@@ -132,7 +135,8 @@ typedef enum { ...@@ -132,7 +135,8 @@ typedef enum {
GST_VIDEO_COLOR_PRIMARIES_SMPTE170M, GST_VIDEO_COLOR_PRIMARIES_SMPTE170M,
GST_VIDEO_COLOR_PRIMARIES_SMPTE240M, GST_VIDEO_COLOR_PRIMARIES_SMPTE240M,
GST_VIDEO_COLOR_PRIMARIES_FILM, GST_VIDEO_COLOR_PRIMARIES_FILM,
GST_VIDEO_COLOR_PRIMARIES_BT2020 GST_VIDEO_COLOR_PRIMARIES_BT2020,
GST_VIDEO_COLOR_PRIMARIES_ADOBERGB
} GstVideoColorPrimaries; } GstVideoColorPrimaries;
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment