From ec60f21a16bcc3758dd6b0636ccd30c78b6e94ca Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Fri, 10 Oct 2025 12:48:00 +0200 Subject: [PATCH 1/3] Add fix NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING to port MR2017 --- lib_com/options.h | 1 + lib_dec/FEC_HQ_phase_ecu.c | 38 +++++++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7cfe42215..a4138697c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -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 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 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 ############################ */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 4ad3f28fb..9037bc571 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -263,10 +263,13 @@ static void trans_ana( 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 int16_t last_fec, /* i : signal that previous frame was concealed with fec_alg*/ - float *alpha, /* 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 Xavg[LGW_MAX] /* o : Frequency group average gain to fade to */ +#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 *beta, /* o : Magnitude modification factors for fade to average */ + float *beta_mute, /* o : Factor for long-term mute */ + float Xavg[LGW_MAX] /* o : Frequency group average gain to fade to */ ) { const float *w_hamm; @@ -416,10 +419,28 @@ static void trans_ana( { 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 ) { *beta_mute *= BETA_MUTE_FAC; } +#endif alpha[k] = mag_chg[k]; beta[k] = (float) ( sqrt( 1.0f - SQR( alpha[k] ) ) * *beta_mute ); if ( k >= LGW32k - 1 ) @@ -2097,8 +2118,11 @@ static void hq_phase_ecu( { *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 ); +#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 ); 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 */ } +#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 */ +#endif } mvr2r( X_sav, X, Lprot ); -- GitLab From 6ea875f3b1f57e49f37d2eccec995c05c7ccf4be Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 13 Oct 2025 10:39:46 +0200 Subject: [PATCH 2/3] Clang format --- lib_dec/FEC_HQ_phase_ecu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 65948f4ff..b9c8a5036 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -2161,7 +2161,7 @@ static void hq_phase_ecu( #ifdef FIX_1179_USAN_PHASEECU *time_offs = (int16_t) INT16_MAX; /* high value --> continued muting will ensure that the now saturated seed is not creating tones */ #else - *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 */ #endif } -- GitLab From 57e7cc02fd54a1e779fafa0abb1d724185a8acc2 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 13 Oct 2025 11:01:13 +0200 Subject: [PATCH 3/3] Fix accidental merge error, missing #endif --- lib_dec/FEC_HQ_phase_ecu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index b9c8a5036..061f39204 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -2124,6 +2124,7 @@ static void hq_phase_ecu( { *time_offs = 0; } +#endif #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 -- GitLab