1 diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c
2 --- a/media/libspeex_resampler/src/resample.c
3 +++ b/media/libspeex_resampler/src/resample.c
5 (e.g. 2/3), and get rid of the rounding operations in the inner loop.
6 The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
13 +#define RESAMPLE_HUGEMEM 1
17 static void *speex_alloc (int size) {return calloc(size,1);}
18 static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
19 static void speex_free (void *ptr) {free(ptr);}
20 #include "speex_resampler.h"
22 #else /* OUTSIDE_SPEEX */
23 @@ -643,25 +645,26 @@ static int update_filter(SpeexResamplerS
25 if (st->oversample < 1)
29 st->cutoff = quality_map[st->quality].upsample_bandwidth;
32 - /* Choose the resampling type that requires the least amount of memory */
33 -#ifdef RESAMPLE_FULL_SINC_TABLE
35 - if (INT_MAX/sizeof(spx_word16_t)/st->den_rate < st->filt_len)
38 +#ifdef RESAMPLE_HUGEMEM
39 + /* Choose the direct resampler, even with higher initialization costs,
40 + when resampling any multiple of 100 to 44100. */
43 - use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
44 + /* Choose the resampling type that requires the least amount of memory */
45 + st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
47 && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len;
51 min_sinc_table_length = st->filt_len*st->den_rate;
53 if ((INT_MAX/sizeof(spx_word16_t)-8)/st->oversample < st->filt_len)
56 min_sinc_table_length = st->filt_len*st->oversample+8;