Commit 25a154f2 authored by Jan Kiene's avatar Jan Kiene
Browse files

small cleanup and optimization

parent d5ac7778
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -1054,7 +1054,6 @@ void TonalMdctConceal_create_concealment_noise(
    c_inv = sqrtf( 1 - hStereoMdct->lastCoh );

    /* pre-compute the noise shape for later weighting of the noise spectra */
    /* TODO: optimize by intertwining with later loop */
    cngNoiseLevelPtr = &hFdCngCom->cngNoiseLevel[0];
    inc = ( st->core > TCX_20_CORE ) ? 2 : 1;
    start_idx = hFdCngCom->startBand / inc;
@@ -1126,8 +1125,6 @@ void TonalMdctConceal_whiten_noise_shape(
    const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode
)
{
    float scf[SNS_NPTS];
    float scfs_int[FDNS_NPTS];
    float whitenend_noise_shape[L_FRAME16k];
    int16_t inc, start_idx, stop_idx;
    float *noiseLevelPtr, *scfs_bg, *scfs_for_shaping;
@@ -1153,6 +1150,9 @@ void TonalMdctConceal_whiten_noise_shape(

    if ( whitening_mode == ON_FIRST_LOST_FRAME )
    {
        float scf[SNS_NPTS];
        float scfs_int[FDNS_NPTS];

        sns_compute_scf( whitenend_noise_shape, *psychParams, L_frame, scf );
        sns_interpolate_scalefactors( scfs_int, scf, ENC );
        sns_interpolate_scalefactors( scfs_bg, scf, DEC );
@@ -1163,9 +1163,16 @@ void TonalMdctConceal_whiten_noise_shape(
        scfs_for_shaping = &scfs_bg[0];
    }

    if ( sum_f( scfs_for_shaping, FDNS_NPTS ) > 0.0f )
    {
        sns_shape_spectrum( whitenend_noise_shape, *psychParams, scfs_for_shaping, L_frame );

        mvr2r( whitenend_noise_shape + start_idx, hFdCngCom->cngNoiseLevel, stop_idx - start_idx );
    }
    else
    {
        set_zero( hFdCngCom->cngNoiseLevel, stop_idx - start_idx );
    }

    wmops_sub_end();
}