video: Rename video_color_transfer to video_transfer_function

Rename remaining `gst_video_color_transfer_{encode,decode}` functions on
the `GstVideoTransferFunction` enumeration to
`gst_video_transfer_function_{encode,decode}` permitting
gobject-introspection to turn these into associated functions and place
them under the respective `<enumeration>` block in gir XML files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/805>
This commit is contained in:
Marijn Suijten 2020-09-11 20:15:14 +02:00 committed by Sebastian Dröge
parent b4ea8332f5
commit d0f36c7e13
4 changed files with 50 additions and 12 deletions

View file

@ -399,6 +399,21 @@ gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr,
* @func: a #GstVideoTransferFunction
* @val: a value
*
* Deprecated: Use gst_video_transfer_function_encode() instead.
*
* Since: 1.6
*/
gdouble
gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
{
return gst_video_transfer_function_encode (func, val);
}
/**
* gst_video_transfer_function_encode:
* @func: a #GstVideoTransferFunction
* @val: a value
*
* Convert @val to its gamma encoded value.
*
* For a linear value L in the range [0..1], conversion to the non-linear
@ -413,10 +428,10 @@ gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr,
*
* Returns: the gamma encoded value of @val
*
* Since: 1.6
* Since: 1.20
*/
gdouble
gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
gst_video_transfer_function_encode (GstVideoTransferFunction func, gdouble val)
{
gdouble res;
@ -516,6 +531,21 @@ gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
* @func: a #GstVideoTransferFunction
* @val: a value
*
* Deprecated: Use gst_video_transfer_function_decode() instead.
*
* Since: 1.6
*/
gdouble
gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val)
{
return gst_video_transfer_function_decode (func, val);
}
/**
* gst_video_transfer_function_decode:
* @func: a #GstVideoTransferFunction
* @val: a value
*
* Convert @val to its gamma decoded value. This is the inverse operation of
* @gst_video_color_transfer_encode().
*
@ -531,10 +561,10 @@ gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
*
* Returns: the gamma decoded value of @val
*
* Since: 1.6
* Since: 1.20
*/
gdouble
gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val)
gst_video_transfer_function_decode (GstVideoTransferFunction func, gdouble val)
{
gdouble res;

View file

@ -138,11 +138,15 @@ typedef enum {
GST_VIDEO_TRANSFER_BT601
} GstVideoTransferFunction;
GST_VIDEO_DEPRECATED_FOR(gst_video_transfer_function_encode)
gdouble gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val);
GST_VIDEO_API
gdouble gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val);
gdouble gst_video_transfer_function_encode (GstVideoTransferFunction func, gdouble val);
GST_VIDEO_DEPRECATED_FOR(gst_video_transfer_function_decode)
gdouble gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val);
GST_VIDEO_API
gdouble gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val);
gdouble gst_video_transfer_function_decode (GstVideoTransferFunction func, gdouble val);
/**
* GstVideoColorPrimaries:

View file

@ -1523,7 +1523,8 @@ setup_gamma_decode (GstVideoConverter * convert)
t = convert->gamma_dec.gamma_table = g_malloc (sizeof (guint16) * 256);
for (i = 0; i < 256; i++)
t[i] = rint (gst_video_color_transfer_decode (func, i / 255.0) * 65535.0);
t[i] =
rint (gst_video_transfer_function_decode (func, i / 255.0) * 65535.0);
} else {
GST_DEBUG ("gamma decode 16->16: %d", func);
convert->gamma_dec.gamma_func = gamma_convert_u16_u16;
@ -1531,7 +1532,8 @@ setup_gamma_decode (GstVideoConverter * convert)
for (i = 0; i < 65536; i++)
t[i] =
rint (gst_video_color_transfer_decode (func, i / 65535.0) * 65535.0);
rint (gst_video_transfer_function_decode (func,
i / 65535.0) * 65535.0);
}
convert->current_bits = 16;
convert->current_pstride = 8;
@ -1555,7 +1557,8 @@ setup_gamma_encode (GstVideoConverter * convert, gint target_bits)
t = convert->gamma_enc.gamma_table = g_malloc (sizeof (guint8) * 65536);
for (i = 0; i < 65536; i++)
t[i] = rint (gst_video_color_transfer_encode (func, i / 65535.0) * 255.0);
t[i] =
rint (gst_video_transfer_function_encode (func, i / 65535.0) * 255.0);
} else {
guint16 *t;
@ -1565,7 +1568,8 @@ setup_gamma_encode (GstVideoConverter * convert, gint target_bits)
for (i = 0; i < 65536; i++)
t[i] =
rint (gst_video_color_transfer_encode (func, i / 65535.0) * 65535.0);
rint (gst_video_transfer_function_encode (func,
i / 65535.0) * 65535.0);
}
}

View file

@ -2728,10 +2728,10 @@ GST_START_TEST (test_video_transfer)
for (i = 0; i < 256; i++) {
gdouble val1, val2;
val1 = gst_video_color_transfer_encode (j, i / 255.0);
val1 = gst_video_transfer_function_encode (j, i / 255.0);
fail_if (val1 < 0.0 || val1 > 1.0);
val2 = gst_video_color_transfer_decode (j, val1);
val2 = gst_video_transfer_function_decode (j, val1);
fail_if (val2 < 0.0 || val2 > 1.0);
GST_DEBUG ("%d: %d %f->%f->%f %d", j, i, i / 255.0, val1, val2,