| Index: silk/encode_pulses.c
|
| diff --git a/silk/encode_pulses.c b/silk/encode_pulses.c
|
| index b01b5853620d097fa3c53c2ef96719c35f53e514..d1b2f5dc5422f00414c3c2d427a7e25d9b8bbc23 100644
|
| --- a/silk/encode_pulses.c
|
| +++ b/silk/encode_pulses.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"
|
|
|
| /*********************************************/
|
| /* Encode quantization indices of excitation */
|
| @@ -66,14 +67,15 @@ void silk_encode_pulses(
|
| {
|
| opus_int i, k, j, iter, bit, nLS, scale_down, RateLevelIndex = 0;
|
| opus_int32 abs_q, minSumBits_Q5, sumBits_Q5;
|
| - opus_int abs_pulses[ MAX_FRAME_LENGTH ];
|
| - opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ];
|
| - opus_int nRshifts[ MAX_NB_SHELL_BLOCKS ];
|
| + VARDECL( opus_int, abs_pulses );
|
| + VARDECL( opus_int, sum_pulses );
|
| + VARDECL( opus_int, nRshifts );
|
| opus_int pulses_comb[ 8 ];
|
| opus_int *abs_pulses_ptr;
|
| const opus_int8 *pulses_ptr;
|
| const opus_uint8 *cdf_ptr;
|
| const opus_uint8 *nBits_ptr;
|
| + SAVE_STACK;
|
|
|
| silk_memset( pulses_comb, 0, 8 * sizeof( opus_int ) ); /* Fixing Valgrind reported problem*/
|
|
|
| @@ -90,6 +92,8 @@ void silk_encode_pulses(
|
| }
|
|
|
| /* Take the absolute value of the pulses */
|
| + ALLOC( abs_pulses, iter * SHELL_CODEC_FRAME_LENGTH, opus_int );
|
| + silk_assert( !( SHELL_CODEC_FRAME_LENGTH & 3 ) );
|
| for( i = 0; i < iter * SHELL_CODEC_FRAME_LENGTH; i+=4 ) {
|
| abs_pulses[i+0] = ( opus_int )silk_abs( pulses[ i + 0 ] );
|
| abs_pulses[i+1] = ( opus_int )silk_abs( pulses[ i + 1 ] );
|
| @@ -98,6 +102,8 @@ void silk_encode_pulses(
|
| }
|
|
|
| /* Calc sum pulses per shell code frame */
|
| + ALLOC( sum_pulses, iter, opus_int );
|
| + ALLOC( nRshifts, iter, opus_int );
|
| abs_pulses_ptr = abs_pulses;
|
| for( i = 0; i < iter; i++ ) {
|
| nRshifts[ i ] = 0;
|
| @@ -196,4 +202,5 @@ void silk_encode_pulses(
|
| /* Encode signs */
|
| /****************/
|
| silk_encode_signs( psRangeEnc, pulses, frame_length, signalType, quantOffsetType, sum_pulses );
|
| + RESTORE_STACK;
|
| }
|
|
|