Commit ec60f21a authored by norvell's avatar norvell
Browse files

Add fix NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING to port MR2017

parent d74ec907
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -205,6 +205,7 @@
#define FIX_1387_INIT_PRM_SQQ                           /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
#define FIX_1387_INIT_PRM_SQQ                           /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS      /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */
#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS      /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */
#define FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING           /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms  in PhECU-PLC  */ 


/* #################### End BASOP porting switches ############################ */
/* #################### End BASOP porting switches ############################ */


+33 −5
Original line number Original line Diff line number Diff line
@@ -263,6 +263,9 @@ static void trans_ana(
    const int16_t time_offs,     /* i  : Time offset                                          */
    const int16_t time_offs,     /* i  : Time offset                                          */
    const float est_mus_content, /* i  : 0.0=speech_like ... 1.0=Music    (==st->env_stab )   */
    const float est_mus_content, /* i  : 0.0=speech_like ... 1.0=Music    (==st->env_stab )   */
    const int16_t last_fec,      /* i  : signal that previous frame was concealed with fec_alg*/
    const int16_t last_fec,      /* i  : signal that previous frame was concealed with fec_alg*/
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
    const int16_t element_mode, /* i :  element_mode req to handle EVS_MONO specific BE path  */
#endif
    float *alpha,       /* o  : Magnitude modification factors for fade to average   */
    float *alpha,       /* o  : Magnitude modification factors for fade to average   */
    float *beta,        /* o  : Magnitude modification factors for fade to average   */
    float *beta,        /* o  : Magnitude modification factors for fade to average   */
    float *beta_mute,   /* o  : Factor for long-term mute                            */
    float *beta_mute,   /* o  : Factor for long-term mute                            */
@@ -416,10 +419,28 @@ static void trans_ana(
            {
            {
                mag_chg[k] = 0;
                mag_chg[k] = 0;
            }
            }

#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
            if ( element_mode != EVS_MONO )
            {
                if ( k == 0 && burst_len > BETA_MUTE_THR ) /* beta_mute final long term attenuation adjusted only once per frame in the first sub-band, Ref   Eq(184) in 26.447 */
                {
                    *beta_mute *= BETA_MUTE_FAC;
                }
            }
            else
            {
                if ( burst_len > BETA_MUTE_THR ) /* legacy incorrect(too fast) EVS_MONO operation, still kept for BE.  To be updated after EVS CR, ref Eq (184) in 26.447 */
                {
                    *beta_mute *= BETA_MUTE_FAC;
                }
            }
#else
            if ( burst_len > BETA_MUTE_THR )
            if ( burst_len > BETA_MUTE_THR )
            {
            {
                *beta_mute *= BETA_MUTE_FAC;
                *beta_mute *= BETA_MUTE_FAC;
            }
            }
#endif
            alpha[k] = mag_chg[k];
            alpha[k] = mag_chg[k];
            beta[k] = (float) ( sqrt( 1.0f - SQR( alpha[k] ) ) * *beta_mute );
            beta[k] = (float) ( sqrt( 1.0f - SQR( alpha[k] ) ) * *beta_mute );
            if ( k >= LGW32k - 1 )
            if ( k >= LGW32k - 1 )
@@ -2097,8 +2118,11 @@ static void hq_phase_ecu(
        {
        {
            *time_offs = 0;
            *time_offs = 0;
        }
        }

#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
        trans_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, element_mode, alpha, beta, beta_mute, Xavg );
#else
        trans_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, alpha, beta, beta_mute, Xavg );
        trans_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, alpha, beta, beta_mute, Xavg );
#endif
        spec_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, plocs, plocsi, num_p, X_sav, output_frame, bwidth, element_mode, &noise_fac, pcorr );
        spec_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, plocs, plocsi, num_p, X_sav, output_frame, bwidth, element_mode, &noise_fac, pcorr );


        if ( prev_bfi && *last_fec )
        if ( prev_bfi && *last_fec )
@@ -2115,7 +2139,11 @@ static void hq_phase_ecu(
            *time_offs = MAX16B; /* continued muting will ensure that the now fixed seeds are not creating tones */
            *time_offs = MAX16B; /* continued muting will ensure that the now fixed seeds are not creating tones */
        }
        }


#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
        trans_ana( prevsynth + 2 * output_frame - Lprot, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, 0, element_mode, alpha, beta, beta_mute, Xavg ); /* 1.0 stable-music,  0.0 speech-like */
#else
        trans_ana( prevsynth + 2 * output_frame - Lprot, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, 0, alpha, beta, beta_mute, Xavg ); /* 1.0 stable-music,  0.0 speech-like */
        trans_ana( prevsynth + 2 * output_frame - Lprot, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, 0, alpha, beta, beta_mute, Xavg ); /* 1.0 stable-music,  0.0 speech-like */
#endif
    }
    }


    mvr2r( X_sav, X, Lprot );
    mvr2r( X_sav, X, Lprot );