Index: silk/NLSF_encode.c |
diff --git a/silk/NLSF_encode.c b/silk/NLSF_encode.c |
index 52a263d97a895ef678bb42c64fe2d233c3501b9f..03a036fda2f74f09553621c8ace42f9a184de382 100644 |
--- a/silk/NLSF_encode.c |
+++ b/silk/NLSF_encode.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.h" |
+#include "stack_alloc.h" |
/***********************/ |
/* NLSF vector encoder */ |
@@ -46,10 +47,10 @@ opus_int32 silk_NLSF_encode( /* O Returns |
{ |
opus_int i, s, ind1, bestIndex, prob_Q8, bits_q7; |
opus_int32 W_tmp_Q9; |
- opus_int32 err_Q26[ NLSF_VQ_MAX_VECTORS ]; |
- opus_int32 RD_Q25[ NLSF_VQ_MAX_SURVIVORS ]; |
- opus_int tempIndices1[ NLSF_VQ_MAX_SURVIVORS ]; |
- opus_int8 tempIndices2[ NLSF_VQ_MAX_SURVIVORS * MAX_LPC_ORDER ]; |
+ VARDECL( opus_int32, err_Q26 ); |
+ VARDECL( opus_int32, RD_Q25 ); |
+ VARDECL( opus_int, tempIndices1 ); |
+ VARDECL( opus_int8, tempIndices2 ); |
opus_int16 res_Q15[ MAX_LPC_ORDER ]; |
opus_int16 res_Q10[ MAX_LPC_ORDER ]; |
opus_int16 NLSF_tmp_Q15[ MAX_LPC_ORDER ]; |
@@ -58,6 +59,7 @@ opus_int32 silk_NLSF_encode( /* O Returns |
opus_uint8 pred_Q8[ MAX_LPC_ORDER ]; |
opus_int16 ec_ix[ MAX_LPC_ORDER ]; |
const opus_uint8 *pCB_element, *iCDF_ptr; |
+ SAVE_STACK; |
silk_assert( nSurvivors <= NLSF_VQ_MAX_SURVIVORS ); |
silk_assert( signalType >= 0 && signalType <= 2 ); |
@@ -67,11 +69,16 @@ opus_int32 silk_NLSF_encode( /* O Returns |
silk_NLSF_stabilize( pNLSF_Q15, psNLSF_CB->deltaMin_Q15, psNLSF_CB->order ); |
/* First stage: VQ */ |
+ ALLOC( err_Q26, psNLSF_CB->nVectors, opus_int32 ); |
silk_NLSF_VQ( err_Q26, pNLSF_Q15, psNLSF_CB->CB1_NLSF_Q8, psNLSF_CB->nVectors, psNLSF_CB->order ); |
/* Sort the quantization errors */ |
+ ALLOC( tempIndices1, nSurvivors, opus_int ); |
silk_insertion_sort_increasing( err_Q26, tempIndices1, psNLSF_CB->nVectors, nSurvivors ); |
+ ALLOC( RD_Q25, nSurvivors, opus_int32 ); |
+ ALLOC( tempIndices2, nSurvivors * MAX_LPC_ORDER, opus_int8 ); |
+ |
/* Loop over survivors */ |
for( s = 0; s < nSurvivors; s++ ) { |
ind1 = tempIndices1[ s ]; |
@@ -124,5 +131,6 @@ opus_int32 silk_NLSF_encode( /* O Returns |
/* Decode */ |
silk_NLSF_decode( pNLSF_Q15, NLSFIndices, psNLSF_CB ); |
+ RESTORE_STACK; |
return RD_Q25[ 0 ]; |
} |