Commit 039cdc14 authored by eichenseer's avatar eichenseer
Browse files

Update contribution: move decoder-side noise estimation to core coder; remove...

Update contribution: move decoder-side noise estimation to core coder; remove scaling factor from SID payload
parent 88075d51
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -153,8 +153,10 @@ typedef struct ivas_param_ism_data_structure

    float long_term_energy_stereo_dmx_enc[PARAM_ISM_MAX_DMX][PARAM_ISM_HYS_BUF_SIZE];
    float coh;
#ifndef SCALING_OFF
    float ene_ratio;
#endif
#endif

} PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE;

+5 −8
Original line number Diff line number Diff line
@@ -156,14 +156,11 @@
#define PARAM_ISM_DTX_CNG                               /* Support of DTX/CNG for Param-ISM */ 
#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!! */
#define PARAM_ISM_DTX_CNG_EST_RES_SPEC_DEC              /* Patch to estimate noise at decoder, includes USE_NOISE_EST_FROM_CORE_PARAM_ISM_DTX */
// helper switches:
#define SCALING_OFF                                     /* Remove the energy ratio/scaling parameter previously transmitted in the SID frames */
#define TMP_FIX                                         /* To do: move cng_type init to correct place */
//#define TMP_FIX2
#endif

/* ################## End DEVELOPMENT switches ######################### */
+2 −0
Original line number Diff line number Diff line
@@ -408,8 +408,10 @@ typedef struct
    int16_t no_side_flag; /* indicates whether the side noise shape should be zeroed-out or not */

#ifdef PARAM_ISM_DTX_CNG
#ifndef SCALING_OFF
    float scaling;
#endif
#endif

} FD_CNG_COM, *HANDLE_FD_CNG_COM;

+15 −0
Original line number Diff line number Diff line
@@ -532,6 +532,21 @@ ivas_error acelp_core_dec(
                    }
                    ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                }
#ifdef PARAM_ISM_DTX_CNG_EST_RES_SPEC_DEC
                //USE_NOISE_EST_FROM_CORE_PARAM_ISM_DTX
                /* TODO: condition missing to do this only for param ism */ /* esr: use cng_paramISM_flag? */
                // if (!st->read_sid_info)
                if (!st->read_sid_info && st->cng_paramISM_flag)
                {
                    float noise_lvl_highest;
                    
                    noise_lvl_highest = st->hFdCngDec->hFdCngCom->cngNoiseLevel[st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand - 1];
                    for (int16_t b = st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand; b < st->hFdCngDec->hFdCngCom->stopBand; b++)
                    {
                        st->hFdCngDec->hFdCngCom->cngNoiseLevel[b] = noise_lvl_highest;
                    }
                }
#endif

                generate_comfort_noise_dec( NULL, NULL, st, nchan_out );

+5 −3
Original line number Diff line number Diff line
@@ -1367,7 +1367,7 @@ void generate_comfort_noise_dec_hf(
    float **bufferImag,         /* o  : Imaginary part of input bands */
    HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables   */
#ifdef PARAM_ISM_DTX_CNG
    , int16_t cng_flag          /*i: CNG Flag */
    , int16_t cng_coh_flag          /* i: CNG Flag for coherence handling */
#endif 
)
{
@@ -1381,14 +1381,16 @@ void generate_comfort_noise_dec_hf(
    int16_t *seed2 = &(hFdCngCom->seed);
    float tmp1, tmp2, c1 = 0.f, c2 = 0.f;

    if ( cng_flag )
    if ( cng_coh_flag )
    {
        seed2 = &(hFdCngCom->seed3);

        c1 = (float)sqrt(hFdCngCom->coherence);
        c2 = (float)sqrt(1 - hFdCngCom->coherence);

#ifndef SCALING_OFF
        scale *= hFdCngCom->scaling;
#endif
    }
#endif 

@@ -1404,7 +1406,7 @@ void generate_comfort_noise_dec_hf(
            for ( i = 0; i < hFdCngCom->numSlots; i++ )
            {
#ifdef PARAM_ISM_DTX_CNG
                if (cng_flag)
                if (cng_coh_flag)
                {
                    /* Real part in CLDFB band */
                    rand_gauss(&tmp1, seed);
Loading