From 2c50f3e1ace391d0ba232402c6999476b0479438 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 3 Feb 2025 17:03:59 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 1125: interfering talker flag not triggered on short test vector Link #1125 --- lib_com/ivas_rom_com_fx.c | 10 ++++++++++ lib_com/ivas_rom_com_fx.h | 1 + lib_com/options.h | 1 + lib_enc/ivas_stereo_ica_enc.c | 17 +++++++++++++++-- lib_enc/ivas_stereo_td_analysis.c | 15 ++++++++++++++- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index ac4736561..cc138d070 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1356,6 +1356,16 @@ const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1] = { 2147483647, 2147483647, 2147483647 }; +// Q30 +const Word32 tdm_ratio_tabl_fx_Q30[] = { + 0, 0, 11703786, 26306674, 46385648, 71940704, 102542344, 137868448, + 177596896, 221298192, 268435456, 318471840, 370977792, 425201760, 480714208, + 536870912, 593027584, 648540032, 702764032, 755270016, 805306368, 852443648, + 896144896, 935873344, 971199488, 1001801152, 1027356160, 1047435136, + 1062038016, 1073741824, 1073741824, 1073741824 +}; + + // Q24 const Word32 tdm_ratio_tabl_fx_Q24[TDM_NQ + 1] = { 0, 0, 182871, 411041, 724775, 1124073, 1602224, 2154194, diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h index 88bbaabbc..e1f4d0a6e 100644 --- a/lib_com/ivas_rom_com_fx.h +++ b/lib_com/ivas_rom_com_fx.h @@ -108,6 +108,7 @@ extern const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[]; *----------------------------------------------------------------------------------*/ extern const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1]; +extern const Word32 tdm_ratio_tabl_fx_Q30[TDM_NQ + 1]; extern const Word32 tdm_ratio_tabl_fx_Q24[TDM_NQ + 1]; extern const UWord32 tdm_den_ratio_tabl_fx[]; extern const Word16 icbwe_gsMapping_tbl_fx[]; // Q12 diff --git a/lib_com/options.h b/lib_com/options.h index d5314dd12..573b619bf 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,6 +105,7 @@ #define FIX_1100_REMOVE_LPC_RESCALING /* VA: Remove the rescaling of LPC coefficient to Q12 as residu and syn-filt are already taking care of it*/ #define FIX_1133_IMPROVE_MC_MLD /* Ittiam: Correcting wrong updation of exponents in ivas_mc_paramupmix_param_est_enc_fx() */ #define FIX_ISSUE_1122 /* Ittiam: Fix issue 1122: corrected incorrect scaling of a buffer leading to incorrect metadata bits */ +#define FIX_ISSUE_1125 /* Ittiam: Fix issue 1125: interfering talker flag not triggered on short test vector */ #define FIX_1132_STACK_CORRUPTION /* Stack corruption issue due of extending index access*/ #define FIX_ISSUE_1092 /* Ittiam: Fix for Issue 1092: BASOP asserts in stereo fx encoder for selection test inputs*/ #define FIX_ISSUE_1135 /* Ittiam: Fix for Issue 1135: downmixing difference between float and fixed-point (DFT - stereo) */ diff --git a/lib_enc/ivas_stereo_ica_enc.c b/lib_enc/ivas_stereo_ica_enc.c index 3f4696a06..67a575e44 100644 --- a/lib_enc/ivas_stereo_ica_enc.c +++ b/lib_enc/ivas_stereo_ica_enc.c @@ -2258,9 +2258,22 @@ static void unclr_calc_corr_features_fx( corrR = BASOP_Util_Add_Mant32Exp( corrR, corrR_exp, Mpy_32_32( buf2[i], mono_i ), add( sub( 31, q_com ), exp ), &corrR_exp ); /* Q31-corrR_exp */ ener = BASOP_Util_Add_Mant32Exp( ener, ener_exp, Mpy_32_32( mono_i, mono_i ), shl( exp, 1 ), &ener_exp ); - side_i = BASOP_Util_Add_Mant32Exp( L_shr( buf1[i], 1 ), sub( 31, q_com ), L_negate( L_shr( buf2[i], 1 ) ), sub( 31, q_com ), &exp ); /* Q31-exp */ - ener_side = BASOP_Util_Add_Mant32Exp( ener_side, ener_side_exp, Mpy_32_32( side_i, side_i ), shl( exp, 1 ), &ener_side_exp ); /* Q31-ener_side_exp */ + side_i = BASOP_Util_Add_Mant32Exp( L_shr( buf1[i], 1 ), sub( 31, q_com ), L_negate( L_shr( buf2[i], 1 ) ), sub( 31, q_com ), &exp ); /* Q31-exp */ + ener_side = BASOP_Util_Add_Mant32Exp( ener_side, ener_side_exp, Mpy_32_32( side_i, side_i ), shl( exp, 1 ), &ener_side_exp ); /* Q31-ener_side_exp */ + +#ifdef FIX_ISSUE_1125 + Word16 n1, n2, prod_i_exp; + Word32 x, y, prod_i; + n1 = norm_l( buf1[i] ); + n2 = norm_l( buf2[i] ); + x = L_shl( buf1[i], n1 ); // q: q_com + n1 + y = L_shl( buf2[i], n2 ); // q: q_com + n2 + prod_i = Mpy_32_32( x, y ); // q: q_com * 2 + n1 + n2 - 31 + prod_i_exp = sub( 62, add( shl( q_com, 1 ), add( n1, n2 ) ) ); + sum_prod = BASOP_Util_Add_Mant32Exp( sum_prod, sum_prod_exp, prod_i, prod_i_exp, &sum_prod_exp ); /* Q31-sum_prod_exp */ +#else sum_prod = BASOP_Util_Add_Mant32Exp( sum_prod, sum_prod_exp, Mpy_32_32( buf1[i], buf2[i] ), sub( 62, shl( q_com, 1 ) ), &sum_prod_exp ); /* Q31-sum_prod_exp */ +#endif } /* average energy of L and R channels */ diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 58e72c91e..901a5dd28 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -635,14 +635,23 @@ Word16 stereo_tdm_ener_analysis_fx( hStereoTD->tdm_last_LRTD_PriCh_cnt = add( hStereoTD->tdm_last_LRTD_PriCh_cnt, 1 ); move16(); } + +#ifdef FIX_ISSUE_1125 + ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 +#else ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 +#endif move32(); test(); IF( EQ_16( hStereoTD->tdm_SM_modi_flag, 1 ) && hStereoTD->tdm_LRTD_flag == 0 ) { idx = shr( add( hStereoTD->tdm_last_ratio_idx, add( LRTD_STEREO_MID_IS_PRIM, 1 ) ), 1 ); +#ifdef FIX_ISSUE_1125 + ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 +#else ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 +#endif move32(); } @@ -731,8 +740,12 @@ Word16 stereo_tdm_ener_analysis_fx( move16(); } - hCPE->hStereoClassif->ratio_L_fx = ratio_L_fx; /* Q15 */ + hCPE->hStereoClassif->ratio_L_fx = ratio_L_fx; /* 31 - ratio_L_e */ move32(); +#ifdef FIX_ISSUE_1125 + hCPE->hStereoClassif->ratio_L_e = 1; + move16(); +#endif return idx; } -- GitLab From c33bd4db6c70dc6a104267dd99167301d117739e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 3 Feb 2025 20:43:41 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_enc/ivas_stereo_td_analysis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 901a5dd28..e5bf2ea53 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -639,7 +639,7 @@ Word16 stereo_tdm_ener_analysis_fx( #ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 #else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 + ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 #endif move32(); -- GitLab