From 554ca834e8b4838416978499f20294388a5dccdc Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 18 Jun 2025 14:19:21 +1000 Subject: [PATCH 1/8] spar com optimizations --- lib_com/ivas_spar_com_fx.c | 22 ++++++++++++++++++++++ lib_com/options.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 15a529149..60c9c8b79 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4257,10 +4257,19 @@ void ivas_get_spar_md_from_dirac_enc_fx( { Word32 norm_fx; Word16 norm_q; + +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + Word16 num_ch_order; +#else Word16 num_ch_order, hoa2_ch_order; +#endif num_ch_order = ivas_sba_get_nchan_fx( order, 0 ); +#ifndef NONBE_FIX_1748_SPAR_DIV_OPT hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 ); +#else + assert( order == 1 ); +#endif FOR( ch = 0; ch < num_ch_order; ch++ ) { @@ -4327,6 +4336,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( } } +#ifndef NONBE_FIX_1748_SPAR_DIV_OPT + /*normalize 2nd order*/ norm_fx = 0; move32(); @@ -4426,6 +4437,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( move32(); } } +#endif } } @@ -4815,10 +4827,18 @@ void ivas_get_spar_md_from_dirac_fx( { Word32 norm_fx; Word16 norm_q; +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + Word16 num_ch_order; +#else Word16 num_ch_order, hoa2_ch_order; +#endif num_ch_order = ivas_sba_get_nchan_fx( order, 0 ); +#ifndef NONBE_FIX_1748_SPAR_DIV_OPT hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 ); +#else + assert( order == 1 ); +#endif FOR( ch = 0; ch < num_ch_order; ch++ ) { @@ -4885,6 +4905,7 @@ void ivas_get_spar_md_from_dirac_fx( } } +#ifndef NONBE_FIX_1748_SPAR_DIV_OPT /*normalize 2nd order*/ norm_fx = 0; move32(); @@ -4984,6 +5005,7 @@ void ivas_get_spar_md_from_dirac_fx( move32(); } } +#endif } } diff --git a/lib_com/options.h b/lib_com/options.h index 7996f8d41..ebb93fa2d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -119,4 +119,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ +#define NONBE_FIX_1748_SPAR_DIV_OPT /*Dlb: issue 1748: SPAR common div optimizations*/ + #endif -- GitLab From 54d86d4ed995b750a84dc5b2fa33c556305ca12c Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 18 Jun 2025 20:52:04 +1000 Subject: [PATCH 2/8] simplify spherical harm response normalization, non-BE --- lib_com/ivas_spar_com_fx.c | 47 +++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 60c9c8b79..65e4b1c29 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4017,7 +4017,12 @@ void ivas_compute_spar_params_fx( Word32 diff_norm_order1_table[4] = { 0, 805306368, 402653184, 268435456 }; // q28 Word32 diff_norm_order2_table[6] = { 0, 1342177280, 671088640, 447392416, 335544320, 268435456 }; // q28 Word32 diff_norm_order3_table[8] = { 0, 1879048192, 939524096, 626349376, 469762048, 375809632, 313174688, 268435456 }; // q28 -#define EPSILON_FX_THR 70 +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT +#define EPSILON_FX_SHIFT 6 +#define EPSILON_FX_THR ( 1 << EPSILON_FX_SHIFT ) +#else +#define EPSILON_FX_THR 70 +#endif #define ONE_BY_THREE_Q31 715827882 #define ONE_BY_FIVE_Q31 429496729 #define ONE_BY_SEVEN_Q31 306783378 @@ -4310,6 +4315,25 @@ void ivas_get_spar_md_from_dirac_enc_fx( move16(); } norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 + +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + IF( LT_32( norm_fx, EPSILON_FX_THR ) ) + { + FOR( ch = 1; ch < foa_ch; ch++ ) + { + /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/ + response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( Q30, EPSILON_FX_SHIFT ) ); // q30 + move32(); + } + } + ELSE + { + response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 + move32(); + response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 + move32(); + } +#else FOR( ch = 1; ch < foa_ch; ch++ ) { IF( LT_32( norm_fx, EPSILON_FX_THR ) ) @@ -4335,6 +4359,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( move32(); } } +#endif #ifndef NONBE_FIX_1748_SPAR_DIV_OPT @@ -4879,6 +4904,25 @@ void ivas_get_spar_md_from_dirac_fx( move16(); } norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 + +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + IF( LT_32( norm_fx, EPSILON_FX_THR ) ) + { + FOR( ch = 1; ch < foa_ch; ch++ ) + { + /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/ + response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( Q30, EPSILON_FX_SHIFT ) ); // q30 + move32(); + } + } + ELSE + { + response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 + move32(); + response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 + move32(); + } +#else FOR( ch = 1; ch < foa_ch; ch++ ) { IF( LT_32( norm_fx, EPSILON_FX_THR ) ) @@ -4904,6 +4948,7 @@ void ivas_get_spar_md_from_dirac_fx( move32(); } } +#endif #ifndef NONBE_FIX_1748_SPAR_DIV_OPT /*normalize 2nd order*/ -- GitLab From 8e294c8eef9ee5db708e054f8c040568e0617ca3 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 19 Jun 2025 11:21:43 +1000 Subject: [PATCH 3/8] add missing loop line --- lib_com/ivas_spar_com_fx.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 65e4b1c29..02cc83d68 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4289,6 +4289,11 @@ void ivas_get_spar_md_from_dirac_enc_fx( } /*normalize 1st order*/ +#if 0 // def NONBE_FIX_1748_SPAR_DIV_OPT + Word16 norm_t = L_norm_arr( &response_avg_fx[1], foa_ch - 1 ); + norm_t = norm_t - 1; + scale_sig32( &response_avg_fx[1], foa_ch - 1, norm_t ); +#endif norm_fx = 0; move32(); norm_q = 0; @@ -4328,10 +4333,13 @@ void ivas_get_spar_md_from_dirac_enc_fx( } ELSE { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); + FOR( ch = 1; ch < foa_ch; ch++ ) + { + response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 + move32(); + response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 + move32(); + } } #else FOR( ch = 1; ch < foa_ch; ch++ ) @@ -4878,6 +4886,11 @@ void ivas_get_spar_md_from_dirac_fx( } /*normalize 1st order*/ +#if 0 // def NONBE_FIX_1748_SPAR_DIV_OPT + Word16 norm_t = L_norm_arr( &response_avg_fx[1], foa_ch - 1 ); + norm_t = norm_t - 1; + scale_sig32( &response_avg_fx[1], foa_ch - 1, norm_t ); +#endif norm_fx = 0; move32(); norm_q = 0; @@ -4917,10 +4930,13 @@ void ivas_get_spar_md_from_dirac_fx( } ELSE { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 - move32(); + FOR( ch = 1; ch < foa_ch; ch++ ) + { + response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 + move32(); + response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 + move32(); + } } #else FOR( ch = 1; ch < foa_ch; ch++ ) -- GitLab From 91fed7387e7557d914211e69af8f3e60decabfca Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 19 Jun 2025 12:55:55 +1000 Subject: [PATCH 4/8] improve precision of average sph harm resp --- lib_com/ivas_spar_com_fx.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 02cc83d68..e1c216d00 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4264,7 +4264,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT - Word16 num_ch_order; + Word16 num_ch_order, norm_t; #else Word16 num_ch_order, hoa2_ch_order; #endif @@ -4289,21 +4289,28 @@ void ivas_get_spar_md_from_dirac_enc_fx( } /*normalize 1st order*/ -#if 0 // def NONBE_FIX_1748_SPAR_DIV_OPT - Word16 norm_t = L_norm_arr( &response_avg_fx[1], foa_ch - 1 ); - norm_t = norm_t - 1; - scale_sig32( &response_avg_fx[1], foa_ch - 1, norm_t ); +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) ); + move16(); + norm_t = sub( norm_t, 1 ); + move16(); + scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t ); #endif norm_fx = 0; move32(); +#ifndef NONBE_FIX_1748_SPAR_DIV_OPT norm_q = 0; move16(); +#endif FOR( ch = 1; ch < foa_ch; ch++ ) { norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 } norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) ); +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q +#else IF( norm_fx ) { norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q @@ -4313,6 +4320,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( norm_fx = EPSILON_FX; move32(); } +#endif IF( norm_q <= 0 ) { norm_fx = L_shr( norm_fx, ( negate( norm_q ) ) ); // q=31 @@ -4861,7 +4869,7 @@ void ivas_get_spar_md_from_dirac_fx( Word32 norm_fx; Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT - Word16 num_ch_order; + Word16 num_ch_order, norm_t; #else Word16 num_ch_order, hoa2_ch_order; #endif @@ -4886,21 +4894,29 @@ void ivas_get_spar_md_from_dirac_fx( } /*normalize 1st order*/ -#if 0 // def NONBE_FIX_1748_SPAR_DIV_OPT - Word16 norm_t = L_norm_arr( &response_avg_fx[1], foa_ch - 1 ); - norm_t = norm_t - 1; - scale_sig32( &response_avg_fx[1], foa_ch - 1, norm_t ); +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) ); + move16(); + norm_t = sub( norm_t, 1 ); + move16(); + scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t ); #endif norm_fx = 0; move32(); +#ifndef NONBE_FIX_1748_SPAR_DIV_OPT norm_q = 0; move16(); +#endif FOR( ch = 1; ch < foa_ch; ch++ ) { norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29 } norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) ); + +#ifdef NONBE_FIX_1748_SPAR_DIV_OPT + norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q +#else IF( norm_fx ) { norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q @@ -4910,6 +4926,8 @@ void ivas_get_spar_md_from_dirac_fx( norm_fx = EPSILON_FX; move32(); } +#endif + IF( norm_q <= 0 ) { norm_fx = L_shr( norm_fx, ( negate( norm_q ) ) ); // q=31 -- GitLab From 5a952a01ad9f232f646350b0aaef3a71f44d1689 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 23 Jun 2025 13:00:36 +1000 Subject: [PATCH 5/8] replace divide3232 with BASOP_Util_Divide3232_Scale_newton --- lib_com/ivas_spar_com_fx.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index e1c216d00..0d6b9ec03 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4264,7 +4264,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT - Word16 num_ch_order, norm_t; + Word16 num_ch_order, norm_t, tmp_e; #else Word16 num_ch_order, hoa2_ch_order; #endif @@ -4291,9 +4291,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( /*normalize 1st order*/ #ifdef NONBE_FIX_1748_SPAR_DIV_OPT norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) ); - move16(); norm_t = sub( norm_t, 1 ); - move16(); scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t ); #endif norm_fx = 0; @@ -4343,9 +4341,9 @@ void ivas_get_spar_md_from_dirac_enc_fx( { FOR( ch = 1; ch < foa_ch; ch++ ) { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 + response_avg_fx[ch] = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ), &tmp_e ); // Q31 - tmp_e move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 + response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( tmp_e, Q1 ) ); // q30 move32(); } } @@ -4869,7 +4867,7 @@ void ivas_get_spar_md_from_dirac_fx( Word32 norm_fx; Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT - Word16 num_ch_order, norm_t; + Word16 num_ch_order, norm_t, tmp_e; #else Word16 num_ch_order, hoa2_ch_order; #endif @@ -4896,9 +4894,7 @@ void ivas_get_spar_md_from_dirac_fx( /*normalize 1st order*/ #ifdef NONBE_FIX_1748_SPAR_DIV_OPT norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) ); - move16(); norm_t = sub( norm_t, 1 ); - move16(); scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t ); #endif norm_fx = 0; @@ -4950,9 +4946,9 @@ void ivas_get_spar_md_from_dirac_fx( { FOR( ch = 1; ch < foa_ch; ch++ ) { - response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15 + response_avg_fx[ch] = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ), &tmp_e ); // Q31 - tmp_e move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30 + response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( tmp_e, Q1 ) ); // q30 move32(); } } -- GitLab From 69d1b54024f672dcad5bcbb1e61b8753ac966c0a Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 24 Jun 2025 22:45:28 +1000 Subject: [PATCH 6/8] reduce precision of normalized response to avoid magnitude overshoot --- lib_com/ivas_spar_com_fx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 0d6b9ec03..6dea0a20d 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4265,6 +4265,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( #ifdef NONBE_FIX_1748_SPAR_DIV_OPT Word16 num_ch_order, norm_t, tmp_e; + Word32 tmp_norm_out; #else Word16 num_ch_order, hoa2_ch_order; #endif @@ -4341,9 +4342,9 @@ void ivas_get_spar_md_from_dirac_enc_fx( { FOR( ch = 1; ch < foa_ch; ch++ ) { - response_avg_fx[ch] = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ), &tmp_e ); // Q31 - tmp_e - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( tmp_e, Q1 ) ); // q30 + tmp_norm_out = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ), &tmp_e ); // Q31 - tmp_e + tmp_norm_out = L_shl( tmp_norm_out, sub( tmp_e, Q1 ) ); // q30 + response_avg_fx[ch] = L_and( tmp_norm_out, 0xffff8000 ); // q30 move32(); } } @@ -4868,6 +4869,7 @@ void ivas_get_spar_md_from_dirac_fx( Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT Word16 num_ch_order, norm_t, tmp_e; + Word32 tmp_norm_out; #else Word16 num_ch_order, hoa2_ch_order; #endif @@ -4946,9 +4948,9 @@ void ivas_get_spar_md_from_dirac_fx( { FOR( ch = 1; ch < foa_ch; ch++ ) { - response_avg_fx[ch] = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ), &tmp_e ); // Q31 - tmp_e - move32(); - response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( tmp_e, Q1 ) ); // q30 + tmp_norm_out = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ), &tmp_e ); // Q31 - tmp_e + tmp_norm_out = L_shl( tmp_norm_out, sub( tmp_e, Q1 ) ); // q30 + response_avg_fx[ch] = L_and( tmp_norm_out, 0xffff8000 ); // q30 move32(); } } -- GitLab From 2ad939bc7a179df772a916c85a68e609f5600736 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 24 Jun 2025 23:38:33 +1000 Subject: [PATCH 7/8] roll back to divide3232 to retain q15 precision --- lib_com/ivas_spar_com_fx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 6dea0a20d..2be38b4bc 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4264,7 +4264,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT - Word16 num_ch_order, norm_t, tmp_e; + Word16 num_ch_order, norm_t; Word32 tmp_norm_out; #else Word16 num_ch_order, hoa2_ch_order; @@ -4342,9 +4342,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( { FOR( ch = 1; ch < foa_ch; ch++ ) { - tmp_norm_out = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ), &tmp_e ); // Q31 - tmp_e - tmp_norm_out = L_shl( tmp_norm_out, sub( tmp_e, Q1 ) ); // q30 - response_avg_fx[ch] = L_and( tmp_norm_out, 0xffff8000 ); // q30 + tmp_norm_out = divide3232( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ) ); // q15 + response_avg_fx[ch] = L_shl( tmp_norm_out, 15 ); // q30 move32(); } } @@ -4868,7 +4867,7 @@ void ivas_get_spar_md_from_dirac_fx( Word32 norm_fx; Word16 norm_q; #ifdef NONBE_FIX_1748_SPAR_DIV_OPT - Word16 num_ch_order, norm_t, tmp_e; + Word16 num_ch_order, norm_t; Word32 tmp_norm_out; #else Word16 num_ch_order, hoa2_ch_order; @@ -4948,9 +4947,8 @@ void ivas_get_spar_md_from_dirac_fx( { FOR( ch = 1; ch < foa_ch; ch++ ) { - tmp_norm_out = BASOP_Util_Divide3232_Scale_newton( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ), &tmp_e ); // Q31 - tmp_e - tmp_norm_out = L_shl( tmp_norm_out, sub( tmp_e, Q1 ) ); // q30 - response_avg_fx[ch] = L_and( tmp_norm_out, 0xffff8000 ); // q30 + tmp_norm_out = divide3232( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ) ); // q15 + response_avg_fx[ch] = L_shl( tmp_norm_out, 15 ); // q30 move32(); } } -- GitLab From b9ddc95f747742326cb26e5b48981bb8321e27e7 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 8 Jul 2025 11:46:51 +1000 Subject: [PATCH 8/8] address review comment --- lib_com/ivas_spar_com_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 2be38b4bc..656868120 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4334,7 +4334,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( FOR( ch = 1; ch < foa_ch; ch++ ) { /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/ - response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( Q30, EPSILON_FX_SHIFT ) ); // q30 + response_avg_fx[ch] = L_shl( response_avg_fx[ch], Q30 - EPSILON_FX_SHIFT ); // q30 move32(); } } @@ -4939,7 +4939,7 @@ void ivas_get_spar_md_from_dirac_fx( FOR( ch = 1; ch < foa_ch; ch++ ) { /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/ - response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( Q30, EPSILON_FX_SHIFT ) ); // q30 + response_avg_fx[ch] = L_shl( response_avg_fx[ch], Q30 - EPSILON_FX_SHIFT ); // q30 move32(); } } -- GitLab