dnl used in examples
AG_GST_DEFAULT_ELEMENTS
+dnl behaviour of speex based audio resampler
+AC_MSG_CHECKING(which audio resample format to use for integer)
+AC_ARG_WITH([audioresample_format],
+ AS_HELP_STRING([--with-audioresample-format],[Which implementation should be used for integer audio resampling, int/float/auto, (default is auto)]),
+ [ac_cv_audioresample_format=$withval], [ac_cv_audioresample_format=auto])dnl
+AC_MSG_RESULT($ac_cv_audioresample_format)
+case $ac_cv_audioresample_format in
+ int)
+ AC_DEFINE(AUDIORESAMPLE_FORMAT_INT,1,[The int implementation should be used for integer audio resampling])
+ AC_SUBST(AUDIORESAMPLE_FORMAT_INT)
+ ;;
+ float)
+ AC_DEFINE(AUDIORESAMPLE_FORMAT_FLOAT,1,[The float implementation should be used for integer audio resampling])
+ AC_SUBST(AUDIORESAMPLE_FORMAT_FLOAT)
+ ;;
+ auto)
+ AC_DEFINE(AUDIORESAMPLE_FORMAT_AUTO,1,[The implementation that should be used for integer audio resampling witll be benchmarked at runtime])
+ AC_SUBST(AUDIORESAMPLE_FORMAT_AUTO)
+esac
+
dnl *** plug-ins to include ***
dnl these are all the gst plug-ins, compilable without additional libs
)
/* If TRUE integer arithmetic resampling is faster and will be used if appropiate */
+#if defined AUDIORESAMPLE_FORMAT_INT
+static gboolean gst_audio_resample_use_int = TRUE;
+#elif defined AUDIORESAMPLE_FORMAT_FLOAT
static gboolean gst_audio_resample_use_int = FALSE;
+#else
+static gboolean gst_audio_resample_use_int = FALSE;
+#endif
static GstStaticPadTemplate gst_audio_resample_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
}
}
+#if defined AUDIORESAMPLE_FORMAT_AUTO
#define BENCHMARK_SIZE 512
static gboolean
oil_profile_get_ave_std (&a, &av, NULL);
oil_profile_get_ave_std (&b, &bv, NULL);
+ /* Remember benchmark result in global variable */
gst_audio_resample_use_int = (av > bv);
resample_float_resampler_destroy (sta);
- resample_float_resampler_destroy (stb);
+ resample_int_resampler_destroy (stb);
if (av > bv)
- GST_DEBUG ("Using integer resampler if appropiate: %lf < %lf", bv, av);
+ GST_INFO ("Using integer resampler if appropiate: %lf < %lf", bv, av);
else
- GST_DEBUG ("Using float resampler for everything: %lf <= %lf", av, bv);
+ GST_INFO ("Using float resampler for everything: %lf <= %lf", av, bv);
return TRUE;
error:
resample_float_resampler_destroy (sta);
- resample_float_resampler_destroy (stb);
+ resample_int_resampler_destroy (stb);
return FALSE;
}
+#endif
static gboolean
plugin_init (GstPlugin * plugin)
oil_init ();
+#if defined AUDIORESAMPLE_FORMAT_AUTO
if (!_benchmark_integer_resampling ())
return FALSE;
+#endif
if (!gst_element_register (plugin, "audioresample", GST_RANK_PRIMARY,
GST_TYPE_AUDIO_RESAMPLE)) {