diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index 1de1666127177ca4bc8a343fa38c8aa2b40aa39c..21a589c56bb746729643a20e3a6b7bf35a1996b6 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -790,15 +790,16 @@ void FEC_scale_syn_ivas_fx( /*-----------------------------------------------------------------* * Find the energy/gain at the end of the frame *-----------------------------------------------------------------*/ - IF( LT_16( getScaleFactor16( synth, L_frame ), 2 ) ) + tmp = sub( 3, getScaleFactor16( synth, L_frame ) ); + IF( tmp > 0 ) { - Scale_sig( synth, L_frame, -1 ); - frame_ener_fx( L_frame, clas, synth, pitch[sub( shr( L_frame, 6 ), 1 )], &L_enr2 /*Q0*/, 1, sub( Q_syn, 1 ), 3, 0 ); - Scale_sig( synth, L_frame, 1 ); + Word16 synth_tmp[L_FRAME16k]; + Copy_Scale_sig( synth, synth_tmp, L_frame, -tmp ); // Q_synth - tmp + frame_ener_fx( L_frame, clas, synth_tmp, pitch[L_frame / L_SUBFR - 1], &L_enr2 /*Q0*/, 1, sub( Q_syn, tmp ), 3, 0 ); } ELSE { - frame_ener_fx( L_frame, clas, synth, pitch[sub( shr( L_frame, 6 ), 1 )], &L_enr2 /*Q0*/, 1, Q_syn, 3, 0 ); + frame_ener_fx( L_frame, clas, synth, pitch[L_frame / L_SUBFR - 1], &L_enr2 /*Q0*/, 1, Q_syn, 3, 0 ); } test();