audioresample: convert from liboil to orc

This commit is contained in:
David Schleef 2010-06-06 23:50:05 -07:00
parent 84832877a6
commit e39e729a70
2 changed files with 15 additions and 26 deletions

View file

@ -1,13 +1,5 @@
plugin_LTLIBRARIES = libgstaudioresample.la plugin_LTLIBRARIES = libgstaudioresample.la
if AUDIORESAMPLE_NEEDS_LIBOIL
COND_LIBOIL_CFLAGS=$(LIBOIL_CFLAGS)
COND_LIBOIL_LIBS=$(LIBOIL_LIBS)
else
COND_LIBOIL_CFLAGS=
COND_LIBOIL_LIBS=
endif
libgstaudioresample_la_SOURCES = \ libgstaudioresample_la_SOURCES = \
gstaudioresample.c \ gstaudioresample.c \
speex_resampler_int.c \ speex_resampler_int.c \
@ -18,13 +10,13 @@ libgstaudioresample_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \ $(GST_CFLAGS) \
$(COND_LIBOIL_CFLAGS) $(ORC_CFLAGS)
libgstaudioresample_la_LIBADD = \ libgstaudioresample_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \ $(GST_PLUGINS_BASE_LIBS) \
$(GST_BASE_LIBS) \ $(GST_BASE_LIBS) \
$(GST_LIBS) \ $(GST_LIBS) \
$(COND_LIBOIL_LIBS) \ $(ORC_LIBS) -lorc-test-0.4 \
$(LIBM) $(LIBM)
libgstaudioresample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstaudioresample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -50,11 +50,10 @@
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
#include <gst/base/gstbasetransform.h> #include <gst/base/gstbasetransform.h>
#if defined AUDIORESAMPLE_FORMAT_AUTO #include <orc/orc.h>
#define OIL_ENABLE_UNSTABLE_API #include <orc-test/orctest.h>
#include <liboil/liboilprofile.h> #include <orc-test/orcprofile.h>
#include <liboil/liboil.h>
#endif
GST_DEBUG_CATEGORY (audio_resample_debug); GST_DEBUG_CATEGORY (audio_resample_debug);
#define GST_CAT_DEFAULT audio_resample_debug #define GST_CAT_DEFAULT audio_resample_debug
@ -1391,13 +1390,13 @@ _benchmark_int_int (SpeexResamplerState * st)
static gboolean static gboolean
_benchmark_integer_resampling (void) _benchmark_integer_resampling (void)
{ {
OilProfile a, b; OrcProfile a, b;
gdouble av, bv; gdouble av, bv;
SpeexResamplerState *sta, *stb; SpeexResamplerState *sta, *stb;
int i; int i;
oil_profile_init (&a); orc_profile_init (&a);
oil_profile_init (&b); orc_profile_init (&b);
sta = resample_float_resampler_init (1, 48000, 24000, 4, NULL); sta = resample_float_resampler_init (1, 48000, 24000, 4, NULL);
if (sta == NULL) { if (sta == NULL) {
@ -1414,23 +1413,23 @@ _benchmark_integer_resampling (void)
/* Benchmark */ /* Benchmark */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
oil_profile_start (&a); orc_profile_start (&a);
if (!_benchmark_int_float (sta)) if (!_benchmark_int_float (sta))
goto error; goto error;
oil_profile_stop (&a); orc_profile_stop (&a);
} }
/* Benchmark */ /* Benchmark */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
oil_profile_start (&b); orc_profile_start (&b);
if (!_benchmark_int_int (stb)) if (!_benchmark_int_int (stb))
goto error; goto error;
oil_profile_stop (&b); orc_profile_stop (&b);
} }
/* Handle results */ /* Handle results */
oil_profile_get_ave_std (&a, &av, NULL); orc_profile_get_ave_std (&a, &av, NULL);
oil_profile_get_ave_std (&b, &bv, NULL); orc_profile_get_ave_std (&b, &bv, NULL);
/* Remember benchmark result in global variable */ /* Remember benchmark result in global variable */
gst_audio_resample_use_int = (av > bv); gst_audio_resample_use_int = (av > bv);
@ -1458,8 +1457,6 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (audio_resample_debug, "audioresample", 0, GST_DEBUG_CATEGORY_INIT (audio_resample_debug, "audioresample", 0,
"audio resampling element"); "audio resampling element");
#if defined AUDIORESAMPLE_FORMAT_AUTO #if defined AUDIORESAMPLE_FORMAT_AUTO
oil_init ();
if (!_benchmark_integer_resampling ()) if (!_benchmark_integer_resampling ())
return FALSE; return FALSE;
#endif #endif