video-scaler: rename resampler to video-resampler
authorWim Taymans <wtaymans@redhat.com>
Thu, 30 Oct 2014 10:43:52 +0000 (11:43 +0100)
committerWim Taymans <wtaymans@redhat.com>
Thu, 30 Oct 2014 10:48:00 +0000 (11:48 +0100)
Prefix the resampler with video-. It we would like to reuse the
resampler for audio later, we can copy/move it and deprecate this
one.

gst-libs/gst/video/Makefile.am
gst-libs/gst/video/video-converter.c
gst-libs/gst/video/video-resampler.c [moved from gst-libs/gst/video/resampler.c with 85% similarity]
gst-libs/gst/video/video-resampler.h [moved from gst-libs/gst/video/resampler.h with 59% similarity]
gst-libs/gst/video/video-scaler.c
gst-libs/gst/video/video-scaler.h

index 695f1d7..c220f0b 100644 (file)
@@ -4,7 +4,7 @@ include $(top_srcdir)/common/orc.mak
 
 glib_enum_headers = video.h video-format.h video-color.h video-info.h \
                        colorbalance.h navigation.h video-chroma.h video-tile.h video-converter.h \
-                       resampler.h
+                       video-resampler.h
 glib_enum_define = GST_VIDEO
 glib_gen_prefix = gst_video
 glib_gen_basename = video
@@ -41,7 +41,7 @@ libgstvideo_@GST_API_VERSION@_la_SOURCES = \
        gstvideodecoder.c       \
        gstvideoencoder.c       \
        gstvideoutils.c         \
-       resampler.c             \
+       video-resampler.c       \
        video-blend.c           \
        video-overlay-composition.c
 
@@ -71,7 +71,7 @@ libgstvideo_@GST_API_VERSION@include_HEADERS = \
        gstvideodecoder.h       \
        gstvideoencoder.h       \
        gstvideoutils.h         \
-       resampler.h             \
+       video-resampler.h       \
        video-blend.h           \
        video-overlay-composition.h
 
index 4eb72d9..4864d47 100644 (file)
@@ -310,9 +310,9 @@ chain_hscale (GstVideoConverter * convert, GstLineCacheNeedLineFunc need_line)
       need_line, convert, NULL);
 
   if (!gst_structure_get_enum (convert->config,
-          GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD, GST_TYPE_RESAMPLER_METHOD,
-          &method))
-    method = GST_RESAMPLER_METHOD_CUBIC;
+          GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
+          GST_TYPE_VIDEO_RESAMPLER_METHOD, &method))
+    method = GST_VIDEO_RESAMPLER_METHOD_CUBIC;
   if (!gst_structure_get_uint (convert->config,
           GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS, &taps))
     taps = 0;
@@ -339,9 +339,9 @@ chain_vscale (GstVideoConverter * convert, GstLineCacheNeedLineFunc need_line)
       need_line, convert, NULL);
 
   if (!gst_structure_get_enum (convert->config,
-          GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD, GST_TYPE_RESAMPLER_METHOD,
-          &method))
-    method = GST_RESAMPLER_METHOD_CUBIC;
+          GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
+          GST_TYPE_VIDEO_RESAMPLER_METHOD, &method))
+    method = GST_VIDEO_RESAMPLER_METHOD_CUBIC;
   if (!gst_structure_get_uint (convert->config,
           GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS, &taps))
     taps = 0;
@@ -1108,10 +1108,10 @@ do_unpack_lines (GstLineCache * cache, gint line, GstVideoConverter * convert)
   gpointer tmpline;
   guint cline;;
 
-  tmpline = get_temp_line (convert);
   cline = CLAMP (line, 0, convert->in_height - 1);
 
   GST_DEBUG ("unpack line %d (%u)", line, cline);
+  tmpline = get_temp_line (convert);
   UNPACK_FRAME (convert->src, tmpline, cline, convert->in_width);
 
   gst_line_cache_add_line (cache, line, tmpline);
similarity index 85%
rename from gst-libs/gst/video/resampler.c
rename to gst-libs/gst/video/video-resampler.c
index 04475cc..91977ee 100644 (file)
 #include <stdio.h>
 #include <math.h>
 
