1 diff --git a/src/resample.c b/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);}
23 @@ -633,25 +645,26 @@ static int update_filter(SpeexResamplerS
25 if (st->oversample < 1)
29 st->cutoff = quality_map[st->quality].upsample_bandwidth;
32 -#ifdef RESAMPLE_FULL_SINC_TABLE
34 - if (INT_MAX/sizeof(spx_word16_t)/st->den_rate < st->filt_len)
37 - /* Choose the resampling type that requires the least amount of memory */
38 - use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
39 - && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len;
41 +#ifdef RESAMPLE_HUGEMEM
42 + /* Choose the direct resampler, even with higher initialization costs,
43 + when resampling any multiple of 100 to 44100. */
46 + /* Choose the resampling type that requires the least amount of memory */
47 + st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
49 + && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len;
52 min_sinc_table_length = st->filt_len*st->den_rate;
54 if ((INT_MAX/sizeof(spx_word16_t)-8)/st->oversample < st->filt_len)
57 min_sinc_table_length = st->filt_len*st->oversample+8;