From fa151856ce9001b9ba74c82a8cb237cab9daa98b Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 9 May 2024 14:48:25 -0400 Subject: [PATCH] Propose fix for the last problem of 736, related to icBWE --- lib_com/options.h | 2 ++ lib_dec/ivas_stereo_icbwe_dec.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 677bbe613..99aea9efd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -131,6 +131,8 @@ #define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues #define FIX_SATURATION_725 // Propose fix for saturation in AVQ #define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ +#define FIX_736_BWE_SECT_C // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 150df7e1d..ac5e223af 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -916,7 +916,11 @@ void stereo_icBWE_dec_fx( L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] ); // prev_q_bwe_exc - 16 L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] ); // Q_exc L_nlExc16k = L_shl( L_nlExc16k, 18 - ( st->prev_Q_bwe_exc - 16 ) ); // Q18 +#ifndef FIX_736_BWE_SECT_C L_mixExc16k = L_shl( L_mixExc16k, 18 - st->Q_exc ); // Q18 +#else + L_mixExc16k = L_shl( L_mixExc16k, 18 - ( st->prev_Q_bwe_exc - 25 ) ); // Q18 +#endif excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q18 move32(); k++; @@ -2028,9 +2032,15 @@ void stereo_icBWE_decproc_fx( win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ gain0_fx = Mpy_32_32( win_in_fx, hCPE->hStereoDft->td_gain_fx[0] ); /* Q --> q_td_gain[0] */ +#ifdef FIX_736_BWE_SECT_C + gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ + gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ + gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ +#else gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ output[0][i] = L_add_sat( output[0][i], tmp_fx ); @@ -2040,7 +2050,11 @@ void stereo_icBWE_decproc_fx( } FOR( i = dftOvlLen; i < output_frame; i++ ) { +#ifdef FIX_736_BWE_SECT_C + tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ +#else tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif output[0][i] = L_add_sat( output[0][i], tmp_fx ); move32(); output[1][i] = L_sub_sat( output[1][i], tmp_fx ); -- GitLab