Calculation of optimum Q_bwe_exc differs between encoder and decoder
This is a follow up of https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/merge_requests/2851#note_111222. The calculation of optimum scaling factor `Q_bwe_exc` in IVAS modes is different between encoder and decoder SWB TBE functions `swb_tbe_enc_fx()` and `swb_tbe_dec_fx()`. While at the decoder, the length of the signal on which the scaling factor is computed equals to `L_FRAME32k + NL_BUFF_OFFSET`: ``` /* ----- calculate optimum Q_bwe_exc and rescale memories accordingly ----- */ Word16 sig_len = L_FRAME32k + NL_BUFF_OFFSET; move16(); IF( st->element_mode == EVS_MONO ) { sig_len = L_FRAME32k; move16(); } Lmax = 0; move32(); FOR( cnt = 0; cnt < sig_len; cnt++ ) // note: this differs from the encoder where the length is always L_FRAME32k { Lmax = L_max( Lmax, L_abs( bwe_exc_extended_fx[cnt] ) ); } ``` the length at the encoder is `L_FRAME16k`: ```c /* ----- calculate optimum Q_bwe_exc and rescale memories accordingly ----- */ Lmax = L_deposit_l( 0 ); FOR( cnt = 0; cnt < L_FRAME32k; cnt++ ) { Lmax = L_max( Lmax, L_abs( bwe_exc_extended[cnt] ) ); } ``` See also the comment at https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/blob/main/lib_dec/swb_tbe_dec_fx.c#L5315. <!--- Below are labels that will be added but are not shown in description. This is a template to help fill them. Add further information to the first row and remove and add labels as necessary.-->
issue