From 7ead565a817e943d3b1cf86c45ddfbab00fec153 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 9 Feb 2026 11:54:23 +0100 Subject: [PATCH 1/4] Combine xtalk_scale_td and xtalk_coef_td into one factor, avoiding a division in the xtalk score calculation. --- lib_com/options.h | 2 ++ lib_enc/ivas_rom_enc.h | 5 +++++ lib_enc/ivas_rom_enc_fx.c | 12 ++++++++++++ lib_enc/ivas_stereo_classifier_fx.c | 9 +++++++++ lib_enc/ivas_stereo_ica_enc_fx.c | 6 ++++++ 5 files changed, 34 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 61a3c10cc..f0e9fff76 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -109,6 +109,8 @@ #define FIX_2406_FIX_GAIN_ON_INACTIVE /* VA: basop issue 2406: gain between 6.4 and 8kHz was too weak during inactive content with Fs=16kHz */ #define FIX_2407_FIX_RESIDU_IVAS /* VA: basop 2407, Implementation issue in residu_ivas + unnecessary complexity */ +#define NONBE_MR2809 + /* ##################### End NON-BE switches ########################### */ /* ################## End MAINTENANCE switches ######################### */ diff --git a/lib_enc/ivas_rom_enc.h b/lib_enc/ivas_rom_enc.h index cd296fa14..fef071126 100644 --- a/lib_enc/ivas_rom_enc.h +++ b/lib_enc/ivas_rom_enc.h @@ -50,8 +50,13 @@ extern const Word32 unclr_coef_td[]; extern const Word16 xtalk_isel_td[]; extern const Word32 xtalk_mean_td[]; +#ifdef NONBE_MR2809 +extern const Word32 xtalk_factor_td_m[]; +extern const Word16 xtalk_factor_td_e[]; +#else extern const Word32 xtalk_scale_td[]; extern const Word32 xtalk_coef_td[]; +#endif extern const Word16 xtalk_isel_dft[]; extern const Word32 xtalk_mean_dft_q15[]; extern const Word32 xtalk_scale_dft_q15[]; diff --git a/lib_enc/ivas_rom_enc_fx.c b/lib_enc/ivas_rom_enc_fx.c index 6829a16ce..a0e888bd2 100644 --- a/lib_enc/ivas_rom_enc_fx.c +++ b/lib_enc/ivas_rom_enc_fx.c @@ -98,6 +98,17 @@ const Word32 xtalk_mean_td[SIZE_XTALK_ISEL_TD] = /*Q15*/ 19572, 4323, 44674958, 20928, 248554, 5077, 123099, 19205, 217973, 57391, 22648, 21, 23142, 342411, 59, 612, -71224 }; +#ifdef NONBE_MR2809 +const Word32 xtalk_factor_td_m[SIZE_XTALK_ISEL_TD] = +{ + 1699245373, 1831181873, 1809297797, -618548720, 1524499779, 1779553202, -37818623, 1749773419, 2137615296, + -1823588164, -296137032, -2147483648, 2065624539, -562715, -2147483648, 1263996665, 1129562195 +}; +const Word16 xtalk_factor_td_e[SIZE_XTALK_ISEL_TD] = +{ + -4, 1, -12, 0, -7, -2, 0, -4, 0, 0, 0, 0, -2, 0, 0, -7, -1 +}; +#else const Word32 xtalk_scale_td[SIZE_XTALK_ISEL_TD] = /*Q15*/ { 37220, 2553, 16147962, 18786, 191263, 13110, 139310, 20547, 45408, 60617, 17627, 43, 9123, 2070239, 88, 21549, 68968 @@ -107,6 +118,7 @@ const Word32 xtalk_coef_td[SIZE_XTALK_ISEL_TD] = /*Q15*/ { 1841, 4353, 3322, -5411, 1061, 2716, -2453, 1046, 45199, -51474, -2431, -2245, 2194, -542, -135853, 99, 18138 }; +#endif const Word16 xtalk_isel_dft[SIZE_XTALK_ISEL_DFT] = { E_clas, E_gainILD, E_gainIPD, E_angle_rot, E_g_pred, E_d_prodL_prodR, E_sum_xcorr, E_xcorr_itd_value, E_gphat_d_itd2, E_gphat_ratio_m1_m2, E_gphat_m2_m2 diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 9538302fa..4a003272e 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -1146,12 +1146,21 @@ void xtalk_classifier_td_fx( move16(); /* mean & std removal */ +#ifdef NONBE_MR2809 + fvn = L_sub( hStereoClassif->xtalk_fv_fx[ind], xtalk_mean_td[i] ); + fvn = Mpy_32_32( fvn, xtalk_factor_td_m[i] ); // exp = 16 + 20 = 36 + exp = add( 16, xtalk_factor_td_e[i] ); + + /* LR */ + score = BASOP_Util_Add_Mant32Exp( score, score_exp, fvn, exp, &score_exp ); +#else fvn = BASOP_Util_Divide3232_Scale_newton( L_sub( hStereoClassif->xtalk_fv_fx[ind], xtalk_mean_td[i] ), xtalk_scale_td[i], &exp ); fvn = Mpy_32_32( fvn, xtalk_coef_td[i] ); // Q = 31-exp+15-31 = 15-exp exp = add( exp, 16 ); // exp = 31-(15-exp) = 16+exp /* LR */ score = BASOP_Util_Add_Mant32Exp( score, score_exp, fvn, exp, &score_exp ); +#endif } score = L_shl_sat( score, sub( score_exp, 3 ) ); // Q28 diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index c50ea4c0c..feb5ad596 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -2040,6 +2040,12 @@ void stereo_tca_enc_fx( move16(); sts[1]->q_inp32 = input_mem_loc_q; move16(); +#ifdef NONBE_MR2809 + sts[0]->q_old_inp32 = input_mem_loc_q; + move16(); + sts[1]->q_old_inp32 = input_mem_loc_q; + move16(); +#endif icaMemUpdate_fx( sts, hCPE, input_mem_loc_fx[0], input_mem_loc_fx[1], input_mem_loc_q, lMemRecalc, lMemRecalc_SCh, input_frame ); -- GitLab From 06b65c6ecbd2846fb9250e9695e327e9ecdbfd50 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 9 Feb 2026 12:47:05 +0100 Subject: [PATCH 2/4] Correct xtalk_factor_td_m/xtalk_factor_td_e. --- lib_enc/ivas_rom_enc_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_rom_enc_fx.c b/lib_enc/ivas_rom_enc_fx.c index a0e888bd2..7b1c88895 100644 --- a/lib_enc/ivas_rom_enc_fx.c +++ b/lib_enc/ivas_rom_enc_fx.c @@ -101,12 +101,13 @@ const Word32 xtalk_mean_td[SIZE_XTALK_ISEL_TD] = /*Q15*/ #ifdef NONBE_MR2809 const Word32 xtalk_factor_td_m[SIZE_XTALK_ISEL_TD] = { - 1699245373, 1831181873, 1809297797, -618548720, 1524499779, 1779553202, -37818623, 1749773419, 2137615296, - -1823588164, -296137032, -2147483648, 2065624539, -562715, -2147483648, 1263996665, 1129562195 + 1699245373, 1831181873, 1809297797, -1237097441, 1524499779, 1779553202, -1210195954, 1749773419, + 2137615296, -1823588164, -1184548129, -1761774848, 2065624539, -1152440556, -1625161800, 1263996665, + 1129562195 }; const Word16 xtalk_factor_td_e[SIZE_XTALK_ISEL_TD] = { - -4, 1, -12, 0, -7, -2, 0, -4, 0, 0, 0, 0, -2, 0, 0, -7, -1 + -4, 1, -12, -1, -7, -2, -5, -4, 0, 0, -2, 6, -2, -11, 11, -7, -1 }; #else const Word32 xtalk_scale_td[SIZE_XTALK_ISEL_TD] = /*Q15*/ -- GitLab From 76e32b473cf3348c622e89863ec7f122ea8c44d0 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 9 Feb 2026 15:42:04 +0100 Subject: [PATCH 3/4] Correct typo, wrong exponent was used for hStereoClassif->ps_sta_ch2_fx. Effect likely very small because most of the time hStereoClassif->ps_sta_ch1_e==hStereoClassif->ps_sta_ch2_e. --- lib_enc/ivas_stereo_classifier_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 4a003272e..597124c33 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -842,7 +842,11 @@ void stereo_classifier_features_ivas_fx( ELSE { hStereoClassif->xtalk_fv_fx[E_d_ps_diff] = L_abs( L_sub( L_shr( hStereoClassif->ps_diff_ch1_fx, sub( 16, hStereoClassif->ps_diff_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_diff_ch2_fx, sub( 16, hStereoClassif->ps_diff_ch2_e ) ) /*q15*/ ) ); /*q15*/ +#ifdef NONBE_MR2809 + hStereoClassif->xtalk_fv_fx[E_d_ps_sta] = L_abs( L_sub( L_shr( hStereoClassif->ps_sta_ch1_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_sta_ch2_fx, sub( 16, hStereoClassif->ps_sta_ch2_e ) ) /*q15*/ ) ); /*q15*/ +#else hStereoClassif->xtalk_fv_fx[E_d_ps_sta] = L_abs( L_sub( L_shr( hStereoClassif->ps_sta_ch1_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_sta_ch2_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/ ) ); /*q15*/ +#endif } move32(); move32(); -- GitLab From 3498057aa0d711901567495dbc676c4b44ea12a7 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 9 Feb 2026 15:44:13 +0100 Subject: [PATCH 4/4] clang format --- lib_enc/ivas_stereo_classifier_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 597124c33..d7e822f0f 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -843,9 +843,9 @@ void stereo_classifier_features_ivas_fx( { hStereoClassif->xtalk_fv_fx[E_d_ps_diff] = L_abs( L_sub( L_shr( hStereoClassif->ps_diff_ch1_fx, sub( 16, hStereoClassif->ps_diff_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_diff_ch2_fx, sub( 16, hStereoClassif->ps_diff_ch2_e ) ) /*q15*/ ) ); /*q15*/ #ifdef NONBE_MR2809 - hStereoClassif->xtalk_fv_fx[E_d_ps_sta] = L_abs( L_sub( L_shr( hStereoClassif->ps_sta_ch1_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_sta_ch2_fx, sub( 16, hStereoClassif->ps_sta_ch2_e ) ) /*q15*/ ) ); /*q15*/ + hStereoClassif->xtalk_fv_fx[E_d_ps_sta] = L_abs( L_sub( L_shr( hStereoClassif->ps_sta_ch1_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_sta_ch2_fx, sub( 16, hStereoClassif->ps_sta_ch2_e ) ) /*q15*/ ) ); /*q15*/ #else - hStereoClassif->xtalk_fv_fx[E_d_ps_sta] = L_abs( L_sub( L_shr( hStereoClassif->ps_sta_ch1_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_sta_ch2_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/ ) ); /*q15*/ + hStereoClassif->xtalk_fv_fx[E_d_ps_sta] = L_abs( L_sub( L_shr( hStereoClassif->ps_sta_ch1_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/, L_shr( hStereoClassif->ps_sta_ch2_fx, sub( 16, hStereoClassif->ps_sta_ch1_e ) ) /*q15*/ ) ); /*q15*/ #endif } move32(); -- GitLab