-#include "resampler.h"
+#include "video-resampler.h"
 
 typedef struct _ResamplerParams ResamplerParams;
 
 struct _ResamplerParams
 {
-  GstResamplerMethod method;
-  GstResamplerFlags flags;
+  GstVideoResamplerMethod method;
+  GstVideoResamplerFlags flags;
 
   gdouble shift;
 
@@ -47,7 +47,7 @@ struct _ResamplerParams
   gdouble sharpness;
   gdouble sharpen;
 
-  GstResampler *resampler;
+  GstVideoResampler *resampler;
 };
 
 static double
@@ -152,7 +152,7 @@ get_lanczos_tap (ResamplerParams * params, gint l, gint xi, gdouble x)
 static void
 resampler_calculate_taps (ResamplerParams * params)
 {
-  GstResampler *resampler = params->resampler;
+  GstVideoResampler *resampler = params->resampler;
   gint j;
   guint32 *offset, *n_taps, *phase;
   gint tap_offs;
@@ -236,10 +236,10 @@ resampler_calculate_taps (ResamplerParams * params)
 }
 
 /**
- * gst_resampler_new:
- * @resampler: a #GstResampler
- * @method: a #GstResamplerMethod
- * @flags: #GstResamplerFlags
+ * gst_video_resampler_new:
+ * @resampler: a #GstVideoResampler
+ * @method: a #GstVideoResamplerMethod
+ * @flags: #GstVideoResamplerFlags
  * @n_phases: number of phases to use
  * @n_taps: number of taps to use
  * @in_size: number of source elements
@@ -258,8 +258,8 @@ resampler_calculate_taps (ResamplerParams * params)
  * Since: 1.6
  */
 gboolean
-gst_resampler_init (GstResampler * resampler,
-    GstResamplerMethod method, GstResamplerFlags flags,
+gst_video_resampler_init (GstVideoResampler * resampler,
+    GstVideoResamplerMethod method, GstVideoResamplerFlags flags,
     guint n_phases, guint n_taps, gdouble shift, guint in_size, guint out_size,
     GstStructure * options)
 {
@@ -281,48 +281,48 @@ gst_resampler_init (GstResampler * resampler,
   GST_DEBUG ("%d %u  %u->%u", method, n_taps, in_size, out_size);
 
   switch (method) {
-    case GST_RESAMPLER_METHOD_NEAREST:
+    case GST_VIDEO_RESAMPLER_METHOD_NEAREST:
       params.get_tap = get_nearest_tap;
       if (n_taps == 0)
         n_taps = 1;
       break;
-    case GST_RESAMPLER_METHOD_LINEAR:
+    case GST_VIDEO_RESAMPLER_METHOD_LINEAR:
       params.get_tap = get_linear_tap;
       if (n_taps == 0)
         n_taps = 2;
       break;
-    case GST_RESAMPLER_METHOD_CUBIC:
+    case GST_VIDEO_RESAMPLER_METHOD_CUBIC:
       if (!options
-          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_CUBIC_B,
-              &params.b))
+          || !gst_structure_get_double (options,
+              GST_VIDEO_RESAMPLER_OPT_CUBIC_B, &params.b))
         params.b = 1.0 / 3.0;
       if (!options
-          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_CUBIC_C,
-              &params.c))
+          || !gst_structure_get_double (options,
+              GST_VIDEO_RESAMPLER_OPT_CUBIC_C, &params.c))
         params.c = 1.0 / 3.0;
       n_taps = 4;
       params.get_tap = get_cubic_tap;
       break;
-    case GST_RESAMPLER_METHOD_SINC:
+    case GST_VIDEO_RESAMPLER_METHOD_SINC:
       params.get_tap = get_sinc_tap;
       if (n_taps == 0)
         n_taps = 4;
       break;
