From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- media/libspeex_resampler/04_hugemem.patch | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 media/libspeex_resampler/04_hugemem.patch (limited to 'media/libspeex_resampler/04_hugemem.patch') diff --git a/media/libspeex_resampler/04_hugemem.patch b/media/libspeex_resampler/04_hugemem.patch new file mode 100644 index 0000000000..f8bbac8c9f --- /dev/null +++ b/media/libspeex_resampler/04_hugemem.patch @@ -0,0 +1,57 @@ +diff --git a/src/resample.c b/src/resample.c +--- a/src/resample.c ++++ b/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 + 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);} + #ifndef EXPORT + #define EXPORT + #endif +@@ -633,25 +645,26 @@ static int update_filter(SpeexResamplerS + st->oversample >>= 1; + if (st->oversample < 1) + st->oversample = 1; + } else { + /* up-sampling */ + st->cutoff = quality_map[st->quality].upsample_bandwidth; + } + +-#ifdef RESAMPLE_FULL_SINC_TABLE +- use_direct = 1; +- if (INT_MAX/sizeof(spx_word16_t)/st->den_rate < st->filt_len) +- goto fail; +-#else +- /* Choose the resampling type that requires the least amount of memory */ +- use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 +- && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len; ++ use_direct = ++#ifdef RESAMPLE_HUGEMEM ++ /* Choose the direct resampler, even with higher initialization costs, ++ when resampling any multiple of 100 to 44100. */ ++ st->den_rate <= 441 ++#else ++ /* Choose the resampling type that requires the least amount of memory */ ++ 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; + if (use_direct) + { + min_sinc_table_length = st->filt_len*st->den_rate; + } else { + if ((INT_MAX/sizeof(spx_word16_t)-8)/st->oversample < st->filt_len) + goto fail; + + min_sinc_table_length = st->filt_len*st->oversample+8; -- cgit v1.2.3