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

Fix for crash observed for SBA format with LTV streams

parent 7cb8a253
Loading
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -1457,7 +1457,7 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx(
    const Word16 L_frame,
    const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode )
{
    Word16 inc, start_idx, stop_idx;
    Word16 inc, start_idx, stop_idx, i;
    Word32 *noiseLevelPtr, *scfs_bg, *scfs_for_shaping;
    Word16 noiseLevelPtr_exp;
    HANDLE_FD_CNG_COM hFdCngCom;
@@ -1533,8 +1533,23 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx(
        q_wns = sub( sub( 31, noiseLevelPtr_exp ), 3 );
        sns_shape_spectrum_fx( whitenend_noise_shape, &q_wns, psychParams, scfs_for_shaping, Q16, L_frame, NULL );

        IF( GT_16( add( q_wns, 1 ), sub( 31, hFdCngCom->cngNoiseLevelExp ) ) )
        {
            FOR( i = 0; i < sub( stop_idx, start_idx ); i++ )
            {
                hFdCngCom->cngNoiseLevel[i] = L_shr( whitenend_noise_shape[start_idx + i], sub( add( q_wns, hFdCngCom->cngNoiseLevelExp ), 30 ) );
                move32();
            }
        }
        ELSE
        {
            Copy32( whitenend_noise_shape + start_idx, hFdCngCom->cngNoiseLevel, sub( stop_idx, start_idx ) );
        hFdCngCom->cngNoiseLevelExp = sub( Q30, q_wns );

            scale_sig32( hFdCngCom->cngNoiseLevel + sub( stop_idx, start_idx ), sub( FFTCLDFBLEN, sub( stop_idx, start_idx ) ), sub( add( q_wns, hFdCngCom->cngNoiseLevelExp ), 30 ) );

            hFdCngCom->cngNoiseLevelExp = sub( Q30, q_wns ); // Exponent = 31 - (q_wns + 1)
            move16();
        }
    }
    ELSE
    {