gecko-dev/media/libspeex_resampler/hugemem.patch
Karl Tomlinson b232975926 b=1042504 use direct resampler for 48->44.1k r=padenot
Transplanted from patch by Gregory Maxwell <greg@xiph.org>
http://git.xiph.org/?p=opus-tools.git;a=commitdiff;h=f426ab52

--HG--
extra : rebase_source : 457a874135b4fea8649d72299be96a79e7dcda64
2014-07-21 16:34:26 +12:00

44 lines
1.5 KiB
Diff

diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c
--- a/media/libspeex_resampler/src/resample.c
+++ b/media/libspeex_resampler/src/resample.c
@@ -56,16 +56,18 @@
(e.g. 2/3), and get rid of the rounding operations in the inner loop.
The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#define RESAMPLE_HUGEMEM 1
+
#ifdef OUTSIDE_SPEEX
#include <stdlib.h>
static void *speex_alloc (int size) {return calloc(size,1);}
static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
static void speex_free (void *ptr) {free(ptr);}
#include "speex_resampler.h"
#include "arch.h"
#else /* OUTSIDE_SPEEX */
@@ -613,18 +615,18 @@ static void update_filter(SpeexResampler
if (st->oversample < 1)
st->oversample = 1;
} else {
/* up-sampling */
st->cutoff = quality_map[st->quality].upsample_bandwidth;
}
/* Choose the resampling type that requires the least amount of memory */
-#ifdef RESAMPLE_FULL_SINC_TABLE
- if (1)
+#ifdef RESAMPLE_HUGEMEM
+ if (st->den_rate <= 16*(st->oversample+8))
#else
if (st->filt_len*st->den_rate <= st->filt_len*st->oversample+8)
#endif
{
spx_uint32_t i;
if (st->sinc_table_length < st->filt_len*st->den_rate)
{
st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t));