Commit c7605ca3 authored by multrus's avatar multrus
Browse files

correctly initialize exponents in getChannelEnergies_fx()

parent 187213dc
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@
#define FIX_1500_ISM_MD_DTX                             /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */
#define FIX_2348_REPLACE_FEC_ENC                        /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx  */
#define FIX_2338_HARM_GSC_GAIN_COMP                     /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */
#define FIX_2356_GET_CHAN_ENERGIES                      /* FhG: basop issue 2356: correctly initialize exponents in getChannelEnergies_fx() */

/* ##################### End NON-BE switches ########################### */

+21 −0
Original line number Diff line number Diff line
@@ -92,15 +92,36 @@ void getChannelEnergies_fx(
            move16();
            nrg[ch] = 0;
            move32();

#ifdef FIX_2356_GET_CHAN_ENERGIES
            /* move first loop iteration outside of loop - we need a proper initialization of nrg_e[ch] based on sum2_e, which is calculated in first loop iteration */
            sum2 = sum2_32_exp_fx( st->hTcxEnc->spectrum_fx[0], L_subframe, &sum2_e, gb ); // 31 - sum2_e

            nrg_e[ch] = sum2_e; /* only needed in first iteration */
            move16();

            nrg[ch] = BASOP_Util_Add_Mant32Exp( nrg[ch], nrg_e[ch], sum2, sum2_e, &nrg_e[ch] );
            move32();

            FOR( n = 0; n < nSubframes; n++ )
#else
            FOR( n = 1; n < nSubframes; n++ )
#endif
            {
#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