Index: silk/fixed/residual_energy_FIX.c |
diff --git a/silk/fixed/residual_energy_FIX.c b/silk/fixed/residual_energy_FIX.c |
index f284e51f0fe36b13034772beefdd0b7578fd2557..105ae31807b0b10f7092794fd8983c1e2c4eab4d 100644 |
--- a/silk/fixed/residual_energy_FIX.c |
+++ b/silk/fixed/residual_energy_FIX.c |
@@ -8,11 +8,11 @@ this list of conditions and the following disclaimer. |
- Redistributions in binary form must reproduce the above copyright |
notice, this list of conditions and the following disclaimer in the |
documentation and/or other materials provided with the distribution. |
-- Neither the name of Internet Society, IETF or IETF Trust, nor the |
+- Neither the name of Internet Society, IETF or IETF Trust, nor the |
names of specific contributors, may be used to endorse or promote |
products derived from this software without specific prior written |
permission. |
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” |
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
@@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. |
#endif |
#include "main_FIX.h" |
+#include "stack_alloc.h" |
/* Calculates residual energies of input subframes where all subframes have LPC_order */ |
/* of preceding samples */ |
@@ -45,14 +46,18 @@ void silk_residual_energy_FIX( |
) |
{ |
opus_int offset, i, j, rshift, lz1, lz2; |
- opus_int16 *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; |
+ opus_int16 *LPC_res_ptr; |
+ VARDECL( opus_int16, LPC_res ); |
const opus_int16 *x_ptr; |
opus_int32 tmp32; |
+ SAVE_STACK; |
x_ptr = x; |
offset = LPC_order + subfr_length; |
/* Filter input to create the LPC residual for each frame half, and measure subframe energies */ |
+ ALLOC( LPC_res, ( MAX_NB_SUBFR >> 1 ) * offset, opus_int16 ); |
+ silk_assert( ( nb_subfr >> 1 ) * ( MAX_NB_SUBFR >> 1 ) == nb_subfr ); |
for( i = 0; i < nb_subfr >> 1; i++ ) { |
/* Calculate half frame LPC residual signal including preceding samples */ |
silk_LPC_analysis_filter( LPC_res, x_ptr, a_Q12[ i ], ( MAX_NB_SUBFR >> 1 ) * offset, LPC_order ); |
@@ -88,4 +93,5 @@ void silk_residual_energy_FIX( |
nrgs[ i ] = silk_SMMUL( tmp32, silk_LSHIFT32( nrgs[ i ], lz1 ) ); /* Q( nrgsQ[ i ] + lz1 + 2 * lz2 - 32 - 32 )*/ |
nrgsQ[ i ] += lz1 + 2 * lz2 - 32 - 32; |
} |
+ RESTORE_STACK; |
} |