2014-07-21 08:34:26 +04:00
|
|
|
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 */
|
2014-08-07 11:15:27 +04:00
|
|
|
@@ -633,24 +635,23 @@ static int update_filter(SpeexResamplerS
|
2014-07-21 08:34:26 +04:00
|
|
|
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
|
2014-08-07 10:13:12 +04:00
|
|
|
- use_direct = 1;
|
2014-08-07 11:15:27 +04:00
|
|
|
- if (INT_MAX/sizeof(spx_word16_t)/st->den_rate < st->filt_len)
|
|
|
|
- goto fail;
|
|
|
|
+ use_direct =
|
2014-07-21 08:34:26 +04:00
|
|
|
+#ifdef RESAMPLE_HUGEMEM
|
2014-08-07 11:15:27 +04:00
|
|
|
+ st->den_rate <= 16*(st->oversample+8)
|
2014-07-21 08:34:26 +04:00
|
|
|
#else
|
2014-08-07 11:15:27 +04:00
|
|
|
- use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
|
|
|
|
+ st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
|
|
|
|
+#endif
|
|
|
|
&& INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len;
|
|
|
|
-#endif
|
2014-08-07 10:13:12 +04:00
|
|
|
if (use_direct)
|
2014-07-21 08:34:26 +04:00
|
|
|
{
|
2014-08-07 10:13:12 +04:00
|
|
|
min_sinc_table_length = st->filt_len*st->den_rate;
|
|
|
|
} else {
|
2014-08-07 11:15:27 +04:00
|
|
|
if ((INT_MAX/sizeof(spx_word16_t)-8)/st->oversample < st->filt_len)
|
|
|
|
goto fail;
|
|
|
|
|
2014-08-07 10:13:12 +04:00
|
|
|
min_sinc_table_length = st->filt_len*st->oversample+8;
|