diff --git a/lib_com/options.h b/lib_com/options.h index 726a1f6a8238a25f4c8ba1522f626bd4d9284766..0edcb809916e50d6446a232f6dcad31713645102 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -117,6 +117,7 @@ #define REMOVE_SCALING_SHB_SPEECH /* VA: remove unnecessary scaling and 32-bit buffers from ivas_core_enc_fx() */ #define FIX_2352_COPY_AQ_IN_TCX /* FhG: basop issue 2352: prevent copying uninitialized values from Aq_fx[][] to Aq_fx_32[][] in TCX */ #define FIX_2353_PTR_INIT /* FhG: basop issue 2353: initialize prm_sqQ-pointer, to prevent being uninitialized in case of bfi == 1 */ +#define FIX_2356_GET_CHAN_ENERGIES /* FhG: basop issue 2356: correctly initialize exponents in getChannelEnergies_fx() */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index 5b26420306b5cc9a7aa9f4fe519116637f86c9bd..84bc74dd98149b30521d9403528b1111879a78bb 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -88,19 +88,33 @@ void getChannelEnergies_fx( gb = find_guarded_bits_fx( (Word32) L_subframe ); +#ifndef FIX_2356_GET_CHAN_ENERGIES sum2_e = st->hTcxEnc->spectrum_e[0]; move16(); +#endif nrg[ch] = 0; move32(); +#ifdef FIX_2356_GET_CHAN_ENERGIES + nrg_e[ch] = 0; /* if the mantissa is 0, the exponent gets set to sum2_e inside BASOP_Util_Add_Mant32Exp() */ + move16(); +#endif + FOR( n = 0; n < nSubframes; n++ ) { +#ifdef FIX_2356_GET_CHAN_ENERGIES + sum2_e = st->hTcxEnc->spectrum_e[n]; + move16(); + +#endif sum2 = sum2_32_exp_fx( st->hTcxEnc->spectrum_fx[n], L_subframe, &sum2_e, gb ); // 31 - sum2_e nrg[ch] = BASOP_Util_Add_Mant32Exp( nrg[ch], nrg_e[ch], sum2, sum2_e, &nrg_e[ch] ); move32(); +#ifndef FIX_2356_GET_CHAN_ENERGIES sum2_e = st->hTcxEnc->spectrum_e[0]; move16(); +#endif } nrg[ch] = Sqrt32( nrg[ch], &nrg_e[ch] ); // nrg_e