-    case GST_RESAMPLER_METHOD_LANCZOS:
+    case GST_VIDEO_RESAMPLER_METHOD_LANCZOS:
     {
       gdouble resample_inc = in_size / (gdouble) out_size;
 
       if (!options
-          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_ENVELOPE,
-              &params.envelope))
+          || !gst_structure_get_double (options,
+              GST_VIDEO_RESAMPLER_OPT_ENVELOPE, &params.envelope))
         params.envelope = 2.0;
       if (!options
-          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_SHARPNESS,
-              &params.sharpness))
+          || !gst_structure_get_double (options,
+              GST_VIDEO_RESAMPLER_OPT_SHARPNESS, &params.sharpness))
         params.sharpness = 1.0;
       if (!options
-          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_SHARPEN,
-              &params.sharpen))
+          || !gst_structure_get_double (options,
+              GST_VIDEO_RESAMPLER_OPT_SHARPEN, &params.sharpen))
         params.sharpen = 0.0;
 
       if (resample_inc > 1.0) {
@@ -379,15 +379,15 @@ gst_resampler_init (GstResampler * resampler,
 }
 
 /**
- * gst_resampler_clear:
- * @resampler: a #GstResampler
+ * gst_video_resampler_clear:
+ * @resampler: a #GstVideoResampler
  *
- * Clear a previously initialized #GstResampler @resampler.
+ * Clear a previously initialized #GstVideoResampler @resampler.
  *
  * Since: 1.6
  */
 void
-gst_resampler_clear (GstResampler * resampler)
+gst_video_resampler_clear (GstVideoResampler * resampler)
 {
   g_return_if_fail (resampler != NULL);
 
similarity index 59%
rename from gst-libs/gst/video/resampler.h
rename to gst-libs/gst/video/video-resampler.h
index d9db20d..9ebe4df 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef __GST_RESAMPLER_H__
-#define __GST_RESAMPLER_H__
+#ifndef __GST_VIDEO_RESAMPLER_H__
+#define __GST_VIDEO_RESAMPLER_H__
 
 #include <gst/gst.h>
 
 G_BEGIN_DECLS
 
-typedef struct _GstResampler GstResampler;
+typedef struct _GstVideoResampler GstVideoResampler;
 
 /**
- * GstResamplerMethod:
- * @GST_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
+ * GstVideoResamplerMethod:
+ * @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
  *    upsampling and drops when downsampling
- * @GST_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
+ * @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
  *    missing samples and averaging to downsample
- * @GST_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
- * @GST_RESAMPLER_METHOD_SINC: Uses sinc interpolation
- * @GST_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
+ * @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
+ * @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
  *
  * Different subsampling and upsampling methods
  *
  * Since: 1.6
  */
 typedef enum {
-  GST_RESAMPLER_METHOD_NEAREST,
-  GST_RESAMPLER_METHOD_LINEAR,
-  GST_RESAMPLER_METHOD_CUBIC,
-  GST_RESAMPLER_METHOD_SINC,
-  GST_RESAMPLER_METHOD_LANCZOS,
-} GstResamplerMethod;
+  GST_VIDEO_RESAMPLER_METHOD_NEAREST,
+  GST_VIDEO_RESAMPLER_METHOD_LINEAR,
+  GST_VIDEO_RESAMPLER_METHOD_CUBIC,
+  GST_VIDEO_RESAMPLER_METHOD_SINC,
+  GST_VIDEO_RESAMPLER_METHOD_LANCZOS,
+} GstVideoResamplerMethod;
 
 /**
- * GST_RESAMPLER_OPT_CUBIC_B:
+ * GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
  *
  * G_TYPE_DOUBLE, B parameter of the cubic filter. The B
  * parameter controls the bluriness. Values between 0.0 and
@@ -67,59 +67,59 @@ typedef enum {
  * Robidoux
  *  Soft             0.6796  0.1602
  */
-#define GST_RESAMPLER_OPT_CUBIC_B      "GstResampler.cubic-b"
+#define GST_VIDEO_RESAMPLER_OPT_CUBIC_B      "GstVideoResampler.cubic-b"
 /**
- * GST_RESAMPLER_OPT_CUBIC_C:
+ * GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
  *
  * G_TYPE_DOUBLE, C parameter of the cubic filter. The C
  * parameter controls the Keys alpha value. Values between 0.0 and
  * 2.0 are accepted. 1/3 is the default.
  *
- * See #GST_RESAMPLER_OPT_CUBIC_B for some more common values
+ * See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
  */
-#define GST_RESAMPLER_OPT_CUBIC_C      "GstResampler.cubic-c"
+#define GST_VIDEO_RESAMPLER_OPT_CUBIC_C      "GstVideoResampler.cubic-c"
 
 /**
- * GST_RESAMPLER_OPT_ENVELOPE:
+ * GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
  *
  * G_TYPE_DOUBLE, specifies the size of filter envelope for
- * @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
  * 1.0 and 5.0. 2.0 is the default.
  */
-#define GST_RESAMPLER_OPT_ENVELOPE      "GstResampler.envelope"
+#define GST_VIDEO_RESAMPLER_OPT_ENVELOPE      "GstVideoResampler.envelope"
 
 /**
- * GST_RESAMPLER_OPT_SHARPNESS:
+ * GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
  *
  * G_TYPE_DOUBLE, specifies sharpness of the filter for
- * @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
  * 0.5 and 1.5. 1.0 is the default.
  */
-#define GST_RESAMPLER_OPT_SHARPNESS     "GstResampler.sharpness"
+#define GST_VIDEO_RESAMPLER_OPT_SHARPNESS     "GstVideoResampler.sharpness"
 
 /**
- * GST_RESAMPLER_OPT_SHARPEN:
+ * GST_VIDEO_RESAMPLER_OPT_SHARPEN:
  *
  * G_TYPE_DOUBLE, specifies sharpening of the filter for
- * @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
  * 0.0 and 1.0. 0.0 is the default.
  */
-#define GST_RESAMPLER_OPT_SHARPEN      "GstResampler.sharpen"
+#define GST_VIDEO_RESAMPLER_OPT_SHARPEN      "GstVideoResampler.sharpen"
 
 /**
- * GstResamplerFlags:
- * @GST_RESAMPLER_FLAG_NONE: no flags
+ * GstVideoResamplerFlags:
+ * @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
  *
  * Different resampler flags.
  *
  * Since: 1.6
  */
 typedef enum {
-  GST_RESAMPLER_FLAG_NONE                 = (0),
-} GstResamplerFlags;
+  GST_VIDEO_RESAMPLER_FLAG_NONE                 = (0),
+} GstVideoResamplerFlags;
 
 /**
- * GstResampler:
+ * GstVideoResampler:
  * @in_size: the input size
  * @out_size: the output size
  * @max_taps: the maximum number of taps
@@ -133,7 +133,7 @@ typedef enum {
  *
  * Since: 1.6
  */
