From 0f9b0399ed065076529081735c3484fcacedc5b1 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Feb 2025 21:47:01 +0530 Subject: [PATCH] Fix for 3GPP issue 1288: Missing scaling in NB post-filter Link #1288 --- lib_com/prot_fx.h | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 6 +++--- lib_dec/dec_post_fx.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 9fae6a1c1..21cb3ba36 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6631,7 +6631,7 @@ void nb_post_filt_fx( const Word16 tmp_noise, /* i : noise energy Q0 */ Word16 *Synth, /* i : 12k8 synthesis Qsyn */ const Word16 *Aq, /* i : LP filter coefficient Q12 */ - const Word16 *Pitch_buf, /* i : Fractionnal subframe pitch buffer Q6 */ + const Word16 *Pitch_buf, /* i : Fractionnal subframe pitch buffer Q0 */ const Word16 coder_type, /* i : coder_type */ const Word16 BER_detect, /* i : BER detect flag */ const Word16 disable_hpf /* i : flag to diabled HPF */ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 0914e7ece..92ea2e032 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1235,7 +1235,7 @@ ivas_error acelp_core_dec_ivas_fx( *------------------------------------------------------------*/ - Copy_Scale_sig( pitch_buf_fx, pitch_buf_tmp, NB_SUBFR16k, -Q6 ); // Q0 + Copy_Scale_sig( pitch_buf_fx, pitch_buf_tmp, st->nb_subfr, -Q6 ); // Q0 FEC_scale_syn_ivas_fx( st->L_frame, &update_flg, st->clas_dec, st->last_good, psyn_fx, pitch_buf_tmp, st->enr_old_fx, enr_q_fx, st->coder_type, LSF_Q_prediction, &st->scaling_flag, &st->lp_ener_FEC_av, &st->lp_ener_FEC_max, st->bfi, st->total_brate, st->prev_bfi, st->last_core_brate, exc_fx, exc2_fx, Aq_fx, &st->old_enr_LP, mem_tmp_fx, st->mem_syn2_fx, st->Q_exc, st->Q_syn, avoid_lpc_burst_on_recovery, 0 ); @@ -1393,7 +1393,7 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( EQ_32( st->total_brate, ACELP_7k20 ) || EQ_32( st->total_brate, ACELP_8k00 ) ) { - Copy_Scale_sig( pitch_buf_fx, pitch_buf_tmp, NB_SUBFR16k, -Q6 ); // Q0 + Copy_Scale_sig( pitch_buf_fx, pitch_buf_tmp, st->nb_subfr, -Q6 ); // Q0 FEC_scale_syn_ivas_fx( st->L_frame, &update_flg, st->clas_dec, st->last_good, psyn_fx, pitch_buf_tmp, st->enr_old_fx, enr_q_fx, st->coder_type, LSF_Q_prediction, &st->scaling_flag, &st->lp_ener_FEC_av, &st->lp_ener_FEC_max, st->bfi, st->total_brate, st->prev_bfi, st->last_core_brate, @@ -1430,7 +1430,7 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( st->last_bwidth == NB && st->hPFstat != NULL ) { - Copy( pitch_buf_fx, pitch_buf_tmp, NB_SUBFR16k ); + Copy_Scale_sig( pitch_buf_fx, pitch_buf_tmp, st->nb_subfr, -Q6 ); // Q0 IF( st->bwidth == NB ) { st->hPFstat->on = 1; diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index a6e06db54..a4f618a3f 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -86,7 +86,7 @@ void nb_post_filt_fx( const Word16 tmp_noise, /* i : noise energy Q0 */ Word16 *Synth, /* i : 12k8 synthesis Qsyn */ const Word16 *Aq, /* i : LP filter coefficient Q12 */ - const Word16 *Pitch_buf, /* i : Fractionnal subframe pitch buffer Q6 */ + const Word16 *Pitch_buf, /* i : Fractionnal subframe pitch buffer Q0 */ const Word16 coder_type, /* i : coder_type */ const Word16 BER_detect, /* i : BER detect flag */ const Word16 disable_hpf /* i : flag to diabled HPF */ @@ -142,7 +142,7 @@ void nb_post_filt_fx( move16(); FOR( i = 0; i < L_frame; i += L_SUBFR ) { - T0_first = Pitch_buf[j]; // Q6 + T0_first = Pitch_buf[j]; // Q0 move16(); Dec_postfilt_fx( hPFstat, T0_first, &Pf_in[i], p_Aq, &Synth[i], Post_G1, Post_G2, Gain_factor, disable_hpf ); @@ -179,7 +179,7 @@ void nb_post_filt_fx( *----------------------------------------------------------------------------*/ static void Dec_postfilt_fx( PFSTAT_HANDLE hPFstat, /* i : core decoder parameters */ - const Word16 t0, /* i : pitch delay given by coder Q6 */ + const Word16 t0, /* i : pitch delay given by coder Q0 */ const Word16 *signal_ptr, /* i : input signal (pointer to current subframe Q0 */ const Word16 *coeff, /* i : LPC coefficients for current subframe Q12 */ Word16 *sig_out, /* o : postfiltered output Q15*/ @@ -749,7 +749,7 @@ static void modify_pst_param_fx( * Perform harmonic postfilter *----------------------------------------------------------------------------*/ static void pst_ltp_fx( - Word16 t0, /* i : pitch delay given by coder Q6 */ + Word16 t0, /* i : pitch delay given by coder Q0 */ Word16 *ptr_sig_in, /* i : postfilter i filter (residu2) Qx */ Word16 *ptr_sig_pst0, /* o : harmonic postfilter o Qx */ Word16 gain_factor /* i : Gain Factor (Q15) */ -- GitLab