Commit 2a394598 authored by Jan Kiene's avatar Jan Kiene
Browse files

do not apply igf gain damping for bfi frames

parent cfd5b3e5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2086,7 +2086,12 @@ void IGFDecApplyStereo(
    const int16_t igfGridIdx,                                   /* i  : in case of CELP->TCX switching, use 1.25 framelength */
    const int16_t *coreMsMask,
    const int16_t restrict_hopsize,
#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
    const int16_t bfi,                                          /* i  : frame loss == 1, frame good == 0        */
    const int16_t element_mode                                  /* i  : decoder element mode                    */
#else
    const int16_t bfi                                           /* i  : frame loss == 1, frame good == 0        */
#endif
);

void IGFEncStereoEncoder(
+4 −0
Original line number Diff line number Diff line
@@ -2005,7 +2005,11 @@ void decoder_tcx_IGF_stereo(
            igfGridIdx = ( sts[0]->last_core == ACELP_CORE || ( left_rect && bfi ) ) ? IGF_GRID_LB_TRAN : IGF_GRID_LB_NORM;
        }

#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
        IGFDecApplyStereo( sts[0]->hIGFDec, sts[1]->hIGFDec, x[0][k], x[1][k], igfGridIdx, coreMsMask, hStereoMdct->IGFStereoMode[k] == SMDCT_BW_MS, bfi, sts[0]->element_mode );
#else
        IGFDecApplyStereo( sts[0]->hIGFDec, sts[1]->hIGFDec, x[0][k], x[1][k], igfGridIdx, coreMsMask, hStereoMdct->IGFStereoMode[k] == SMDCT_BW_MS, bfi );
#endif
    }

    return;
+23 −0
Original line number Diff line number Diff line
@@ -679,7 +679,12 @@ static void IGF_appl(
    float *pSpectralData,                     /* i/o: Q31 | MDCT spectrum                                  */
    const float *igf_spec,                    /* i  : Q31 | prepared IGF spectrum                          */
    float *virtualSpec,                       /* o  : Q31 | virtual IGF spectrum, used for temp flattening */
#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
    int16_t *flag_sparse,                     /* o  : Q0  | temp flattening indicator                      */
    const int16_t bfi_apply_damping                 /* i  : flag to indicate if damping for lost frames should be applied */
#else
    int16_t *flag_sparse                      /* o  : Q0  | temp flattening indicator                      */
#endif
)
{
    H_IGF_GRID hGrid;
@@ -855,7 +860,11 @@ static void IGF_appl(
    for ( sfb = start_sfb; sfb < stop_sfb; sfb++ )
    {

#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
        if ( bfi_apply_damping && hPrivateData->frameLossCounter > 0 )
#else
        if ( hPrivateData->frameLossCounter > 0 )
#endif
        {
            gain[sfb] = min( gain[sfb], 12.f );

@@ -1212,7 +1221,11 @@ void IGFDecApplyMono(
        /* apply IGF in three steps: */
        IGF_prep( hPrivateData, igfGridIdx, hIGFDec->infoTCXNoise, igf_spec, hPrivateData->pSpecFlat, element_mode );
        IGF_calc( hPrivateData, igfGridIdx, spectrum, igf_spec );
#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
        IGF_appl( hPrivateData, igfGridIdx, spectrum, igf_spec, hIGFDec->virtualSpec, hIGFDec->flag_sparse, element_mode != IVAS_CPE_MDCT );
#else
        IGF_appl( hPrivateData, igfGridIdx, spectrum, igf_spec, hIGFDec->virtualSpec, hIGFDec->flag_sparse );
#endif
    }

    /* reset TCX noise indicator vector */
@@ -1238,7 +1251,12 @@ void IGFDecApplyStereo(
    const int16_t igfGridIdx,               /* i  : in case of CELP->TCX switching, use 1.25 framelength */
    const int16_t *coreMsMask,
    const int16_t restrict_hopsize,
#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
    const int16_t bfi, /* i  : frame loss == 1, frame good == 0                     */
    const int16_t element_mode
#else
    const int16_t bfi /* i  : frame loss == 1, frame good == 0                     */
#endif
)
{
    IGF_DEC_PRIVATE_DATA_HANDLE hPrivateDataL, hPrivateDataR;
@@ -1335,8 +1353,13 @@ void IGFDecApplyStereo(

        IGF_calc( hPrivateDataL, igfGridIdx, spectrumL, igf_specL );
        IGF_calc( hPrivateDataR, igfGridIdx, spectrumR, igf_specR );
#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
        IGF_appl( hPrivateDataL, igfGridIdx, spectrumL, igf_specL, hIGFDecL->virtualSpec, hIGFDecL->flag_sparse, element_mode != IVAS_CPE_MDCT );
        IGF_appl( hPrivateDataR, igfGridIdx, spectrumR, igf_specR, hIGFDecR->virtualSpec, hIGFDecR->flag_sparse, element_mode != IVAS_CPE_MDCT );
#else
        IGF_appl( hPrivateDataL, igfGridIdx, spectrumL, igf_specL, hIGFDecL->virtualSpec, hIGFDecL->flag_sparse );
        IGF_appl( hPrivateDataR, igfGridIdx, spectrumR, igf_specR, hIGFDecR->virtualSpec, hIGFDecR->flag_sparse );
#endif
    }

    /* reset TCX noise indicator vector */