diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 2eab8f473a48006755fe8567e3b7485fb0497e7c..db9c3b661c39099f815d003dd60e250ab99c2f44 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1975,18 +1975,33 @@ ivas_error core_switching_pre_dec_fx( } ELSE { +#ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING + Word16 hdrm = Q16; + move16(); +#endif FOR( i = 0; i < shl( st->L_frame, 1 ); i++ ) { #ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING st->hFdCngDec->hFdCngCom->olapBufferSynth[i] = mult_r( st->hFdCngDec->hFdCngCom->olapBufferSynth[i], 26214 /* Q14*/ ); /* (Q15 - olapBufferSynth_exp) + 1 */ move16(); + if ( st->hFdCngDec->hFdCngCom->olapBufferSynth[i] != 0 ) + { + hdrm = s_min( hdrm, norm_s( st->hFdCngDec->hFdCngCom->olapBufferSynth[i] ) ); + } #else st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( L_shl( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], 1 ), (Word16) 26214 /* 1.6f in Q14 */ ); move32(); #endif } #ifdef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING - st->hFdCngDec->hFdCngCom->olapBufferSynth_exp = add( st->hFdCngDec->hFdCngCom->olapBufferSynth_exp, 1 ); + IF( NE_16( hdrm, 0 ) ) + { + scale_sig( st->hFdCngDec->hFdCngCom->olapBufferSynth, shl( st->L_frame, 1 ), Q1 ); + } + ELSE + { + st->hFdCngDec->hFdCngCom->olapBufferSynth_exp = add( st->hFdCngDec->hFdCngCom->olapBufferSynth_exp, 1 ); + } #endif } }