video: Rename video_color_transfer to video_transfer_function
authorMarijn Suijten <marijns95@gmail.com>
Fri, 11 Sep 2020 18:15:14 +0000 (20:15 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Sat, 12 Sep 2020 06:46:44 +0000 (09:46 +0300)
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>

gst-libs/gst/video/video-color.c
gst-libs/gst/video/video-color.h
gst-libs/gst/video/video-converter.c
tests/check/libs/video.c

index 01f8d17..76043b4 100644 (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;
 
index ba99e07..c6ff3c8 100644 (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:
index 2ee9e81..8a556e2 100644 (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);
   }
 }
 
index b0c7cd4..acea722 100644 (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,