Commit 88075d51 authored by eichenseer's avatar eichenseer
Browse files

Add a couple of adjustments to improve the decoder-side noise estimation. Fix...

Add a couple of adjustments to improve the decoder-side noise estimation. Fix incomplete as frequency range still off.
parent 78b3057b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -157,6 +157,13 @@
#ifdef PARAM_ISM_DTX_CNG
#define PARAM_ISM_DTX_CNG_STABILIZE_SW_DECISION         /* Patch to stabilize the switching decision */
#define PARAM_ISM_DTX_CNG_EST_RES_SPEC_DEC              /* Patch to estimate noise at decoder */
// under test:
#define LPC_FROM_SPEC                                   /* missing (?) lpc_from_spectrum() call */
#define DTX_ADJUST_SCALEBANDS                           /* change input arguments to fit partitions of noise estimation */
#define DTX_FILL_HF                                     /* fill high frequency bands with cngNoiseLevel values */
#define SCALING_OFF
//#define ONLY_VAD0                                     /* estimation only if VAD = 0, but not robust! deactivate
//#define EXP_MSNOISEEST                                  /* replace some estimated values; input-specific!! */
#endif

/* ################## End DEVELOPMENT switches ######################### */
+4 −0
Original line number Diff line number Diff line
@@ -1081,7 +1081,11 @@ void generate_comfort_noise_dec(
#ifdef PARAM_ISM_DTX_CNG
    if ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag )
    {
#ifdef SCALING_OFF
        scale = 1.0f;
#else
        scale = hFdCngCom->scaling;
#endif
        scaleCldfb = ( CLDFB_SCALING / hFdCngCom->scalingFactor ) * scale;
    }
    else
+41 −0
Original line number Diff line number Diff line
@@ -113,7 +113,44 @@ static ivas_error ivas_ism_estimate_noise_shape(

    perform_noise_estimation_dec(output, NULL, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD);
    /* Update the shaping parameters */
#ifndef DTX_ADJUST_SCALEBANDS
    scalebands(hFdCngDec->msNoiseEst, hFdCngCom->part, hFdCngCom->npart, hFdCngCom->midband, hFdCngCom->nFFTpart, hFdCngCom->stopBand - hFdCngCom->startBand, cngNoiseLevel, 1);
#else
    // just testing: replace too low values with higher ones
#ifdef EXP_MSNOISEEST
    for (int16_t q = 56; q < 62; q++)
    {
        hFdCngDec->msNoiseEst[q] = 2.0f;
    }
#endif
    //--- end of testing

    // debug:
    //set_f(cngNoiseLevel, -1.0f, 340);
    //set_f(cngNoiseLevel, 0.0f, 340);
    //--- end of debug

    /* input arguments from tcx noise estimation */
    scalebands(hFdCngDec->msNoiseEst, hFdCngDec->part_shaping, hFdCngDec->nFFTpart_shaping, hFdCngDec->midband_shaping, hFdCngDec->nFFTpart_shaping, hFdCngCom->stopFFTbin - hFdCngCom->startBand, cngNoiseLevel, 1);
#endif

#ifdef DTX_FILL_HF
    // add cngNoiseLevel values for the higher bands (bands 254 to 274)
    for (int16_t b = hFdCngCom->stopFFTbin - hFdCngCom->startBand; b < hFdCngCom->stopBand; b++)
    {
        int16_t i = hFdCngCom->stopFFTbin - hFdCngCom->startBand - 1; /* index of last present value */
        /* version 1: copy last available value to missing bands */
        cngNoiseLevel[b] = cngNoiseLevel[i];
        /* version 2: create descending values */
        //cngNoiseLevel[b] = cngNoiseLevel[i] * (float)(hFdCngCom->stopBand - b) / (float)(hFdCngCom->stopBand - i);
        /* version 3: create descending values, quarter impact */
        //cngNoiseLevel[b] = cngNoiseLevel[i] * 0.25f * (float)(hFdCngCom->stopBand - b) / (float)(hFdCngCom->stopBand - i);
    }
#endif

#ifdef LPC_FROM_SPEC
    lpc_from_spectrum(hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, st->preemph_fac); // hint from knj, needed?
#endif

    return error;
}
@@ -353,7 +390,11 @@ ivas_error ivas_sce_dec(
#ifdef PARAM_ISM_DTX_CNG
#ifdef PARAM_ISM_DTX_CNG_EST_RES_SPEC_DEC
    /* Estimate noise shape */
#ifndef ONLY_VAD0
    if ( st_ivas->ism_mode == ISM_MODE_PARAM && !(ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA) )
#else
    if ( st_ivas->ism_mode == ISM_MODE_PARAM && !(ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA) && st->VAD == 0 )
#endif
    {
        ivas_ism_estimate_noise_shape(output[0],hSCE);
    }