| Index: silk/fixed/encode_frame_FIX.c
|
| diff --git a/silk/fixed/encode_frame_FIX.c b/silk/fixed/encode_frame_FIX.c
|
| index a37a9f21299587bd292a2c6b520722e3e3b268bd..cacfd67e742aecf7e2000f314450d6211bbdfc16 100644
|
| --- a/silk/fixed/encode_frame_FIX.c
|
| +++ b/silk/fixed/encode_frame_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"
|
| #include "tuning_parameters.h"
|
|
|
| /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
|
| @@ -84,9 +85,7 @@ opus_int silk_encode_frame_FIX(
|
| {
|
| silk_encoder_control_FIX sEncCtrl;
|
| opus_int i, iter, maxIter, found_upper, found_lower, ret = 0;
|
| - opus_int16 *x_frame, *res_pitch_frame;
|
| - opus_int32 xfw_Q3[ MAX_FRAME_LENGTH ];
|
| - opus_int16 res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ];
|
| + opus_int16 *x_frame;
|
| ec_enc sRangeEnc_copy, sRangeEnc_copy2;
|
| silk_nsq_state sNSQ_copy, sNSQ_copy2;
|
| opus_int32 seed_copy, nBits, nBits_lower, nBits_upper, gainMult_lower, gainMult_upper;
|
| @@ -95,7 +94,7 @@ opus_int silk_encode_frame_FIX(
|
| opus_int16 ec_prevLagIndex_copy;
|
| opus_int ec_prevSignalType_copy;
|
| opus_int8 LastGainIndex_copy2;
|
| - opus_uint8 ec_buf_copy[ 1275 ];
|
| + SAVE_STACK;
|
|
|
| /* This is totally unnecessary but many compilers (including gcc) are too dumb to realise it */
|
| LastGainIndex_copy2 = nBits_lower = nBits_upper = gainMult_lower = gainMult_upper = 0;
|
| @@ -105,9 +104,8 @@ opus_int silk_encode_frame_FIX(
|
| /**************************************************************/
|
| /* Set up Input Pointers, and insert frame in input buffer */
|
| /*************************************************************/
|
| - /* pointers aligned with start of frame to encode */
|
| - x_frame = psEnc->x_buf + psEnc->sCmn.ltp_mem_length; /* start of frame to encode */
|
| - res_pitch_frame = res_pitch + psEnc->sCmn.ltp_mem_length; /* start of pitch LPC residual frame */
|
| + /* start of frame to encode */
|
| + x_frame = psEnc->x_buf + psEnc->sCmn.ltp_mem_length;
|
|
|
| /***************************************/
|
| /* Ensure smooth bandwidth transitions */
|
| @@ -120,6 +118,17 @@ opus_int silk_encode_frame_FIX(
|
| silk_memcpy( x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf + 1, psEnc->sCmn.frame_length * sizeof( opus_int16 ) );
|
|
|
| if( !psEnc->sCmn.prefillFlag ) {
|
| + VARDECL( opus_int32, xfw_Q3 );
|
| + VARDECL( opus_int16, res_pitch );
|
| + VARDECL( opus_uint8, ec_buf_copy );
|
| + opus_int16 *res_pitch_frame;
|
| +
|
| + ALLOC( res_pitch,
|
| + psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length
|
| + + psEnc->sCmn.ltp_mem_length, opus_int16 );
|
| + /* start of pitch LPC residual frame */
|
| + res_pitch_frame = res_pitch + psEnc->sCmn.ltp_mem_length;
|
| +
|
| /*****************************************/
|
| /* Find pitch lags, initial LPC analysis */
|
| /*****************************************/
|
| @@ -143,6 +152,7 @@ opus_int silk_encode_frame_FIX(
|
| /*****************************************/
|
| /* Prefiltering for noise shaper */
|
| /*****************************************/
|
| + ALLOC( xfw_Q3, psEnc->sCmn.frame_length, opus_int32 );
|
| silk_prefilter_FIX( psEnc, &sEncCtrl, xfw_Q3, x_frame );
|
|
|
| /****************************************/
|
| @@ -164,6 +174,7 @@ opus_int silk_encode_frame_FIX(
|
| seed_copy = psEnc->sCmn.indices.Seed;
|
| ec_prevLagIndex_copy = psEnc->sCmn.ec_prevLagIndex;
|
| ec_prevSignalType_copy = psEnc->sCmn.ec_prevSignalType;
|
| + ALLOC( ec_buf_copy, 1275, opus_uint8 );
|
| for( iter = 0; ; iter++ ) {
|
| if( gainsID == gainsID_lower ) {
|
| nBits = nBits_lower;
|
| @@ -299,6 +310,7 @@ opus_int silk_encode_frame_FIX(
|
| if( psEnc->sCmn.prefillFlag ) {
|
| /* No payload */
|
| *pnBytesOut = 0;
|
| + RESTORE_STACK;
|
| return ret;
|
| }
|
|
|
| @@ -309,6 +321,7 @@ opus_int silk_encode_frame_FIX(
|
| /* Payload size */
|
| *pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
|
|
|
| + RESTORE_STACK;
|
| return ret;
|
| }
|
|
|
|
|