-struct _GstResampler
+struct _GstVideoResampler
 {
   gint in_size;
   gint out_size;
@@ -148,16 +148,16 @@ struct _GstResampler
 };
 
 
-gboolean    gst_resampler_init            (GstResampler *resampler,
-                                           GstResamplerMethod method,
-                                           GstResamplerFlags flags,
+gboolean    gst_video_resampler_init      (GstVideoResampler *resampler,
+                                           GstVideoResamplerMethod method,
+                                           GstVideoResamplerFlags flags,
                                            guint n_phases, guint n_taps,
                                            gdouble shift,
                                            guint in_size, guint out_size,
                                            GstStructure *options);
 
-void        gst_resampler_clear           (GstResampler *resampler);
+void        gst_video_resampler_clear     (GstVideoResampler *resampler);
 
 G_END_DECLS
 
-#endif /* __GST_RESAMPLER_H__ */
+#endif /* __GST_VIDEO_RESAMPLER_H__ */
index fcfdba4..7401911 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdio.h>
 #include <math.h>
 
-#include "resampler.h"
 #include <orc/orcfunctions.h>
 #include "video-orc.h"
 #include "video-scaler.h"
@@ -42,18 +41,18 @@ typedef void (*GstVideoScalerVFunc) (GstVideoScaler * scale,
 
 struct _GstVideoScaler
 {
-  GstResamplerMethod method;
+  GstVideoResamplerMethod method;
   GstVideoScalerFlags flags;
 
-  GstResampler resampler;
+  GstVideoResampler resampler;
 
   /* cached integer coefficients */
   gint16 *taps_s16;
 };
 
 static void
-resampler_zip (GstResampler * resampler, const GstResampler * r1,
-    const GstResampler * r2)
+resampler_zip (GstVideoResampler * resampler, const GstVideoResampler * r1,
+    const GstVideoResampler * r2)
 {
   guint i, out_size, max_taps;
   gdouble *taps;
@@ -77,7 +76,7 @@ resampler_zip (GstResampler * resampler, const GstResampler * r1,
 
   for (i = 0; i < out_size; i++) {
     guint idx = i / 2;
-    const GstResampler *r;
+    const GstVideoResampler *r;
 
     r = (i & 1) ? r2 : r1;
 
@@ -91,7 +90,7 @@ resampler_zip (GstResampler * resampler, const GstResampler * r1,
 
 /**
  * gst_video_scaler_new:
- * @method: a #GstResamplerMethod
+ * @method: a #GstVideoResamplerMethod
  * @flags: #GstVideoScalerFlags
  * @n_taps: number of taps to use
  * @in_size: number of source elements
@@ -108,7 +107,7 @@ resampler_zip (GstResampler * resampler, const GstResampler * r1,
  * Returns: a #GstVideoResample
  */
 GstVideoScaler *
-gst_video_scaler_new (GstResamplerMethod method, GstVideoScalerFlags flags,
+gst_video_scaler_new (GstVideoResamplerMethod method, GstVideoScalerFlags flags,
     guint n_taps, guint in_size, guint out_size, GstStructure * options)
 {
   GstVideoScaler *scale;
@@ -124,21 +123,21 @@ gst_video_scaler_new (GstResamplerMethod method, GstVideoScalerFlags flags,
   scale->flags = flags;
 
   if (flags & GST_VIDEO_SCALER_FLAG_INTERLACED) {
-    GstResampler tresamp, bresamp;
+    GstVideoResampler tresamp, bresamp;
 
-    gst_resampler_init (&tresamp, method, 0, (out_size + 1) / 2, n_taps,
+    gst_video_resampler_init (&tresamp, method, 0, (out_size + 1) / 2, n_taps,
         0.0, (in_size + 1) / 2, (out_size + 1) / 2, options);
 
-    gst_resampler_init (&bresamp, method, 0, out_size - tresamp.out_size,
+    gst_video_resampler_init (&bresamp, method, 0, out_size - tresamp.out_size,
         n_taps, -1.0, in_size - tresamp.in_size,
         out_size - tresamp.out_size, options);
 
     resampler_zip (&scale->resampler, &tresamp, &bresamp);
-    gst_resampler_clear (&tresamp);
-    gst_resampler_clear (&bresamp);
+    gst_video_resampler_clear (&tresamp);
+    gst_video_resampler_clear (&bresamp);
   } else {
-    gst_resampler_init (&scale->resampler, method, flags, out_size, n_taps,
-        0.0, in_size, out_size, options);
+    gst_video_resampler_init (&scale->resampler, method, flags, out_size,
+        n_taps, 0.0, in_size, out_size, options);
   }
   return scale;
 }
@@ -154,7 +153,7 @@ gst_video_scaler_free (GstVideoScaler * scale)
 {
   g_return_if_fail (scale != NULL);
 
-  gst_resampler_clear (&scale->resampler);
+  gst_video_resampler_clear (&scale->resampler);
   g_free (scale->taps_s16);
   g_slice_free (GstVideoScaler, scale);
 }
index 595a9a1..1a6dab9 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <gst/video/video-format.h>
 #include <gst/video/video-color.h>
-#include <gst/video/resampler.h>
+#include <gst/video/video-resampler.h>
 
 G_BEGIN_DECLS
 
@@ -50,7 +50,7 @@ typedef enum {
 
 typedef struct _GstVideoScaler GstVideoScaler;
 
-GstVideoScaler *      gst_video_scaler_new            (GstResamplerMethod method,
+GstVideoScaler *      gst_video_scaler_new            (GstVideoResamplerMethod method,
                                                        GstVideoScalerFlags flags,
                                                        guint n_taps,
                                                        guint in_size, guint out_size,