Commit bc2c62f9 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_921_fix' into 'main'

Fix for 3GPP issue 921: Decoder crash for MC51 at 48kbps FER in decoder_tcx_noisefilling_fx()

See merge request !661
parents acec605e b7ce8ea6
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -4733,12 +4733,12 @@ void decoder_tcx_noisefilling_fx(
                    Word16 exp1, exp2;
                    exp1 = 0;
                    exp2 = 0;
                    Word32 E_2ndlast, E_last;
                    Word64 E_2ndlast, E_last;
                    E_2ndlast = E_last = EPSILON_FX;
                    move16();
                    move16();
                    move32();
                    move32();
                    move64();
                    move64();

                    Word16 tmp_len;
                    IF( st->element_mode > EVS_MONO )
@@ -4754,11 +4754,19 @@ void decoder_tcx_noisefilling_fx(

                    FOR( i = 0; i < tmp_len; i = i + 2 )
                    {
                        E_2ndlast = BASOP_Util_Add_Mant32Exp( E_2ndlast, exp2, L_mult0( st->hTonalMDCTConc->lastBlockData.spectralData[i], st->hTonalMDCTConc->lastBlockData.spectralData[i] ), 29, &exp2 );
                        E_last = BASOP_Util_Add_Mant32Exp( E_last, exp1, L_mult0( st->hTonalMDCTConc->lastBlockData.spectralData[i + 1], st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] ), 29, &exp1 );
                        E_2ndlast = W_mac_16_16( E_2ndlast, st->hTonalMDCTConc->lastBlockData.spectralData[i], st->hTonalMDCTConc->lastBlockData.spectralData[i] );   /* Q(31 - 2 * st->hTonalMDCTConc->lastBlockData.spectralData_exp) */
                        E_last = W_mac_16_16( E_last, st->hTonalMDCTConc->lastBlockData.spectralData[i + 1], st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] ); /* Q(31 - 2 * st->hTonalMDCTConc->lastBlockData.spectralData_exp) */
                    }

                    tmp1 = BASOP_Util_Divide3232_Scale( E_2ndlast, E_last, &tmp2 );
                    exp2 = W_norm( E_2ndlast );
                    E_2ndlast = W_shl( E_2ndlast, exp2 );
                    exp2 = sub( 63, add( sub( 31, shl( st->hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ) ), exp2 ) );

                    exp1 = W_norm( E_last );
                    E_last = W_shl( E_last, exp1 );
                    exp1 = sub( 63, add( sub( 31, shl( st->hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ) ), exp1 ) );

                    tmp1 = BASOP_Util_Divide3232_Scale( W_extract_h( E_2ndlast ), W_extract_h( E_last ), &tmp2 );
                    tmp2 = add( tmp2, sub( exp2, exp1 ) );

#ifdef BASOP_NOGLOB