Commit 6c3e64c4 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for crash observed with -10dB LTV test case on decoder pipeline

parent 8c9a4c72
Loading
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -1531,7 +1531,15 @@ Word16 ApplyFdCng_ivas_fx(
                move16();
                /* This sets the new CNG levels until a SID update overwrites it */
                Copy32( hFdCngDec->bandNoiseShape, cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ); /* This sets the new CNG levels until a SID update overwrites it */ /*Q31 - hFdCngDec->bandNoiseShape_exp*/
                *cngNoiseLevel_exp = hFdCngDec->bandNoiseShape_exp;

                Word16 shift1 = L_norm_arr( cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) );
                Word16 shift2 = L_norm_arr( cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ) );
                Word16 shift = s_max( sub( hFdCngDec->bandNoiseShape_exp, shift1 ), sub( *cngNoiseLevel_exp, shift2 ) );

                scale_sig32( cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), sub( sub( hFdCngDec->bandNoiseShape_exp, shift1 ), shift ) );
                scale_sig32( cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ), sub( sub( *cngNoiseLevel_exp, shift2 ), shift ) );

                *cngNoiseLevel_exp = shift;
                move16();

                /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/
@@ -5059,7 +5067,14 @@ void FdCng_decodeSID_ivas_fx(
    }

    scalebands( sidNoiseEst, hFdCngCom->part, hFdCngCom->npart, hFdCngCom->midband, hFdCngCom->nFFTpart, sub( hFdCngCom->stopBand, hFdCngCom->startBand ), hFdCngCom->cngNoiseLevel, 1 );
    hFdCngCom->cngNoiseLevelExp = hFdCngCom->sidNoiseEstExp;
    Word16 shift1 = L_norm_arr( hFdCngCom->cngNoiseLevel, sub( hFdCngCom->stopBand, hFdCngCom->startBand ) );
    Word16 shift2 = L_norm_arr( hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopBand, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopBand, hFdCngCom->startBand ) ) );
    Word16 shift = s_max( sub( hFdCngCom->sidNoiseEstExp, shift1 ), sub( hFdCngCom->cngNoiseLevelExp, shift2 ) );

    scale_sig32( hFdCngCom->cngNoiseLevel, sub( hFdCngCom->stopBand, hFdCngCom->startBand ), sub( sub( hFdCngCom->sidNoiseEstExp, shift1 ), shift ) );
    scale_sig32( hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopBand, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopBand, hFdCngCom->startBand ) ), sub( sub( hFdCngCom->cngNoiseLevelExp, shift2 ), shift ) );

    hFdCngCom->cngNoiseLevelExp = shift;
    move16();

    lpc_from_spectrum( hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, st->preemph_fac );
+6 −1
Original line number Diff line number Diff line
@@ -181,7 +181,12 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx(
            cng_noise_nrg_obj_fx = dotp_fixed_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9, &Q_cng_noise_nrg_obj ); /*Resultant Q_cng_noise_nrg_obj= (Q_cng_noise_nrg_obj-x)<=31*/
            IF( GT_32( cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx ) )
            {
                Word32 temp = divide3232( L_shr( cng_noise_nrg_dominant_fx, 1 ), cng_noise_nrg_obj_fx );   /*Stores value of cng_noise_nrg_dominant_fx/cng_noise_nrg_obj_fx*/
                Word32 temp = 0;
                move32();
                IF( L_shr( cng_noise_nrg_dominant_fx, 1 ) )
                {
                    temp = divide3232( L_shr( cng_noise_nrg_dominant_fx, 1 ), cng_noise_nrg_obj_fx ); /*Stores value of cng_noise_nrg_dominant_fx/cng_noise_nrg_obj_fx*/
                }
                Word16 Q_temp = add( sub( sub( Q_cng_noise_nrg_dominant, 1 ), Q_cng_noise_nrg_obj ), 15 ); /*Stores resultant Q after divide3232 operation above*/
                IF( EQ_16( Q_temp % 2, 1 ) )                                                               /*Making Q_temp even for sqrt function*/
                {