diff options
author | Timothy B. Terriberry <tterribe@xiph.org> | 2013-05-08 21:32:37 +0400 |
---|---|---|
committer | Timothy B. Terriberry <tterribe@xiph.org> | 2013-05-08 21:37:17 +0400 |
commit | c152d602aa6f68b4bc9483393985511bb2d83e86 (patch) | |
tree | 7feb495f759f9d87d0b16c71996cf54ba443ca9f /silk/resampler_private_down_FIR.c | |
parent | dc58579c2c7e060084554018e9a2e8c25097a255 (diff) |
Use dynamic stack allocation in the SILK encoder.
This makes all remaining large stack allocations use the vararray
macros.
This continues the work of 6f2d9f50 to allow compiling with
NONTHREADSAFE_PSEUDOSTACK to move the memory for large buffers
off the stack for devices where it is very limited.
It also does this for some additional large buffers used by the
PLC in the decoder.
Diffstat (limited to 'silk/resampler_private_down_FIR.c')
-rw-r--r-- | silk/resampler_private_down_FIR.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/silk/resampler_private_down_FIR.c b/silk/resampler_private_down_FIR.c index 8bedb0de..a47582a6 100644 --- a/silk/resampler_private_down_FIR.c +++ b/silk/resampler_private_down_FIR.c @@ -31,6 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "SigProc_FIX.h" #include "resampler_private.h" +#include "stack_alloc.h" static inline opus_int16 *silk_resampler_private_down_FIR_INTERPOL( opus_int16 *out, @@ -151,8 +152,11 @@ void silk_resampler_private_down_FIR( silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS; opus_int32 nSamplesIn; opus_int32 max_index_Q16, index_increment_Q16; - opus_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + SILK_RESAMPLER_MAX_FIR_ORDER ]; + VARDECL( opus_int32, buf ); const opus_int16 *FIR_Coefs; + SAVE_STACK; + + ALLOC( buf, S->batchSize + S->FIR_Order, opus_int32 ); /* Copy buffered samples to start of buffer */ silk_memcpy( buf, S->sFIR.i32, S->FIR_Order * sizeof( opus_int32 ) ); @@ -186,4 +190,5 @@ void silk_resampler_private_down_FIR( /* Copy last part of filtered signal to the state for the next call */ silk_memcpy( S->sFIR.i32, &buf[ nSamplesIn ], S->FIR_Order * sizeof( opus_int32 ) ); + RESTORE_STACK; } |