From 87aee1193ca2f40585981ebab4932121e4abc5c0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 08:30:56 +0200 Subject: [PATCH 001/103] add macro ISSUE_1836_replace_overflow_libcom --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 14b1c5eb8..16641c03c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -124,6 +124,7 @@ #define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ #define ISSUE_1770_replace_shr_ro /* FhG: replace by non-overflow-alternative - BE */ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ +#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ #define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */ -- GitLab From de46490b7c9862ade8cdf2fa1a96d9798333d215 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 08:32:21 +0200 Subject: [PATCH 002/103] arith_coder_fx.c : changed void tcx_arith_scale_envelope --- lib_com/arith_coder_fx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 846b4dcea..928b90e5e 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -194,10 +194,12 @@ void tcx_arith_scale_envelope( Word16 statesi, bits; Word32 mean, a, s, L_tmp; Word16 mean_e, tmp, tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif lob_bits = 0; @@ -223,7 +225,11 @@ void tcx_arith_scale_envelope( tmp = norm_l( env[k] ); tmp2 = sub( 15, tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = Inv16( round_fx_sat( L_shl( env[k], tmp ) ), &tmp2 ); /* exp(tmp2) */ +#else tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */ +#endif ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ move32(); mean = L_add( mean, ienv[k] ); /* Q16 */ -- GitLab From 793395a89309b9ad63b9dfe98ea6e64ac20bf1d5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 08:41:56 +0200 Subject: [PATCH 003/103] arith_coder_fx.c : changed void tcx_arith_scale_envelope --- lib_com/arith_coder_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 928b90e5e..5fabbe6de 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -262,7 +262,11 @@ void tcx_arith_scale_envelope( b_e = add( b_e, mean_e ); /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 )); +#else tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow ); +#endif IF( tmp <= 0 ) { -- GitLab From c43506998e2b1aac086be4da5e12296ce465bdc2 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 08:52:42 +0200 Subject: [PATCH 004/103] deactivate macro 1836 --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 00d5e0f60..66bfde5cc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -125,7 +125,7 @@ #define ISSUE_1770_replace_shr_ro /* FhG: replace by non-overflow-alternative - BE */ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/ -#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ +//#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ #define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */ -- GitLab From e2828fc0ebee92282558757d4a72c0a0fff3c4ce Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 09:21:48 +0200 Subject: [PATCH 005/103] arith_coder_fx.c : changed void tcx_arith_scale_envelope --- lib_com/arith_coder_fx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index c6a123c28..80efe63c2 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -281,7 +281,7 @@ void tcx_arith_scale_envelope( tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); /* exp(scale) */ scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom scale = shl_sat( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */ #else scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */ @@ -334,7 +334,11 @@ void tcx_arith_scale_envelope( L_tmp = L_add( L_tmp, L_shl( Mpy_32_16_1( env[k], mult_r( 1147 /*0.035f Q15*/, iscale ) ), iscale_e ) ); /* Q16 */ tmp = norm_l( L_tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + statesi = mult_r( statesi, round_fx_sat( L_shl( L_tmp, tmp ) ) ); +#else statesi = mult_r( statesi, round_fx_o( L_shl_o( L_tmp, tmp, &Overflow ), &Overflow ) ); +#endif bits = add( bits, sub( 15, tmp ) ); tmp = norm_s( statesi ); -- GitLab From 9ae3c7f7b4fed5f63cfae6b64bb5d81d7119eddb Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 09:23:00 +0200 Subject: [PATCH 006/103] arith_coder_fx.c : completed void tcx_arith_scale_envelope --- lib_com/arith_coder_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 80efe63c2..d8632ad29 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -424,9 +424,13 @@ void tcx_arith_scale_envelope( tmp = getScaleFactor32( env, L_frame ); *s_env_e = sub( add( 15, iscale_e ), tmp ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + a = L_shl_sat( 1265000, sub( 15, *s_env_e ) ); +#else BASOP_SATURATE_WARNING_OFF_EVS; a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow ); BASOP_SATURATE_WARNING_ON_EVS; +#endif FOR( k = 0; k < L_frame; k++ ) { -- GitLab From d4b803242e26421a3c9e15d2bc12cec005fbbe3d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:16:36 +0200 Subject: [PATCH 007/103] replaced overflow operators in basop_util.c --- lib_com/basop_util.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 4c7ebea26..7b1d6b13d 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -267,9 +267,11 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a Word16 preShift, postShift; Word16 m; Word32 m32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif assert( b_m != 0 ); @@ -303,7 +305,11 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a /* normalize result */ postShift = norm_l( m32 ); +#ifdef ISSUE_1836_replace_overflow_libcom + m = round_fx_sat( L_shl( m32, postShift ) ); +#else m = round_fx_o( L_shl( m32, postShift ), &Overflow ); +#endif /* exponent */ *ptrResult_e = sub( add( add( a_e, sub( 1, b_e ) ), preShift ), postShift ); @@ -319,7 +325,9 @@ static Word16 Sqrt16_common( Word16 m, Word16 e ) { Word16 index, frac; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; +#endif assert( ( m >= 0x4000 ) || ( m == 0 ) ); @@ -334,9 +342,13 @@ static Word16 Sqrt16_common( Word16 m, /* interpolate */ if ( m != 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + m = mac_r_sat( SqrtTable[index], SqrtDiffTable[index], frac ); +#else BASOP_SATURATE_WARNING_OFF_EVS; m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow ); BASOP_SATURATE_WARNING_ON_EVS; +#endif } /* handle odd exponents */ @@ -352,13 +364,19 @@ static Word32 Sqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif assert( ( m >= 0x40000000 ) || ( m == 0 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + m16 = round_fx_sat( m ); +#else m16 = round_fx_o( m, &Overflow ); +#endif /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 9) - 32; */ @@ -414,16 +432,23 @@ static Word32 ISqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif assert( m >= 0x40000000 ); +#ifdef ISSUE_1836_replace_overflow_libcom + m16 = round_fx_sat( m ); +#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL m16 = round_fx_o( m, &Overflow ); #else m16 = round_fx( m ); #endif +#endif + /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 25) - 32; */ @@ -890,9 +915,11 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) { Word16 z; Word32 sign; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif sign = L_and( L_xor( L_num, L_denom ), (Word32) 0x80000000 ); @@ -906,7 +933,11 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) L_denom = L_shl( L_denom, z ); /* round_fx instead of extract_h improves spectral distortion in E_UTIL_lev_dur (schur version). */ +#ifdef ISSUE_1836_replace_overflow_libcom + z = div_l( L_num, round_fx_sat( L_denom ) ); +#else z = div_l( L_num, round_fx_o( L_denom, &Overflow ) ); +#endif if ( 0 != sign ) { z = negate( z ); @@ -2054,14 +2085,21 @@ Word32 norm_llQ31( /* o : normalized result Q31 */ Word16 i; Word32 L_tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; +#endif Flag Carry = 0; #endif /* BASOP_NOGLOB */ /* Move MSBit of L_sum into L_c */ Carry = 0; +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1 */ + L_c = L_add_c( L_c, L_c, &Carry ); +#else L_tmp = L_add_co( L_sum, L_sum, &Carry, &Overflow ); /* L_tmp = L_sum << 1 */ L_c = L_add_co( L_c, L_c, &Carry, &Overflow ); +#endif L_add( 0, 0 ); test(); IF( ( L_c != (Word32) 0L ) && ( L_c != (Word32) 0xFFFFFFFFL ) ) -- GitLab From e1b307ffb7c5109ade554e4ec6536f439c6fbe31 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:17:58 +0200 Subject: [PATCH 008/103] fix basop saturation warning --- lib_com/arith_coder_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index d8632ad29..f0ede14a7 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -424,13 +424,13 @@ void tcx_arith_scale_envelope( tmp = getScaleFactor32( env, L_frame ); *s_env_e = sub( add( 15, iscale_e ), tmp ); move16(); + BASOP_SATURATE_WARNING_OFF_EVS; #ifdef ISSUE_1836_replace_overflow_libcom a = L_shl_sat( 1265000, sub( 15, *s_env_e ) ); #else - BASOP_SATURATE_WARNING_OFF_EVS; a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow ); - BASOP_SATURATE_WARNING_ON_EVS; #endif + BASOP_SATURATE_WARNING_ON_EVS; FOR( k = 0; k < L_frame; k++ ) { -- GitLab From 58ef7853772e3f3a026cc00cb65c2f843f9e9e63 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:18:38 +0200 Subject: [PATCH 009/103] activated macro --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0e4e79b4a..2f0a886cc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -126,7 +126,7 @@ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/ #define ISSUE_1799_replace_L_shr_o /* FhG: replace by non-overflow-alternative - BE */ -//#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ +#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ #define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */ -- GitLab From 349f85633beebd8596c898b558fe1a97d19043d8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:29:00 +0200 Subject: [PATCH 010/103] clang format patch --- lib_com/arith_coder_fx.c | 4 ++-- lib_com/lsf_tools_fx.c | 2 +- lib_dec/LD_music_post_filter_fx.c | 2 +- lib_enc/hvq_enc_fx.c | 8 ++++---- lib_enc/nois_est_fx.c | 2 +- lib_enc/vad_fx.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index f0ede14a7..55d7a3ec5 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -230,7 +230,7 @@ void tcx_arith_scale_envelope( #else tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */ #endif - ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ + ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ move32(); mean = L_add( mean, ienv[k] ); /* Q16 */ } @@ -263,7 +263,7 @@ void tcx_arith_scale_envelope( /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 )); + tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ) ); #else tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow ); #endif diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 5c7dcd02c..1a8760c58 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -2326,7 +2326,7 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index c9d03fd54..4c3fa3728 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -932,7 +932,7 @@ static Word16 norm_lfe( #ifdef ISSUE_1796_replace_shl_o tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ #else - tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ + tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ #endif return tmp16; diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index 519114e40..f6c45dab2 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -149,7 +149,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits #ifdef ISSUE_1799_replace_L_shr_o noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ #else - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ #endif move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); @@ -184,7 +184,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits #ifdef ISSUE_1799_replace_L_shr_o lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ #else - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ #endif IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ { @@ -338,7 +338,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits #ifdef ISSUE_1799_replace_L_shr_o noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ #else - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ #endif move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); @@ -373,7 +373,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits #ifdef ISSUE_1799_replace_L_shr_o lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ #else - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ #endif IF( lb_nfpe > 16384 ) /* in Q15 */ { diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index ae7d07a67..224e4dddb 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -2568,7 +2568,7 @@ void noise_est_ivas_fx( #ifdef ISSUE_1796_replace_shl_o noise_chartmp = shl_sat( num, sub( sub( exp, exp2 ), 4 ) ); // 15+exp2-exp1 -> Q11 #else - noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 + noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 #endif } diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index e22f8cdcd..955c7c74d 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1090,7 +1090,7 @@ Word16 wb_vad_fx( #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ #else - tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ + tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ #endif IF( LT_16( i, 2 ) ) { -- GitLab From 1361488c413fd436179cd6929082fafbf05f2ce3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:31:36 +0200 Subject: [PATCH 011/103] bitalloc.c : replaced overflow basops --- lib_com/bitalloc_fx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 3bb0cbd72..d507c86ba 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -23,9 +23,11 @@ void bitalloc_fx( Word16 diff, temp; Word16 fac; Word16 ii; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Word16 SFM_thr = SFM_G1G2; move16(); @@ -54,7 +56,11 @@ void bitalloc_fx( move16(); FOR( m = 1; m < im; m++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + v = sub_sat( temp, y[m] ); /* Q0 */ +#else v = sub_o( temp, y[m], &Overflow ); /* Q0 */ +#endif temp = s_max( temp, y[m] ); if ( v < 0 ) { @@ -245,7 +251,7 @@ Word16 BitAllocF_fx( Word16 tmp, exp1, exp2; Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */ Word16 B_w16_fx; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -444,7 +450,7 @@ Word16 BitAllocF_fx( exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ #else m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ -- GitLab From 2cc44d9a6ea708c28b4757f4a473f359a8d5ef75 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:51:49 +0200 Subject: [PATCH 012/103] replaced overflow basops in cldfb_evs_fx.c --- lib_com/cldfb_evs_fx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 710ecf121..153f95cf9 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -1240,9 +1240,11 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( k = 0; k < numberCols; k++ ) @@ -1329,8 +1331,8 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); #else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); #endif @@ -1356,8 +1358,8 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); #else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); #endif -- GitLab From a3d7e73c91b8db6db8f38d20d9e97dcf50cf3f69 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 15:57:27 +0200 Subject: [PATCH 013/103] cldfb_fx.c : replaced all overflow basops --- lib_com/cldfb_fx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 244967c20..a15d1d5e7 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -1816,9 +1816,11 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( k = 0; k < numberCols; k++ ) @@ -1905,8 +1907,8 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); #else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); #endif @@ -1932,8 +1934,8 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); #else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); #endif -- GitLab From c3efc79c0d1558a50863880e921ea531a39d99a5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 16:27:09 +0200 Subject: [PATCH 014/103] cng_enc_fx.c : replaced overflow basops --- lib_com/cng_exc_fx.c | 73 +++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 00ce93218..f4fc5d295 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -615,9 +615,11 @@ void cng_params_postupd_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); @@ -644,9 +646,15 @@ void cng_params_postupd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ +#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ +#endif L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); @@ -725,9 +733,11 @@ void cng_params_postupd_ivas_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); @@ -754,9 +764,15 @@ void cng_params_postupd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ +#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ +#endif L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); // To do : Saturation to be re-validated. @@ -861,10 +877,12 @@ void cng_params_upd_fx( Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif /* update the pointer to circular buffer of old LSP vectors */ @@ -902,11 +920,13 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; -#ifdef ISSUE_1799_replace_L_shr_o - L_ener = L_add_o( L_ener, L_shr_sat( L_tmp, 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ + L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #else + L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); + pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #endif } @@ -919,16 +939,18 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; -#ifdef ISSUE_1799_replace_L_shr_o - L_ener = L_add_o( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ + L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ #else + L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); + pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ #endif } } -#ifdef ISSUE_1799_replace_L_shr_o +#ifdef ISSUE_1836_replace_overflow_libcom L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ #else L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ @@ -966,9 +988,15 @@ void cng_params_upd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ +#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ +#endif L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); @@ -1052,9 +1080,11 @@ void cng_params_upd_ivas_fx( move16(); Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* update the pointer to circular buffer of old LSP vectors */ @@ -1092,11 +1122,13 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; -#ifdef ISSUE_1799_replace_L_shr_o - L_ener = L_add_o( L_ener, L_shr_sat( L_tmp, 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ + L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #else + L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); + pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #endif } @@ -1109,16 +1141,18 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; -#ifdef ISSUE_1799_replace_L_shr_o - L_ener = L_add_o( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ + L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ #else + L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); + pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ #endif } } -#ifdef ISSUE_1799_replace_L_shr_o +#ifdef ISSUE_1836_replace_overflow_libcom L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ #else L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ @@ -1156,14 +1190,19 @@ void cng_params_upd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + tmp = add( add( Q_exc, Q_exc ), 1 ); + sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); +#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); -#ifdef ISSUE_1799_replace_L_shr_o - sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); -#else sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); #endif move32(); /* Q6 */ -- GitLab From 4b5dee1bb5921868be7d872c7ceac5ed1fc50fe7 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 07:16:48 +0200 Subject: [PATCH 015/103] codec_tcx_common_fx.c, deemph_fx.c : replaced overflow ops --- lib_com/codec_tcx_common_fx.c | 10 +++++----- lib_com/deemph_fx.c | 36 ++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 683e1e8d4..010590ad1 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -61,7 +61,7 @@ void tcxFormantEnhancement( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -141,7 +141,7 @@ void tcxFormantEnhancement( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); #else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); @@ -233,7 +233,7 @@ void tcxFormantEnhancement_with_shift( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -317,7 +317,7 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); #else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); @@ -366,7 +366,7 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); #else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 523061b98..4fc0b7495 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -93,22 +93,34 @@ void deemph_fx( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); #endif - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/ signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ +#else + L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ + L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ + signal[0] = round_fx_sat( L_tmp ); /*Qx*/ +#endif + + move16(); FOR( i = 1; i < L; i++ ) { - L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ + L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ + signal[i] = round_fx_sat( L_tmp ); /*Qx*/ +#else L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ +#endif move16(); } @@ -131,10 +143,12 @@ void Deemph2( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif /* saturation can occur in L_mac() */ @@ -145,7 +159,11 @@ void Deemph2( FOR( i = 1; i < L; i++ ) { L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ +#else x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ +#endif move16(); } @@ -175,10 +193,12 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif /* signal[0] = signal[0] + mu * (*mem); */ @@ -188,8 +208,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W shift = shr( -32768, shift ); /*Q15 - shift*/ FOR( i = 0; i < L; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/ + x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ +#else L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ +#endif move16(); } } @@ -197,12 +222,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1772_replace_shr_o - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/ + x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ #else L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_o( x[i], shift, &Overflow ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ -#endif x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ +#endif move16(); } } -- GitLab From 964038397763ac1cd4b2fb1cbfd19d34edbbc322 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 07:23:44 +0200 Subject: [PATCH 016/103] edct_fx.c : replaced overflow ops --- lib_com/edct_fx.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index c30ed4a57..e73aacf65 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -396,10 +396,12 @@ void edct_16fx( const Word16 *px, *pt; Word16 *py; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif /*COMPLETE: some eDCT sub function are missing */ @@ -456,12 +458,21 @@ void edct_16fx( i2 = shl( i, 1 ); L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */ + re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ + move16(); + L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ + Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */ + im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ +#else Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow ); /*Q(Qx+16) */ re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ move16(); L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ Lacc = L_msu_o( L_tmp, x[i2], *pt, &Overflow ); /*Q(Qx+16) */ im2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ +#endif move16(); px -= 2; pt--; @@ -487,11 +498,19 @@ void edct_16fx( FOR( i = 0; i < shr( length, 1 ); i++ ) { tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ +#ifdef ISSUE_1836_replace_overflow_libcom + re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */ +#else re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ +#endif move16(); tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ +#ifdef ISSUE_1836_replace_overflow_libcom + im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */ +#else im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ +#endif move16(); } @@ -502,21 +521,23 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ -#ifdef ISSUE_1799_replace_L_shr_o - y[i2] = round_fx_o( L_shr_sat( Lacc, Q_edct ), &Overflow ); /* Q(Qx) */ + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ + move16(); + + L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ + Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ + *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ #else + Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ -#endif move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ -#ifdef ISSUE_1799_replace_L_shr_o - *py = round_fx_o( L_shr_sat( Lacc, Q_edct ), &Overflow ); /* Q(Qx) */ -#else - *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ + *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ #endif move16(); -- GitLab From 9c8cf35f910220fdd049f59591182d004c70e51a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 08:34:24 +0200 Subject: [PATCH 017/103] lib_com/env_stab_fx.c lib_com/fd_cng_com_fx.c : completed overflow op replacement --- lib_com/env_stab_fx.c | 6 ++++++ lib_com/fd_cng_com_fx.c | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index a3140b4e4..f87194506 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -187,9 +187,11 @@ Word16 env_stab_smo_fx( /* Q0 */ Word16 maxval, pp[NUM_ENV_STAB_PLC_STATES], pa[NUM_ENV_STAB_PLC_STATES]; Word16 i; Word16 tmp, sum, exp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* get previous state */ prev_state = maximum_fx( env_stab_state_p, NUM_ENV_STAB_PLC_STATES, &maxval ); @@ -226,7 +228,11 @@ Word16 env_stab_smo_fx( /* Q0 */ /*tmp = shl(tmp, add(exp, 1));*/ /* Q15 */ FOR( i = 0; i < NUM_ENV_STAB_PLC_STATES; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + env_stab_state_p[i] = round_fx_sat( L_shl_sat( L_mult_sat( env_stab_state_p[i], tmp ), add( exp, 1 ) ) ); /* Q15 */ +#else env_stab_state_p[i] = round_fx_o( L_shl_o( L_mult_o( env_stab_state_p[i], tmp, &Overflow ), add( exp, 1 ), &Overflow ), &Overflow ); /* Q15 */ +#endif move16(); } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 7420a4457..c4038ee38 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -647,11 +647,12 @@ void minimum_statistics( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif - +#endif len2 = i_mult( MSNUMSUBFR, len ); @@ -750,7 +751,11 @@ void minimum_statistics( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); +#else scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); +#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -900,7 +905,11 @@ void minimum_statistics( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); +#else tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); +#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -988,8 +997,13 @@ void minimum_statistics( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); + move32(); +#else msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); move32(); +#endif BASOP_SATURATE_WARNING_ON_EVS; } } @@ -1246,10 +1260,12 @@ void minimum_statistics_fx( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif len2 = i_mult( MSNUMSUBFR, len ); @@ -1349,7 +1365,11 @@ void minimum_statistics_fx( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); +#else scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); +#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -1506,7 +1526,11 @@ void minimum_statistics_fx( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); +#else tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); +#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -1594,7 +1618,11 @@ void minimum_statistics_fx( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); +#else msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); +#endif move32(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -2279,7 +2307,7 @@ static void getmidbands( ) { Word16 j, max_psize, shift; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -2318,7 +2346,7 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp) #else psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) -- GitLab From 5a23784c13d0801b58373e80ddacbcfe8277b32a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 08:41:31 +0200 Subject: [PATCH 018/103] clang format patch --- lib_com/bitalloc_fx.c | 2 +- lib_com/cng_exc_fx.c | 50 +++++++++++++++++++++---------------------- lib_com/deemph_fx.c | 28 ++++++++++++------------ lib_com/edct_fx.c | 34 ++++++++++++++--------------- 4 files changed, 57 insertions(+), 57 deletions(-) diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index d507c86ba..2b630cf21 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -59,7 +59,7 @@ void bitalloc_fx( #ifdef ISSUE_1836_replace_overflow_libcom v = sub_sat( temp, y[m] ); /* Q0 */ #else - v = sub_o( temp, y[m], &Overflow ); /* Q0 */ + v = sub_o( temp, y[m], &Overflow ); /* Q0 */ #endif temp = s_max( temp, y[m] ); if ( v < 0 ) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index f4fc5d295..6296b406c 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -647,15 +647,15 @@ void cng_params_postupd_fx( { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ #else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ #endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -765,15 +765,15 @@ void cng_params_postupd_ivas_fx( { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ #else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ #endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); // To do : Saturation to be re-validated. sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); @@ -927,7 +927,7 @@ void cng_params_upd_fx( #else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; - L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ + L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #endif } } @@ -989,15 +989,15 @@ void cng_params_upd_fx( { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ #else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ #endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -1129,7 +1129,7 @@ void cng_params_upd_ivas_fx( #else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; - L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ + L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #endif } } @@ -1191,17 +1191,17 @@ void cng_params_upd_ivas_fx( { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); #else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); #endif diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 4fc0b7495..0181f65d8 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -103,9 +103,9 @@ void deemph_fx( L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/ signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ #else - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ - L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ - signal[0] = round_fx_sat( L_tmp ); /*Qx*/ + L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ + L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ + signal[0] = round_fx_sat( L_tmp ); /*Qx*/ #endif @@ -115,11 +115,11 @@ void deemph_fx( { L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ - signal[i] = round_fx_sat( L_tmp ); /*Qx*/ + L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ + signal[i] = round_fx_sat( L_tmp ); /*Qx*/ #else - L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ - signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ + L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ + signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ #endif move16(); } @@ -158,11 +158,11 @@ void Deemph2( FOR( i = 1; i < L; i++ ) { - L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ + L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ #ifdef ISSUE_1836_replace_overflow_libcom - x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ + x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ #else - x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ + x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ #endif move16(); } @@ -212,8 +212,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ #else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ + L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ #endif move16(); } @@ -224,10 +224,10 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/ - x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ + x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ #else L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_o( x[i], shift, &Overflow ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ #endif move16(); } diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index e73aacf65..a6d4ece4e 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -457,14 +457,14 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ + L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */ - re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ + Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */ + re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ move16(); - L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ - Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */ - im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ + L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ + Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */ + im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ #else Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow ); /*Q(Qx+16) */ re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ @@ -497,19 +497,19 @@ void edct_16fx( fact = round_fx( L_shl( L_tmp, 2 ) ); /*Q15 */ FOR( i = 0; i < shr( length, 1 ); i++ ) { - tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ + tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ #ifdef ISSUE_1836_replace_overflow_libcom - re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */ + re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */ #else - re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ + re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ #endif move16(); - tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ + tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ #ifdef ISSUE_1836_replace_overflow_libcom - im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */ + im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */ #else - im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ + im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ #endif move16(); } @@ -521,18 +521,18 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ + Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ #else - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ + Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ -- GitLab From f908d5bfa1686f010e4873d51e0226416cfd991d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 10:27:15 +0200 Subject: [PATCH 019/103] fft_fx_evs.c : completed overflow op replacement --- lib_com/fft_fx_evs.c | 430 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 429 insertions(+), 1 deletion(-) diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index b6f2bb2ac..f7e28bb49 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -1186,9 +1186,11 @@ static void fft5_32_16fx( Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7; Word16 i0, i1, i2, i3, i4; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif i0 = Idx[0]; move16(); @@ -1216,9 +1218,15 @@ static void fft5_32_16fx( move16(); T6 = zRe[i3]; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + T7 = add_sat( T5, T6 ); + T8 = add_sat( T4, T7 ); + Tt = sub_sat( T5, T6 ); +#else T7 = add_o( T5, T6, &Overflow ); T8 = add_o( T4, T7, &Overflow ); Tt = sub_o( T5, T6, &Overflow ); +#endif /* T9 = KP559016994 * (T4 - T7); */ L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) T9 = round_fx_sat( L_tmp ); // Qx @@ -1240,11 +1248,17 @@ static void fft5_32_16fx( L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) Tn = round_fx_sat( L_tmp ); // Qx - +#ifdef ISSUE_1836_replace_overflow_libcom + zRe[i0] = add_sat( T1, T8 ); + move16(); + zIm[i0] = add_sat( To, Tp ); + move32(); +#else zRe[i0] = add_o( T1, T8, &Overflow ); move16(); zIm[i0] = add_o( To, Tp, &Overflow ); move32(); +#endif /*T2 = KP951056516*Te + KP587785252*Th; */ L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x) @@ -1261,6 +1275,16 @@ static void fft5_32_16fx( T4 = add_sat( T9, T6 ); T5 = sub_sat( T6, T9 ); +#ifdef ISSUE_1836_replace_overflow_libcom + zRe[i3] = sub_sat( T4, T2 ); + move32(); + zRe[i1] = add_sat( T5, T3 ); + move32(); + zRe[i2] = add_sat( T4, T2 ); + move32(); + zRe[i4] = sub_sat( T5, T3 ); + move32(); +#else zRe[i3] = sub_o( T4, T2, &Overflow ); move32(); zRe[i1] = add_o( T5, T3, &Overflow ); @@ -1269,6 +1293,7 @@ static void fft5_32_16fx( move32(); zRe[i4] = sub_o( T5, T3, &Overflow ); move32(); +#endif /* T2 = KP951056516 * Ts + KP587785252 * Tt; */ L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x) @@ -1675,9 +1700,11 @@ static void cftfsub_16fx( { Word16 j, j1, j2, j3, l; Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif l = 2; @@ -1731,6 +1758,15 @@ static void cftfsub_16fx( { FOR( j = 0; j < l; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); + x0r = sub_sat( a[j], a[j1] ); + x0i = sub_sat( a[j + 1], a[j1 + 1] ); + a[j] = add_sat( a[j], a[j1] ); + move16(); + a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); + move16(); +#else j1 = add_o( j, l, &Overflow ); x0r = sub_o( a[j], a[j1], &Overflow ); x0i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); @@ -1738,6 +1774,7 @@ static void cftfsub_16fx( move16(); a[j + 1] = add_o( a[j + 1], a[j1 + 1], &Overflow ); move16(); +#endif a[j1] = x0r; move16(); a[j1 + 1] = x0i; @@ -1762,11 +1799,84 @@ static void cft1st_16fx( Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; Word16 tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + x0r = add_sat( a[0], a[2] ); + x0i = add_sat( a[1], a[3] ); + x1r = sub_sat( a[0], a[2] ); + x1i = sub_sat( a[1], a[3] ); + x2r = add_sat( a[4], a[6] ); + x2i = add_sat( a[5], a[7] ); + x3r = sub_sat( a[4], a[6] ); + x3i = sub_sat( a[5], a[7] ); + a[0] = add_sat( x0r, x2r ); + move16(); + a[1] = add_sat( x0i, x2i ); + move16(); + a[4] = sub_sat( x0r, x2r ); + move16(); + a[5] = sub_sat( x0i, x2i ); + move16(); + a[2] = sub_sat( x1r, x3i ); + move16(); + a[3] = add_sat( x1i, x3r ); + move16(); + a[6] = add_sat( x1r, x3i ); + move16(); + a[7] = sub_sat( x1i, x3r ); + wk1r = w[2]; + move32(); + + x0r = add_sat( a[8], a[10] ); + x0i = add_sat( a[9], a[11] ); + x1r = sub_sat( a[8], a[10] ); + x1i = sub_sat( a[9], a[11] ); + x2r = add_sat( a[12], a[14] ); + x2i = add_sat( a[13], a[15] ); + x3r = sub_sat( a[12], a[14] ); + x3i = sub_sat( a[13], a[15] ); + a[8] = add_sat( x0r, x2r ); + move16(); + a[9] = add_sat( x0i, x2i ); + move16(); + a[12] = sub_sat( x2i, x0i ); + move16(); + a[13] = sub_sat( x0r, x2r ); + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + tmp = sub_sat( x0r, x0i ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + + a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + tmp = add_sat( x0r, x0i ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct) */ + move16(); + + x0r = add_sat( x3i, x1r ); + x0i = sub_sat( x3r, x1i ); + tmp = sub_sat( x0i, x0r ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + tmp = add_sat( x0i, x0r ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + k1 = 0; + move16(); +#else x0r = add_o( a[0], a[2], &Overflow ); x0i = add_o( a[1], a[3], &Overflow ); x1r = sub_o( a[0], a[2], &Overflow ); @@ -1836,6 +1946,7 @@ static void cft1st_16fx( move16(); k1 = 0; move16(); +#endif FOR( j = 16; j < n; j += 16 ) { @@ -1856,6 +1967,118 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ +#ifdef ISSUE_1836_replace_overflow_libcom + x0r = add_sat( a[j], a[j + 2] ); + x0i = add_sat( a[j + 1], a[j + 3] ); + x1r = sub_sat( a[j], a[j + 2] ); + x1i = sub_sat( a[j + 1], a[j + 3] ); + x2r = add_sat( a[j + 4], a[j + 6] ); + x2i = add_sat( a[j + 5], a[j + 7] ); + x3r = sub_sat( a[j + 4], a[j + 6] ); + x3i = sub_sat( a[j + 5], a[j + 7] ); + a[j] = add_sat( x0r, x2r ); + move16(); + a[j + 1] = add_sat( x0i, x2i ); + move16(); + + x0r = sub_sat( x0r, x2r ); + x0i = sub_sat( x0i, x2i ); + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = add_sat( x1r, x3i ); + x0i = sub_sat( x1i, x3r ); + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + wk1r = w[k2 + 2]; + move32(); + wk1i = w[k2 + 3]; + move32(); + L_tmp = L_shl( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ + wk3r = L_sub( wk1r, L_shl( L_tmp, 1 ) ); /*Q30 */ + + L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ + wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ + + x0r = add_sat( a[j + 8], a[j + 10] ); + x0i = add_sat( a[j + 9], a[j + 11] ); + x1r = sub_sat( a[j + 8], a[j + 10] ); + x1i = sub_sat( a[j + 9], a[j + 11] ); + x2r = add_sat( a[j + 12], a[j + 14] ); + x2i = add_sat( a[j + 13], a[j + 15] ); + x3r = sub_sat( a[j + 12], a[j + 14] ); + x3i = sub_sat( a[j + 13], a[j + 15] ); + a[j + 8] = add_sat( x0r, x2r ); + move16(); + a[j + 9] = add_sat( x0i, x2i ); + move16(); + + x0r = sub_sat( x0r, x2r ); + x0i = sub_sat( x0i, x2i ); + tmp = negate( x0r ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + tmp = negate( x0i ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = add_sat( x1r, x3i ); + x0i = sub_sat( x1i, x3r ); + + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); +#else x0r = add_o( a[j], a[j + 2], &Overflow ); x0i = add_o( a[j + 1], a[j + 3], &Overflow ); x1r = sub_o( a[j], a[j + 2], &Overflow ); @@ -1966,6 +2189,7 @@ static void cft1st_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 15] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } return; @@ -1988,13 +2212,44 @@ static void cftmdl_16fx( Word16 tmp, tmp2; Word32 L_tmp; Word32 L_x0r, L_x0i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif m = shl( l, 2 ); FOR( j = 0; j < l; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); + j2 = add_sat( j1, l ); + j3 = add_sat( j2, l ); + x0r = add_sat( a[j], a[j1] ); + x0i = add_sat( a[j + 1], a[j1 + 1] ); + x1r = sub_sat( a[j], a[j1] ); + x1i = sub_sat( a[j + 1], a[j1 + 1] ); + x2r = add_sat( a[j2], a[j3] ); + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); + x3r = sub_sat( a[j2], a[j3] ); + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); + a[j] = add_sat( x0r, x2r ); + move16(); + a[j + 1] = add_sat( x0i, x2i ); + move16(); + a[j2] = sub_sat( x0r, x2r ); + move16(); + a[j2 + 1] = sub_sat( x0i, x2i ); + move16(); + a[j1] = sub_sat( x1r, x3i ); + move16(); + a[j1 + 1] = add_sat( x1i, x3r ); + move16(); + a[j3] = add_sat( x1r, x3i ); + move16(); + a[j3 + 1] = sub_sat( x1i, x3r ); + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2022,6 +2277,7 @@ static void cftmdl_16fx( move16(); a[j3 + 1] = sub_o( x1i, x3r, &Overflow ); move16(); +#endif } wk1r = w[2]; @@ -2029,6 +2285,51 @@ static void cftmdl_16fx( tmp2 = add( l, m ); FOR( j = m; j < tmp2; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); + j2 = add_sat( j1, l ); + j3 = add_sat( j2, l ); + x0r = add_sat( a[j], a[j1] ); + x0i = add_sat( a[j + 1], a[j1 + 1] ); + x1r = sub_sat( a[j], a[j1] ); + x1i = sub_sat( a[j + 1], a[j1 + 1] ); + x2r = add_sat( a[j2], a[j3] ); + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); + x3r = sub_sat( a[j2], a[j3] ); + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); + a[j] = add_sat( x0r, x2r ); + move16(); + a[j + 1] = add_sat( x0i, x2i ); + move16(); + a[j2] = sub_sat( x2i, x0i ); + move16(); + a[j2 + 1] = sub_sat( x0r, x2r ); + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + tmp = sub_sat( x0r, x0i ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + tmp = add_sat( x0r, x0i ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = add_sat( x3i, x1r ); + x0i = sub_sat( x3r, x1i ); + tmp = sub_sat( x0i, x0r ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + tmp = add_sat( x0i, x0r ); + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2072,6 +2373,7 @@ static void cftmdl_16fx( L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } k1 = 0; @@ -2098,6 +2400,63 @@ static void cftmdl_16fx( tmp2 = add( l, k ); FOR( j = k; j < tmp2; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); + j2 = add_sat( j1, l ); + j3 = add_sat( j2, l ); + x0r = add_sat( a[j], a[j1] ); + x0i = add_sat( a[j + 1], a[j1 + 1] ); + x1r = sub_sat( a[j], a[j1] ); + x1i = sub_sat( a[j + 1], a[j1 + 1] ); + x2r = add_sat( a[j2], a[j3] ); + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); + x3r = sub_sat( a[j2], a[j3] ); + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); + a[j] = add_sat( x0r, x2r ); + move16(); + a[j + 1] = add_sat( x0i, x2i ); + move16(); + + x0r = sub_sat( x0r, x2r ); + x0i = sub_sat( x0i, x2i ); + + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_x0r = L_add( (Word32) x1r, (Word32) x3i ); + L_x0i = L_sub( (Word32) x1i, (Word32) x3r ); + x0r = extract_l( L_x0r ); + x0i = extract_l( L_x0i ); + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2153,20 +2512,88 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } wk1r = w[k2 + 2]; move32(); wk1i = w[k2 + 3]; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ + wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ + + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ + wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ + tmp2 = add( l, add( k, m ) ); +#else L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */ wk3r = L_sub_o( wk1r, L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q30 */ L_tmp = L_shl_o( Mult_32_32( wk2r, wk1r ), 1, &Overflow ); /*Q29 */ wk3i = L_sub_o( L_shl_o( L_tmp, 1, &Overflow ), wk1i, &Overflow ); /*Q30 */ tmp2 = add( l, add( k, m ) ); +#endif FOR( j = add( k, m ); j < tmp2; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); + j2 = add_sat( j1, l ); + j3 = add_sat( j2, l ); + x0r = add_sat( a[j], a[j1] ); + x0i = add_sat( a[j + 1], a[j1 + 1] ); + x1r = sub_sat( a[j], a[j1] ); + x1i = sub_sat( a[j + 1], a[j1 + 1] ); + x2r = add_sat( a[j2], a[j3] ); + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); + x3r = sub_sat( a[j2], a[j3] ); + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); + a[j] = add_sat( x0r, x2r ); + move16(); + a[j + 1] = add_sat( x0i, x2i ); + move16(); + + x0r = sub_sat( x0r, x2r ); + x0i = sub_sat( x0i, x2i ); + + tmp = negate( x0r ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + tmp = negate( x0i ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + x0r = add_sat( x1r, x3i ); + x0i = sub_sat( x1i, x3r ); + + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2223,6 +2650,7 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } } -- GitLab From cc77b482ced3ec97104828155c86d2d53ebae109 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 10:55:56 +0200 Subject: [PATCH 020/103] clang patch --- lib_com/fft_fx_evs.c | 182 +++++++++++++++++++++---------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index f7e28bb49..27eef7a8a 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -1853,26 +1853,26 @@ static void cft1st_16fx( x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); tmp = sub_sat( x0r, x0i ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); tmp = add_sat( x0r, x0i ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct) */ move16(); x0r = add_sat( x3i, x1r ); x0i = sub_sat( x3r, x1i ); tmp = sub_sat( x0i, x0r ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); tmp = add_sat( x0i, x0r ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); k1 = 0; move16(); @@ -1983,38 +1983,38 @@ static void cft1st_16fx( x0r = sub_sat( x0r, x2r ); x0i = sub_sat( x0i, x2i ); - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = add_sat( x1r, x3i ); x0i = sub_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); wk1r = w[k2 + 2]; @@ -2043,40 +2043,40 @@ static void cft1st_16fx( x0r = sub_sat( x0r, x2r ); x0i = sub_sat( x0i, x2i ); tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = add_sat( x1r, x3i ); x0i = sub_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); #else x0r = add_o( a[j], a[j + 2], &Overflow ); @@ -2309,25 +2309,25 @@ static void cftmdl_16fx( x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); tmp = sub_sat( x0r, x0i ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); tmp = add_sat( x0r, x0i ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = add_sat( x3i, x1r ); x0i = sub_sat( x3r, x1i ); tmp = sub_sat( x0i, x0r ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); tmp = add_sat( x0i, x0r ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); #else j1 = add_o( j, l, &Overflow ); @@ -2420,41 +2420,41 @@ static void cftmdl_16fx( x0r = sub_sat( x0r, x2r ); x0i = sub_sat( x0i, x2i ); - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); L_x0r = L_add( (Word32) x1r, (Word32) x3i ); L_x0i = L_sub( (Word32) x1i, (Word32) x3r ); x0r = extract_l( L_x0r ); x0i = extract_l( L_x0i ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); #else j1 = add_o( j, l, &Overflow ); @@ -2520,11 +2520,11 @@ static void cftmdl_16fx( wk1i = w[k2 + 3]; move32(); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ - wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ + wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ - L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ - wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ + wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ tmp2 = add( l, add( k, m ) ); #else L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */ @@ -2557,41 +2557,41 @@ static void cftmdl_16fx( x0i = sub_sat( x0i, x2i ); tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); x0r = add_sat( x1r, x3i ); x0i = sub_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); #else j1 = add_o( j, l, &Overflow ); -- GitLab From 68f73a3b9732fc23599959bb5dee5a40f6a9d11f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 15:33:50 +0200 Subject: [PATCH 021/103] lib_com/frame_ener_fx.c lib_com/get_gain_fx.c lib_com/gs_bitallocation_fx.c lib_com/gs_bitallocation_ivas_fx.c lib_com/gs_gains_fx.c lib_com/gs_noisefill_fx.c : completed overflow op replacement --- lib_com/frame_ener_fx.c | 21 +++++++++-- lib_com/get_gain_fx.c | 13 +++++++ lib_com/gs_bitallocation_fx.c | 6 ++++ lib_com/gs_bitallocation_ivas_fx.c | 6 ++++ lib_com/gs_gains_fx.c | 28 +++++++++++++-- lib_com/gs_noisefill_fx.c | 58 ++++++++++++++++++++++++------ 6 files changed, 115 insertions(+), 17 deletions(-) diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index f3dbe52bd..7d5b19493 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -239,14 +239,20 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 const Word16 *pt1; Word16 tmp16, exp1, exp2, tmp1, tmp2; Word16 len, enern; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif /* len = (0.5f * (pitch[2]/64.0 + pitch[3]/64.0) + 0.5f) */ +#ifdef ISSUE_1836_replace_overflow_libcom + len = mult_r( add_sat( pitch[2], pitch[3] ), 256 ); //??sat +#else len = mult_r( add_o( pitch[2], pitch[3], &Overflow ), 256 ); +#endif if ( LT_16( len, L_SUBFR ) ) { @@ -277,19 +283,28 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 /*add ld(2^exp1)=exp1 but check format, first*/ tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ -#ifdef ISSUE_1799_replace_L_shr_o - Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ //??sat #else Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ #endif exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/ //??sat +#else Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ +#endif /*make 10*log10 out of log2*/ Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + *frame_ener = extract_h( L_shl_sat( Ltmp, add( tmp16, 1 ) ) ); /*Q8*/ //??sat + move16(); + enern = sub_sat( *frame_ener, lp_speech ); /*Q8*/ //??sat +#else *frame_ener = extract_h( L_shl_o( Ltmp, add( tmp16, 1 ), &Overflow ) ); /*Q8*/ move16(); enern = sub_o( *frame_ener, lp_speech, &Overflow ); /*Q8*/ - +#endif return enern; } diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index 8ec4f5a40..530627c5d 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -53,10 +53,12 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 exp_c, exp_e, exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif tcorr = L_deposit_l( 0 ); @@ -70,8 +72,13 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) tcorr = Dot_product16HQ( 0, x, y, n, &exp_c ); tener = Dot_productSq16HQ( 0, y, n, &exp_e ); +#ifdef ISSUE_1836_replace_overflow_libcom + BASOP_Util_Divide_MantExp( round_fx_sat( tcorr ), exp_c, s_max( round_fx_sat( tener ), 1 ), exp_e, &tmp, &exp ); //??sat + Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat +#else BASOP_Util_Divide_MantExp( round_fx_o( tcorr, &Overflow ), exp_c, s_max( round_fx_o( tener, &Overflow ), 1 ), exp_e, &tmp, &exp ); Lgain = L_shl_o( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ), &Overflow ) /*Q16*/; +#endif return Lgain; } @@ -84,9 +91,11 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 m_corr, m_ener, negative, Q_corr, Q_ener; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif negative = 0; @@ -130,7 +139,11 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) Q_corr = sub( Q_corr, Q_ener ); +#ifdef ISSUE_1836_replace_overflow_libcom + Lgain = L_shl_sat( L_deposit_l( m_corr ), add( Q_corr, 1 ) ); /* Lgain in Q16 */ //??sat +#else Lgain = L_shl_o( L_deposit_l( m_corr ), add( Q_corr, 1 ), &Overflow ); /* Lgain in Q16 */ +#endif if ( negative != 0 ) { diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 0ce59482f..dfb4dee4a 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -77,8 +77,10 @@ void bands_and_bit_alloc_fx( Word16 w_sum_bit; (void) GSC_IVAS_mode; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif nb_tot_bands = MBANDS_GN; move16(); @@ -93,7 +95,11 @@ void bands_and_bit_alloc_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ +#ifdef ISSUE_1836_replace_overflow_libcom + ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ //??sat +#else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ +#endif Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; move16(); diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 9243f640e..e017ca229 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -105,8 +105,10 @@ void bands_and_bit_alloc_ivas_fx( Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; /* Q18 */ Word16 w_sum_bit; Word16 fzero_val; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif nb_tot_bands = MBANDS_GN; move16(); @@ -120,7 +122,11 @@ void bands_and_bit_alloc_ivas_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ +#ifdef ISSUE_1836_replace_overflow_libcom + ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ //??sat +#else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ +#endif move16(); Copy( Ener_per_bd_iQ + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index d49a786f2..0a873d1b3 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -84,9 +84,11 @@ void Comp_and_apply_gain_fx( Word16 y_gain; Word16 L16, frac, exp1, tmp_exp; Word32 L32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Recreate excitation for local synthesis and decoder */ @@ -108,9 +110,15 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */ //??sat + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */ //??sat + move16(); +#else L32 = L_shl_o( L_mult( exc_diffQ[i], y_gain ), tmp_exp, &Overflow ); /*Q_exc+16 */ exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc */ move16(); +#endif } } ELSE @@ -126,7 +134,7 @@ void Comp_and_apply_gain_fx( y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); #else Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); @@ -137,7 +145,11 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */ //??sat //??sat +#else exc_diffQ[i] = round_fx_o( L_shl_o( L32, tmp_exp, &Overflow ), &Overflow ); /*Q_exc */ +#endif move16(); } } @@ -161,9 +173,11 @@ void Comp_and_apply_gain_ivas_fx( Word16 L16, frac, exp1, tmp_exp; Word32 L32; Word16 Q_exc_diffQ[L_FRAME16k]; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Recreate excitation for local synthesis and decoder */ @@ -186,7 +200,11 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat +#else exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ +#endif move16(); IF( exc_diffQ[i] ) { @@ -212,10 +230,10 @@ void Comp_and_apply_gain_ivas_fx( y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ #else - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ + Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ //??sat #endif move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); @@ -223,7 +241,11 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat +#else exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ +#endif move16(); IF( exc_diffQ[i] ) { diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 53fb67601..8cbd90ca1 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -411,9 +411,11 @@ static void Decreas_freqPeak_fx( Word16 lsf_new_diff[M]; Word16 tmp, tmp1, exp; Word16 tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif move16(); /*ptr init*/ lsf_new_diff[0] = 0; /* prevent unitialized value */ @@ -472,7 +474,11 @@ static void Decreas_freqPeak_fx( exp = norm_s( max_val ); tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ +#endif tmp = sub( 32767, tmp ); /*Q14 */ L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ @@ -528,9 +534,11 @@ static void envelop_modify_fx( Word16 weight_fx; Word32 L_exc_diffQ_fx[L_FRAME16k], exc_diffQ_max; Word16 Q_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif start_band = i_mult( last_bin, 16 ); @@ -565,8 +573,8 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o - Ener1_fx = mult_ro( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ //??sat #else Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ #endif @@ -595,10 +603,10 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o - Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ + Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ #endif src_fx = &exc_diffQ_fx[224]; @@ -698,9 +706,11 @@ void highband_exc_dct_in_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -716,13 +726,15 @@ void highband_exc_dct_in_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o - tmp1 = shl_sat( tmp, exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = shl_sat( tmp, exp ); //??sat + move16(); + ener = add_sat( tmp1, ener ); /*Q0 */ //??sat #else tmp1 = shl_o( tmp, exp, &Overflow ); -#endif move16(); ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ +#endif } test(); @@ -954,7 +966,11 @@ void highband_exc_dct_in_fx( tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat +#else exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ +#endif } } @@ -989,9 +1005,15 @@ void highband_exc_dct_in_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; +#ifdef ISSUE_1836_replace_overflow_libcom + *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat + move16(); + tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat +#else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ +#endif if ( tmp2 > 0 ) { *src = tmp; @@ -1080,9 +1102,11 @@ void highband_exc_dct_in_ivas_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -1098,13 +1122,15 @@ void highband_exc_dct_in_ivas_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o - tmp1 = shl_sat( tmp, exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = shl_sat( tmp, exp ); //??sat + move16(); + ener = add_sat( tmp1, ener ); /*Q0 */ //??sat #else tmp1 = shl_o( tmp, exp, &Overflow ); -#endif move16(); ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ +#endif } test(); @@ -1451,7 +1477,11 @@ void highband_exc_dct_in_ivas_fx( tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat +#else exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ +#endif } } @@ -1486,9 +1516,15 @@ void highband_exc_dct_in_ivas_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; +#ifdef ISSUE_1836_replace_overflow_libcom + *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat + move16(); + tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat +#else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ +#endif IF( tmp2 > 0 ) { *src = tmp; -- GitLab From 0f1cb3b272b02a7670ea54ee738e52a1a2325bba Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 15:48:30 +0200 Subject: [PATCH 022/103] clang format patch --- lib_com/frame_ener_fx.c | 10 +++---- lib_com/get_gain_fx.c | 2 +- lib_com/gs_bitallocation_fx.c | 2 +- lib_com/gs_gains_fx.c | 20 ++++++------- lib_com/gs_noisefill_fx.c | 56 +++++++++++++++++------------------ 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index 7d5b19493..d0d94383d 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -286,17 +286,17 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 #ifdef ISSUE_1836_replace_overflow_libcom Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ //??sat #else - Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ + Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ #endif - exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ + exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ #ifdef ISSUE_1836_replace_overflow_libcom - Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/ //??sat + Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/ //??sat #else - Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ + Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ #endif /*make 10*log10 out of log2*/ - Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ + Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ #ifdef ISSUE_1836_replace_overflow_libcom *frame_ener = extract_h( L_shl_sat( Ltmp, add( tmp16, 1 ) ) ); /*Q8*/ //??sat move16(); diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index 530627c5d..8d10f3c4d 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -74,7 +74,7 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) #ifdef ISSUE_1836_replace_overflow_libcom BASOP_Util_Divide_MantExp( round_fx_sat( tcorr ), exp_c, s_max( round_fx_sat( tener ), 1 ), exp_e, &tmp, &exp ); //??sat - Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat + Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat #else BASOP_Util_Divide_MantExp( round_fx_o( tcorr, &Overflow ), exp_c, s_max( round_fx_o( tener, &Overflow ), 1 ), exp_e, &tmp, &exp ); Lgain = L_shl_o( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ), &Overflow ) /*Q16*/; diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index dfb4dee4a..5e3870a7e 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -100,7 +100,7 @@ void bands_and_bit_alloc_fx( #else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ #endif - Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ + Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; move16(); IF( EQ_16( L_frame, L_FRAME16k ) ) diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 0a873d1b3..4fc636ec8 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -111,8 +111,8 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */ //??sat - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */ //??sat + L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */ //??sat + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */ //??sat move16(); #else L32 = L_shl_o( L_mult( exc_diffQ[i], y_gain ), tmp_exp, &Overflow ); /*Q_exc+16 */ @@ -144,9 +144,9 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ #ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */ //??sat //??sat + exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */ //??sat //??sat #else exc_diffQ[i] = round_fx_o( L_shl_o( L32, tmp_exp, &Overflow ), &Overflow ); /*Q_exc */ #endif @@ -199,11 +199,11 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ + L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ #ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat #else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ #endif move16(); IF( exc_diffQ[i] ) @@ -240,11 +240,11 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ #ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat #else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ #endif move16(); IF( exc_diffQ[i] ) diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 8cbd90ca1..d41fa3ea8 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -472,15 +472,15 @@ static void Decreas_freqPeak_fx( { tmp = abs_s( *src ); exp = norm_s( max_val ); - tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ - L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ + tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ + L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat + tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat #else tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ #endif - tmp = sub( 32767, tmp ); /*Q14 */ - L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ + tmp = sub( 32767, tmp ); /*Q14 */ + L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ tmp = round_fx( L_shl( L_tmp, 1 ) ); tmp1 = negate( tmp ); @@ -574,9 +574,9 @@ static void envelop_modify_fx( /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); #ifdef ISSUE_1836_replace_overflow_libcom - Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ //??sat + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ //??sat #else - Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ + Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ #endif FOR( j = 0; j < 16; j++ ) @@ -604,9 +604,9 @@ static void envelop_modify_fx( /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); #ifdef ISSUE_1836_replace_overflow_libcom - Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ + Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ #endif src_fx = &exc_diffQ_fx[224]; @@ -727,13 +727,13 @@ void highband_exc_dct_in_fx( /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = shl_sat( tmp, exp ); //??sat + tmp1 = shl_sat( tmp, exp ); //??sat move16(); - ener = add_sat( tmp1, ener ); /*Q0 */ //??sat + ener = add_sat( tmp1, ener ); /*Q0 */ //??sat #else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ #endif } @@ -963,13 +963,13 @@ void highband_exc_dct_in_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ #ifdef ISSUE_1836_replace_overflow_libcom - exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat + exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat #else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ #endif } } @@ -1006,9 +1006,9 @@ void highband_exc_dct_in_fx( { tmp2 = *src; #ifdef ISSUE_1836_replace_overflow_libcom - *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat + *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat move16(); - tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat + tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat #else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); @@ -1123,13 +1123,13 @@ void highband_exc_dct_in_ivas_fx( /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = shl_sat( tmp, exp ); //??sat + tmp1 = shl_sat( tmp, exp ); //??sat move16(); ener = add_sat( tmp1, ener ); /*Q0 */ //??sat #else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ #endif } @@ -1474,13 +1474,13 @@ void highband_exc_dct_in_ivas_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ #ifdef ISSUE_1836_replace_overflow_libcom - exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat + exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat #else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ #endif } } @@ -1517,9 +1517,9 @@ void highband_exc_dct_in_ivas_fx( { tmp2 = *src; #ifdef ISSUE_1836_replace_overflow_libcom - *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat + *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat move16(); - tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat + tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat #else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); -- GitLab From 0f077019b343c358aeda5165595a642421fe40bf Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 16:08:07 +0200 Subject: [PATCH 023/103] lib_com/hp50_fx.c lib_com/hq2_bit_alloc_fx.c lib_com/hq2_core_com_fx.c : completed overflow op replacement --- lib_com/hp50_fx.c | 88 ++++++++++++++++++++++++++------------ lib_com/hq2_bit_alloc_fx.c | 6 +++ lib_com/hq2_core_com_fx.c | 24 ++++++++--- 3 files changed, 84 insertions(+), 34 deletions(-) diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 0e412f70d..a223b21d2 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -86,9 +86,11 @@ static void filter_2nd_order( Word16 i; Word16 x2, x1; Word32 L_sum, L_y1, L_y2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif /* @@ -107,12 +109,19 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat +#else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); - BASOP_SATURATE_WARNING_ON_EVS +#endif + BASOP_SATURATE_WARNING_ON_EVS BASOP_SATURATE_ERROR_ON_EVS L_sum = HP50_Mpy_32_32_fix( b2, mem[3] ); /* b2*x2 */ L_sum = L_add( L_sum, HP50_Mode2_Mpy_32_16_fix( b1, x2 ) ); /* b1*x1 */ @@ -121,10 +130,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat +#else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS move16(); @@ -140,10 +156,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat +#else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS /* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */ BASOP_SATURATE_ERROR_ON_EVS @@ -154,10 +177,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat +#else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS move16(); } @@ -190,9 +220,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { Word32 a1, b1, a2, b2; Word16 prescale, prescaleOld, diff; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif prescale = getScaleFactor16( signal, lg ); @@ -202,7 +234,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { prescale = s_min( prescale, diff ); } +#ifdef ISSUE_1836_replace_overflow_libcom + diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat +#else diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); +#endif if ( mem[3] != 0 ) { prescale = s_min( prescale, diff ); @@ -212,27 +248,21 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * IF( prescale != prescaleOld ) { diff = sub( prescale, prescaleOld ); -#ifdef ISSUE_1799_replace_L_shr_o - mem[0] = L_shr_sat( mem[0], diff ); +#ifdef ISSUE_1836_replace_overflow_libcom + mem[0] = L_shr_sat( mem[0], diff ); //??sat + move32(); + mem[1] = L_shr_sat( mem[1], diff ); //??sat + move32(); + mem[2] = L_shr_sat( mem[2], diff ); //??sat + move32(); + mem[3] = L_shr_sat( mem[3], diff ); //?sat #else mem[0] = L_shr_o( mem[0], diff, &Overflow ); -#endif move32(); -#ifdef ISSUE_1799_replace_L_shr_o - mem[1] = L_shr_sat( mem[1], diff ); -#else mem[1] = L_shr_o( mem[1], diff, &Overflow ); -#endif move32(); -#ifdef ISSUE_1799_replace_L_shr_o - mem[2] = L_shr_sat( mem[2], diff ); -#else mem[2] = L_shr_o( mem[2], diff, &Overflow ); -#endif move32(); -#ifdef ISSUE_1799_replace_L_shr_o - mem[3] = L_shr_sat( mem[3], diff ); -#else mem[3] = L_shr_o( mem[3], diff, &Overflow ); #endif move32(); @@ -319,7 +349,9 @@ void hp20_fx_32( Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; +#endif Word16 prescale, prescaleOld, prescale_current_frame, diff; prescale = getScaleFactor32( signal_fx, lg ); @@ -328,8 +360,14 @@ void hp20_fx_32( prescaleOld = extract_l( mem_fx[4] ); +#ifdef ISSUE_1836_replace_overflow_libcom + diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat + diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat +#else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); +#endif + diff = L_max( diff_pos, diff_neg ); @@ -341,27 +379,21 @@ void hp20_fx_32( prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); -#ifdef ISSUE_1799_replace_L_shr_o +#ifdef ISSUE_1836_replace_overflow_libcom mem_fx[0] = L_shr_sat( mem_fx[0], diff ); -#else - mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); -#endif move32(); -#ifdef ISSUE_1799_replace_L_shr_o mem_fx[1] = L_shr_sat( mem_fx[1], diff ); -#else - mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); -#endif move32(); -#ifdef ISSUE_1799_replace_L_shr_o mem_fx[2] = L_shr_sat( mem_fx[2], diff ); -#else - mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); -#endif move32(); -#ifdef ISSUE_1799_replace_L_shr_o mem_fx[3] = L_shr_sat( mem_fx[3], diff ); #else + mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); + move32(); + mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); + move32(); + mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); + move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); #endif move32(); diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 61d00ce98..215d62368 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -312,9 +312,11 @@ void hq2_bit_alloc_har_fx( Word16 exp_shift; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; Overflow = 0; move32(); +#endif L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk ); L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); @@ -570,9 +572,13 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat +#else lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ move32(); +#endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index 9017903c8..8250748a5 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -88,9 +88,11 @@ void mdct_spectrum_denorm_fx( Word16 cond_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ +#endif #endif exp_safe = 4; /* safe bit for overflow */ @@ -163,12 +165,12 @@ void mdct_spectrum_denorm_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ -#endif Overflow = 0; +#endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { @@ -200,7 +202,11 @@ void mdct_spectrum_denorm_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat +#else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); +#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } @@ -264,9 +270,11 @@ void mdct_spectrum_denorm_ivas_fx( Word16 cond_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ +#endif #endif exp_safe = 4; /* safe bit for overflow */ @@ -339,12 +347,12 @@ void mdct_spectrum_denorm_ivas_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ -#endif Overflow = 0; +#endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { @@ -376,7 +384,11 @@ void mdct_spectrum_denorm_ivas_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat +#else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); +#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } -- GitLab From d3e771b559bf4bbef6a50562f99650293a41f812 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 07:28:17 +0200 Subject: [PATCH 024/103] buildfix --- lib_com/gs_noisefill_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index d41fa3ea8..df8813844 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -574,7 +574,7 @@ static void envelop_modify_fx( /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); #ifdef ISSUE_1836_replace_overflow_libcom - Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ //??sat + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ #endif -- GitLab From fa2e5f000b3af1ecca99a352c9353a57c1ea59a6 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 07:46:36 +0200 Subject: [PATCH 025/103] clang format patch --- lib_com/hp50_fx.c | 30 +++++++++++++++--------------- lib_com/hq2_bit_alloc_fx.c | 2 +- lib_com/hq2_core_com_fx.c | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index a223b21d2..84fe683fe 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -110,10 +110,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ #ifdef ISSUE_1836_replace_overflow_libcom - L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS - signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat + signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat #else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS @@ -131,10 +131,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ #ifdef ISSUE_1836_replace_overflow_libcom - L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS - signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat + signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat #else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS @@ -157,10 +157,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom - L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS - signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat + signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat #else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS @@ -178,10 +178,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom - L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS - signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat + signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat #else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS @@ -235,7 +235,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * prescale = s_min( prescale, diff ); } #ifdef ISSUE_1836_replace_overflow_libcom - diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat + diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat #else diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); #endif @@ -249,13 +249,13 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom - mem[0] = L_shr_sat( mem[0], diff ); //??sat + mem[0] = L_shr_sat( mem[0], diff ); //??sat move32(); - mem[1] = L_shr_sat( mem[1], diff ); //??sat + mem[1] = L_shr_sat( mem[1], diff ); //??sat move32(); - mem[2] = L_shr_sat( mem[2], diff ); //??sat + mem[2] = L_shr_sat( mem[2], diff ); //??sat move32(); - mem[3] = L_shr_sat( mem[3], diff ); //?sat + mem[3] = L_shr_sat( mem[3], diff ); //?sat #else mem[0] = L_shr_o( mem[0], diff, &Overflow ); move32(); @@ -361,8 +361,8 @@ void hp20_fx_32( prescaleOld = extract_l( mem_fx[4] ); #ifdef ISSUE_1836_replace_overflow_libcom - diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat - diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat + diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat + diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat #else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 215d62368..452481334 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -573,7 +573,7 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ #ifdef ISSUE_1836_replace_overflow_libcom - lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat + lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat #else lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index 8250748a5..5c1a63f28 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -166,7 +166,7 @@ void mdct_spectrum_denorm_fx( Qpd = add( sub( exp_normn, exp_normd ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom - cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat + cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; @@ -203,7 +203,7 @@ void mdct_spectrum_denorm_fx( L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); #ifdef ISSUE_1836_replace_overflow_libcom - gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat + gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat #else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); #endif @@ -348,7 +348,7 @@ void mdct_spectrum_denorm_ivas_fx( Qpd = add( sub( exp_normn, exp_normd ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom - cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat + cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; @@ -385,7 +385,7 @@ void mdct_spectrum_denorm_ivas_fx( L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); #ifdef ISSUE_1836_replace_overflow_libcom - gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat + gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat #else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); #endif -- GitLab From b46c8a45f838819a591204370b6a46a89c861f8b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 09:55:43 +0200 Subject: [PATCH 026/103] lib_com/hq2_noise_inject_fx.c lib_com/ifft_rel_fx.c lib_com/igf_base_fx.c lib_com/interpol_fx.c lib_com/low_rate_band_att_fx.c lib_com/lpc_tools_fx.c : completed overflow op replacement --- lib_com/hq2_noise_inject_fx.c | 38 ++++++++++-- lib_com/ifft_rel_fx.c | 95 ++++++++++++++++++++++------- lib_com/igf_base_fx.c | 11 +++- lib_com/interpol_fx.c | 8 +++ lib_com/low_rate_band_att_fx.c | 20 +++++-- lib_com/lpc_tools_fx.c | 105 ++++++++++++++++++++++++++++++++- 6 files changed, 247 insertions(+), 30 deletions(-) diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index db1099809..98c66dc58 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -80,9 +80,11 @@ void hq2_noise_inject_fx( Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos; Word16 sb = bands; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif satur = 0; @@ -90,7 +92,11 @@ void hq2_noise_inject_fx( FOR( i = 0; i < bands; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat +#else Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ +#endif move32(); } @@ -155,7 +161,11 @@ void hq2_noise_inject_fx( Q_env_fx[k] = sub( 31, exp2 ); move16(); tmp = sub( 17, Q_env_fx[k] ); +#ifdef ISSUE_1836_replace_overflow_libcom + env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat +#else env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ +#endif peak_fx[k] = 0; move16(); count[k] = 0; @@ -166,7 +176,11 @@ void hq2_noise_inject_fx( FOR( i = band_start[k]; i <= band_end[k]; i++ ) { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat +#else Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); +#endif move32(); /* Q0 */ IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) ) { @@ -387,7 +401,11 @@ void hq2_noise_inject_fx( ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ +#else fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */ +#endif } } @@ -467,8 +485,8 @@ void hq2_noise_inject_fx( } L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ -#ifdef ISSUE_1799_replace_L_shr_o - ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat #else ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); #endif @@ -593,14 +611,22 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */ tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat +#else tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ +#endif } ELSE { tmp = 0x7fff; /*Q0 */ L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat +#else tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ +#endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -612,8 +638,8 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat #else tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ #endif @@ -629,7 +655,11 @@ void hq2_noise_inject_fx( tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ L_tmp = L_mult( tmp1, j ); /*Q13 */ L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat +#else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ +#endif tmp = sub( fac_fx, tmp ); /*Q12 */ L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index b372e15f3..c96e37e70 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -77,10 +77,12 @@ void ifft_rel_fx( Word16 cc1, cc3, ss1, ss3; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif +#endif /*-----------------------------------------------------------------* @@ -108,30 +110,43 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat + *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat + move16(); + *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat + move16(); + *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat + move16(); + *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat + move16(); +#else t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); -#ifdef ISSUE_1796_replace_shl_o - *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ -#else *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ -#endif move16(); -#ifdef ISSUE_1796_replace_shl_o - *xi3 = sub_o( t1, shl_sat( *xi4, 1 ), &Overflow ); /*Qx*/ -#else *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ -#endif move16(); -#ifdef ISSUE_1796_replace_shl_o - *xi4 = add_o( t1, shl_sat( *xi4, 1 ), &Overflow ); /*Qx*/ -#else *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ -#endif move16(); +#endif IF( NE_16( n4, 1 ) ) { +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat + t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat + + *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat + move16(); + *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat + move16(); + *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat + move16(); + *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat + move16(); +#else t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ @@ -139,18 +154,11 @@ void ifft_rel_fx( move16(); *( xi2 + n8 ) = sub_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ); /*Qx*/ move16(); -#ifdef ISSUE_1796_replace_shl_o - *( xi3 + n8 ) = negate( shl_sat( add_o( t2, t1, &Overflow ), 1 ) ); /*Qx*/ -#else *( xi3 + n8 ) = negate( shl_o( add_o( t2, t1, &Overflow ), 1, &Overflow ) ); /*Qx*/ -#endif move16(); -#ifdef ISSUE_1796_replace_shl_o - *( xi4 + n8 ) = shl_sat( sub_o( t1, t2, &Overflow ), 1 ); /*Qx*/ -#else *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ -#endif move16(); +#endif } xi1 += id; xi2 += id; @@ -198,6 +206,45 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + move16(); + xup1 += n4; + xdn6 -= n4; + + t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat + *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + move16(); + + xdn6 += n4; + t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat + *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/ //??sat + move16(); + + xup3 += n4; + xdn8 -= n4; + + t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat + *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/ //??sat + move16(); + + t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat + t1 = add_sat( t1, t4 ); /*Qx*/ //??sat + t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat + t2 = add_sat( t2, t3 ); /*Qx*/ //??sat + *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/ //??sat + move16(); + xup3 -= n4; + *xup3 = add_sat( mult_r( t5, cc1 ), mult_r( t4, ss1 ) ); /*Qx*/ //??sat + move16(); + *xdn8 = sub_sat( mult_r( t5, ss1 ), mult_r( t4, cc1 ) ); /*Qx*/ //??sat + move16(); + + xdn8 += n4; + *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/ //??sat + move16(); +#else t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/ *xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ move16(); @@ -235,6 +282,7 @@ void ifft_rel_fx( xdn8 += n4; *xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/ move16(); +#endif xup1 -= n4; xup1 += id; @@ -265,10 +313,17 @@ void ifft_rel_fx( { r1 = *xi0; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat + move16(); + *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat + move16(); +#else *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); *xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); +#endif xi0 += id; xi1 += id; } diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index 44cf27c5f..a822ea7e3 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1119,9 +1119,11 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in Word32 L_c; #ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; - Flag Carry = 0; move16(); +#endif + Flag Carry = 0; move16(); #endif @@ -1142,11 +1144,18 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in { Carry = 0; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + sfbEnergy[sfb] = L_add_c( sfbEnergy[sfb], pPowerSpectrum[line], &Carry ); //??sat + move32(); + move16(); + L_c = L_macNs_c( L_c, 0, 0, &Carry ); //??sat +#else sfbEnergy[sfb] = L_add_co( sfbEnergy[sfb], pPowerSpectrum[line], &Carry, &Overflow ); move32(); Overflow = 0; move16(); L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); +#endif } sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) ); move32(); diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index 030d41735..b5a18b879 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -89,8 +89,10 @@ Word16 Interpol_4( /* Qx o : interpolated value */ { Word16 i; Word32 L_sum; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif x = x - L_INTERPOL1 + 1; @@ -108,7 +110,13 @@ Word16 Interpol_4( /* Qx o : interpolated value */ } BASOP_SATURATE_WARNING_OFF_EVS /* Here, saturation might occur by intention */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_shl_sat( L_sum, 1 ); /*Qx+14+2*/ + BASOP_SATURATE_WARNING_ON_EVS + return round_fx_sat( L_sum ); /*Qx*/ //??sat +#else L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/ BASOP_SATURATE_WARNING_ON_EVS return round_fx_o( L_sum, &Overflow ); /*Qx*/ +#endif } diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 186074445..8569b9029 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -39,9 +39,11 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -81,7 +83,11 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -97,8 +103,8 @@ void ivas_fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1772_replace_shr_o - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ #endif @@ -158,9 +164,11 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -193,7 +201,11 @@ void fine_gain_pred_fx( exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -209,8 +221,8 @@ void fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1772_replace_shr_o - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ #endif diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 1035f017a..5a5d721ad 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -409,8 +409,10 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -427,7 +429,11 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_shl_sat( L_32, 2 ); //??sat +#else L_32 = L_shl_o( L_32, 2, &Overflow ); +#endif return ( L_32 ); } @@ -463,9 +469,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -526,12 +534,21 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ +#endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -546,7 +563,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -585,7 +606,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -621,7 +646,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -657,9 +686,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -720,12 +751,21 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ +#endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -740,7 +780,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -850,11 +894,13 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word16 alp_h, alp_l, alp_exp; /* Prediction gain; hi lo and exponent */ Word32 t0, t1, t2; /* temporary variables */ Word16 flag; - Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ + Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */# +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -915,12 +961,21 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ +#endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); + t0 = L_msu_sat( t0, Rh[i], -32768 ); +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -935,7 +990,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -974,7 +1033,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1010,7 +1073,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = L_shl_sat( t0, k ); //??sat +#else A[i] = L_shl_o( t0, k, &Overflow ); +#endif move16(); } @@ -1478,9 +1545,11 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* half length FFT */ @@ -1656,6 +1725,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1670,6 +1755,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1690,6 +1776,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1704,6 +1806,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); -- GitLab From c2d0583ba373264554e44df176cd1ac699158d33 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 11:36:58 +0200 Subject: [PATCH 027/103] lib_com/hq2_noise_inject_fx.c lib_com/ifft_rel_fx.c lib_com/igf_base_fx.c lib_com/interpol_fx.c lib_com/low_rate_band_att_fx.c lib_com/lpc_tools_fx.c lib_com/lsf_tools_fx.c : completed overflow op replacement --- lib_com/hq2_noise_inject_fx.c | 36 +++++------ lib_com/ifft_rel_fx.c | 50 ++++++++-------- lib_com/igf_base_fx.c | 9 --- lib_com/interpol_fx.c | 4 +- lib_com/low_rate_band_att_fx.c | 8 +-- lib_com/lpc_tools_fx.c | 55 ++++++++--------- lib_com/lsf_tools_fx.c | 105 +++++++++++++++++++++++++++++---- 7 files changed, 170 insertions(+), 97 deletions(-) diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 98c66dc58..7f61e9a91 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -93,9 +93,9 @@ void hq2_noise_inject_fx( FOR( i = 0; i < bands; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat + Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat #else - Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ + Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ #endif move32(); } @@ -162,7 +162,7 @@ void hq2_noise_inject_fx( move16(); tmp = sub( 17, Q_env_fx[k] ); #ifdef ISSUE_1836_replace_overflow_libcom - env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat + env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat #else env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ #endif @@ -177,7 +177,7 @@ void hq2_noise_inject_fx( { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ #ifdef ISSUE_1836_replace_overflow_libcom - Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat + Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat #else Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); #endif @@ -400,7 +400,7 @@ void hq2_noise_inject_fx( } ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { - L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ + L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ #ifdef ISSUE_1836_replace_overflow_libcom fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ #else @@ -486,7 +486,7 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ #ifdef ISSUE_1836_replace_overflow_libcom - ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat + ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat #else ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); #endif @@ -612,9 +612,9 @@ void hq2_noise_inject_fx( tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat + tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } ELSE @@ -623,9 +623,9 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat + tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -639,9 +639,9 @@ void hq2_noise_inject_fx( { Q_speech = norm_s( band_width[k] ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat + tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat #else - tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ + tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ #endif tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } @@ -652,16 +652,16 @@ void hq2_noise_inject_fx( move16(); move16(); } - tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ - L_tmp = L_mult( tmp1, j ); /*Q13 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ + tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ + L_tmp = L_mult( tmp1, j ); /*Q13 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat + tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ #endif - tmp = sub( fac_fx, tmp ); /*Q12 */ - L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ + tmp = sub( fac_fx, tmp ); /*Q12 */ + L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); move32(); /*Q12 */ } diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index c96e37e70..2ea116ef5 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -111,40 +111,40 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { #ifdef ISSUE_1836_replace_overflow_libcom - t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat - *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat + t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat + *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat move16(); - *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat + *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat move16(); - *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat + *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat move16(); - *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat + *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat move16(); #else t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); - *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ + *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ move16(); - *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ + *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ move16(); - *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ + *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ move16(); #endif IF( NE_16( n4, 1 ) ) { #ifdef ISSUE_1836_replace_overflow_libcom - t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat - t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat + t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat + t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat - *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat + *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat move16(); - *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat + *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat move16(); - *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat + *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat move16(); - *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat + *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat move16(); #else t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ @@ -156,7 +156,7 @@ void ifft_rel_fx( move16(); *( xi3 + n8 ) = negate( shl_o( add_o( t2, t1, &Overflow ), 1, &Overflow ) ); /*Qx*/ move16(); - *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ + *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ move16(); #endif } @@ -207,32 +207,32 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { #ifdef ISSUE_1836_replace_overflow_libcom - t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat move16(); xup1 += n4; xdn6 -= n4; - t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat + t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat move16(); xdn6 += n4; - t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat + t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/ //??sat move16(); xup3 += n4; xdn8 -= n4; - t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat + t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/ //??sat move16(); - t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat - t1 = add_sat( t1, t4 ); /*Qx*/ //??sat - t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat - t2 = add_sat( t2, t3 ); /*Qx*/ //??sat + t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat + t1 = add_sat( t1, t4 ); /*Qx*/ //??sat + t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat + t2 = add_sat( t2, t3 ); /*Qx*/ //??sat *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/ //??sat move16(); xup3 -= n4; @@ -314,9 +314,9 @@ void ifft_rel_fx( r1 = *xi0; move16(); #ifdef ISSUE_1836_replace_overflow_libcom - *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat + *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat move16(); - *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat + *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat move16(); #else *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index a822ea7e3..5badabb66 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1119,10 +1119,8 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in Word32 L_c; #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move16(); -#endif Flag Carry = 0; move16(); #endif @@ -1144,18 +1142,11 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in { Carry = 0; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - sfbEnergy[sfb] = L_add_c( sfbEnergy[sfb], pPowerSpectrum[line], &Carry ); //??sat - move32(); - move16(); - L_c = L_macNs_c( L_c, 0, 0, &Carry ); //??sat -#else sfbEnergy[sfb] = L_add_co( sfbEnergy[sfb], pPowerSpectrum[line], &Carry, &Overflow ); move32(); Overflow = 0; move16(); L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); -#endif } sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) ); move32(); diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index b5a18b879..645f8b774 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -76,7 +76,7 @@ Word32 Interpol_lc_fx( /* o : interpolated value #else L_sum = W_sat_l( L_sum64 ); /*Q14*/ } - L_sum = L_shl_sat( L_sum, 1 ); /*Q15*/ + L_sum = L_shl_sat( L_sum, 1 ); /*Q15*/ #endif return L_sum; } @@ -113,7 +113,7 @@ Word16 Interpol_4( /* Qx o : interpolated value */ #ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_shl_sat( L_sum, 1 ); /*Qx+14+2*/ BASOP_SATURATE_WARNING_ON_EVS - return round_fx_sat( L_sum ); /*Qx*/ //??sat + return round_fx_sat( L_sum ); /*Qx*/ //??sat #else L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/ BASOP_SATURATE_WARNING_ON_EVS diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 8569b9029..124ed1e4e 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -106,7 +106,7 @@ void ivas_fine_gain_pred_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else - tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ + tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ #endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ @@ -199,8 +199,8 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ #ifdef ISSUE_1836_replace_overflow_libcom gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat #else @@ -224,7 +224,7 @@ void fine_gain_pred_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else - tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ + tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ #endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 5a5d721ad..476930421 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -430,7 +430,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); #ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_shl_sat( L_32, 2 ); //??sat + L_32 = L_shl_sat( L_32, 2 ); //??sat #else L_32 = L_shl_o( L_32, 2, &Overflow ); #endif @@ -539,12 +539,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat #else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); @@ -564,7 +564,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif @@ -607,9 +607,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -752,16 +752,16 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 } #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat #else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); @@ -781,7 +781,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif @@ -894,10 +894,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word16 alp_h, alp_l, alp_exp; /* Prediction gain; hi lo and exponent */ Word32 t0, t1, t2; /* temporary variables */ Word16 flag; - Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */# + Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +# #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; + Flag Overflow = 0; move32(); #endif #endif @@ -962,11 +963,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* } #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat #else - t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ + t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom @@ -991,7 +992,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif @@ -1034,9 +1035,9 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -1074,7 +1075,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom - A[i] = L_shl_sat( t0, k ); //??sat + A[i] = L_shl_sat( t0, k ); //??sat #else A[i] = L_shl_o( t0, k, &Overflow ); #endif @@ -1726,9 +1727,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat move16(); BASOP_SATURATE_WARNING_ON_EVS RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); @@ -1736,9 +1737,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); move16(); BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat move16(); #else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); @@ -1779,7 +1780,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ #ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat move16(); BASOP_SATURATE_WARNING_ON_EVS RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); @@ -1789,7 +1790,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ BASOP_SATURATE_WARNING_OFF_EVS tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat move16(); #else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 1a8760c58..c4ef9c28c 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -69,8 +69,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif cheb = norm_s( x ); @@ -108,15 +110,25 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ +#endif t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ +#endif t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ @@ -125,8 +137,13 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ +#endif t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ /*b1 = L_add(b2,0);*/ } @@ -146,8 +163,13 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat + cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat +#else t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ +#endif cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); @@ -162,8 +184,10 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------* @@ -286,7 +310,11 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + y = sub_sat( yhigh, ylow ); +#else y = sub_o( yhigh, ylow, &Overflow ); +#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1222,9 +1250,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif /*-----------------------------------------------------* @@ -1255,7 +1285,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat +#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); +#endif move32(); } @@ -1265,11 +1299,19 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 1; i <= nc; i++ ) + { + t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); + t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); + } +#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } +#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1283,6 +1325,16 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_add_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat + + /* a[j] = 0.5*(f1[i] - f2[i]) */ + t0 = L_sub_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat +#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1291,6 +1343,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ +#endif j--; } @@ -1734,8 +1787,10 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; +#ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1796,32 +1851,40 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat + L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat +#else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ - L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ -#else L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ -#endif f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ +#endif } IF( m & 1 ) { L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ - L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1, &Overflow ); /* extracting in q_a */ //??sat + move16(); #else + L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ -#endif f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); +#endif } } @@ -2273,8 +2336,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2320,11 +2385,15 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ +#endif tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat #else tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif @@ -2364,8 +2433,10 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2417,7 +2488,11 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ +#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3776,8 +3851,10 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3847,7 +3924,11 @@ Word16 root_search_fx( Word16 low, exp1 = sub( 30 - 25, exp1 ); tmp = div_s( 16384, tmp ); /* 15+exp1 */ Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat +#else Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ +#endif if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); -- GitLab From 0f57f4cd3407cdb7afcd3f5487852949e843a601 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 12:19:03 +0200 Subject: [PATCH 028/103] clang patch --- lib_com/lpc_tools_fx.c | 2 +- lib_com/lsf_tools_fx.c | 78 +++++++++++++++++------------------ lib_com/lsp_conv_poly_fx.c | 83 +++++++++++++++++++++++++++++++++++--- 3 files changed, 118 insertions(+), 45 deletions(-) diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 476930421..6e34dbbe1 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -898,7 +898,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* # #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; + Flag Overflow = 0; move32(); #endif #endif diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c4ef9c28c..ddbd74a2b 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -117,8 +117,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ @@ -129,7 +129,7 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -144,8 +144,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -164,13 +164,13 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat - cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat + t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat + cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat #else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ #endif - cheb = s_max( -32767, cheb ); /* to avoid saturation */ + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -1326,14 +1326,14 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_add_sat( f1[i], f2[i] ); //??sat + t0 = L_add_sat( f1[i], f2[i] ); //??sat t0 = L_shl( t0, k ); - a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat + a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat /* a[j] = 0.5*(f1[i] - f2[i]) */ - t0 = L_sub_sat( f1[i], f2[i] ); //??sat + t0 = L_sub_sat( f1[i], f2[i] ); //??sat t0 = L_shl( t0, k ); - a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat + a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat #else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); @@ -1342,7 +1342,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ #endif j--; } @@ -1851,38 +1851,38 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat - L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat #else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ - f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ + L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ + L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ + f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ #endif } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1, &Overflow ); /* extracting in q_a */ //??sat + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1, &Overflow ); /* extracting in q_a */ //??sat move16(); #else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ + f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); #endif } @@ -2386,16 +2386,16 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ e = sub( 30 - 21 - 1, e ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat #else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ #endif tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat + tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); @@ -2489,7 +2489,7 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability e = sub( 30 - 21 - 1, e ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat #else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ #endif @@ -3922,12 +3922,12 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ #ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat + Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat #else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ #endif if ( LT_32( *v_low, vh ) ) { diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 2e989cfbf..298f25221 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -336,8 +336,10 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; +#ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif exp_den = norm_l( in32 ); @@ -345,14 +347,17 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); -#ifdef ISSUE_1796_replace_shl_o - exp_den = shl_sat( exp_den, 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + exp_den = shl( exp_den, 1 ); + + div_out = div_s( 8192, m_den ); + Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #else exp_den = shl_o( exp_den, 1, &Overflow ); -#endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ +#endif return Ltmp; } @@ -368,8 +373,10 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; +#ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif IF( re == 0 ) @@ -382,7 +389,11 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -397,7 +408,11 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -427,8 +442,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif @@ -509,8 +524,10 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*---------------------------------------------------------------------* @@ -533,7 +550,11 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + r[0] = L_add_sat( r[0], G[i] ); +#else r[0] = L_add_o( r[0], G[i], &Overflow ); +#endif move32(); } @@ -567,18 +588,47 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_add_sat( G[i], G[N - i - 1] ); //??sat +#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); +#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); +#ifdef ISSUE_1836_replace_overflow_libcom + r[1] = L_add_sat( r[1], mh ); //??sat +#else r[1] = L_add_o( r[1], mh, &Overflow ); +#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = mult_r( c[j - 1], x[i - 1] ); + move16(); + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + /*r[j] = L_mac(r[j], c[j], gp);*/ + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); + + c[j + 1] = mult_r( c[j], x[i - 1] ); + move16(); + c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat + move16(); + + /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ + Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); + r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat + move32(); +#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -598,33 +648,56 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); +#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); +#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); +#endif + } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat + gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); + + r[0] = L_add_sat( r[0], gp ); //??sat +#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); +#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_Extract( L_shl( L_add_sat( r[j], gn), exp0 ), &rh[j], &rl[j] ); //??sat + L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat +#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); +#endif } return; -- GitLab From d1e2bf27c3d71db77c238187769e2757da916b02 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 12:37:22 +0200 Subject: [PATCH 029/103] clang patch --- lib_com/lsp_conv_poly_fx.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 298f25221..e8b241a9a 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -351,7 +351,7 @@ static Word32 b_inv_sq( exp_den = shl( exp_den, 1 ); div_out = div_s( 8192, m_den ); - Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat + Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #else exp_den = shl_o( exp_den, 1, &Overflow ); @@ -390,7 +390,7 @@ static Word32 inv_pow( exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif @@ -443,7 +443,7 @@ static Word32 inv_pow( tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat + L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif @@ -589,7 +589,7 @@ static void spectautocorr_fx( FOR( i = 1; i < imid; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - gp = L_add_sat( G[i], G[N - i - 1] ); //??sat + gp = L_add_sat( G[i], G[N - i - 1] ); //??sat #else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); #endif @@ -598,7 +598,7 @@ static void spectautocorr_fx( /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); #ifdef ISSUE_1836_replace_overflow_libcom - r[1] = L_add_sat( r[1], mh ); //??sat + r[1] = L_add_sat( r[1], mh ); //??sat #else r[1] = L_add_o( r[1], mh, &Overflow ); #endif @@ -611,22 +611,22 @@ static void spectautocorr_fx( #ifdef ISSUE_1836_replace_overflow_libcom c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); /*r[j] = L_mac(r[j], c[j], gp);*/ Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat + r[j] = L_add_sat( r[j], mh ); //??sat move32(); c[j + 1] = mult_r( c[j], x[i - 1] ); move16(); - c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat + c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat move16(); /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); - r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat + r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat move32(); #else c[j] = mult_r( c[j - 1], x[i - 1] ); @@ -653,11 +653,11 @@ static void spectautocorr_fx( c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat + r[j] = L_add_sat( r[j], mh ); //??sat move32(); #else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -667,7 +667,6 @@ static void spectautocorr_fx( r[j] = L_add_o( r[j], mh, &Overflow ); move32(); #endif - } /*---------------------------------------------------------------------* @@ -675,10 +674,10 @@ static void spectautocorr_fx( * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ #ifdef ISSUE_1836_replace_overflow_libcom - gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat + gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); - r[0] = L_add_sat( r[0], gp ); //??sat + r[0] = L_add_sat( r[0], gp ); //??sat #else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); @@ -692,8 +691,8 @@ static void spectautocorr_fx( FOR( j = 1; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_Extract( L_shl( L_add_sat( r[j], gn), exp0 ), &rh[j], &rl[j] ); //??sat - L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat + L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat + L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat #else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); -- GitLab From 104a9f52abead2899a49bb21c7420400cc802897 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 14:58:43 +0200 Subject: [PATCH 030/103] lib_com/lpc_tools_fx.c lib_com/lsf_tools_fx.c lib_com/lsp_conv_poly_fx.c lib_com/math_op.c lib_com/modif_fs_fx.c : completed overflow op replacement and fix warnings --- lib_com/lpc_tools_fx.c | 8 +++ lib_com/lsf_tools_fx.c | 6 +- lib_com/lsp_conv_poly_fx.c | 4 +- lib_com/math_op.c | 30 +++++++-- lib_com/modif_fs_fx.c | 133 +++++++++++++++++++++++++++++++++++-- 5 files changed, 162 insertions(+), 19 deletions(-) diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 6e34dbbe1..4aedf6be9 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -823,7 +823,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -859,7 +863,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index ddbd74a2b..d5175f682 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -1875,9 +1875,9 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ { L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1, &Overflow ); /* extracting in q_a */ //??sat + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat move16(); #else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index e8b241a9a..bc3383518 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -336,7 +336,7 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; -#ifdef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -373,7 +373,7 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; -#ifdef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 74143b8ed..3d5171bb0 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -228,20 +228,30 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat + FOR( i = 1; i < lg; i++ ) + { + L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat + } +#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } +#endif } IF( expi < 0 ) { @@ -251,26 +261,32 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat +#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); +#endif } } IF( expi > 0 ) { -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( x[0], expi ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( x[0], expi ); //??sat + L_sum = L_mac_sat( 1, tmp, tmp ); //??sat + FOR( i = 1; i < lg; i++ ) + { + tmp = shl_sat( x[i], expi ); //??sat + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat + } #else tmp = shl_o( x[0], expi, &Overflow ); -#endif L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( x[i], expi ); -#else tmp = shl_o( x[i], expi, &Overflow ); -#endif L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } +#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index fae2a43c2..baba8fbc4 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -75,7 +75,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -279,8 +279,8 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { -#ifdef ISSUE_1796_replace_shl_o - num_den = shl_sat( num_den, 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -364,7 +364,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -565,8 +565,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifdef ISSUE_1796_replace_shl_o - num_den = shl_sat( num_den, 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -941,9 +941,11 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -954,20 +956,34 @@ void Decimate_allpass_steep_fx( { Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ +#endif mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat + + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat +#else Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ temp2 = extract_h( Lacc1 ); /* Qx */ Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ +#endif mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); @@ -975,37 +991,67 @@ void Decimate_allpass_steep_fx( Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat + move16(); +#else out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); +#endif + } /* lower allpass filter chain */ Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat +#else Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat + temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ + move16(); + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ +#endif mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ @@ -1018,10 +1064,17 @@ void Decimate_allpass_steep_fx( Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1030,6 +1083,20 @@ void Decimate_allpass_steep_fx( Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ + temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ +#else Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; @@ -1042,6 +1109,8 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ @@ -1158,9 +1227,11 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1169,6 +1240,30 @@ void Interpolate_allpass_steep_fx( { Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[0] = round_fx_sat( Lacc1 ); //??sat + move16(); + Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat + Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat + Lacc = L_deposit_h( temp1 ); + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat + move16(); + + Lacc1 = L_deposit_h( temp2 ); + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat + out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat + move16(); +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1191,6 +1286,7 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ @@ -1198,6 +1294,28 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_deposit_h( temp1 ); + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( temp2 ); + out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat + move16(); + mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat + move16(); +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1218,6 +1336,7 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } return; -- GitLab From ace728e1800a7591733b6fba882f3e9b48e1a790 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 15:10:07 +0200 Subject: [PATCH 031/103] lib_com/fft_fx_evs.c : completed overflow op replacement by adding //??sat comment --- lib_com/fft_fx_evs.c | 390 +++++++++++++++++++++---------------------- 1 file changed, 195 insertions(+), 195 deletions(-) diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index 27eef7a8a..c0c070cc5 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -1219,9 +1219,9 @@ static void fft5_32_16fx( T6 = zRe[i3]; move16(); #ifdef ISSUE_1836_replace_overflow_libcom - T7 = add_sat( T5, T6 ); - T8 = add_sat( T4, T7 ); - Tt = sub_sat( T5, T6 ); + T7 = add_sat( T5, T6 ); //??sat + T8 = add_sat( T4, T7 ); //??sat + Tt = sub_sat( T5, T6 ); //??sat #else T7 = add_o( T5, T6, &Overflow ); T8 = add_o( T4, T7, &Overflow ); @@ -1249,9 +1249,9 @@ static void fft5_32_16fx( Tn = round_fx_sat( L_tmp ); // Qx #ifdef ISSUE_1836_replace_overflow_libcom - zRe[i0] = add_sat( T1, T8 ); - move16(); - zIm[i0] = add_sat( To, Tp ); + zRe[i0] = add_sat( T1, T8 ); //??sat + move16(); + zIm[i0] = add_sat( To, Tp ); //??sat move32(); #else zRe[i0] = add_o( T1, T8, &Overflow ); @@ -1276,13 +1276,13 @@ static void fft5_32_16fx( T5 = sub_sat( T6, T9 ); #ifdef ISSUE_1836_replace_overflow_libcom - zRe[i3] = sub_sat( T4, T2 ); + zRe[i3] = sub_sat( T4, T2 ); //??sat move32(); - zRe[i1] = add_sat( T5, T3 ); + zRe[i1] = add_sat( T5, T3 ); //??sat move32(); - zRe[i2] = add_sat( T4, T2 ); + zRe[i2] = add_sat( T4, T2 ); //??sat move32(); - zRe[i4] = sub_sat( T5, T3 ); + zRe[i4] = sub_sat( T5, T3 ); //??sat move32(); #else zRe[i3] = sub_o( T4, T2, &Overflow ); @@ -1759,12 +1759,12 @@ static void cftfsub_16fx( FOR( j = 0; j < l; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); - x0r = sub_sat( a[j], a[j1] ); - x0i = sub_sat( a[j + 1], a[j1 + 1] ); - a[j] = add_sat( a[j], a[j1] ); + j1 = add_sat( j, l ); //??sat + x0r = sub_sat( a[j], a[j1] ); //??sat + x0i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + a[j] = add_sat( a[j], a[j1] ); //??sat move16(); - a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); + a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); //??sat move16(); #else j1 = add_o( j, l, &Overflow ); @@ -1807,72 +1807,72 @@ static void cft1st_16fx( #endif #ifdef ISSUE_1836_replace_overflow_libcom - x0r = add_sat( a[0], a[2] ); - x0i = add_sat( a[1], a[3] ); - x1r = sub_sat( a[0], a[2] ); - x1i = sub_sat( a[1], a[3] ); - x2r = add_sat( a[4], a[6] ); - x2i = add_sat( a[5], a[7] ); - x3r = sub_sat( a[4], a[6] ); - x3i = sub_sat( a[5], a[7] ); - a[0] = add_sat( x0r, x2r ); + x0r = add_sat( a[0], a[2] ); //??sat + x0i = add_sat( a[1], a[3] ); //??sat + x1r = sub_sat( a[0], a[2] ); //??sat + x1i = sub_sat( a[1], a[3] ); //??sat + x2r = add_sat( a[4], a[6] ); //??sat + x2i = add_sat( a[5], a[7] ); //??sat + x3r = sub_sat( a[4], a[6] ); //??sat + x3i = sub_sat( a[5], a[7] ); //??sat + a[0] = add_sat( x0r, x2r ); //??sat move16(); - a[1] = add_sat( x0i, x2i ); + a[1] = add_sat( x0i, x2i ); //??sat move16(); - a[4] = sub_sat( x0r, x2r ); + a[4] = sub_sat( x0r, x2r ); //??sat move16(); - a[5] = sub_sat( x0i, x2i ); + a[5] = sub_sat( x0i, x2i ); //??sat move16(); - a[2] = sub_sat( x1r, x3i ); + a[2] = sub_sat( x1r, x3i ); //??sat move16(); - a[3] = add_sat( x1i, x3r ); + a[3] = add_sat( x1i, x3r ); //??sat move16(); - a[6] = add_sat( x1r, x3i ); + a[6] = add_sat( x1r, x3i ); //??sat move16(); - a[7] = sub_sat( x1i, x3r ); + a[7] = sub_sat( x1i, x3r ); //??sat wk1r = w[2]; move32(); - x0r = add_sat( a[8], a[10] ); - x0i = add_sat( a[9], a[11] ); - x1r = sub_sat( a[8], a[10] ); - x1i = sub_sat( a[9], a[11] ); - x2r = add_sat( a[12], a[14] ); - x2i = add_sat( a[13], a[15] ); - x3r = sub_sat( a[12], a[14] ); - x3i = sub_sat( a[13], a[15] ); - a[8] = add_sat( x0r, x2r ); + x0r = add_sat( a[8], a[10] ); //??sat + x0i = add_sat( a[9], a[11] ); //??sat + x1r = sub_sat( a[8], a[10] ); //??sat + x1i = sub_sat( a[9], a[11] ); //??sat + x2r = add_sat( a[12], a[14] ); //??sat + x2i = add_sat( a[13], a[15] ); //??sat + x3r = sub_sat( a[12], a[14] ); //??sat + x3i = sub_sat( a[13], a[15] ); //??sat + a[8] = add_sat( x0r, x2r ); //??sat move16(); - a[9] = add_sat( x0i, x2i ); + a[9] = add_sat( x0i, x2i ); //??sat move16(); - a[12] = sub_sat( x2i, x0i ); + a[12] = sub_sat( x2i, x0i ); //??sat move16(); - a[13] = sub_sat( x0r, x2r ); + a[13] = sub_sat( x0r, x2r ); //??sat move16(); - x0r = sub_sat( x1r, x3i ); - x0i = add_sat( x1i, x3r ); - tmp = sub_sat( x0r, x0i ); + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + tmp = sub_sat( x0r, x0i ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0r, x0i ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct) */ + tmp = add_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat + a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct)*/ //??sat move16(); - x0r = add_sat( x3i, x1r ); - x0i = sub_sat( x3r, x1i ); - tmp = sub_sat( x0i, x0r ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + x0r = add_sat( x3i, x1r ); //??sat + x0i = sub_sat( x3r, x1i ); //??sat + tmp = sub_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat + a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0i, x0r ); + tmp = add_sat( x0i, x0r ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); k1 = 0; move16(); @@ -1968,53 +1968,53 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ #ifdef ISSUE_1836_replace_overflow_libcom - x0r = add_sat( a[j], a[j + 2] ); - x0i = add_sat( a[j + 1], a[j + 3] ); - x1r = sub_sat( a[j], a[j + 2] ); - x1i = sub_sat( a[j + 1], a[j + 3] ); - x2r = add_sat( a[j + 4], a[j + 6] ); - x2i = add_sat( a[j + 5], a[j + 7] ); - x3r = sub_sat( a[j + 4], a[j + 6] ); - x3i = sub_sat( a[j + 5], a[j + 7] ); - a[j] = add_sat( x0r, x2r ); + x0r = add_sat( a[j], a[j + 2] ); //??sat + x0i = add_sat( a[j + 1], a[j + 3] ); //??sat + x1r = sub_sat( a[j], a[j + 2] ); //??sat + x1i = sub_sat( a[j + 1], a[j + 3] ); //??sat + x2r = add_sat( a[j + 4], a[j + 6] ); //??sat + x2i = add_sat( a[j + 5], a[j + 7] ); //??sat + x3r = sub_sat( a[j + 4], a[j + 6] ); //??sat + x3i = sub_sat( a[j + 5], a[j + 7] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - x0r = sub_sat( x0r, x2r ); - x0i = sub_sat( x0i, x2i ); + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = add_sat( x1r, x3i ); x0i = sub_sat( x1i, x3r ); L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); wk1r = w[k2 + 2]; @@ -2027,56 +2027,56 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ - x0r = add_sat( a[j + 8], a[j + 10] ); - x0i = add_sat( a[j + 9], a[j + 11] ); - x1r = sub_sat( a[j + 8], a[j + 10] ); - x1i = sub_sat( a[j + 9], a[j + 11] ); - x2r = add_sat( a[j + 12], a[j + 14] ); - x2i = add_sat( a[j + 13], a[j + 15] ); - x3r = sub_sat( a[j + 12], a[j + 14] ); - x3i = sub_sat( a[j + 13], a[j + 15] ); - a[j + 8] = add_sat( x0r, x2r ); + x0r = add_sat( a[j + 8], a[j + 10] ); //??sat + x0i = add_sat( a[j + 9], a[j + 11] ); //??sat + x1r = sub_sat( a[j + 8], a[j + 10] ); //??sat + x1i = sub_sat( a[j + 9], a[j + 11] ); //??sat + x2r = add_sat( a[j + 12], a[j + 14] ); //??sat + x2i = add_sat( a[j + 13], a[j + 15] ); //??sat + x3r = sub_sat( a[j + 12], a[j + 14] ); //??sat + x3i = sub_sat( a[j + 13], a[j + 15] ); //??sat + a[j + 8] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 9] = add_sat( x0i, x2i ); + a[j + 9] = add_sat( x0i, x2i ); //??sat move16(); - x0r = sub_sat( x0r, x2r ); - x0i = sub_sat( x0i, x2i ); + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat tmp = negate( x0r ); L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); tmp = negate( x0i ); L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = sub_sat( x1r, x3i ); - x0i = add_sat( x1i, x3r ); + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = add_sat( x1r, x3i ); - x0i = sub_sat( x1i, x3r ); + x0r = add_sat( x1r, x3i ); //??sat + x0i = sub_sat( x1i, x3r ); //??sat L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else x0r = add_o( a[j], a[j + 2], &Overflow ); @@ -2222,32 +2222,32 @@ static void cftmdl_16fx( FOR( j = 0; j < l; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); - j2 = add_sat( j1, l ); - j3 = add_sat( j2, l ); - x0r = add_sat( a[j], a[j1] ); - x0i = add_sat( a[j + 1], a[j1 + 1] ); - x1r = sub_sat( a[j], a[j1] ); - x1i = sub_sat( a[j + 1], a[j1 + 1] ); - x2r = add_sat( a[j2], a[j3] ); - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); - x3r = sub_sat( a[j2], a[j3] ); - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); - a[j] = add_sat( x0r, x2r ); + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] );//??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] );//??sat + a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - a[j2] = sub_sat( x0r, x2r ); + a[j2] = sub_sat( x0r, x2r ); //??sat move16(); - a[j2 + 1] = sub_sat( x0i, x2i ); + a[j2 + 1] = sub_sat( x0i, x2i ); //??sat move16(); - a[j1] = sub_sat( x1r, x3i ); + a[j1] = sub_sat( x1r, x3i ); //??sat move16(); - a[j1 + 1] = add_sat( x1i, x3r ); + a[j1 + 1] = add_sat( x1i, x3r ); //??sat move16(); - a[j3] = add_sat( x1r, x3i ); + a[j3] = add_sat( x1r, x3i ); //??sat move16(); - a[j3 + 1] = sub_sat( x1i, x3r ); + a[j3 + 1] = sub_sat( x1i, x3r ); //??sat move16(); #else j1 = add_o( j, l, &Overflow ); @@ -2286,48 +2286,48 @@ static void cftmdl_16fx( FOR( j = m; j < tmp2; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); - j2 = add_sat( j1, l ); - j3 = add_sat( j2, l ); - x0r = add_sat( a[j], a[j1] ); - x0i = add_sat( a[j + 1], a[j1 + 1] ); - x1r = sub_sat( a[j], a[j1] ); - x1i = sub_sat( a[j + 1], a[j1 + 1] ); - x2r = add_sat( a[j2], a[j3] ); - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); - x3r = sub_sat( a[j2], a[j3] ); - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); - a[j] = add_sat( x0r, x2r ); + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] );//??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] );//??sat + a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - a[j2] = sub_sat( x2i, x0i ); + a[j2] = sub_sat( x2i, x0i ); //??sat move16(); - a[j2 + 1] = sub_sat( x0r, x2r ); + a[j2 + 1] = sub_sat( x0r, x2r ); //??sat move16(); - x0r = sub_sat( x1r, x3i ); - x0i = add_sat( x1i, x3r ); - tmp = sub_sat( x0r, x0i ); + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + tmp = sub_sat( x0r, x0i ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0r, x0i ); + tmp = add_sat( x0r, x0i ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = add_sat( x3i, x1r ); - x0i = sub_sat( x3r, x1i ); - tmp = sub_sat( x0i, x0r ); + x0r = add_sat( x3i, x1r ); //??sat + x0i = sub_sat( x3r, x1i ); //??sat + tmp = sub_sat( x0i, x0r ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0i, x0r ); + tmp = add_sat( x0i, x0r ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else j1 = add_o( j, l, &Overflow ); @@ -2401,46 +2401,46 @@ static void cftmdl_16fx( FOR( j = k; j < tmp2; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); - j2 = add_sat( j1, l ); - j3 = add_sat( j2, l ); - x0r = add_sat( a[j], a[j1] ); - x0i = add_sat( a[j + 1], a[j1 + 1] ); - x1r = sub_sat( a[j], a[j1] ); - x1i = sub_sat( a[j + 1], a[j1 + 1] ); - x2r = add_sat( a[j2], a[j3] ); - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); - x3r = sub_sat( a[j2], a[j3] ); - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); - a[j] = add_sat( x0r, x2r ); + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - x0r = sub_sat( x0r, x2r ); - x0i = sub_sat( x0i, x2i ); + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = sub_sat( x1r, x3i ); - x0i = add_sat( x1i, x3r ); + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_x0r = L_add( (Word32) x1r, (Word32) x3i ); @@ -2449,12 +2449,12 @@ static void cftmdl_16fx( x0i = extract_l( L_x0i ); L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else j1 = add_o( j, l, &Overflow ); @@ -2520,11 +2520,11 @@ static void cftmdl_16fx( wk1i = w[k2 + 3]; move32(); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ - wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ //??sat + wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ //??sat - L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ - wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ //??sat + wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ //??sat tmp2 = add( l, add( k, m ) ); #else L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */ @@ -2537,61 +2537,61 @@ static void cftmdl_16fx( FOR( j = add( k, m ); j < tmp2; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); - j2 = add_sat( j1, l ); - j3 = add_sat( j2, l ); - x0r = add_sat( a[j], a[j1] ); - x0i = add_sat( a[j + 1], a[j1 + 1] ); - x1r = sub_sat( a[j], a[j1] ); - x1i = sub_sat( a[j + 1], a[j1 + 1] ); - x2r = add_sat( a[j2], a[j3] ); - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); - x3r = sub_sat( a[j2], a[j3] ); - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); - a[j] = add_sat( x0r, x2r ); + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - x0r = sub_sat( x0r, x2r ); - x0i = sub_sat( x0i, x2i ); + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat tmp = negate( x0r ); L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); tmp = negate( x0i ); L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = sub_sat( x1r, x3i ); - x0i = add_sat( x1i, x3r ); + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = add_sat( x1r, x3i ); - x0i = sub_sat( x1i, x3r ); + x0r = add_sat( x1r, x3i ); //??sat + x0i = sub_sat( x1i, x3r ); //??sat L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else j1 = add_o( j, l, &Overflow ); -- GitLab From 3ab958842b5e254b74573769a3edec85ce949b2c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 16:04:53 +0200 Subject: [PATCH 032/103] clang patch --- lib_com/fft_fx_evs.c | 322 +++++++++++++++++----------------- lib_com/lpc_tools_fx.c | 8 +- lib_com/math_op.c | 8 +- lib_com/modif_fs_fx.c | 173 +++++++++--------- lib_com/oper_32b.c | 22 +++ lib_com/phase_dispersion_fx.c | 10 ++ lib_com/ppp_fx.c | 10 ++ lib_com/pred_lt4_fx.c | 25 +++ 8 files changed, 322 insertions(+), 256 deletions(-) diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index c0c070cc5..6572b57d7 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -1219,9 +1219,9 @@ static void fft5_32_16fx( T6 = zRe[i3]; move16(); #ifdef ISSUE_1836_replace_overflow_libcom - T7 = add_sat( T5, T6 ); //??sat - T8 = add_sat( T4, T7 ); //??sat - Tt = sub_sat( T5, T6 ); //??sat + T7 = add_sat( T5, T6 ); //??sat + T8 = add_sat( T4, T7 ); //??sat + Tt = sub_sat( T5, T6 ); //??sat #else T7 = add_o( T5, T6, &Overflow ); T8 = add_o( T4, T7, &Overflow ); @@ -1250,7 +1250,7 @@ static void fft5_32_16fx( #ifdef ISSUE_1836_replace_overflow_libcom zRe[i0] = add_sat( T1, T8 ); //??sat - move16(); + move16(); zIm[i0] = add_sat( To, Tp ); //??sat move32(); #else @@ -1276,13 +1276,13 @@ static void fft5_32_16fx( T5 = sub_sat( T6, T9 ); #ifdef ISSUE_1836_replace_overflow_libcom - zRe[i3] = sub_sat( T4, T2 ); //??sat + zRe[i3] = sub_sat( T4, T2 ); //??sat move32(); - zRe[i1] = add_sat( T5, T3 ); //??sat + zRe[i1] = add_sat( T5, T3 ); //??sat move32(); - zRe[i2] = add_sat( T4, T2 ); //??sat + zRe[i2] = add_sat( T4, T2 ); //??sat move32(); - zRe[i4] = sub_sat( T5, T3 ); //??sat + zRe[i4] = sub_sat( T5, T3 ); //??sat move32(); #else zRe[i3] = sub_o( T4, T2, &Overflow ); @@ -1759,12 +1759,12 @@ static void cftfsub_16fx( FOR( j = 0; j < l; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - x0r = sub_sat( a[j], a[j1] ); //??sat - x0i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - a[j] = add_sat( a[j], a[j1] ); //??sat + j1 = add_sat( j, l ); //??sat + x0r = sub_sat( a[j], a[j1] ); //??sat + x0i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + a[j] = add_sat( a[j], a[j1] ); //??sat move16(); - a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); //??sat + a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); //??sat move16(); #else j1 = add_o( j, l, &Overflow ); @@ -1833,10 +1833,10 @@ static void cft1st_16fx( wk1r = w[2]; move32(); - x0r = add_sat( a[8], a[10] ); //??sat - x0i = add_sat( a[9], a[11] ); //??sat - x1r = sub_sat( a[8], a[10] ); //??sat - x1i = sub_sat( a[9], a[11] ); //??sat + x0r = add_sat( a[8], a[10] ); //??sat + x0i = add_sat( a[9], a[11] ); //??sat + x1r = sub_sat( a[8], a[10] ); //??sat + x1i = sub_sat( a[9], a[11] ); //??sat x2r = add_sat( a[12], a[14] ); //??sat x2i = add_sat( a[13], a[15] ); //??sat x3r = sub_sat( a[12], a[14] ); //??sat @@ -1850,28 +1850,28 @@ static void cft1st_16fx( a[13] = sub_sat( x0r, x2r ); //??sat move16(); - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - tmp = sub_sat( x0r, x0i ); //??sat + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + tmp = sub_sat( x0r, x0i ); //??sat L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat - a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct)*/ //??sat + tmp = add_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat + a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct)*/ //??sat move16(); - x0r = add_sat( x3i, x1r ); //??sat - x0i = sub_sat( x3r, x1i ); //??sat - tmp = sub_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat - a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + x0r = add_sat( x3i, x1r ); //??sat + x0i = sub_sat( x3r, x1i ); //??sat + tmp = sub_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat + a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + tmp = add_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); k1 = 0; @@ -1968,7 +1968,7 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ #ifdef ISSUE_1836_replace_overflow_libcom - x0r = add_sat( a[j], a[j + 2] ); //??sat + x0r = add_sat( a[j], a[j + 2] ); //??sat x0i = add_sat( a[j + 1], a[j + 3] ); //??sat x1r = sub_sat( a[j], a[j + 2] ); //??sat x1i = sub_sat( a[j + 1], a[j + 3] ); //??sat @@ -1981,39 +1981,39 @@ static void cft1st_16fx( a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - x0r = sub_sat( x0r, x2r ); //??sat - x0i = sub_sat( x0i, x2i ); //??sat - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = sub_sat( x1r, x3i ); x0i = add_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = add_sat( x1r, x3i ); x0i = sub_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); @@ -2027,10 +2027,10 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ - x0r = add_sat( a[j + 8], a[j + 10] ); //??sat - x0i = add_sat( a[j + 9], a[j + 11] ); //??sat - x1r = sub_sat( a[j + 8], a[j + 10] ); //??sat - x1i = sub_sat( a[j + 9], a[j + 11] ); //??sat + x0r = add_sat( a[j + 8], a[j + 10] ); //??sat + x0i = add_sat( a[j + 9], a[j + 11] ); //??sat + x1r = sub_sat( a[j + 8], a[j + 10] ); //??sat + x1i = sub_sat( a[j + 9], a[j + 11] ); //??sat x2r = add_sat( a[j + 12], a[j + 14] ); //??sat x2i = add_sat( a[j + 13], a[j + 15] ); //??sat x3r = sub_sat( a[j + 12], a[j + 14] ); //??sat @@ -2043,39 +2043,39 @@ static void cft1st_16fx( x0r = sub_sat( x0r, x2r ); //??sat x0i = sub_sat( x0i, x2i ); //??sat tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = add_sat( x1r, x3i ); //??sat x0i = sub_sat( x1i, x3r ); //??sat - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else @@ -2222,32 +2222,32 @@ static void cftmdl_16fx( FOR( j = 0; j < l; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] );//??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] );//??sat - a[j] = add_sat( x0r, x2r ); //??sat + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); - a[j2] = sub_sat( x0r, x2r ); //??sat + a[j2] = sub_sat( x0r, x2r ); //??sat move16(); - a[j2 + 1] = sub_sat( x0i, x2i ); //??sat + a[j2 + 1] = sub_sat( x0i, x2i ); //??sat move16(); - a[j1] = sub_sat( x1r, x3i ); //??sat + a[j1] = sub_sat( x1r, x3i ); //??sat move16(); - a[j1 + 1] = add_sat( x1i, x3r ); //??sat + a[j1 + 1] = add_sat( x1i, x3r ); //??sat move16(); - a[j3] = add_sat( x1r, x3i ); //??sat + a[j3] = add_sat( x1r, x3i ); //??sat move16(); - a[j3 + 1] = sub_sat( x1i, x3r ); //??sat + a[j3 + 1] = sub_sat( x1i, x3r ); //??sat move16(); #else j1 = add_o( j, l, &Overflow ); @@ -2286,47 +2286,47 @@ static void cftmdl_16fx( FOR( j = m; j < tmp2; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] );//??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] );//??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat - move16(); - a[j2] = sub_sat( x2i, x0i ); //??sat - move16(); - a[j2 + 1] = sub_sat( x0r, x2r ); //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - tmp = sub_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat + move16(); + a[j2] = sub_sat( x2i, x0i ); //??sat + move16(); + a[j2 + 1] = sub_sat( x0r, x2r ); //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + tmp = sub_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + tmp = add_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - x0r = add_sat( x3i, x1r ); //??sat - x0i = sub_sat( x3r, x1i ); //??sat - tmp = sub_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + x0r = add_sat( x3i, x1r ); //??sat + x0i = sub_sat( x3r, x1i ); //??sat + tmp = sub_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - tmp = add_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + tmp = add_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else @@ -2401,45 +2401,45 @@ static void cftmdl_16fx( FOR( j = k; j < tmp2; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); x0r = sub_sat( x0r, x2r ); //??sat x0i = sub_sat( x0i, x2i ); //??sat - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = sub_sat( x1r, x3i ); //??sat x0i = add_sat( x1i, x3r ); //??sat - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); @@ -2447,13 +2447,13 @@ static void cftmdl_16fx( L_x0i = L_sub( (Word32) x1i, (Word32) x3r ); x0r = extract_l( L_x0r ); x0i = extract_l( L_x0i ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else @@ -2537,60 +2537,60 @@ static void cftmdl_16fx( FOR( j = add( k, m ); j < tmp2; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat x3r = sub_sat( a[j2], a[j3] ); //??sat x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat a[j] = add_sat( x0r, x2r ); //??sat move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat + a[j + 1] = add_sat( x0i, x2i ); //??sat move16(); x0r = sub_sat( x0r, x2r ); //??sat x0i = sub_sat( x0i, x2i ); //??sat tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = sub_sat( x1r, x3i ); //??sat x0i = add_sat( x1i, x3r ); //??sat - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); x0r = add_sat( x1r, x3i ); //??sat x0i = sub_sat( x1i, x3r ); //??sat - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat move16(); #else diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 4aedf6be9..c1498808d 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -824,9 +824,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -864,7 +864,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat #else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); #endif @@ -973,7 +973,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat #else - t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ + t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 3d5171bb0..24eb88278 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -240,7 +240,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val IF( expi == 0 ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat + L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat @@ -262,7 +262,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { tmp = mult_r( x[i], sft ); #ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat #else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); #endif @@ -271,8 +271,8 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val IF( expi > 0 ) { #ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( x[0], expi ); //??sat - L_sum = L_mac_sat( 1, tmp, tmp ); //??sat + tmp = shl_sat( x[0], expi ); //??sat + L_sum = L_mac_sat( 1, tmp, tmp ); //??sat FOR( i = 1; i < lg; i++ ) { tmp = shl_sat( x[i], expi ); //??sat diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index baba8fbc4..4860ad832 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -280,7 +280,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat + num_den = shl_sat( num_den, 1 ); //??sat #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -566,7 +566,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ { #ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat + num_den = shl_sat( num_den, 1 ); //??sat #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -955,46 +955,46 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat #else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ #endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat + Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat #else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ #endif - mem[1] = extract_h( Lacc ); /* Qx */ + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat + mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat move16(); #else out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ @@ -1002,17 +1002,16 @@ void Decimate_allpass_steep_fx( mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); #endif - } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat #else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ @@ -1023,36 +1022,36 @@ void Decimate_allpass_steep_fx( temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat #else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ #endif - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat - temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat + temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat #else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1063,17 +1062,17 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat #else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ #endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ @@ -1082,23 +1081,23 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ - temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ + temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ #else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1111,7 +1110,7 @@ void Decimate_allpass_steep_fx( Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1239,35 +1238,35 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - mem[0] = round_fx_sat( Lacc1 ); //??sat + mem[0] = round_fx_sat( Lacc1 ); //??sat move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat - Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat + Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat + Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat Lacc = L_deposit_h( temp1 ); - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat move16(); Lacc1 = L_deposit_h( temp2 ); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat - out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat + out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat + mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat move16(); #else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1293,25 +1292,25 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat + mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat Lacc = L_deposit_h( temp1 ); - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc1 = L_deposit_h( temp2 ); - out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat + out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat move16(); diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index be34a1248..0f7d0fa4d 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -124,13 +124,20 @@ Word32 L_Comp( Word16 hi, Word16 lo ) Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif L_32 = L_mult( hi1, hi2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat +#else L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); +#endif return ( L_32 ); } @@ -159,13 +166,21 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; +#ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat +#else L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); +#endif return ( L_32 ); } @@ -193,12 +208,19 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Sqr_32( Word16 hi, Word16 lo ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mult_sat( hi, hi ); //??sat + L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 );//??sat +#else L_32 = L_mult_o( hi, hi, &Overflow ); L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); +#endif return ( L_32 ); } diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 3103723be..bc72e908f 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -30,9 +30,11 @@ void phase_dispersion( Word32 x32[2 * L_SUBFR]; Word16 *code_real, *code_imag; const Word16 *h_real, *h_imag; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif move16(); @@ -57,7 +59,11 @@ void phase_dispersion( move16(); prev_gain_pit[0] = gain_pit; +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) ) //??sat +#else IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) ) +#endif { IF( LT_16( state, 2 ) ) { @@ -165,7 +171,11 @@ void phase_dispersion( scale2 = getScaleFactor32( x32, L_subfr ); FOR( i = 0; i < L_subfr; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) ); +#else code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); +#endif move16(); } j = sub( j, scale2 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index cc6b59bdb..a583b1a0f 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -97,9 +97,11 @@ void deemph_lpc_fx( Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif b_fx[0] = 4096; move16(); /* 1 in Q12 */ @@ -115,7 +117,11 @@ void deemph_lpc_fx( { /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat +#else LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); +#endif move16(); /* Q12 */ } @@ -137,7 +143,11 @@ void deemph_lpc_fx( { /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat +#else LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); +#endif move16(); /* Q12 */ } } diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 465138bde..277cb0da4 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -35,9 +35,11 @@ void pred_lt4_ivas_fx( Word32 s; const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0]; @@ -71,7 +73,11 @@ void pred_lt4_ivas_fx( s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } +#ifdef ISSUE_1836_replace_overflow_libcom + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat +#else excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ +#endif move16(); } return; @@ -91,9 +97,11 @@ void pred_lt4( Word16 i, j; Word32 s; const Word16 *x0, *x1, *x2, *c1, *c2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0]; @@ -127,12 +135,21 @@ void pred_lt4( } s = W_sat_l( s64 ); /* Q_exc + Q14 */ } +#ifdef ISSUE_1836_replace_overflow_libcom +#if ( INTERP_EXP != -1 ) + s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ //??sat +#endif + + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat + move16(); +#else #if ( INTERP_EXP != -1 ) s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ #endif excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); +#endif } return; } @@ -177,9 +194,11 @@ void pred_lt4_tc_fx( Word16 excO[L_SUBFR + 1]; Word32 L_sum; Word16 excI[2 * L_SUBFR]; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ @@ -212,8 +231,14 @@ void pred_lt4_tc_fx( k += UP_SAMP; L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat + excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat +#else L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ +#endif + move16(); x0++; -- GitLab From 43fc0cfb9df4491ec7903cfec6ef395297ca131d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 16:11:16 +0200 Subject: [PATCH 033/103] clang patch --- lib_com/oper_32b.c | 14 +++++++------- lib_com/ppp_fx.c | 4 ++-- lib_com/pred_lt4_fx.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index 0f7d0fa4d..d1f8dd2f1 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -132,8 +132,8 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) L_32 = L_mult( hi1, hi2 ); #ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat - L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat #else L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); @@ -173,9 +173,9 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) #endif #ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat - L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat - L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat + L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat #else L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); @@ -215,8 +215,8 @@ Word32 Sqr_32( Word16 hi, Word16 lo ) #endif #ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mult_sat( hi, hi ); //??sat - L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 );//??sat + L_32 = L_mult_sat( hi, hi ); //??sat + L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 ); //??sat #else L_32 = L_mult_o( hi, hi, &Overflow ); L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index a583b1a0f..56cde5456 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -118,7 +118,7 @@ void deemph_lpc_fx( /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ #ifdef ISSUE_1836_replace_overflow_libcom - LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat + LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat #else LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); #endif @@ -144,7 +144,7 @@ void deemph_lpc_fx( /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ #ifdef ISSUE_1836_replace_overflow_libcom - LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat + LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat #else LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); #endif diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 277cb0da4..c625cd6b9 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -74,9 +74,9 @@ void pred_lt4_ivas_fx( } #ifdef ISSUE_1836_replace_overflow_libcom - excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat #else - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ #endif move16(); } @@ -140,7 +140,7 @@ void pred_lt4( s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ //??sat #endif - excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat move16(); #else #if ( INTERP_EXP != -1 ) @@ -232,8 +232,8 @@ void pred_lt4_tc_fx( L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } #ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat - excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat + L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat + excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat #else L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ -- GitLab From b87e4111a3e4cd482ab20ac40ef8b76621aeac23 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 31 Jul 2025 16:33:56 +0200 Subject: [PATCH 034/103] lib_com/pred_lt4_fx.c lib_com/preemph_fx.c : completed overflow op replacement and build fix --- lib_com/pred_lt4_fx.c | 4 ++++ lib_com/preemph_fx.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index c625cd6b9..262df116a 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -245,7 +245,11 @@ void pred_lt4_tc_fx( } FOR( i = T0; i < L_SUBFR; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */ //??sat +#else exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ +#endif move16(); } } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index b7886cb65..e40603a42 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -22,12 +22,23 @@ void preemph_copy_fx( ) { Word16 i, temp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = x[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */ + move16(); + } + y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ @@ -35,6 +46,8 @@ void preemph_copy_fx( } y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ move16(); +#endif + *mem = temp; /* Qx */ move16(); @@ -49,12 +62,23 @@ void preemph_copy_32fx( ) { Word16 i, temp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = x[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ //??sat + move16(); + } + y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */ @@ -62,6 +86,7 @@ void preemph_copy_32fx( } y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */ move16(); +#endif *mem = temp; /* Qx */ move16(); @@ -125,13 +150,31 @@ void E_UTIL_f_preemph2( { Word16 i, temp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif + #endif temp = signal[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + move16(); + } + + L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ @@ -146,6 +189,7 @@ void E_UTIL_f_preemph2( L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); +#endif *mem = temp; /* Qx */ move16(); -- GitLab From 637b453aa837c81252149e0ccb67b0d6fbb2caa0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 07:21:46 +0200 Subject: [PATCH 035/103] clan gpatch --- lib_com/pred_lt4_fx.c | 4 ++-- lib_com/preemph_fx.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 262df116a..4dd399c6b 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -235,8 +235,8 @@ void pred_lt4_tc_fx( L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat #else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ #endif move16(); diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index e40603a42..b24aa9467 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -76,7 +76,7 @@ void preemph_copy_32fx( y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ //??sat move16(); } - y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat + y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat move16(); #else FOR( i = lg - 1; i > 0; i-- ) @@ -155,24 +155,24 @@ void E_UTIL_f_preemph2( Flag Overflow = 0; move32(); #endif - #endif +#endif temp = signal[lg - 1]; /* Qx */ move16(); #ifdef ISSUE_1836_replace_overflow_libcom FOR( i = lg - 1; i > 0; i-- ) { - L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat - L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ - signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat move16(); } - L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat - L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ - signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat move16(); #else FOR( i = lg - 1; i > 0; i-- ) -- GitLab From 7aad8d83748df2069102af25ba1d239147d1f4c2 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 11:54:22 +0200 Subject: [PATCH 036/103] : completed overflow op replacement --- lib_com/pvq_com_fx.c | 12 ++ lib_com/residu_fx.c | 42 ++++++- lib_com/stat_noise_uv_mod_fx.c | 32 +++-- lib_com/swb_bwe_com_fx.c | 9 ++ lib_com/swb_bwe_com_lr_fx.c | 39 ++++++- lib_com/swb_tbe_com_fx.c | 206 +++++++++++++++++++++++++++++---- 6 files changed, 299 insertions(+), 41 deletions(-) diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 1adcdb7ae..d53004f03 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -427,9 +427,11 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); @@ -456,7 +458,11 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat +#else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ +#endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ @@ -527,9 +533,11 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -552,7 +560,11 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat +#else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); +#endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 0ed9c9ac8..ca46c3063 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -62,9 +62,11 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif q = add( norm_s( a[0] ), 1 ); @@ -72,11 +74,37 @@ void Residu3_lc_fx( { q = add( q, shift ); } -#ifdef ISSUE_1796_replace_shl_o - *y++ = shl_sat( x[0], shift ); +#ifdef ISSUE_1836_replace_overflow_libcom + *y++ = shl_sat( x[0], shift ); //??sat + move16(); + + FOR( i = 1; i < m; i++ ) + { + s = L_mult_sat( x[i], a[0] ); //??sat + /* Stop at i to Avoid Mults with Zeros */ + FOR( j = 1; j <= i; j++ ) + { + s = L_mac_sat( s, x[i - j], a[j] ); //??sat + } + + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat + } + + FOR( ; i < lg; i++ ) + { + s = L_mult_sat( x[i], a[0] ); //??sat + FOR( j = 1; j <= m; j++ ) + { + s = L_mac_sat( s, x[i - j], a[j] ); //??sat + } + + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat + } + #else *y++ = shl_o( x[0], shift, &Overflow ); -#endif move16(); FOR( i = 1; i < m; i++ ) @@ -103,6 +131,8 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } + +#endif } /*--------------------------------------------------------------------* @@ -155,9 +185,11 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) @@ -174,7 +206,11 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( s32 ); //??sat +#else y[i] = round_fx_o( s32, &Overflow ); +#endif move16(); } } diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index 8d1236b53..fa28c84f0 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -74,9 +74,11 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*---------------------------------------------------------* @@ -109,7 +111,11 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + min_alpha = add_sat( tmp_res, 16384 ); //??sat +#else min_alpha = add_o( tmp_res, 16384, &Overflow ); +#endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ @@ -161,8 +167,8 @@ void stat_noise_uv_mod_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1796_replace_shl_o - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -190,8 +196,8 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1796_replace_shl_o - tmp_res = shl_sat( tmp_res, tmp_shift ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif @@ -258,7 +264,11 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat +#else tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ +#endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -392,9 +402,11 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*---------------------------------------------------------* @@ -424,7 +436,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + min_alpha = add_sat( tmp_res, 16384 ); //??sat +#else min_alpha = add_o( tmp_res, 16384, &Overflow ); +#endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); @@ -475,8 +491,8 @@ void stat_noise_uv_mod_ivas_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1796_replace_shl_o - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -504,8 +520,8 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1796_replace_shl_o - tmp_res = shl_sat( tmp_res, tmp_shift ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index fd4c6df66..2f2368b31 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -623,12 +623,21 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat +#else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); +#endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat + tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat +#else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); +#endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 78422a292..204c1e53d 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -927,9 +927,11 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *Qss = 10; @@ -986,7 +988,11 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat +#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ +#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1010,6 +1016,18 @@ void SpectrumSmoothing_fx( } ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) { +#ifdef ISSUE_1836_replace_overflow_libcom + IF( L_inBuf_pss[j] >= 0 ) + { + outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat + move16(); + } +#else IF( L_inBuf_pss[j] >= 0 ) { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); @@ -1020,6 +1038,7 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); move16(); } +#endif } ELSE { @@ -2225,9 +2244,11 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *QbeL = 3; @@ -2338,7 +2359,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom //??sat E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2380,13 +2401,19 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ +#ifdef ISSUE_1836_replace_overflow_libcom + IF ( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat +#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) +#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } +#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); +#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3213,7 +3240,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3252,8 +3279,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3326,8 +3353,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index beaef4614..e147b2353 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -996,11 +996,10 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; -#endif move32(); - +#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1040,8 +1039,8 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1796_replace_shl_o - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat #else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); #endif @@ -1451,9 +1450,11 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1543,8 +1544,8 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1 +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif @@ -1553,16 +1554,28 @@ void GenShapedWBExcitation_ivas_fx( n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] );/* Q29 */ //saturation not possible: excTmp2_frac[i] < MIN_16 + pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ //saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 + } +#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } +#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //L_mult: sat not poosible, excTmp2 > 0 //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1592,7 +1605,11 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1600,8 +1617,13 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ + pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ +#else L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ +#endif } } @@ -1610,11 +1632,19 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat +#else scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat +#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ +#endif move16(); } } @@ -1630,8 +1660,8 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_vfac = shl_sat( voice_factors[i], 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1643,6 +1673,20 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k++; + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1655,6 +1699,8 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } +#endif + } } } @@ -1709,9 +1755,11 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); move16(); @@ -1803,8 +1851,8 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); #endif @@ -1815,14 +1863,23 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ + pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat +#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1853,7 +1910,11 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1861,8 +1922,13 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat + pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ +#else L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } @@ -1871,6 +1937,15 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ + sc = sub( add( n2, Q_bwe_exc ), 14 ); + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + move16(); + } +#else scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1878,6 +1953,7 @@ void GenShapedWBExcitation_fx( exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } +#endif } ELSE { @@ -1892,8 +1968,8 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_vfac = shl_sat( voice_factors[i], 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1905,6 +1981,20 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k = add( k, 1 ); + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -1917,6 +2007,7 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } +#endif } } } @@ -5691,10 +5782,12 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5793,13 +5886,17 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /* Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif @@ -5826,7 +5923,11 @@ void non_linearity_fx( { exp = norm_s( max_val ); tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -5875,7 +5976,11 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5951,10 +6056,12 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6053,13 +6160,17 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /* Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif @@ -6086,7 +6197,11 @@ void non_linearity_ivas_fx( { exp = norm_s( max_val ); tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -6135,13 +6250,17 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /*Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif @@ -6879,9 +6998,11 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; +#ifdef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -6940,7 +7061,11 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, expb ); num_flag = 0; @@ -7064,9 +7189,11 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7081,8 +7208,8 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1796_replace_shl_o - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ +#ifdef ISSUE_1836_replace_overflow_libcom + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif @@ -7115,6 +7242,18 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat + FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) + { + L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ + L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat + L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat + L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ + bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat + move16(); + } +#else gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7125,6 +7264,7 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } +#endif } ELSE { @@ -7138,10 +7278,17 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat + + tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat +#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7151,8 +7298,13 @@ void prep_tbe_exc_fx( { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat +#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7160,9 +7312,15 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + (i_subfr_fx << 1)] ); /*Q14+Q_exc+1 */ + tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat + bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat +#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ +#endif move16(); } } @@ -7198,7 +7356,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7229,8 +7387,8 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1796_replace_shl_o - formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); +#ifdef ISSUE_1836_replace_overflow_libcom + formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif -- GitLab From 8222c771701cd826caad6dbd5c6acfc236faf061 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 12:12:03 +0200 Subject: [PATCH 037/103] buildfix, warning fix --- lib_com/swb_tbe_com_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e147b2353..6eb6f7105 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -5985,7 +5985,7 @@ void non_linearity_fx( frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ @@ -6998,7 +6998,7 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; -#ifdef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -- GitLab From e13d5e402b26231366e027f12d486df135de9aba Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 12:18:12 +0200 Subject: [PATCH 038/103] clang format patch --- lib_com/residu_fx.c | 16 +-- lib_com/stat_noise_uv_mod_fx.c | 14 +-- lib_com/swb_bwe_com_lr_fx.c | 179 ++++++++++++++++----------------- lib_com/swb_tbe_com_fx.c | 147 ++++++++++++++------------- lib_dec/FEC_HQ_core_fx.c | 2 +- lib_enc/find_tilt_fx.c | 6 +- 6 files changed, 180 insertions(+), 184 deletions(-) diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index ca46c3063..1de4fac6c 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -75,32 +75,32 @@ void Residu3_lc_fx( q = add( q, shift ); } #ifdef ISSUE_1836_replace_overflow_libcom - *y++ = shl_sat( x[0], shift ); //??sat + *y++ = shl_sat( x[0], shift ); //??sat move16(); FOR( i = 1; i < m; i++ ) { - s = L_mult_sat( x[i], a[0] ); //??sat + s = L_mult_sat( x[i], a[0] ); //??sat /* Stop at i to Avoid Mults with Zeros */ FOR( j = 1; j <= i; j++ ) { s = L_mac_sat( s, x[i - j], a[j] ); //??sat } - s = L_shl_sat( s, q ); //??sat - *y++ = round_fx_sat( s ); //??sat + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat } FOR( ; i < lg; i++ ) { - s = L_mult_sat( x[i], a[0] ); //??sat + s = L_mult_sat( x[i], a[0] ); //??sat FOR( j = 1; j <= m; j++ ) { s = L_mac_sat( s, x[i - j], a[j] ); //??sat } - s = L_shl_sat( s, q ); //??sat - *y++ = round_fx_sat( s ); //??sat + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat } #else @@ -207,7 +207,7 @@ void Residu3_fx( s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( s32 ); //??sat + y[i] = round_fx_sat( s32 ); //??sat #else y[i] = round_fx_o( s32, &Overflow ); #endif diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index fa28c84f0..7624375d3 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -112,7 +112,7 @@ void stat_noise_uv_mod_fx( tmp_res = div_l( L_tmp_res, tmp_den ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom - min_alpha = add_sat( tmp_res, 16384 ); //??sat + min_alpha = add_sat( tmp_res, 16384 ); //??sat #else min_alpha = add_o( tmp_res, 16384, &Overflow ); #endif @@ -168,7 +168,7 @@ void stat_noise_uv_mod_fx( { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -197,7 +197,7 @@ void stat_noise_uv_mod_fx( tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat + tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif @@ -265,9 +265,9 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat + tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat #else - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ #endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -492,7 +492,7 @@ void stat_noise_uv_mod_ivas_fx( { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -521,7 +521,7 @@ void stat_noise_uv_mod_ivas_fx( tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat + tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 204c1e53d..7688f504d 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -1014,122 +1014,119 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) - { + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ #ifdef ISSUE_1836_replace_overflow_libcom - IF( L_inBuf_pss[j] >= 0 ) - { - outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat - move16(); - } + IF( L_inBuf_pss[j] >= 0 ){ + outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat + move16(); + } #else - IF( L_inBuf_pss[j] >= 0 ) - { + IF( L_inBuf_pss[j] >= 0 ){ outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); - } -#endif - } - ELSE - { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; - move16(); - if ( L_inBuf_pss[j] < 0x0L ) - { - outBuf_pss_fx[j] = -0x2800; - move16(); - } - } - j++; + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); } +#endif } - - k = 0; - move16(); - m = 0; - move16(); - n = 0; - move16(); - reset_flag = 0; - move16(); - n_list[0] = 0; - move16(); - FOR( j = 0; j < num_subband_smooth_fx; j++ ) + ELSE { - cnt_zero_cont = 0; + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; move16(); - FOR( i = 0; i < L_SB; i++ ) + if ( L_inBuf_pss[j] < 0x0L ) { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) - { - cnt_zero_cont = 0; - move16(); - } - k = add( k, 1 ); + outBuf_pss_fx[j] = -0x2800; + move16(); } + } + j++; +} +} - IF( cnt_zero_cont != 0 ) +k = 0; +move16(); +m = 0; +move16(); +n = 0; +move16(); +reset_flag = 0; +move16(); +n_list[0] = 0; +move16(); +FOR( j = 0; j < num_subband_smooth_fx; j++ ) +{ + cnt_zero_cont = 0; + move16(); + FOR( i = 0; i < L_SB; i++ ) + { + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) { - test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) - { - n = 0; - move16(); - reset_flag = 1; - move16(); - } - n_list[n] = j; + cnt_zero_cont = 0; move16(); - n = add( n, 1 ); } + k = add( k, 1 ); + } + IF( cnt_zero_cont != 0 ) + { test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) { - m = 0; + n = 0; + move16(); + reset_flag = 1; move16(); } + n_list[n] = j; + move16(); + n = add( n, 1 ); + } + + test(); + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + { + m = 0; + move16(); + } - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + { + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + if ( outBuf_pss_fx[pk + i] == 0 ) { - if ( outBuf_pss_fx[pk + i] == 0 ) - { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); - } + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); } - m = add( m, 1 ); } + m = add( m, 1 ); } +} - FOR( i = 0; i < fLen; i++ ) +FOR( i = 0; i < fLen; i++ ) +{ + outBuf_fx[i] = 0x0; + move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) { - outBuf_fx[i] = 0x0; + outBuf_fx[i] = outBuf_pss_fx[i]; move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) - { - outBuf_fx[i] = outBuf_pss_fx[i]; - move16(); - } } +} - return; +return; } /*-------------------------------------------------------------------* @@ -2359,7 +2356,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat +#ifdef ISSUE_1836_replace_overflow_libcom //??sat E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2402,7 +2399,7 @@ void ton_ene_est_fx( /* 0.12f: 257698038 (Q31) */ #ifdef ISSUE_1836_replace_overflow_libcom - IF ( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat + IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat #else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) #endif @@ -3280,7 +3277,7 @@ void noiseinj_hf_fx( /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); #ifdef ISSUE_1836_replace_overflow_libcom - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3354,7 +3351,7 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); #ifdef ISSUE_1836_replace_overflow_libcom - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 6eb6f7105..454a51411 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1040,7 +1040,7 @@ static void filt_mu_fx( temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ #ifdef ISSUE_1836_replace_overflow_libcom - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat #else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); #endif @@ -1557,8 +1557,8 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] );/* Q29 */ //saturation not possible: excTmp2_frac[i] < MIN_16 - pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ //saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 + pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 } #else FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1572,7 +1572,7 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //L_mult: sat not poosible, excTmp2 > 0 //??sat + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat #else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); #endif @@ -1608,7 +1608,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ #else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ #endif move16(); } @@ -1618,11 +1618,11 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ - pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ + L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ + pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ #endif } } @@ -1635,13 +1635,13 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat #else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ #endif @@ -1661,7 +1661,7 @@ void GenShapedWBExcitation_ivas_fx( /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ #ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1674,15 +1674,15 @@ void GenShapedWBExcitation_ivas_fx( Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); #ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat FOR( j = 0; j < L_FRAME16k / 16; j++ ) { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat move16(); k++; } @@ -1700,7 +1700,6 @@ void GenShapedWBExcitation_ivas_fx( k++; } #endif - } } } @@ -1864,8 +1863,8 @@ void GenShapedWBExcitation_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ - pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ + pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat #else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ @@ -1876,7 +1875,7 @@ void GenShapedWBExcitation_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat #else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); #endif @@ -1923,11 +1922,11 @@ void GenShapedWBExcitation_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat - pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat + pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ #endif } } @@ -1942,11 +1941,11 @@ void GenShapedWBExcitation_fx( sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat move16(); } #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { @@ -1969,7 +1968,7 @@ void GenShapedWBExcitation_fx( /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ #ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1982,15 +1981,15 @@ void GenShapedWBExcitation_fx( Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); #ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat FOR( j = 0; j < L_FRAME16k / 16; j++ ) { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat move16(); k = add( k, 1 ); } @@ -5887,18 +5886,18 @@ void non_linearity_fx( /* (log2(scale / prev_scale))/length */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); #ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5922,7 +5921,7 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else @@ -5977,9 +5976,9 @@ void non_linearity_fx( /* (log2(scale / prev_scale))/length */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5988,7 +5987,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6163,16 +6162,16 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); #ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6196,11 +6195,11 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ #endif } ELSE @@ -6251,18 +6250,18 @@ void non_linearity_ivas_fx( /* (log2(scale / prev_scale))/length */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); #ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat + scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -7062,7 +7061,7 @@ void Estimate_mix_factors_fx( expb = norm_l( temp_p1_p2 ); #ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat + fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat #else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); #endif @@ -7209,9 +7208,9 @@ void prep_tbe_exc_fx( move16(); #ifdef ISSUE_1836_replace_overflow_libcom - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7241,16 +7240,16 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ #ifdef ISSUE_1836_replace_overflow_libcom - gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat + gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { - L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ - L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat - L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat - L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ - bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat + L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ + L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat + L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat + L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ + bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat move16(); } #else @@ -7279,15 +7278,15 @@ void prep_tbe_exc_fx( Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ #ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat - tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat + tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat #else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ #endif move16(); } @@ -7297,13 +7296,13 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ #ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat #else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ #endif move16(); } @@ -7313,9 +7312,9 @@ void prep_tbe_exc_fx( FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + (i_subfr_fx << 1)] ); /*Q14+Q_exc+1 */ - tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat - bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat + L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ + tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat + bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat #else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 26c6587e5..1be7453ab 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -1089,7 +1089,7 @@ static Word16 find_best_delay_fx( #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ #else - tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ + tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ #endif } diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index 415e3cad4..ed0b332c2 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -178,7 +178,7 @@ void find_tilt_fx( #ifdef ISSUE_1799_replace_L_shr_o lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ #else - lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ + lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ #endif pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */ @@ -210,7 +210,7 @@ void find_tilt_fx( #ifdef ISSUE_1799_replace_L_shr_o ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ #else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ #endif } ELSE IF( lp_E == 0 ) @@ -473,7 +473,7 @@ void find_tilt_ivas_fx( #ifdef ISSUE_1799_replace_L_shr_o ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ #else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ #endif move32(); } -- GitLab From 219fd4d153c597d342c30917f59284b7ce7943a3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 12:28:25 +0200 Subject: [PATCH 039/103] fix warnings --- lib_com/lsf_tools_fx.c | 2 +- lib_com/oper_32b.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index f7b488181..e168cd0f8 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -1787,7 +1787,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; -#ifdef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index d1f8dd2f1..de733005e 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -166,7 +166,7 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifdef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -- GitLab From 742a5b6486f25ee768edbd2d62fb6c67f7fa593b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 13:47:07 +0200 Subject: [PATCH 040/103] lib_com/syn_filt_fx.c lib_com/tcx_ltp_fx.c lib_com/tcx_mdct_fx.c lib_com/tcx_utils_fx.c lib_com/tns_base.c : completed overflow op replacement --- lib_com/syn_filt_fx.c | 46 +++++++++++++++++++++++++++++++++++++++--- lib_com/tcx_ltp_fx.c | 9 +++++++++ lib_com/tcx_mdct_fx.c | 16 +++++++++++++++ lib_com/tcx_utils_fx.c | 22 ++++++++++++++++++++ lib_com/tns_base.c | 6 ++++++ 5 files changed, 96 insertions(+), 3 deletions(-) diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index e0315bbcb..8b7eff497 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -11,11 +11,16 @@ static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); +#else + L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat + return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat +#endif } static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] ) @@ -341,9 +346,11 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif if ( EQ_16( m, 6 ) ) @@ -377,8 +384,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); /* Filtering from Input + Mix of Memory & Output Signal Past */ @@ -388,15 +400,24 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Process Output Signal Past */ FOR( j = 1; j <= i; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( L_tmp, a[j], y[-j] ); //??sat +#else L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow ); +#endif } /* Process Memory */ FOR( ; j <= m; j++ ) { L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); } @@ -404,8 +425,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W FOR( ; i < lg; i++ ) { L_tmp = syn_kern( L_mult( a0, *x++ ), a, y ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); + *y++ = round_fx_sat( L_tmp ); +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); } @@ -452,8 +478,10 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; +#ifdef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); +#endif if ( EQ_16( m, 6 ) ) { @@ -480,8 +508,8 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ mem += m; /*move32();*/ -#ifdef ISSUE_1799_replace_L_shr_o - a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ +#ifdef ISSUE_1836_replace_overflow_libcom + a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat #else a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ #endif @@ -491,7 +519,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); @@ -509,7 +541,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] ); } - L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else + L_tmp = L_shl_o( L_tmp, q ); +#endif *y++ = L_tmp; move32(); } @@ -518,7 +554,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] FOR( ; i < lg; i++ ) { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); } diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 322549a6f..0fd5439dc 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -389,9 +389,11 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); @@ -408,10 +410,17 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat + excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat +#else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ +#endif move16(); x0++; diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index b2cee32e6..c4a0827a9 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -107,9 +107,11 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); @@ -126,7 +128,11 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat +#else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } FOR( i = 0; i < m / 2; i++ ) @@ -136,7 +142,11 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ +#else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } @@ -163,9 +173,11 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); @@ -182,7 +194,11 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat +#else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } FOR( i = 0; i < m / 2; i++ ) diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index c5ff95e04..5081ee1de 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -991,8 +991,10 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* FDNS_NPTS = 64 */ @@ -1044,7 +1046,11 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ +#else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#endif move32(); x++; } @@ -1063,7 +1069,11 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ +#else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#endif move32(); x += k; gains++; @@ -1389,9 +1399,11 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif assert( lpcGains[0] >= 0x4000 ); @@ -1438,7 +1450,11 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_tmp ); /* Q15 */ +#else tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ +#endif fac = tmp; /* Q15 */ move16(); @@ -2081,8 +2097,10 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif maxX = L_deposit_l( 1 ); @@ -2129,7 +2147,11 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ +#else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ +#endif if ( corr < 0 ) tmp = negate( tmp ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index aaf262786..3036f7c77 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -439,9 +439,11 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -475,7 +477,11 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ +#else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ +#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ -- GitLab From 1cae4d03543f10e191937acf49de74fc5b1a5c72 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 16:17:55 +0200 Subject: [PATCH 041/103] lib_com/tools_fx.c lib_com/weight_a_fx.c lib_com/wi_fx.c lib_com/window_fx.c : completed overflow op replacement --- lib_com/tools_fx.c | 181 ++++++++++++++++++-- lib_com/weight_a_fx.c | 6 + lib_com/wi_fx.c | 384 +++++++++++++++++++++++++++++++++++++++--- lib_com/window_fx.c | 10 +- 4 files changed, 542 insertions(+), 39 deletions(-) diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 5e116a286..5283e2c8a 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -308,28 +308,36 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ - L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ -#ifdef ISSUE_1796_replace_shl_o - idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat + idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat #else + L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ #endif + idx = s_min( idx, sub( cbsize, 1 ) ); idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ L_tmp = L_deposit_l( qlow ); /*Qx */ L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ +#else *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ +#endif return idx; } /*-------------------------------------------------------------------* @@ -395,14 +403,20 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ +#else L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ +#endif } return L_tmp; @@ -456,15 +470,21 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); +#else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); +#endif } return L_tmp; @@ -684,7 +704,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -711,8 +731,8 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - y[i] = shl_sat( x[i], exp0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = shl_sat( x[i], exp0 ); //??sat #else y[i] = shl_o( x[i], exp0, &Overflow ); #endif @@ -733,7 +753,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -755,8 +775,8 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -772,8 +792,8 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( 1, exp0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( 1, exp0 ); //??sat #else tmp = shl_o( 1, exp0, &Overflow ); #endif @@ -793,10 +813,12 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( exp0 == 0 ) @@ -813,8 +835,8 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -822,7 +844,11 @@ void Copy_Scale_sig_16_32_no_sat( } return; } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat +#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); +#endif IF( L_tmp >= 0x7FFF ) { @@ -854,9 +880,11 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif tmp = add( 16, exp0 ); @@ -864,7 +892,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); +#else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); +#endif move16(); } } @@ -872,7 +904,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( x[i] ); //??sat +#else y[i] = round_fx_o( x[i], &Overflow ); +#endif move16(); } } @@ -890,9 +926,11 @@ void Scale_sig32( ) { Word16 i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( 0 == exp0 ) { @@ -901,7 +939,11 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + x[i] = L_shl_sat( x[i], exp0 ); +#else x[i] = L_shl_o( x[i], exp0, &Overflow ); +#endif move32(); /* saturation can occur here */ } } @@ -1896,10 +1938,12 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif idx = 0; @@ -1916,6 +1960,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + if ( weights[3] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + if ( weights[2] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + if ( weights[1] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + if ( weights[0] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } +#else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { @@ -1936,6 +2002,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } +#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -1965,6 +2032,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + if ( weights[0] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + if ( weights[1] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + if ( weights[2] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + if ( weights[3] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } +#else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { @@ -1985,6 +2074,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } +#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2451,9 +2541,11 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) @@ -2464,15 +2556,23 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); +#ifdef ISSUE_1836_replace_overflow_libcom + num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat +#else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); +#endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); +#ifdef ISSUE_1836_replace_overflow_libcom + den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat +#else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); +#endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom //??sat num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); @@ -2632,9 +2732,11 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); @@ -2647,14 +2749,27 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mult_sat( buf_in[K + i], h[0] ); //??sat +#else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); +#endif FOR( j = 1; j <= K; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat +#else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); +#endif } +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_shl_sat( s, shift ); //??sat + y[i] = round_fx_sat( s ); /*Qx */ //??sat +#else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ +#endif move16(); } } @@ -2790,8 +2905,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif idx = 0; @@ -2802,10 +2919,18 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x, cb[c] ); +#else tmp = sub_o( x, cb[c], &Overflow ); +#endif /*dist += tmp*tmp; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat +#else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); +#endif if ( LT_32( L_dist, L_mindist ) ) { @@ -2943,9 +3068,11 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( exp0 == 0 ) { @@ -2960,12 +3087,20 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_shl_sat( x[i], tmp ); //??sat +#else y[i] = L_shl_o( x[i], tmp, &Overflow ); +#endif move16(); } return; } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat +#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); +#endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); @@ -3142,9 +3277,11 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); @@ -3152,7 +3289,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat +#else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); +#endif move16(); } } @@ -3160,7 +3301,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat +#else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); +#endif move16(); } } @@ -3287,7 +3432,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ +#ifdef ISSUE_1836_replace_overflow_libcom + temp = mult_r( *signal++, 16384 ); +#else temp = mult_ro( *signal++, 16384, &Overflow ); +#endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ @@ -3297,7 +3446,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + temp = mult_r( *signal++, 16384 ); +#else temp = mult_ro( *signal++, 16384, &Overflow ); +#endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } #ifdef ISSUE_1799_replace_L_shr_o diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index 7bea66ea0..6aa036cd7 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -100,10 +100,12 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif fac = gamma; /* Q15 */ @@ -122,7 +124,11 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat +#else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ +#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 5a8ad35c5..0ca8fa69c 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -264,9 +264,11 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -320,10 +322,17 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat + ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat + move16(); + move16(); +#else ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ move16(); move16(); +#endif } start = sub( Eshift, Adiff_fx ); @@ -344,8 +353,13 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat + corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat +#else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); +#endif move32(); move32(); temp = add( temp, temp1 ); @@ -358,12 +372,20 @@ static Word16 DTFS_alignment_weight_fx( move16(); } - temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ -#ifdef ISSUE_1796_replace_shl_o - wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat + wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat + IF( GE_16( Qmaxcorr, Qcorr ) ) + { + diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ + } + ELSE + { + diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ + } #else + temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ -#endif IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ @@ -372,6 +394,7 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ } +#endif IF( diff_corr > 0 ) { @@ -421,9 +444,11 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Calculating the expected alignment shift */ @@ -457,8 +482,13 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat + ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat +#else ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ +#endif } IF( FR_flag == 0 ) { @@ -488,9 +518,15 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + temp = add_sat( temp, temp1 ); //??sat +#else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); temp = add_o( temp, temp1, &Overflow ); +#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -596,9 +632,11 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp2 = L_deposit_l( 0 ); @@ -610,9 +648,15 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat + X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat + temp2 = L_add_sat( temp2, (Word32) ph ); //??sat +#else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); +#endif move16(); move16(); } @@ -624,9 +668,15 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat + X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat + temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat +#else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); +#endif move16(); move16(); } @@ -730,9 +780,11 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( !FR_flag ) @@ -770,6 +822,15 @@ void DTFS_to_fs_fx( exp = norm_s( X_fx->lag_fx ); tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ + diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat + + exp = norm_s( diff_fx ); + tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ + L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat + nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat +#else L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -777,6 +838,7 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ +#endif nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) @@ -800,8 +862,13 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat + inv_lag = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); +#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -815,8 +882,13 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat + L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat +#else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ +#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -853,13 +925,22 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat + L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat +#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); +#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat +#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ +#endif } La[k] = L_shl( L_a, 7 ); @@ -884,6 +965,30 @@ void DTFS_to_fs_fx( move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( k = 1; k <= nH; k++ ) + { + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + move16(); + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ + X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + move16(); + X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ + } + + /* IF ( N%2 == 0 ) */ + IF( s_and( N, 1 ) == 0 ) + { + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ + X_fx->b_fx[k] = 0; + move16(); + } +#else FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ @@ -906,6 +1011,7 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } +#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1201,9 +1307,11 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qmin = 32767; move16(); @@ -1221,6 +1329,22 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat + temp2 = add( temp2, temp ); + } + + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + + /* Calculate the circular convolution */ + L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); + L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat + L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); + + L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat +#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); temp2 = add( temp2, temp ); @@ -1233,7 +1357,9 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ +#endif /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1253,8 +1379,13 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat + X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat +#else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ +#endif move32(); move32(); @@ -1270,14 +1401,14 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1796_replace_shl_o - X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat #else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ -#ifdef ISSUE_1796_replace_shl_o - X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat #else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif @@ -1525,9 +1656,11 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); @@ -1537,15 +1670,23 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); - +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); +#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); +#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1553,9 +1694,13 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); - +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); +#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1586,6 +1731,23 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); + HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); + FOR( k = 1; k <= HalfLag_fx; k++ ) + { + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + } + en_fx = L_shr( en_fx, 1 ); + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat + /* IF (X_fx->lag_fx%2 == 0) */ + IF( s_and( X_fx->lag_fx, 1 ) == 0 ) + { + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + } +#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1605,7 +1767,7 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); } - +#endif return en_fx; /* 2*X1.Q */ } @@ -1732,16 +1894,22 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat +#else Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ +#endif Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) @@ -1849,10 +2017,12 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -1864,7 +2034,11 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat +#else Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ +#endif Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -1879,8 +2053,13 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat +#else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ +#endif count = add( count, 1 ); } } @@ -1893,7 +2072,11 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat +#else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); +#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -1904,7 +2087,11 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); +#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -1942,7 +2129,11 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat +#else X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ +#endif move16(); } @@ -2006,9 +2197,11 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif num_flag = 0; move16(); @@ -2077,8 +2270,11 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ - +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat +#else IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) +#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2091,7 +2287,11 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( Ltemp3, expa ) ); +#else fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); +#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2100,7 +2300,11 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = extract_h( L_shl( Ltemp2, expb ) ); //??sat +#else fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); +#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2117,8 +2321,8 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fraca = shl_sat( fraca, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = shl_sat( fraca, scale ); //??sat #else fraca = shl_o( fraca, scale, &Overflow ); #endif @@ -2137,8 +2341,13 @@ static void cubicPhase_fx( tmp = negate( tmp ); } +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat + Lacc = L_add_sat( Lacc, 0x08000 ); //??sat +#else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); +#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2264,7 +2473,11 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //??sat //?sat +#else Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ +#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2322,9 +2535,11 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; @@ -2390,7 +2605,11 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?ßsat //??sat +#else out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ +#endif move16(); IF( GT_16( count[i], 1 ) ) { @@ -2462,9 +2681,11 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Word16 *erb_fx = NULL; /*move16(); */ @@ -2547,6 +2768,32 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ //??sat //??sat + move16(); + IF( GT_16( out_fx[j], 1 ) ) + { + expb = norm_l( mf_fx[j] ); + fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) ); //??sat //??sat + expb = sub( 30, add( expb, 20 ) ); + + + expa = norm_l( out_fx[j] ); + fraca = extract_h( L_shl( out_fx[j], expa ) ); + expa = sub( 30, expa ); + + scale = shr( sub( fraca, fracb ), 15 ); + fracb = shl( fracb, scale ); + expb = sub( expb, scale ); + + tmp = div_s( fracb, fraca ); + exp = sub( expb, expa ); + L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat + + mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat + move16(); + } +#else mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) @@ -2571,6 +2818,7 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); move16(); } +#endif } return; } @@ -2620,9 +2868,11 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) @@ -2708,7 +2958,11 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ //??sat //??sat +#else X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ +#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3450,9 +3704,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3497,18 +3753,28 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); + expa = sub( 30, add( expa, 1 ) ); + + + expb = norm_l( L_sum ); + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat +#else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); +#endif + expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fracb = shl_sat( fracb, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = shl_sat( fracb, scale ); //??sat #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -3535,18 +3801,27 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat + expa = sub( Q29, expa ); // 30 - expa - 1; + + + expb = norm_l( L_sum ); + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat +#else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fracb = shl_sat( fracb, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = shl_sat( fracb, scale ); //??sat #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -4029,9 +4304,11 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif retX_fx->lag_fx = X1_fx->lag_fx; @@ -4042,8 +4319,13 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat + Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat +#else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ +#endif exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4085,6 +4367,17 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat + sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ + move16(); + + Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat + cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ +#else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ @@ -4094,6 +4387,7 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ +#endif move16(); } k = sub( k, 1 ); @@ -4147,9 +4441,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif en = L_deposit_l( 0 ); @@ -4185,7 +4481,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat +#else Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ +#endif n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4196,12 +4496,20 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat +#else Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ +#endif n = add( n, k4 ); /* n=4*i*k */ } Im = L_shr( Lacc, 1 ); /* Q27 */ /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat +#else Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ +#endif Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ @@ -4228,7 +4536,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); //??sat +#else Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); +#endif } ELSE { @@ -4277,9 +4589,11 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qmin = 32767; move16(); @@ -4294,21 +4608,38 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat +#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ +#endif temp2 = add( temp2, k ); } - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + /* Calculate the circular convolution */ + sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ + + L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); + L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); + L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sast +#else + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat /* Calculate the circular convolution */ - sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ + sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ //??sat L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ + L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ + L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat +#endif IF( sum ) { exp = norm_l( sum ); @@ -4407,9 +4738,11 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); @@ -4423,8 +4756,13 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { +#ifndef ISSUE_1836_replace_overflow_libcom sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ +#else + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat +#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 84302ff08..a3e9cb58e 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -29,10 +29,12 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif +#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -46,7 +48,11 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat +#else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -63,8 +69,8 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1796_replace_shl_o - fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ +#ifdef ISSUE_1836_replace_overflow_libcom + fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat #else fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif -- GitLab From 37d6896597b79996d1de1c632ad72cbdb2927db8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 16:21:31 +0200 Subject: [PATCH 042/103] fix warning --- lib_com/syn_filt_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 8b7eff497..6ebba7ca7 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -478,7 +478,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; -#ifdef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); #endif -- GitLab From 2463691abffc642024f44a09a7757259afe31475 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 16:34:27 +0200 Subject: [PATCH 043/103] add some separate activation macros for development only --- lib_com/options.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 4a9b36f60..27fb5bace 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -103,6 +103,75 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ + +#define ISSUE_1836_FILEACTIVE_arith_coder_fx_c +#define ISSUE_1836_FILEACTIVE_basop32_c +#define ISSUE_1836_FILEACTIVE_basop32_h +#define ISSUE_1836_FILEACTIVE_basop_lsf_tools_c +#define ISSUE_1836_FILEACTIVE_basop_util_c +#define ISSUE_1836_FILEACTIVE_bitalloc_fx_c +#define ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c +#define ISSUE_1836_FILEACTIVE_cldfb_fx_c +#define ISSUE_1836_FILEACTIVE_cng_exc_fx_c +#define ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c +#define ISSUE_1836_FILEACTIVE_deemph_fx_c +#define ISSUE_1836_FILEACTIVE_edct_fx_c +#define ISSUE_1836_FILEACTIVE_enh1632_c +#define ISSUE_1836_FILEACTIVE_enh1632_h +#define ISSUE_1836_FILEACTIVE_enh32_c +#define ISSUE_1836_FILEACTIVE_enh40_c +#define ISSUE_1836_FILEACTIVE_enh40_h +#define ISSUE_1836_FILEACTIVE_enh64_c +#define ISSUE_1836_FILEACTIVE_enh64_h +#define ISSUE_1836_FILEACTIVE_enhUL32_c +#define ISSUE_1836_FILEACTIVE_enr_1_az_fx_c +#define ISSUE_1836_FILEACTIVE_env_stab_fx_c +#define ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c +#define ISSUE_1836_FILEACTIVE_fft_fx_evs_c +#define ISSUE_1836_FILEACTIVE_fft_rel_fx_c +#define ISSUE_1836_FILEACTIVE_frame_ener_fx_c +#define ISSUE_1836_FILEACTIVE_get_gain_fx_c +#define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c +#define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c +#define ISSUE_1836_FILEACTIVE_gs_gains_fx_c +#define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c +#define ISSUE_1836_FILEACTIVE_hp50_fx_c +#define ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c +#define ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c +#define ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c +#define ISSUE_1836_FILEACTIVE_ifft_rel_fx_c +#define ISSUE_1836_FILEACTIVE_igf_base_fx_c +#define ISSUE_1836_FILEACTIVE_interpol_fx_c +#define ISSUE_1836_FILEACTIVE_log2_c +#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c +#define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c +#define ISSUE_1836_FILEACTIVE_math_op_c +#define ISSUE_1836_FILEACTIVE_math_op_h +#define ISSUE_1836_FILEACTIVE_modif_fs_fx_c +#define ISSUE_1836_FILEACTIVE_oper_32b_c +#define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c +#define ISSUE_1836_FILEACTIVE_ppp_fx_c +#define ISSUE_1836_FILEACTIVE_pred_lt4_fx_c +#define ISSUE_1836_FILEACTIVE_preemph_fx_c +#define ISSUE_1836_FILEACTIVE_prot_fx_h +#define ISSUE_1836_FILEACTIVE_pvq_com_fx_c +#define ISSUE_1836_FILEACTIVE_residu_fx_c +#define ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c +#define ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c +#define ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c +#define ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c +#define ISSUE_1836_FILEACTIVE_syn_filt_fx_c +#define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c +#define ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c +#define ISSUE_1836_FILEACTIVE_tcx_utils_fx_c +#define ISSUE_1836_FILEACTIVE_tns_base_c +#define ISSUE_1836_FILEACTIVE_tools_fx_c +#define ISSUE_1836_FILEACTIVE_weight_a_fx_c +#define ISSUE_1836_FILEACTIVE_wi_fx_c +#define ISSUE_1836_FILEACTIVE_window_fx_c + /* #################### End BASOP porting switches ############################ */ #endif -- GitLab From b92ab0e3d0bc0e10ca925f76a20b2c79509c6614 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 16:34:53 +0200 Subject: [PATCH 044/103] lib_com/swb_tbe_com_fx.c lib_com/syn_filt_fx.c lib_com/tcx_ltp_fx.c lib_com/tcx_mdct_fx.c lib_com/tcx_utils_fx.c lib_com/tns_base.c lib_com/tools_fx.c lib_com/weight_a_fx.c lib_com/wi_fx.c lib_com/window_fx.c : added development macros: FILEACTIVE --- lib_com/swb_tbe_com_fx.c | 6 ++++++ lib_com/syn_filt_fx.c | 6 ++++++ lib_com/tcx_ltp_fx.c | 6 ++++++ lib_com/tcx_mdct_fx.c | 6 ++++++ lib_com/tcx_utils_fx.c | 6 ++++++ lib_com/tns_base.c | 6 ++++++ lib_com/tools_fx.c | 6 ++++++ lib_com/weight_a_fx.c | 7 +++++++ lib_com/wi_fx.c | 6 ++++++ lib_com/window_fx.c | 6 ++++++ 10 files changed, 61 insertions(+) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 454a51411..e8a74d834 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,6 +12,12 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 6ebba7ca7..26793f7e2 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -9,6 +9,12 @@ #include "prot_fx.h" #include "stl.h" +#ifndef ISSUE_1836_FILEACTIVE_syn_filt_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { #ifndef ISSUE_1836_replace_overflow_libcom diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 0fd5439dc..247ff1aea 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index c4a0827a9..a2646ae42 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -8,6 +8,12 @@ #include "prot_fx.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index 5081ee1de..b572f7cce 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -12,6 +12,12 @@ #define inv_int InvIntTable +#ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * getInvFrameLen() * diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 3036f7c77..35394f8f9 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -22,6 +22,12 @@ #define MAX_SUBDIVISIONS 3 +#ifndef ISSUE_1836_FILEACTIVE_tns_base_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 5283e2c8a..e6f521c2a 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -52,6 +52,12 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index 6aa036cd7..473bc84ee 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -7,6 +7,13 @@ #include "prot_fx.h" #include + +#ifndef ISSUE_1836_FILEACTIVE_weight_a_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------ * weight_a_subfr() * diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 0ca8fa69c..c574ffb45 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -22,6 +22,12 @@ #define WI_THRESHLD 0.8 #define WI_SAMPLE_THLD 20 +#ifndef ISSUE_1836_FILEACTIVE_wi_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */ /*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */ /*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */ diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index a3e9cb58e..deb585ba9 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -21,6 +21,12 @@ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_window_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + void ham_cos_window( Word16 *fh, /* o: 0Q15 */ const Word16 n1, /* i: */ -- GitLab From 390b872da50cc2f4c3815b638b63ebacc84f6f77 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 16:54:58 +0200 Subject: [PATCH 045/103] clang patch --- lib_com/syn_filt_fx.c | 16 +-- lib_com/tcx_ltp_fx.c | 8 +- lib_com/tcx_mdct_fx.c | 4 +- lib_com/tcx_utils_fx.c | 10 +- lib_com/tools_fx.c | 82 +++++++-------- lib_com/weight_a_fx.c | 2 +- lib_com/wi_fx.c | 222 ++++++++++++++++++++--------------------- lib_com/window_fx.c | 6 +- 8 files changed, 175 insertions(+), 175 deletions(-) diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 26793f7e2..ba0993291 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -24,8 +24,8 @@ static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); #else - L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat - return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat + L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat + return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat #endif } @@ -391,8 +391,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat - *y++ = round_fx_sat( L_tmp ); //??sat + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat #else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); @@ -418,8 +418,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat - *y++ = round_fx_sat( L_tmp ); //??sat + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat #else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); @@ -515,7 +515,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] mem += m; /*move32();*/ #ifdef ISSUE_1836_replace_overflow_libcom - a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat + a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat #else a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ #endif @@ -561,7 +561,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat + L_tmp = L_shl_sat( L_tmp, q ); //??sat #else L_tmp = L_shl_o( L_tmp, q, &Overflow ); #endif diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 247ff1aea..0bf0fb1c9 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -417,10 +417,10 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat - s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat - s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat - excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat + s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat + excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat #else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index a2646ae42..8ef395423 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -137,7 +137,7 @@ void TCX_MDCT( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } @@ -203,7 +203,7 @@ void TCX_MDST( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index b572f7cce..e86f48eed 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -1055,7 +1055,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x++; @@ -1078,7 +1078,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x += k; @@ -1457,11 +1457,11 @@ void PsychAdaptLowFreqDeemph( L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_tmp ); /* Q15 */ + tmp = round_fx_sat( L_tmp ); /* Q15 */ #else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ #endif - fac = tmp; /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index e6f521c2a..2cbc58cd4 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -323,12 +323,12 @@ Word16 usquant_fx( /* o: index of the winning codeword */ /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat + L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat #else - L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ + L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ #endif @@ -337,12 +337,12 @@ Word16 usquant_fx( /* o: index of the winning codeword */ idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ #ifdef ISSUE_1836_replace_overflow_libcom - *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ + *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #endif return idx; } @@ -421,7 +421,7 @@ Word32 sum2_fx( /* o : sum of all squared vector elements #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ #else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ #endif } @@ -738,7 +738,7 @@ void Copy_Scale_sig( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = shl_sat( x[i], exp0 ); //??sat + y[i] = shl_sat( x[i], exp0 ); //??sat #else y[i] = shl_o( x[i], exp0, &Overflow ); #endif @@ -782,7 +782,7 @@ void Copy_Scale_sig_16_32_DEPREC( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -799,7 +799,7 @@ void Copy_Scale_sig_16_32_DEPREC( assert( exp0 < 16 ); #endif #ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( 1, exp0 ); //??sat + tmp = shl_sat( 1, exp0 ); //??sat #else tmp = shl_o( 1, exp0, &Overflow ); #endif @@ -842,7 +842,7 @@ void Copy_Scale_sig_16_32_no_sat( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -911,7 +911,7 @@ void Copy_Scale_sig_32_16( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( x[i] ); //??sat + y[i] = round_fx_sat( x[i] ); //??sat #else y[i] = round_fx_o( x[i], &Overflow ); #endif @@ -1967,25 +1967,25 @@ Word16 w_vquant_fx( dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat if ( weights[3] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } - tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat if ( weights[2] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } - tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat if ( weights[1] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } - tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat if ( weights[0] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } #else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); @@ -2039,25 +2039,25 @@ Word16 w_vquant_fx( dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat if ( weights[0] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } - tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat if ( weights[1] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } - tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat if ( weights[2] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } - tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat if ( weights[3] != 0 ) { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat + dist = L_mac0_sat( dist, tmp, tmp ); //??sat } #else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); @@ -2563,7 +2563,7 @@ Word32 root_a_over_b_fx( exp_num = norm_l( b ); #ifdef ISSUE_1836_replace_overflow_libcom - num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat + num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat #else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); #endif @@ -2571,14 +2571,14 @@ Word32 root_a_over_b_fx( exp_den = norm_l( a ); #ifdef ISSUE_1836_replace_overflow_libcom - den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat + den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat #else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); #endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat +#ifdef ISSUE_1836_replace_overflow_libcom //??sat num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); @@ -2756,7 +2756,7 @@ void fir_fx( const Word16 x[], /* i : input vector FOR( i = 0; i < L; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - s = L_mult_sat( buf_in[K + i], h[0] ); //??sat + s = L_mult_sat( buf_in[K + i], h[0] ); //??sat #else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); #endif @@ -2764,14 +2764,14 @@ void fir_fx( const Word16 x[], /* i : input vector FOR( j = 1; j <= K; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat + s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat #else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); #endif } #ifdef ISSUE_1836_replace_overflow_libcom - s = L_shl_sat( s, shift ); //??sat - y[i] = round_fx_sat( s ); /*Qx */ //??sat + s = L_shl_sat( s, shift ); //??sat + y[i] = round_fx_sat( s ); /*Qx */ //??sat #else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ @@ -2933,7 +2933,7 @@ Word16 squant_fx( /* o: index of the winning codeword */ /*dist += tmp*tmp; */ #ifdef ISSUE_1836_replace_overflow_libcom - L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat + L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat #else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); #endif @@ -3094,7 +3094,7 @@ void Copy_Scale_sig32( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_shl_sat( x[i], tmp ); //??sat + y[i] = L_shl_sat( x[i], tmp ); //??sat #else y[i] = L_shl_o( x[i], tmp, &Overflow ); #endif @@ -3103,7 +3103,7 @@ void Copy_Scale_sig32( return; } #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat #else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); #endif @@ -3296,7 +3296,7 @@ void add_vec_fx( FOR( i = 0; i < N; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat + y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat #else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); #endif @@ -3308,7 +3308,7 @@ void add_vec_fx( FOR( i = 0; i < N; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat + y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat #else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); #endif diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index 473bc84ee..b2d44e1d4 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -132,7 +132,7 @@ void weight_a_fx( FOR( i = 1; i < m; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat + ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat #else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ #endif diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index c574ffb45..df42ac226 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -329,8 +329,8 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat - ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat + ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat + ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat move16(); move16(); #else @@ -360,8 +360,8 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat - corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat + corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat + corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat #else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); @@ -379,8 +379,8 @@ static Word16 DTFS_alignment_weight_fx( } #ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat - wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat + temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat + wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ @@ -391,7 +391,7 @@ static Word16 DTFS_alignment_weight_fx( } #else temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ - wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ + wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ @@ -525,9 +525,9 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - temp = add_sat( temp, temp1 ); //??sat + corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + temp = add_sat( temp, temp1 ); //??sat #else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); @@ -655,9 +655,9 @@ void Q2phaseShift_fx( { temp = X_fx->a_fx[k]; #ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat - X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat - temp2 = L_add_sat( temp2, (Word32) ph ); //??sat + X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat + X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat + temp2 = L_add_sat( temp2, (Word32) ph ); //??sat #else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); @@ -676,8 +676,8 @@ void Q2phaseShift_fx( temp = X_fx->a_fx[k]; #ifdef ISSUE_1836_replace_overflow_libcom X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat - X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat - temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat + X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat + temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat #else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); @@ -827,15 +827,15 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ - diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat + diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat exp = norm_s( diff_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ - L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat - nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat + tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ + L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat + nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat #else L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -845,7 +845,7 @@ void DTFS_to_fs_fx( L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ #endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -869,8 +869,8 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat - inv_lag = round_fx_sat( L_tmp ); //??sat + L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat + inv_lag = round_fx_sat( L_tmp ); //??sat #else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); @@ -889,8 +889,8 @@ void DTFS_to_fs_fx( FOR( n = 1; n < N; n++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat - L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat + L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat + L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat #else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ @@ -932,10 +932,10 @@ void DTFS_to_fs_fx( FOR( n = 0; n < N - 1; n += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat - L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat + L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat #else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ + L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); #endif /*temp= negate(temp); */ @@ -943,7 +943,7 @@ void DTFS_to_fs_fx( if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { #ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat #else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ #endif @@ -974,26 +974,26 @@ void DTFS_to_fs_fx( #ifdef ISSUE_1836_replace_overflow_libcom FOR( k = 1; k <= nH; k++ ) { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat move16(); - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ - X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ + X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat move16(); - X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ + X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ } /* IF ( N%2 == 0 ) */ IF( s_and( N, 1 ) == 0 ) { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat move16(); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ X_fx->b_fx[k] = 0; move16(); - } + } #else FOR( k = 1; k <= nH; k++ ) { @@ -1336,20 +1336,20 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat temp2 = add( temp2, temp ); } - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat /* Calculate the circular convolution */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat + L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat + L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat #else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); @@ -1364,7 +1364,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ #endif /* normalization */ na = norm_l( L_temp1 ); @@ -1386,8 +1386,8 @@ void DTFS_zeroFilter_fx( move16(); } #ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat - X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat + X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat + X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat #else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ @@ -1408,13 +1408,13 @@ void DTFS_zeroFilter_fx( FOR( k = 0; k <= HalfLag; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat + X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat #else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ #ifdef ISSUE_1836_replace_overflow_libcom - X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat + X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat #else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif @@ -1677,8 +1677,8 @@ Word32 DTFS_getEngy_fx( temp_b_fx = X_fx->b_fx[k]; move16(); #ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat #else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); @@ -1700,9 +1700,9 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat #else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); @@ -1742,8 +1742,8 @@ Word32 DTFS_getEngy_P2A_fx( HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat } en_fx = L_shr( en_fx, 1 ); en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat @@ -1910,13 +1910,13 @@ void DTFS_car2pol_fx( FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat + Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat #else Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ #endif - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -2041,9 +2041,9 @@ Word32 DTFS_setEngyHarm_fx( FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat + Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat #else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ #endif Lacc_max = L_max( Lacc_max, Lacc ); @@ -2060,8 +2060,8 @@ Word32 DTFS_setEngyHarm_fx( FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat + L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat #else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ @@ -2079,7 +2079,7 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ #ifdef ISSUE_1836_replace_overflow_libcom - en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat + en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat #else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); #endif @@ -2094,7 +2094,7 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); #ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat + fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat #else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); #endif @@ -2136,9 +2136,9 @@ Word32 DTFS_setEngyHarm_fx( /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ #ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat + X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat #else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ #endif move16(); } @@ -2277,7 +2277,7 @@ static void cubicPhase_fx( Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ #ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat + IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat #else IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) #endif @@ -2328,7 +2328,7 @@ static void cubicPhase_fx( } scale = shr( sub( fracb, fraca ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom - fraca = shl_sat( fraca, scale ); //??sat + fraca = shl_sat( fraca, scale ); //??sat #else fraca = shl_o( fraca, scale, &Overflow ); #endif @@ -2348,8 +2348,8 @@ static void cubicPhase_fx( } #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat - Lacc = L_add_sat( Lacc, 0x08000 ); //??sat + Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat + Lacc = L_add_sat( Lacc, 0x08000 ); //??sat #else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); @@ -2614,7 +2614,7 @@ void DTFS_to_erb_fx( #ifdef ISSUE_1836_replace_overflow_libcom out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?ßsat //??sat #else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ #endif move16(); IF( GT_16( count[i], 1 ) ) @@ -2794,13 +2794,13 @@ void erb_slot_fx( tmp = div_s( fracb, fraca ); exp = sub( expb, expa ); - L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat + L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat - mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat + mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat move16(); } #else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -3765,7 +3765,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat #else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); @@ -3780,7 +3780,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W scale = shr( sub( fraca, fracb ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat + fracb = shl_sat( fracb, scale ); //??sat #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -3808,12 +3808,12 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W expa = norm_l( maxNegEn_fx ); #ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat - expa = sub( Q29, expa ); // 30 - expa - 1; + fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat + expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat #else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; @@ -3827,7 +3827,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W scale = shr( sub( fraca, fracb ), 15 ); #ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat + fracb = shl_sat( fracb, scale ); //??sat #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -4326,11 +4326,11 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat + Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat #else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ + Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ #endif exp = norm_l( Lacc_fx ); @@ -4374,15 +4374,15 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); #ifdef ISSUE_1836_replace_overflow_libcom - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat - sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat + sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ move16(); Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat - cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat + cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ #else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ @@ -4488,11 +4488,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, { /* Compute Re */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat + Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4503,20 +4503,20 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, { /* Compute Im */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat + Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat #else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ #endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4615,8 +4615,8 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ FOR( n = 0; n < N; n++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat #else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ @@ -4626,25 +4626,25 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ #ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat /* Calculate the circular convolution */ sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sast #else - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat /* Calculate the circular convolution */ - sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ //??sat + sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ //??sat L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat #endif IF( sum ) { @@ -4766,8 +4766,8 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ #else - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat #endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index deb585ba9..71a986408 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -55,7 +55,7 @@ void ham_cos_window( /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat + fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat #else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ #endif @@ -76,9 +76,9 @@ void ham_cos_window( { /* fh_f[i] = (Float32)cos(cc); */ #ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat + fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From 9012088a924102ef0d22741b0d8d89c79893cd6e Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 17:11:51 +0200 Subject: [PATCH 046/103] lib_com/phase_dispersion_fx.c lib_com/ppp_fx.c lib_com/pred_lt4_fx.c lib_com/pvq_com_fx.c lib_com/residu_fx.c lib_com/stat_noise_uv_mod_fx.c lib_com/swb_bwe_com_fx.c lib_com/swb_bwe_com_lr_fx.c : added development macros: FILEACTIVE --- lib_com/phase_dispersion_fx.c | 6 ++++++ lib_com/ppp_fx.c | 6 ++++++ lib_com/pred_lt4_fx.c | 5 +++++ lib_com/pvq_com_fx.c | 7 +++++++ lib_com/residu_fx.c | 6 ++++++ lib_com/stat_noise_uv_mod_fx.c | 6 ++++++ lib_com/swb_bwe_com_fx.c | 6 ++++++ lib_com/swb_bwe_com_lr_fx.c | 6 ++++++ 8 files changed, 48 insertions(+) diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index bc72e908f..3679ed372 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-----------------------------------------------------------------------* * phase_dispersion: * diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index 56cde5456..0fceb9165 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,6 +35,12 @@ #include "cnst.h" #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_ppp_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ /*-------------------------------------------------------------------*/ diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 4dd399c6b..c54ee5f39 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -8,6 +8,11 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_pred_lt4_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*-------------------------------------------------------------------* * Function pred_lt4: * diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index d53004f03..63eb26877 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -7,6 +7,13 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_pvq_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + /*! r: Approximate integer division for positive input using lookup table */ UWord32 intLimCDivPos_fx( UWord32 NUM, /* Qx */ diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 1de4fac6c..b1426dcb2 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_residu_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*--------------------------------------------------------------------* * residu_ivas_fx() * diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index 7624375d3..cf4b5edc3 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -16,6 +16,12 @@ #define P1 ( 32768 - ISP_SMOOTHING_QUANT_A1_FX - 1 ) #define P9 ( 32767 - P1 ) +#ifndef ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*---------------------------------------------------------* * Local functions *---------------------------------------------------------*/ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index caa9c636c..ab3efa10d 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -36,6 +36,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*==========================================================================*/ /* FUNCTION : Word16 WB_BWE_gain_pred_fx () */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 7688f504d..4dba49139 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,6 +38,12 @@ #include +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-------------------------------------------------------------------* * GetPredictedSignal() * -- GitLab From e9a74f99f8f373bf6f150f29c5beea85b37bb890 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 17:13:38 +0200 Subject: [PATCH 047/103] lib_com/options.h lib_com/prot_fx.h : added development macros: FILEACTIVE --- lib_com/options.h | 2 ++ lib_com/prot_fx.h | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index eef9a5858..4c95f83a5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ #define ISSUE_1836_FILEACTIVE_math_op_h #define ISSUE_1836_FILEACTIVE_modif_fs_fx_c #define ISSUE_1836_FILEACTIVE_oper_32b_c +#if 0 #define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c #define ISSUE_1836_FILEACTIVE_ppp_fx_c #define ISSUE_1836_FILEACTIVE_pred_lt4_fx_c @@ -180,6 +181,7 @@ #define ISSUE_1836_FILEACTIVE_weight_a_fx_c #define ISSUE_1836_FILEACTIVE_wi_fx_c #define ISSUE_1836_FILEACTIVE_window_fx_c +#endif /* #################### End BASOP porting switches ############################ */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 4b9dbc46e..077230a7f 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -59,6 +59,18 @@ #define TCX_IMDCT_SCALE 15 #define TCX_IMDCT_HEADROOM 1 +#ifndef ISSUE_1836_FILEACTIVE_preemph_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + +#ifndef ISSUE_1836_FILEACTIVE_prot_fx_h +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*----------------------------------------------------------------------------------* * Prototypes of global macros -- GitLab From b8707595d908a2d09e9f00a1701f5ebb8ed928da Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 Aug 2025 17:21:38 +0200 Subject: [PATCH 048/103] buildfix --- lib_com/syn_filt_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index ba0993291..8b044f2f7 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -550,7 +550,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); //??sat #else - L_tmp = L_shl_o( L_tmp, q ); + L_tmp = L_shl_o( L_tmp, q, &Overflow ); #endif *y++ = L_tmp; move32(); -- GitLab From ca2be5d4f34740692d1634011a5958cdb41363a7 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 07:40:58 +0200 Subject: [PATCH 049/103] development macros deactivated: gs_gains_fx - window_fx lib_com/gs_gains_fx.c lib_com/gs_noisefill_fx.c lib_com/hp50_fx.c lib_com/hq2_bit_alloc_fx.c lib_com/hq2_core_com_fx.c lib_com/hq2_noise_inject_fx.c lib_com/ifft_rel_fx.c lib_com/interpol_fx.c lib_com/low_rate_band_att_fx.c lib_com/lpc_tools_fx.c lib_com/lsf_tools_fx.c lib_com/lsp_conv_poly_fx.c lib_com/math_op.c lib_com/modif_fs_fx.c lib_com/oper_32b.c lib_com/options.h --- lib_com/gs_gains_fx.c | 6 ++++++ lib_com/gs_noisefill_fx.c | 6 ++++++ lib_com/hp50_fx.c | 5 +++++ lib_com/hq2_bit_alloc_fx.c | 7 +++++++ lib_com/hq2_core_com_fx.c | 7 +++++++ lib_com/hq2_noise_inject_fx.c | 6 ++++++ lib_com/ifft_rel_fx.c | 7 +++++++ lib_com/interpol_fx.c | 5 +++++ lib_com/low_rate_band_att_fx.c | 5 +++++ lib_com/lpc_tools_fx.c | 6 ++++++ lib_com/lsf_tools_fx.c | 6 ++++++ lib_com/lsp_conv_poly_fx.c | 6 ++++++ lib_com/math_op.c | 6 ++++++ lib_com/modif_fs_fx.c | 7 +++++++ lib_com/oper_32b.c | 6 ++++++ lib_com/options.h | 2 +- 16 files changed, 92 insertions(+), 1 deletion(-) diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 4fc636ec8..caaa79542 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -43,6 +43,12 @@ #include "stl.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_gs_gains_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index df8813844..bc350e165 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -6,6 +6,12 @@ #include "rom_com.h" #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * gs_noisf() * diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 84fe683fe..6952d7da6 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -40,6 +40,11 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_hp50_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif #define HP20_COEFF_SCALE ( 2 ) /* diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 452481334..02d3590c0 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -35,6 +35,13 @@ #include "prot_fx.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + #define MIN_BITS_FIX 0 /* QRk=18 */ #define HQ_16k40_BIT ( HQ_16k40 / 50 ) /* 16400/50=328 */ #define Qbf 14 /* Q value for bits_fact */ diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index 5c1a63f28..f071689d4 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -37,6 +37,13 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 7f61e9a91..04bd5af34 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -36,6 +36,12 @@ #include "oper_32b.h" #include "move.h" +#ifndef ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*--------------------------------------------------------------------------* * hq2_noise_inject() * diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index 2ea116ef5..f0add9252 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -39,6 +39,13 @@ #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" + +#ifndef ISSUE_1836_FILEACTIVE_ifft_rel_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index 51dec3b72..38fc55792 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -41,7 +41,12 @@ #include "rom_com.h" #include "prot_fx_enc.h" +#ifndef ISSUE_1836_FILEACTIVE_interpol_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif Word32 Interpol_lc_fx( /* o : interpolated value Q15 */ const Word16 *x, /* i : input vector Q0 */ const Word16 *win, /* i : interpolation window Q14 */ diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 124ed1e4e..e8b5b37e0 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,6 +8,11 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*--------------------------------------------------------------------------* * fine_gain_pred() diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index c1498808d..bc7ebe478 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,6 +42,12 @@ #include "rom_com.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local constants diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index e168cd0f8..c5d20ef21 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,6 +40,12 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index bc3383518..ddd8f88f6 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,6 +9,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 24eb88278..caa17b3ae 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,6 +23,12 @@ #include #include +#ifndef ISSUE_1836_FILEACTIVE_math_op_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 4860ad832..a351e6904 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,6 +15,13 @@ #include "wmc_auto.h" + +#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index de733005e..91e22a9d6 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -27,6 +27,12 @@ #define WMC_TOOL_SKIP +#ifndef ISSUE_1836_FILEACTIVE_oper_32b_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /***************************************************************************** * * * Function L_Extract() * diff --git a/lib_com/options.h b/lib_com/options.h index 416b5394a..eb77b4b2f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -142,6 +142,7 @@ #define ISSUE_1836_FILEACTIVE_get_gain_fx_c #define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c #define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c +#if 0 #define ISSUE_1836_FILEACTIVE_gs_gains_fx_c #define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c #define ISSUE_1836_FILEACTIVE_hp50_fx_c @@ -160,7 +161,6 @@ #define ISSUE_1836_FILEACTIVE_math_op_h #define ISSUE_1836_FILEACTIVE_modif_fs_fx_c #define ISSUE_1836_FILEACTIVE_oper_32b_c -#if 0 #define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c #define ISSUE_1836_FILEACTIVE_ppp_fx_c #define ISSUE_1836_FILEACTIVE_pred_lt4_fx_c -- GitLab From 2a3d8994f4719a1d17bc783e0b40a8b2dd82de89 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 07:59:19 +0200 Subject: [PATCH 050/103] clang patch --- lib_com/modif_fs_fx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index a351e6904..bc7ea96df 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,7 +15,6 @@ #include "wmc_auto.h" - #ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom -- GitLab From 6336f37e6007c6b3920be5e2fcdcc3d8c43c0065 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 08:10:30 +0200 Subject: [PATCH 051/103] development macros added lib_com/arith_coder_fx.c lib_com/basop_util.c lib_com/bitalloc_fx.c lib_com/cldfb_evs_fx.c lib_com/cldfb_fx.c lib_com/cng_exc_fx.c lib_com/codec_tcx_common_fx.c lib_com/deemph_fx.c lib_com/edct_fx.c lib_com/env_stab_fx.c lib_com/fd_cng_com_fx.c lib_com/fft_fx_evs.c lib_com/frame_ener_fx.c lib_com/get_gain_fx.c lib_com/gs_bitallocation_fx.c lib_com/gs_bitallocation_ivas_fx.c lib_com/options.h --- lib_com/arith_coder_fx.c | 6 ++++++ lib_com/basop_util.c | 7 +++++++ lib_com/bitalloc_fx.c | 6 ++++++ lib_com/cldfb_evs_fx.c | 6 ++++++ lib_com/cldfb_fx.c | 5 +++++ lib_com/cng_exc_fx.c | 6 ++++++ lib_com/codec_tcx_common_fx.c | 6 ++++++ lib_com/deemph_fx.c | 5 +++++ lib_com/edct_fx.c | 5 +++++ lib_com/env_stab_fx.c | 6 ++++++ lib_com/fd_cng_com_fx.c | 6 ++++++ lib_com/fft_fx_evs.c | 6 ++++++ lib_com/frame_ener_fx.c | 7 +++++++ lib_com/get_gain_fx.c | 6 ++++++ lib_com/gs_bitallocation_fx.c | 6 ++++++ lib_com/gs_bitallocation_ivas_fx.c | 7 +++++++ lib_com/options.h | 1 + 17 files changed, 97 insertions(+) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 55d7a3ec5..ff272b8c8 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -10,6 +10,12 @@ #include "basop_proto_func.h" #include "cnst.h" +#ifndef ISSUE_1836_FILEACTIVE_arith_coder_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /* Fixed point implementation of exp(negate()) */ Word32 expfp( /* o: Q31 */ const Word16 x, /* i: mantissa Q-e */ diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 1d9c2f2d9..dd3310a7f 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -45,6 +45,13 @@ #include "basop_settings.h" #include "cnst.h" +#ifndef ISSUE_1836_FILEACTIVE_basop_util_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + extern const Word32 SqrtTable[32]; // Q31 extern const Word16 SqrtDiffTable[32]; /* Q15 */ diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 2b630cf21..c3bcd3c8a 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_bitalloc_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif void bitalloc_fx( Word16 *y, /* i : reordered norm of sub-vectors Q0 */ Word16 *idx, /* i : reordered sub-vector indices Q0 */ diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 153f95cf9..77437a485 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -48,6 +48,12 @@ #define N40 ( 20 ) #define N60 ( 30 ) +#ifndef ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs ); diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index ca261bfc8..877e2f48f 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -51,6 +51,11 @@ #define restrict #endif +#ifndef ISSUE_1836_FILEACTIVE_cldfb_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*-------------------------------------------------------------------* * Local prototypes diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 6296b406c..1f4ee4da4 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" #include "ivas_rom_com_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_cng_exc_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 010590ad1..a3c8cb258 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -11,6 +11,12 @@ #include "rom_basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif #define inv_int InvIntTable Word16 tcxGetNoiseFillingTilt( diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 0181f65d8..cdce5f41c 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -39,7 +39,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_deemph_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif void deemph_fx_32( Word32 *signal, /* i/o: signal Qx*/ const Word16 mu, /* i : deemphasis factor Q15*/ diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index a6d4ece4e..3c3f6fafb 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -13,6 +13,11 @@ #include "math_32.h" +#ifndef ISSUE_1836_FILEACTIVE_edct_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */ { diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index f87194506..93779ea18 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -43,6 +43,12 @@ #include "rom_com.h" #include "wmc_auto.h" #include "stl.h" + +#ifndef ISSUE_1836_FILEACTIVE_env_stab_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endi /*--------------------------------------------------------------------------* * Local constants *--------------------------------------------------------------------------*/ diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index c4038ee38..8ff5eb489 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -21,6 +21,12 @@ #define CNG_HS 4 /* 4 bit headroom for dot product */ #define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */ +#ifndef ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------- * Local function prototypes *-------------------------------------------------------------------*/ diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index 6572b57d7..ce1bd52ea 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -32,6 +32,12 @@ static void fft64_16fx( Word16 *x, Word16 *y, const Word16 *Idx ); static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx ); static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w ); +#ifndef ISSUE_1836_FILEACTIVE_fft_fx_evs_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #include "math_32.h" /*-----------------------------------------------------------------* diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index d0d94383d..ed46494ee 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -40,6 +40,13 @@ #include "cnst.h" #include "prot_fx.h" #include "wmc_auto.h" + +#ifndef ISSUE_1836_FILEACTIVE_frame_ener_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*----------------------------------------------------------------------------------* * fer_energy() * diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index 8d10f3c4d..ab7024371 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -39,6 +39,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_get_gain_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*----------------------------------------------------------------------------------* * get_gain() * diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 5e3870a7e..beb402b5d 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -9,6 +9,12 @@ #include "assert.h" /* Debug prototypes */ #include "stl.h" +#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*==================================================================================*/ /* FUNCTION : void bands_and_bit_alloc_fx(); */ /*----------------------------------------------------------------------------------*/ diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index e017ca229..601eb92d7 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -33,6 +33,13 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const #define Q31_0_02 42949673 /* 0.02 */ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ + +#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ diff --git a/lib_com/options.h b/lib_com/options.h index 8515d735c..d173fa640 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -136,6 +136,7 @@ #define ISSUE_1836_FILEACTIVE_enh64_h #define ISSUE_1836_FILEACTIVE_enhUL32_c #define ISSUE_1836_FILEACTIVE_enr_1_az_fx_c +#define ISSUE_1836_FILEACTIVE_edct_fx_c #define ISSUE_1836_FILEACTIVE_env_stab_fx_c #define ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c #define ISSUE_1836_FILEACTIVE_fft_fx_evs_c -- GitLab From f76059078a9eeab70d385700612302dd6cbc0558 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 08:11:24 +0200 Subject: [PATCH 052/103] clang patch --- lib_enc/find_tilt_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index 042b34228..d2e946098 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -178,7 +178,7 @@ void find_tilt_fx( #ifdef ISSUE_1799_replace_L_shr_o lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ #else - lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ + lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ #endif pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */ @@ -210,7 +210,7 @@ void find_tilt_fx( #ifdef ISSUE_1799_replace_L_shr_o ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ #else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ #endif } ELSE IF( lp_E == 0 ) @@ -477,7 +477,7 @@ void find_tilt_ivas_fx( #ifdef ISSUE_1799_replace_L_shr_o ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ #else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ #endif move32(); } -- GitLab From b2dc66fdc79db8272e335d61f3a174883d54a066 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 08:49:01 +0200 Subject: [PATCH 053/103] buildfix --- lib_com/env_stab_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index 93779ea18..839d39c4f 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -48,7 +48,7 @@ #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif -#endi +#endif /*--------------------------------------------------------------------------* * Local constants *--------------------------------------------------------------------------*/ -- GitLab From 613cb1842f621d16a6f5bae6a2486c9b1e197fb2 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 09:30:41 +0200 Subject: [PATCH 054/103] deactivate macro --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 85de7e70e..5e3405456 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,7 +113,7 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ -#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ +//#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ #define ISSUE_1836_FILEACTIVE_arith_coder_fx_c #define ISSUE_1836_FILEACTIVE_basop32_c -- GitLab From 60c14880ec6a5f124748f3c28fd2bd79ecf94c02 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 08:32:35 +0000 Subject: [PATCH 055/103] cleanup whitespace diffs - synchronize else paths with origin code (intentionally only whitespaces) --- lib_com/deemph_fx.c | 4 +- lib_com/edct_fx.c | 6 +- lib_com/gs_gains_fx.c | 18 ++-- lib_com/gs_noisefill_fx.c | 30 +++---- lib_com/hp50_fx.c | 1 + lib_com/hq2_noise_inject_fx.c | 21 +++-- lib_com/igf_base_fx.c | 2 +- lib_com/low_rate_band_att_fx.c | 12 +-- lib_com/lpc_tools_fx.c | 4 +- lib_com/lsf_tools_fx.c | 30 +++---- lib_com/modif_fs_fx.c | 48 +++++------ lib_com/pred_lt4_fx.c | 6 +- lib_com/prot_fx.h | 12 --- lib_com/stat_noise_uv_mod_fx.c | 6 +- lib_com/swb_bwe_com_lr_fx.c | 149 +++++++++++++++++---------------- lib_com/swb_tbe_com_fx.c | 50 +++++------ lib_com/tcx_mdct_fx.c | 4 +- lib_com/tcx_utils_fx.c | 8 +- lib_com/tools_fx.c | 10 +-- lib_com/wi_fx.c | 45 +++++----- lib_com/window_fx.c | 2 +- 21 files changed, 227 insertions(+), 241 deletions(-) diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index cdce5f41c..9e8480cc7 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -231,8 +231,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ #else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_o( x[i], shift, &Overflow ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ + L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ #endif move16(); } diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 3c3f6fafb..83720f27f 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -526,7 +526,7 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ @@ -536,8 +536,8 @@ void edct_16fx( Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ #else - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ + Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index caaa79542..f5c910267 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -229,17 +229,17 @@ void Comp_and_apply_gain_ivas_fx( * y_gain = pow(10.0, (Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) * = pow(2, 3.321928*(Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) *-----------------------------------------------------------------*/ - L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ - L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ - L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ - y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ + L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ + L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ + frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ + y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ #ifdef ISSUE_1836_replace_overflow_libcom Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ #else - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ //??sat + Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ #endif move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); @@ -250,7 +250,7 @@ void Comp_and_apply_gain_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat #else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ #endif move16(); IF( exc_diffQ[i] ) diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index bc350e165..2d4843c79 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -478,15 +478,15 @@ static void Decreas_freqPeak_fx( { tmp = abs_s( *src ); exp = norm_s( max_val ); - tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ - L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ + tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ + L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat #else tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ #endif - tmp = sub( 32767, tmp ); /*Q14 */ - L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ + tmp = sub( 32767, tmp ); /*Q14 */ + L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ tmp = round_fx( L_shl( L_tmp, 1 ) ); tmp1 = negate( tmp ); @@ -582,7 +582,7 @@ static void envelop_modify_fx( #ifdef ISSUE_1836_replace_overflow_libcom Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else - Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ + Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ #endif FOR( j = 0; j < 16; j++ ) @@ -612,7 +612,7 @@ static void envelop_modify_fx( #ifdef ISSUE_1836_replace_overflow_libcom Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ + Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ #endif src_fx = &exc_diffQ_fx[224]; @@ -739,7 +739,7 @@ void highband_exc_dct_in_fx( #else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ #endif } @@ -969,13 +969,13 @@ void highband_exc_dct_in_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ #ifdef ISSUE_1836_replace_overflow_libcom exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat #else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ #endif } } @@ -1480,13 +1480,13 @@ void highband_exc_dct_in_ivas_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ #ifdef ISSUE_1836_replace_overflow_libcom exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat #else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ #endif } } diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 6952d7da6..f3eb49db6 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -127,6 +127,7 @@ static void filter_2nd_order( #endif BASOP_SATURATE_WARNING_ON_EVS + BASOP_SATURATE_ERROR_ON_EVS L_sum = HP50_Mpy_32_32_fix( b2, mem[3] ); /* b2*x2 */ L_sum = L_add( L_sum, HP50_Mode2_Mpy_32_16_fix( b1, x2 ) ); /* b1*x1 */ diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 04bd5af34..0e6b0bb28 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -101,7 +101,7 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat #else - Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ + Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ #endif move32(); } @@ -620,7 +620,7 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } ELSE @@ -631,7 +631,7 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -647,9 +647,9 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat #else - tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ + tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ #endif - tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ + tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE { @@ -658,16 +658,15 @@ void hq2_noise_inject_fx( move16(); move16(); } - tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ - L_tmp = L_mult( tmp1, j ); /*Q13 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ + tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ + L_tmp = L_mult( tmp1, j ); /*Q13 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ -#endif - tmp = sub( fac_fx, tmp ); /*Q12 */ - L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ + tmp = sub( fac_fx, tmp ); /*Q12 */ + L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); move32(); /*Q12 */ } diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index 5badabb66..44cf27c5f 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1120,9 +1120,9 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; - move16(); Flag Carry = 0; move16(); + move16(); #endif FOR( sfb = startSfb; sfb < stopSfb; sfb++ ) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index e8b5b37e0..9e275ce5a 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -107,11 +107,11 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else - tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ @@ -204,8 +204,8 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ #ifdef ISSUE_1836_replace_overflow_libcom gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat #else @@ -225,11 +225,11 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else - tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index bc7ebe478..17496422f 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -832,7 +832,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -1051,7 +1051,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c5d20ef21..144e71b8f 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -123,8 +123,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ @@ -135,7 +135,7 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -150,8 +150,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -173,10 +173,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat #else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ #endif - cheb = s_max( -32767, cheb ); /* to avoid saturation */ + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -1857,7 +1857,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ @@ -1879,7 +1879,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat @@ -2397,11 +2397,11 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ #endif - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); @@ -3928,12 +3928,12 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ #ifdef ISSUE_1836_replace_overflow_libcom Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat #else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ #endif if ( LT_32( *v_low, vh ) ) { diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index bc7ea96df..c95b491a8 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -973,22 +973,22 @@ void Decimate_allpass_steep_fx( temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ #endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat temp2 = extract_h( Lacc1 ); /* Qx */ Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat #else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ #endif mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; @@ -996,7 +996,7 @@ void Decimate_allpass_steep_fx( move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat move16(); @@ -1036,16 +1036,16 @@ void Decimate_allpass_steep_fx( move16(); Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat #else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ #endif - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ @@ -1057,7 +1057,7 @@ void Decimate_allpass_steep_fx( move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1075,10 +1075,10 @@ void Decimate_allpass_steep_fx( temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat #else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ #endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ @@ -1087,7 +1087,7 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat temp2 = extract_h( Lacc1 ); /* Qx */ @@ -1102,8 +1102,8 @@ void Decimate_allpass_steep_fx( temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ #else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1115,8 +1115,7 @@ void Decimate_allpass_steep_fx( temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #endif - - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1269,10 +1268,9 @@ void Interpolate_allpass_steep_fx( mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat move16(); #else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index c54ee5f39..73669b5a4 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -81,7 +81,7 @@ void pred_lt4_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat #else - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ #endif move16(); } @@ -240,8 +240,8 @@ void pred_lt4_tc_fx( L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat #else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ #endif move16(); diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 20a945868..145f6a3bf 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -59,18 +59,6 @@ #define TCX_IMDCT_SCALE 15 #define TCX_IMDCT_HEADROOM 1 -#ifndef ISSUE_1836_FILEACTIVE_preemph_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - -#ifndef ISSUE_1836_FILEACTIVE_prot_fx_h -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*----------------------------------------------------------------------------------* * Prototypes of global macros diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index cf4b5edc3..3903a1d90 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -172,7 +172,7 @@ void stat_noise_uv_mod_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else @@ -273,7 +273,7 @@ void stat_noise_uv_mod_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat #else - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ #endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -496,7 +496,7 @@ void stat_noise_uv_mod_ivas_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 4dba49139..61953810e 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -1032,107 +1032,108 @@ void SpectrumSmoothing_fx( move16(); } #else - IF( L_inBuf_pss[j] >= 0 ){ + IF( L_inBuf_pss[j] >= 0 ) + { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); - } + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } #endif + } + ELSE + { + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; + move16(); + if ( L_inBuf_pss[j] < 0x0L ) + { + outBuf_pss_fx[j] = -0x2800; + move16(); + } + } + j++; + } } - ELSE + + k = 0; + move16(); + m = 0; + move16(); + n = 0; + move16(); + reset_flag = 0; + move16(); + n_list[0] = 0; + move16(); + FOR( j = 0; j < num_subband_smooth_fx; j++ ) { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; + cnt_zero_cont = 0; move16(); - if ( L_inBuf_pss[j] < 0x0L ) + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[j] = -0x2800; - move16(); + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) + { + cnt_zero_cont = 0; + move16(); + } + k = add( k, 1 ); } - } - j++; -} -} -k = 0; -move16(); -m = 0; -move16(); -n = 0; -move16(); -reset_flag = 0; -move16(); -n_list[0] = 0; -move16(); -FOR( j = 0; j < num_subband_smooth_fx; j++ ) -{ - cnt_zero_cont = 0; - move16(); - FOR( i = 0; i < L_SB; i++ ) - { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) + IF( cnt_zero_cont != 0 ) { - cnt_zero_cont = 0; + test(); + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + { + n = 0; + move16(); + reset_flag = 1; + move16(); + } + n_list[n] = j; move16(); + n = add( n, 1 ); } - k = add( k, 1 ); - } - IF( cnt_zero_cont != 0 ) - { test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) { - n = 0; - move16(); - reset_flag = 1; + m = 0; move16(); } - n_list[n] = j; - move16(); - n = add( n, 1 ); - } - test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) - { - m = 0; - move16(); - } - - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ - { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ { - if ( outBuf_pss_fx[pk + i] == 0 ) + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); + if ( outBuf_pss_fx[pk + i] == 0 ) + { + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); + } } + m = add( m, 1 ); } - m = add( m, 1 ); } -} -FOR( i = 0; i < fLen; i++ ) -{ - outBuf_fx[i] = 0x0; - move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + FOR( i = 0; i < fLen; i++ ) { - outBuf_fx[i] = outBuf_pss_fx[i]; + outBuf_fx[i] = 0x0; move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + { + outBuf_fx[i] = outBuf_pss_fx[i]; + move16(); + } } -} -return; + return; } /*-------------------------------------------------------------------* diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e8a74d834..c12acf085 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1555,7 +1555,7 @@ void GenShapedWBExcitation_ivas_fx( #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif - move16(); /* Q14 */ + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1614,7 +1614,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ #else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ #endif move16(); } @@ -1627,8 +1627,8 @@ void GenShapedWBExcitation_ivas_fx( L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ #endif } } @@ -1641,7 +1641,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1931,8 +1931,8 @@ void GenShapedWBExcitation_fx( L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ #endif } } @@ -1951,7 +1951,7 @@ void GenShapedWBExcitation_fx( move16(); } #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { @@ -5894,7 +5894,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5903,7 +5903,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5927,7 +5927,7 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else @@ -5984,7 +5984,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5993,7 +5993,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6168,7 +6168,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -6177,7 +6177,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6201,11 +6201,11 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ #endif } ELSE @@ -6258,7 +6258,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -6267,7 +6267,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -7216,7 +7216,7 @@ void prep_tbe_exc_fx( #ifdef ISSUE_1836_replace_overflow_libcom pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7246,7 +7246,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ #ifdef ISSUE_1836_replace_overflow_libcom gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) @@ -7292,7 +7292,7 @@ void prep_tbe_exc_fx( Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ #endif move16(); } @@ -7302,13 +7302,13 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ #ifdef ISSUE_1836_replace_overflow_libcom Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat #else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ #endif move16(); } diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 8ef395423..a2646ae42 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -137,7 +137,7 @@ void TCX_MDCT( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } @@ -203,7 +203,7 @@ void TCX_MDST( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index e86f48eed..f74bd7cc4 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -1055,7 +1055,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x++; @@ -1078,7 +1078,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x += k; @@ -1459,9 +1459,9 @@ void PsychAdaptLowFreqDeemph( #ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_tmp ); /* Q15 */ #else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ #endif - fac = tmp; /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 2cbc58cd4..4f1b26624 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -323,7 +323,7 @@ Word16 usquant_fx( /* o: index of the winning codeword */ /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat @@ -337,12 +337,12 @@ Word16 usquant_fx( /* o: index of the winning codeword */ idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ #ifdef ISSUE_1836_replace_overflow_libcom *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #endif return idx; } @@ -421,7 +421,7 @@ Word32 sum2_fx( /* o : sum of all squared vector elements #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ #else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ #endif } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index df42ac226..1b744bd02 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -827,7 +827,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat @@ -845,7 +845,7 @@ void DTFS_to_fs_fx( L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ #endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -1363,8 +1363,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ #endif /* normalization */ na = norm_l( L_temp1 ); @@ -2043,7 +2042,7 @@ Word32 DTFS_setEngyHarm_fx( #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat #else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ #endif Lacc_max = L_max( Lacc_max, Lacc ); @@ -2138,7 +2137,7 @@ Word32 DTFS_setEngyHarm_fx( #ifdef ISSUE_1836_replace_overflow_libcom X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat #else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ #endif move16(); } @@ -2612,9 +2611,9 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?ßsat //??sat + out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat #else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ #endif move16(); IF( GT_16( count[i], 1 ) ) @@ -2800,7 +2799,7 @@ void erb_slot_fx( move16(); } #else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -4490,9 +4489,9 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4505,18 +4504,18 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat #else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ #endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4634,17 +4633,17 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sast + L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat #else - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ - sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ //??sat + sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ #endif IF( sum ) { diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 71a986408..7358abf95 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -78,7 +78,7 @@ void ham_cos_window( #ifdef ISSUE_1836_replace_overflow_libcom fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From 24b168fe21f29c6f0dc668f498d5b1675b8a5db3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 10:43:56 +0200 Subject: [PATCH 056/103] clang patch --- lib_com/deemph_fx.c | 16 ++-- lib_com/edct_fx.c | 6 +- lib_com/gs_gains_fx.c | 18 ++-- lib_com/gs_noisefill_fx.c | 30 +++---- lib_com/hq2_noise_inject_fx.c | 16 ++-- lib_com/low_rate_band_att_fx.c | 12 +-- lib_com/lpc_tools_fx.c | 4 +- lib_com/lsf_tools_fx.c | 30 +++---- lib_com/modif_fs_fx.c | 46 +++++----- lib_com/pred_lt4_fx.c | 6 +- lib_com/stat_noise_uv_mod_fx.c | 6 +- lib_com/swb_bwe_com_lr_fx.c | 149 ++++++++++++++++----------------- lib_com/swb_tbe_com_fx.c | 50 +++++------ lib_com/tcx_mdct_fx.c | 4 +- lib_com/tcx_utils_fx.c | 8 +- lib_com/tools_fx.c | 10 +-- lib_com/wi_fx.c | 36 ++++---- lib_com/window_fx.c | 2 +- 18 files changed, 224 insertions(+), 225 deletions(-) diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 9e8480cc7..e0720a44f 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -108,9 +108,9 @@ void deemph_fx( L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/ signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ #else - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ - L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ - signal[0] = round_fx_sat( L_tmp ); /*Qx*/ + L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ + L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ + signal[0] = round_fx_sat( L_tmp ); /*Qx*/ #endif @@ -123,8 +123,8 @@ void deemph_fx( L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ signal[i] = round_fx_sat( L_tmp ); /*Qx*/ #else - L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ - signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ + L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ + signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ #endif move16(); } @@ -167,7 +167,7 @@ void Deemph2( #ifdef ISSUE_1836_replace_overflow_libcom x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ #else - x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ + x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ #endif move16(); } @@ -217,8 +217,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ #else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ + L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ #endif move16(); } diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 83720f27f..3c3f6fafb 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -526,7 +526,7 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ @@ -536,8 +536,8 @@ void edct_16fx( Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ #else - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ + Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index f5c910267..a00fbd829 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -229,17 +229,17 @@ void Comp_and_apply_gain_ivas_fx( * y_gain = pow(10.0, (Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) * = pow(2, 3.321928*(Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) *-----------------------------------------------------------------*/ - L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ - L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ - L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ - y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ + L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ + L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ + frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ + y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ #ifdef ISSUE_1836_replace_overflow_libcom Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ #else - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ + Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ #endif move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); @@ -250,7 +250,7 @@ void Comp_and_apply_gain_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat #else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ #endif move16(); IF( exc_diffQ[i] ) diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 2d4843c79..bc350e165 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -478,15 +478,15 @@ static void Decreas_freqPeak_fx( { tmp = abs_s( *src ); exp = norm_s( max_val ); - tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ - L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ + tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ + L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat #else tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ #endif - tmp = sub( 32767, tmp ); /*Q14 */ - L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ + tmp = sub( 32767, tmp ); /*Q14 */ + L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ tmp = round_fx( L_shl( L_tmp, 1 ) ); tmp1 = negate( tmp ); @@ -582,7 +582,7 @@ static void envelop_modify_fx( #ifdef ISSUE_1836_replace_overflow_libcom Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else - Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ + Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ #endif FOR( j = 0; j < 16; j++ ) @@ -612,7 +612,7 @@ static void envelop_modify_fx( #ifdef ISSUE_1836_replace_overflow_libcom Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat #else - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ + Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ #endif src_fx = &exc_diffQ_fx[224]; @@ -739,7 +739,7 @@ void highband_exc_dct_in_fx( #else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ #endif } @@ -969,13 +969,13 @@ void highband_exc_dct_in_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ #ifdef ISSUE_1836_replace_overflow_libcom exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat #else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ #endif } } @@ -1480,13 +1480,13 @@ void highband_exc_dct_in_ivas_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ #ifdef ISSUE_1836_replace_overflow_libcom exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat #else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ #endif } } diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 0e6b0bb28..f0ff54efa 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -101,7 +101,7 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat #else - Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ + Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ #endif move32(); } @@ -620,7 +620,7 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } ELSE @@ -631,7 +631,7 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat #else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ #endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -647,9 +647,9 @@ void hq2_noise_inject_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat #else - tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ + tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ #endif - tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ + tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE { @@ -658,9 +658,9 @@ void hq2_noise_inject_fx( move16(); move16(); } - tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ - L_tmp = L_mult( tmp1, j ); /*Q13 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ + tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ + L_tmp = L_mult( tmp1, j ); /*Q13 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat #else diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 9e275ce5a..1a6e91a22 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -107,11 +107,11 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ @@ -204,8 +204,8 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ #ifdef ISSUE_1836_replace_overflow_libcom gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat #else @@ -225,11 +225,11 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 17496422f..bc7ebe478 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -832,7 +832,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -1051,7 +1051,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 144e71b8f..c5d20ef21 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -123,8 +123,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ @@ -135,7 +135,7 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -150,8 +150,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ #endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -173,10 +173,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat #else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ #endif - cheb = s_max( -32767, cheb ); /* to avoid saturation */ + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -1857,7 +1857,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ @@ -1879,7 +1879,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat @@ -2397,11 +2397,11 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ #endif - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); @@ -3928,12 +3928,12 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ #ifdef ISSUE_1836_replace_overflow_libcom Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat #else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ #endif if ( LT_32( *v_low, vh ) ) { diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index c95b491a8..60a15c5d0 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -973,22 +973,22 @@ void Decimate_allpass_steep_fx( temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ #endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat temp2 = extract_h( Lacc1 ); /* Qx */ Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat #else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ #endif mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; @@ -996,7 +996,7 @@ void Decimate_allpass_steep_fx( move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat move16(); @@ -1036,16 +1036,16 @@ void Decimate_allpass_steep_fx( move16(); Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat #else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ #endif - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ @@ -1057,7 +1057,7 @@ void Decimate_allpass_steep_fx( move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1075,10 +1075,10 @@ void Decimate_allpass_steep_fx( temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat #else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ #endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ @@ -1087,7 +1087,7 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat temp2 = extract_h( Lacc1 ); /* Qx */ @@ -1102,8 +1102,8 @@ void Decimate_allpass_steep_fx( temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ #else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1115,7 +1115,7 @@ void Decimate_allpass_steep_fx( temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1268,9 +1268,9 @@ void Interpolate_allpass_steep_fx( mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat move16(); #else - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 73669b5a4..c54ee5f39 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -81,7 +81,7 @@ void pred_lt4_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat #else - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ #endif move16(); } @@ -240,8 +240,8 @@ void pred_lt4_tc_fx( L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat #else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ #endif move16(); diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index 3903a1d90..cf4b5edc3 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -172,7 +172,7 @@ void stat_noise_uv_mod_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else @@ -273,7 +273,7 @@ void stat_noise_uv_mod_fx( #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat #else - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ #endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -496,7 +496,7 @@ void stat_noise_uv_mod_ivas_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 61953810e..4dba49139 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -1032,108 +1032,107 @@ void SpectrumSmoothing_fx( move16(); } #else - IF( L_inBuf_pss[j] >= 0 ) - { + IF( L_inBuf_pss[j] >= 0 ){ outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); - } -#endif - } - ELSE - { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; - move16(); - if ( L_inBuf_pss[j] < 0x0L ) - { - outBuf_pss_fx[j] = -0x2800; - move16(); - } - } - j++; + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); } +#endif } - - k = 0; - move16(); - m = 0; - move16(); - n = 0; - move16(); - reset_flag = 0; - move16(); - n_list[0] = 0; - move16(); - FOR( j = 0; j < num_subband_smooth_fx; j++ ) + ELSE { - cnt_zero_cont = 0; + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; move16(); - FOR( i = 0; i < L_SB; i++ ) + if ( L_inBuf_pss[j] < 0x0L ) { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) - { - cnt_zero_cont = 0; - move16(); - } - k = add( k, 1 ); + outBuf_pss_fx[j] = -0x2800; + move16(); } + } + j++; +} +} - IF( cnt_zero_cont != 0 ) +k = 0; +move16(); +m = 0; +move16(); +n = 0; +move16(); +reset_flag = 0; +move16(); +n_list[0] = 0; +move16(); +FOR( j = 0; j < num_subband_smooth_fx; j++ ) +{ + cnt_zero_cont = 0; + move16(); + FOR( i = 0; i < L_SB; i++ ) + { + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) { - test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) - { - n = 0; - move16(); - reset_flag = 1; - move16(); - } - n_list[n] = j; + cnt_zero_cont = 0; move16(); - n = add( n, 1 ); } + k = add( k, 1 ); + } + IF( cnt_zero_cont != 0 ) + { test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) { - m = 0; + n = 0; + move16(); + reset_flag = 1; move16(); } + n_list[n] = j; + move16(); + n = add( n, 1 ); + } - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + test(); + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + { + m = 0; + move16(); + } + + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + { + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + if ( outBuf_pss_fx[pk + i] == 0 ) { - if ( outBuf_pss_fx[pk + i] == 0 ) - { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); - } + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); } - m = add( m, 1 ); } + m = add( m, 1 ); } +} - FOR( i = 0; i < fLen; i++ ) +FOR( i = 0; i < fLen; i++ ) +{ + outBuf_fx[i] = 0x0; + move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) { - outBuf_fx[i] = 0x0; + outBuf_fx[i] = outBuf_pss_fx[i]; move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) - { - outBuf_fx[i] = outBuf_pss_fx[i]; - move16(); - } } +} - return; +return; } /*-------------------------------------------------------------------* diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index c12acf085..e8a74d834 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1555,7 +1555,7 @@ void GenShapedWBExcitation_ivas_fx( #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif - move16(); /* Q14 */ + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1614,7 +1614,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ #else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ #endif move16(); } @@ -1627,8 +1627,8 @@ void GenShapedWBExcitation_ivas_fx( L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ #endif } } @@ -1641,7 +1641,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1931,8 +1931,8 @@ void GenShapedWBExcitation_fx( L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ #endif } } @@ -1951,7 +1951,7 @@ void GenShapedWBExcitation_fx( move16(); } #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { @@ -5894,7 +5894,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5903,7 +5903,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5927,7 +5927,7 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else @@ -5984,7 +5984,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5993,7 +5993,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6168,7 +6168,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -6177,7 +6177,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6201,11 +6201,11 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ #endif } ELSE @@ -6258,7 +6258,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -6267,7 +6267,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -7216,7 +7216,7 @@ void prep_tbe_exc_fx( #ifdef ISSUE_1836_replace_overflow_libcom pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7246,7 +7246,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ #ifdef ISSUE_1836_replace_overflow_libcom gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) @@ -7292,7 +7292,7 @@ void prep_tbe_exc_fx( Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ #endif move16(); } @@ -7302,13 +7302,13 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ #ifdef ISSUE_1836_replace_overflow_libcom Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat #else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ #endif move16(); } diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index a2646ae42..8ef395423 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -137,7 +137,7 @@ void TCX_MDCT( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } @@ -203,7 +203,7 @@ void TCX_MDST( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index f74bd7cc4..e86f48eed 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -1055,7 +1055,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x++; @@ -1078,7 +1078,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x += k; @@ -1459,9 +1459,9 @@ void PsychAdaptLowFreqDeemph( #ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_tmp ); /* Q15 */ #else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ #endif - fac = tmp; /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 4f1b26624..2cbc58cd4 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -323,7 +323,7 @@ Word16 usquant_fx( /* o: index of the winning codeword */ /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat @@ -337,12 +337,12 @@ Word16 usquant_fx( /* o: index of the winning codeword */ idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ #ifdef ISSUE_1836_replace_overflow_libcom *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #endif return idx; } @@ -421,7 +421,7 @@ Word32 sum2_fx( /* o : sum of all squared vector elements #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ #else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ #endif } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 1b744bd02..1fe679094 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -827,7 +827,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat @@ -845,7 +845,7 @@ void DTFS_to_fs_fx( L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ #endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -1363,7 +1363,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ #endif /* normalization */ na = norm_l( L_temp1 ); @@ -2042,7 +2042,7 @@ Word32 DTFS_setEngyHarm_fx( #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat #else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ #endif Lacc_max = L_max( Lacc_max, Lacc ); @@ -2137,7 +2137,7 @@ Word32 DTFS_setEngyHarm_fx( #ifdef ISSUE_1836_replace_overflow_libcom X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat #else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ #endif move16(); } @@ -2613,7 +2613,7 @@ void DTFS_to_erb_fx( #ifdef ISSUE_1836_replace_overflow_libcom out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat #else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ #endif move16(); IF( GT_16( count[i], 1 ) ) @@ -2799,7 +2799,7 @@ void erb_slot_fx( move16(); } #else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -4489,9 +4489,9 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4504,18 +4504,18 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat #else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ #endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4635,15 +4635,15 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat #else - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ #endif IF( sum ) { diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 7358abf95..71a986408 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -78,7 +78,7 @@ void ham_cos_window( #ifdef ISSUE_1836_replace_overflow_libcom fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From 4813aedab553c1a720832507532d31b64f7daed6 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 10:52:31 +0200 Subject: [PATCH 057/103] buildfix --- lib_com/hq2_noise_inject_fx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index f0ff54efa..6453f0412 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -665,6 +665,7 @@ void hq2_noise_inject_fx( tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat #else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ +#endif tmp = sub( fac_fx, tmp ); /*Q12 */ L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); -- GitLab From c5b94c20ff01f834dd9bcb79a61fb2b1ae5b1c6d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 10:58:21 +0200 Subject: [PATCH 058/103] clang patch --- lib_com/hq2_noise_inject_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 6453f0412..04bd5af34 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -666,8 +666,8 @@ void hq2_noise_inject_fx( #else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ #endif - tmp = sub( fac_fx, tmp ); /*Q12 */ - L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ + tmp = sub( fac_fx, tmp ); /*Q12 */ + L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); move32(); /*Q12 */ } -- GitLab From fb1b91045394e2632947562ecbab54980dc513a4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 11:24:18 +0200 Subject: [PATCH 059/103] checkout libdec and libenc from main --- lib_dec/FEC_HQ_core_fx.c | 34 +++--------------- lib_dec/FEC_fx.c | 23 ------------ lib_dec/LD_music_post_filter_fx.c | 14 ++------ lib_dec/acelp_core_switch_dec_fx.c | 6 ---- lib_dec/dec_higher_acelp_fx.c | 6 ---- lib_dec/dec_pit_exc_fx.c | 6 ---- lib_dec/dec_post_fx.c | 6 +--- lib_dec/er_util_fx.c | 6 ---- lib_dec/igf_dec_fx.c | 12 ------- lib_dec/ivas_dirac_dec_fx.c | 6 ---- lib_dec/ivas_stereo_dft_plc_fx.c | 6 ---- lib_dec/pvq_core_dec_fx.c | 6 ---- lib_dec/pvq_decode_fx.c | 4 --- lib_dec/swb_tbe_dec_fx.c | 8 ----- lib_dec/syn_outp_fx.c | 6 ---- lib_enc/arith_coder_enc_fx.c | 18 ---------- lib_enc/bass_psfilter_enc_fx.c | 10 +----- lib_enc/bw_detect_fx.c | 4 --- lib_enc/cod_tcx_fx.c | 22 ------------ lib_enc/core_enc_ol_fx.c | 4 --- lib_enc/enc_acelp_fx.c | 4 --- lib_enc/enc_higher_acelp_fx.c | 8 ----- lib_enc/enc_pit_exc_fx.c | 12 ++----- lib_enc/energy_fx.c | 6 ---- lib_enc/find_tilt_fx.c | 18 ++-------- lib_enc/find_uv_fx.c | 8 ----- lib_enc/hvq_enc_fx.c | 44 ++++++----------------- lib_enc/lsf_enc_fx.c | 56 ++---------------------------- lib_enc/lsf_msvq_ma_enc_fx.c | 4 --- lib_enc/nois_est_fx.c | 48 ++++++------------------- lib_enc/pitch_ol2_fx.c | 16 --------- lib_enc/pitch_ol_fx.c | 8 ----- lib_enc/pre_proc_fx.c | 6 ---- lib_enc/pvq_core_enc_fx.c | 24 ------------- lib_enc/pvq_encode_fx.c | 16 +++------ lib_enc/scale_enc_fx.c | 4 --- lib_enc/speech_music_classif_fx.c | 26 ++------------ lib_enc/swb_bwe_enc_fx.c | 12 ------- lib_enc/swb_bwe_enc_hr_fx.c | 4 --- lib_enc/swb_bwe_enc_lr_fx.c | 9 +++-- lib_enc/swb_tbe_enc_fx.c | 36 +------------------ lib_enc/tcx_ltp_enc_fx.c | 20 ----------- lib_enc/tcx_utils_enc_fx.c | 20 ----------- lib_enc/vad_fx.c | 20 ++--------- lib_enc/voiced_enc_fx.c | 38 +------------------- 45 files changed, 50 insertions(+), 624 deletions(-) diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 1be7453ab..a69584a32 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,11 +43,9 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Initialize */ @@ -80,11 +78,7 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); -#ifdef ISSUE_1796_replace_shl_o - b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ -#else b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ -#endif move32(); } @@ -168,11 +162,9 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; @@ -390,11 +382,7 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { -#ifdef ISSUE_1796_replace_shl_o - hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); -#else hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); -#endif move16(); k = add( k, 1 ); } @@ -530,12 +518,8 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } -#ifdef ISSUE_1796_replace_shl_o - tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ -#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ -#endif - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -819,12 +803,8 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } -#ifdef ISSUE_1796_replace_shl_o - tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ -#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ -#endif - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -1015,11 +995,9 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); // d1m @@ -1085,12 +1063,8 @@ static Word16 find_best_delay_fx( exp2 = norm_l( min_corr_fx ); L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); - tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ -#else - tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ -#endif + tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ + tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ } *false_flag = 0; diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 78594558b..48d91a87a 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -126,11 +126,7 @@ void FEC_exc_estim_fx( gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */ } -#ifdef ISSUE_1796_replace_shl_o - tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 ); -#else tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow ); -#endif gainCNG = s_min( gainCNG, tmp1 ); set16_fx( exc_dct_in, 0, L_FRAME16k ); @@ -191,15 +187,9 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1796_replace_shl_o - IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && - GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ - GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#else IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) && GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#endif { /* take the pitch value of last subframe of the previous frame */ *tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ); @@ -210,16 +200,9 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1796_replace_shl_o - IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && - GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ - GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#else IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) && GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#endif - { /* take the pitch value of last subframe of the previous frame */ *tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ); @@ -768,11 +751,9 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 { Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e; Word32 tmp_pit2; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif tmp_pit = BASOP_Util_Divide1616_Scale( new_pit /*Q0*/, Tc /*Q0*/, &tmp_pit_e ) /*Q15*/; @@ -782,11 +763,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/ BASOP_SATURATE_WARNING_OFF_EVS /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); -#else tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS *cond1 = sub( tmp_pit, negate( tmp_frame ) ); move16(); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index 4c3fa3728..12a13a4ec 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -599,11 +599,7 @@ static void spectrum_mod_dct_fx( Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/ e_binE = sub( add( e_tmp, e_binE ), 15 ); -#ifdef ISSUE_1799_replace_L_shr_o - Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ -#else - Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ -#endif + Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/ } @@ -905,10 +901,8 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif move32(); @@ -929,11 +923,7 @@ static Word16 norm_lfe( exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */ /* Need to shl by 3 to take into account the 3 multiplications */ } -#ifdef ISSUE_1796_replace_shl_o - tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ -#else - tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ -#endif + tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ return tmp16; } diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index f3e7a8594..109f360cb 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -872,12 +872,10 @@ static void decod_gen_voic_core_switch_fx( Word16 *pt1; GSC_DEC_HANDLE hGSCDec; hGSCDec = st_fx->hGSCDec; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif -#endif /*----------------------------------------------------------------------* @@ -968,11 +966,7 @@ static void decod_gen_voic_core_switch_fx( IF( st_fx->prev_bfi ) { /*gain_code = min(gain_code, 0.5f*gain_code+0.5f*st->lp_gainc);*/ -#ifdef ISSUE_1796_replace_shl_o - gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_sat( 16384 >> 3, st_fx->Q_exc ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */ -#else gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_o( 16384 >> 3, st_fx->Q_exc, &Overflow ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */ -#endif } FOR( i = 0; i < L_SUBFR; i++ ) diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index bc638b1a1..6144765a8 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -30,11 +30,9 @@ void transf_cdbk_dec_fx( Word32 L_tmp; Word32 dct_code32[L_SUBFR]; Word16 qdct; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Word16 avq_bit_sFlag; Word16 trgtSvPos; @@ -144,11 +142,7 @@ void transf_cdbk_dec_fx( } FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - code_preQ[i] = shl_sat( code_preQ[i], q_Code_preQ ); -#else code_preQ[i] = shl_o( code_preQ[i], q_Code_preQ, &Overflow ); -#endif move16(); /* code_preQ in Q6*/ } diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index e82394fbb..ca6660fab 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -73,11 +73,9 @@ void dec_pit_exc_fx( Word16 use_fcb; Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */ Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes */ -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif use_fcb = 0; @@ -250,11 +248,7 @@ void dec_pit_exc_fx( gain_pit_fx = st_fx->lp_gainp_fx; move16(); } -#ifdef ISSUE_1796_replace_shl_o - gain_code_fx = L_mult0( s_max( sub( 32767, shl_sat( gain_pit_fx, 1 ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/ -#else gain_code_fx = L_mult0( s_max( sub( 32767, shl_o( gain_pit_fx, 1, &Overflow ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/ -#endif } /*----------------------------------------------------------------------* diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index f11f851cb..37d088a8f 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -493,7 +493,7 @@ static void modify_pst_param_fx( Word16 tmp; Word16 lp_noiseQ12; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif @@ -502,11 +502,7 @@ static void modify_pst_param_fx( test(); IF( NE_16( coder_type, INACTIVE ) && LT_16( lp_noise, LP_NOISE_THR_FX ) ) { -#ifdef ISSUE_1796_replace_shl_o - lp_noiseQ12 = shl_sat( lp_noise, 4 ); /* to go from Q8 to Q12 */ -#else lp_noiseQ12 = shl_o( lp_noise, 4, &Overflow ); /* to go from Q8 to Q12 */ -#endif /* ftmp = lp_noise*BG1_FX + CG1_FX */ tmp = mac_r( CG1_FX * 65536L, lp_noiseQ12, BG1_FX * 8 ); /* x8 to go from Q12 to Q15 */ diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index 330cb5d44..cecbad294 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -44,22 +44,16 @@ void minimumStatistics_fx( Word16 f, p, i; Word16 tmp, tmp2, tmp_e; Word32 tmp32; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif aOpt_e = 0; move16(); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) ) -#else IF( LT_16( shl_o( currentFrameLevel, currentFrameLevel_e, &Overflow ), PLC_MIN_CNG_LEV ) ) -#endif { BASOP_SATURATE_WARNING_ON_EVS currentFrameLevel = PLC_MIN_CNG_LEV; /*Q15*/ diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 40b02c823..79953aaca 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2975,11 +2975,9 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in Word16 sfb; Word16 tmp; Word16 delta; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif set16_fx( a, 0, IGF_MAX_SFB + 1 ); @@ -2994,11 +2992,7 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in move16(); tmp = add( tmp, 1 ); delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] ); -#ifdef ISSUE_1796_replace_shl_o - delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) ); -#else delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) ); -#endif a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) ); move16(); IF( s_and( a[tmp], 1 ) != 0 ) @@ -3029,11 +3023,9 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han Word16 sfb; Word16 tmp; Word16 delta; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif set16_fx( a, 0, IGF_MAX_SFB + 1 ); @@ -3048,11 +3040,7 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han move16(); tmp = add( tmp, 1 ); delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] ); -#ifdef ISSUE_1796_replace_shl_o - delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) ); -#else delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) ); -#endif a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) ); move16(); // Rounding off delta values >=t+0.5 to t+1 diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 9de2904b8..370254a4e 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3244,16 +3244,10 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac; -#ifndef ISSUE_1796_replace_shl_o Flag flag = 0; move32(); -#endif fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); -#ifdef ISSUE_1796_replace_shl_o - fac = shl_sat( fac, exp ); -#else fac = shl_o( fac, exp, &flag ); -#endif IF( LT_16( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) ) { diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index fa4e914c5..3fed308b2 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -655,9 +655,7 @@ void stereo_dft_res_subst_spec_fx( /* Apply phase adjustment of identified peaks, including Np=1 peak neighbors on each side */ FOR( i = *num_plocs - 1; i >= 0; i-- ) { -#ifndef ISSUE_1796_replace_shl_o Flag flg_ov; -#endif IF( k == 0 ) { Word32 op; @@ -709,11 +707,7 @@ void stereo_dft_res_subst_spec_fx( move32(); } -#ifdef ISSUE_1796_replace_shl_o - cos_F = shl_sat( getCosWord16( extract_l( corr_phase ) ), 1 ); -#else cos_F = shl_o( getCosWord16( extract_l( corr_phase ) ), 1, &flg_ov ); -#endif sin_F = getSinWord16( extract_l( corr_phase ) ); idx = s_max( 0, sub( plocs[i], Np ) ); /* Iterate over plocs[i]-1:plocs[i]+1, considering the edges of the spectrum */ diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c index f9c2db757..93da9c77a 100644 --- a/lib_dec/pvq_core_dec_fx.c +++ b/lib_dec/pvq_core_dec_fx.c @@ -477,11 +477,9 @@ static void densitySymbolIndexDecode_fx( Word32 acc; Word16 alpha = 0; move16(); -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif IF( s_and( (Word16) 0xFFFE, density ) == 0 ) { @@ -494,11 +492,7 @@ static void densitySymbolIndexDecode_fx( sym_freq = L_deposit_l( 1 ); angle = atan2_fx( SQRT_DIM_fx[opp_sz], SQRT_DIM_fx[near_sz] ); // Q13 -#ifdef ISSUE_1796_replace_shl_o - angle = shl_sat( angle, 1 ); -#else angle = shl_o( angle, 1, &Overflow ); -#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); density_c = sub( density, c ); diff --git a/lib_dec/pvq_decode_fx.c b/lib_dec/pvq_decode_fx.c index c9ed050a2..649840f55 100644 --- a/lib_dec/pvq_decode_fx.c +++ b/lib_dec/pvq_decode_fx.c @@ -103,11 +103,7 @@ void pvq_decode_fx( Mpy_32_16_ss( L_isqrt, shl( y[i], shift_num ), &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *2*/ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 *2*/ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( L_tmp, shift_tot ); -#else L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); -#endif xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15 , array move */ move16(); } diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 09f5eda03..174f67f64 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -962,11 +962,7 @@ void ivas_wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ -#else shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ -#endif move16(); } n = sub( 14, n ); @@ -1609,11 +1605,7 @@ void wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ -#else shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ -#endif move16(); } n = sub( 14, n ); diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index 95b98e854..133ff17b4 100644 --- a/lib_dec/syn_outp_fx.c +++ b/lib_dec/syn_outp_fx.c @@ -67,11 +67,9 @@ void unscale_AGC( { Word16 i, fac, tmp, frame_fac, max_val; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*----------------------------------------------------------------* @@ -84,11 +82,7 @@ void unscale_AGC( max_val = s_max( max_val, abs_s( x[i] ) ); } BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( 30000, Qx ); /* saturation can occur here */ -#else tmp = shl_o( 30000, Qx, &Overflow ); /* saturation can occur here */ -#endif BASOP_SATURATE_WARNING_ON_EVS frame_fac = 0; move16(); diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 2e88b1f00..98a5173f5 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -367,12 +367,10 @@ static Word16 tcx_arith_rateloop( Word32 L_tmp; Word16 tmp, tmp3; Word32 tmp2; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif scale = tcx_arith_estimate_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, &tmp ); @@ -381,11 +379,7 @@ static Word16 tcx_arith_rateloop( scale_max = tcx_arith_find_max_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, exps, deadzone, scale_e ); -#ifdef ISSUE_1796_replace_shl_o - scale = shl_sat( scale, sub( tmp, *scale_e ) ); -#else scale = shl_o( scale, sub( tmp, *scale_e ), &Overflow ); -#endif scale = s_min( scale, scale_max ); scale_best = scale; @@ -446,11 +440,7 @@ static Word16 tcx_arith_rateloop( { /* Update estimator temporal compensation factor */ tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 1 << 9 ), bits, &s ); -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( mult_r( *target_bits_fac, tmp ), s ); -#else tmp = shl_o( mult_r( *target_bits_fac, tmp ), s, &Overflow ); -#endif tmp = s_min( tmp, 20480 /*1.25f Q14*/ ); tmp = s_max( tmp, 12288 /*0.75f Q14*/ ); *target_bits_fac = tmp; @@ -480,16 +470,8 @@ static Word16 tcx_arith_rateloop( { /* adjust = 1.25f * target_bits / (float)bits; */ tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 0x280 ), bits, &s ); -#ifdef ISSUE_1796_replace_shl_o - adjust = shl_sat( tmp, sub( s, 1 ) ); /* Q14 */ -#else adjust = shl_o( tmp, sub( s, 1 ), &Overflow ); /* Q14 */ -#endif -#ifdef ISSUE_1796_replace_shl_o - scale = shl_sat( mult_r( scale, adjust ), 1 ); -#else scale = shl_o( mult_r( scale, adjust ), 1, &Overflow ); -#endif scale = s_min( scale, scale_max ); } } diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index f417a0904..a241101ba 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -129,11 +129,7 @@ Word16 bass_pf_enc_fx( /* gain = tmp/nrg; */ gain = BASOP_Util_Divide3232_Scale( tmp, nrg, &tmp16 ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o - gain = shl_sat( gain, tmp16 ); /* Q15 */ -#else - gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ -#endif + gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ BASOP_SATURATE_WARNING_ON_EVS; if ( gain < 0 ) @@ -214,11 +210,7 @@ Word16 bass_pf_enc_fx( tmp32 = L_deposit_l( 1 ); tmp16 = BASOP_Util_Divide3232_Scale( tmp, tmp32, &st ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o - tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */ -#else tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */ -#endif if ( GT_16( tmp16, 16384 /*0.5f Q15*/ ) ) { diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index eeaf56969..6f2dad29a 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -297,11 +297,7 @@ void bw_detect_fx( FOR( i = 0; i < BWD_TOTAL_WIDTH; i++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - spect[i] = round_fx_o( L_shr_sat( spect32[i], Q_dct ), &Overflow ); -#else spect[i] = round_fx_o( L_shr_o( spect32[i], Q_dct, &Overflow ), &Overflow ); -#endif move16(); } Q_dct = -2; diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 2e46dba17..640a5ba3c 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,11 +1657,7 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); -#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS @@ -1781,11 +1777,7 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ -#ifdef ISSUE_1796_replace_shl_o - tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#else tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#endif s = 15 - 5 - 7; IF( L_spec >= 1024 ) { @@ -2745,11 +2737,7 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); -#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); -#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; @@ -3256,11 +3244,7 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); -#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS if ( GT_16( hTcxEnc->tcx_target_bits_fac, 20480 /*1.25 in Q14*/ ) ) @@ -4023,11 +4007,9 @@ void InternalTCXDecoder_fx( Word16 Aq_old_fx[M + 1]; Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1]; Word16 *xn_buf16 = (Word16 *) xn_buf32; -#if !defined( ISSUE_1772_replace_shr_o ) || !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy32( x_quant_fx, spectrum_fx, s_max( L_frame, L_spec ) ); @@ -4677,11 +4659,7 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); -#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); -#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 2f2682b8e..18f48e904 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -552,11 +552,7 @@ void core_encode_openloop_fx( /*v_sub(lsf_uq_rf, lsf_q_1st_rf, lsf_q_d_rf, M);*/ FOR( i = 0; i < M; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 ); -#else lsf_q_d_rf[i] = shl_o( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5, &Overflow ); -#endif move16(); /*input value is in Qx2.56, convert to Q6 to match table, quantizer table kept at Q6 to avoid losing precision */ /*Assume this difference data max range can be represented by Q6*/ diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index f6a8e65b2..4317bdbb3 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,11 +563,7 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn i = add( exp_xy, 1 - 1 ); /* -1 -> gain in Q14 */ i = sub( i, exp_yy ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - gain = shl_sat( gain, i ); /* saturation can occur here */ -#else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ -#endif BASOP_SATURATE_WARNING_ON_EVS /* gain = s_max(0, gain); */ /* see above xy < 0. */ diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 00b18f79d..5edc6229f 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -287,11 +287,7 @@ void transf_cdbk_enc_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); -#else x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); -#endif move16(); } @@ -643,11 +639,7 @@ void transf_cdbk_enc_ivas_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); -#else x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); -#endif move16(); } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 5f173cd7f..548e3f904 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -517,11 +517,7 @@ void enc_pit_exc_fx( } } -#ifdef ISSUE_1796_replace_shl_o - cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ -#else - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ -#endif + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } @@ -993,10 +989,6 @@ void enc_pit_exc_ivas_fx( } } -#ifdef ISSUE_1796_replace_shl_o - cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ -#else - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ -#endif + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } diff --git a/lib_enc/energy_fx.c b/lib_enc/energy_fx.c index cc0001d4a..0168e52b1 100644 --- a/lib_enc/energy_fx.c +++ b/lib_enc/energy_fx.c @@ -42,10 +42,8 @@ void est_energy_fx( const Word16 *Nregion_index; Word32 *sb_power = enerBuffer; Word32 Ltmp32 = 0; -#ifndef ISSUE_1799_replace_L_shr_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif move32(); SNR_sb_num = SNR_SUB_BAND_NUM[bandwidth - CLDFBVAD_NB_ID]; @@ -127,11 +125,7 @@ void est_energy_fx( tmpspec_amp = L_shl( sb_power[j], s16MaxCoefNorm ); /* sb_power_Q + s16MaxCoefNorm */ s32CopyPower = L_add( s32CopyPower, tmpspec_amp ); } -#ifdef ISSUE_1799_replace_L_shr_o - frame_sb_energy[i] = L_shr_sat( s32CopyPower, s16MaxCoefNorm ); /* sb_power_Q */ -#else frame_sb_energy[i] = L_shr_o( s32CopyPower, s16MaxCoefNorm, &Overflow ); /* sb_power_Q */ -#endif move32(); } diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index d2e946098..17a3a2b2b 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -175,11 +175,7 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_cnt ); /* exp(e_tmp + e_cnt) */ e_tmp = sub( e_tmp, e_cnt ); -#ifdef ISSUE_1799_replace_L_shr_o - lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ -#else - lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ -#endif + lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */ } @@ -207,11 +203,7 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_hpE ); /* exp(e_tmp + e_hpE) */ e_tmp = sub( e_tmp, e_hpE ); -#ifdef ISSUE_1799_replace_L_shr_o - ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ -#else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ -#endif + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ } ELSE IF( lp_E == 0 ) { @@ -474,11 +466,7 @@ void find_tilt_ivas_fx( m_hpE = extract_h( L_shl( hp_E[i], e_hpE ) ); // e_hpE+q_bckr-16 m_tmp = div_s( m_tmp, m_hpE ); // Q15+(e_tmp+q_lp_E)-(e_hpE+q_bckr) e_tmp = sub( add( e_tmp, q_lp_E ), add( e_hpE, q_bckr ) ); -#ifdef ISSUE_1799_replace_L_shr_o - ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ -#else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ -#endif + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ move32(); } diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c index 792ddf265..6114fb69b 100644 --- a/lib_enc/find_uv_fx.c +++ b/lib_enc/find_uv_fx.c @@ -178,11 +178,7 @@ Word16 find_uv_fx( /* o : coding type */ exp1 = sub( norm_l( *pt_enr_ssf1 ), 1 ); wtmp1 = extract_h( L_shl( *pt_enr_ssf1, exp1 ) ); fac = div_s( wtmp1, wtmp0 ); -#ifdef ISSUE_1799_replace_L_shr_o - fac_32 = L_shr_sat( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ) ); /* fac32 in Q13*/ -#else fac_32 = L_shr_o( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ), &Overflow ); /* fac32 in Q13*/ -#endif if ( GT_32( fac_32, dE1 ) ) { @@ -674,11 +670,7 @@ Word16 find_uv_ivas_fx( /* o : coding typ exp1 = sub( norm_l( *pt_enr_ssf1 ), 1 ); wtmp1 = extract_h( L_shl( *pt_enr_ssf1, exp1 ) ); fac = div_s( wtmp1, wtmp0 ); -#ifdef ISSUE_1799_replace_L_shr_o - fac_32 = L_shr_sat( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ) ); /* fac32 in Q13*/ -#else fac_32 = L_shr_o( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ), &Overflow ); /* fac32 in Q13*/ -#endif if ( GT_32( fac_32, dE1 ) ) { diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index f6c45dab2..a0acd0bfd 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -145,12 +145,8 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -180,22 +176,14 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */ expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */ /* Number of bits required to adjust to Q15 */ - adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif - IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ + adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ { lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o - Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#else Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#endif } ELSE { @@ -334,12 +322,8 @@ Word16 hvq_enc_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -369,22 +353,14 @@ Word16 hvq_enc_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */ expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */ /* Number of bits required to adjust to Q15 */ - adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif - IF( lb_nfpe > 16384 ) /* in Q15 */ + adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + IF( lb_nfpe > 16384 ) /* in Q15 */ { lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o - Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#else Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#endif } ELSE { diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 8db83c2b9..23ed7d0c2 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -784,11 +784,7 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o - En = L_mac_o( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ -#else En = L_mac_o( En, mult( pred_pow2[i], shl_o( w[i], 2, &Overflow ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ -#endif } cs = shl( cs, 1 ); @@ -2369,10 +2365,8 @@ static Word32 vq_lvq_lsf_enc( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif stagesVQ = sub( stages, 1 ); @@ -2424,25 +2418,13 @@ static Word32 vq_lvq_lsf_enc( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o - diff[j] = shl_sat( diff[j], 4 ); -#else diff[j] = shl_o( diff[j], 4, &Overflow ); -#endif move16(); } -#ifdef ISSUE_1796_replace_shl_o - L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif + L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ FOR( j = 1; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o - L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif } e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ move32(); @@ -2489,10 +2471,8 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif stagesVQ = sub( stages, 1 ); @@ -2561,25 +2541,13 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o - diff[j] = shl_sat( diff[j], 4 ); -#else diff[j] = shl_o( diff[j], 4, &Overflow ); -#endif move16(); } -#ifdef ISSUE_1796_replace_shl_o - L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif + L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ FOR( j = 1; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o - L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif } e[i] = L_tmp; move32(); @@ -3428,11 +3396,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o - temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow ); -#else temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_o( w_fx[i], 2, &Overflow ) ), yy_fx[i], &Overflow ); -#endif } cs = shl( cs, 1 ); temp_l = L_shr( temp_l, cs ); @@ -3636,17 +3600,9 @@ static void lsf_mid_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, 4 ); -#else tmp = shl_o( tmp, 4, &Overflow ); -#endif tmp = mult_ro( tmp, tmp, &Overflow ); -#ifdef ISSUE_1796_replace_shl_o - err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); -#else err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); -#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); @@ -3830,17 +3786,9 @@ static void lsf_mid_enc_ivas_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, 4 ); -#else tmp = shl_o( tmp, 4, &Overflow ); -#endif tmp = mult_ro( tmp, tmp, &Overflow ); -#ifdef ISSUE_1796_replace_shl_o - err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); -#else err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); -#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 981c7e51c..6056c0c46 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -1630,11 +1630,7 @@ void midlsf_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, 4 ); -#else tmp = shl_o( tmp, 4, &Overflow ); -#endif tmp = mult_ro( tmp, tmp, &Overflow ); err = L_mac( err, tmp, wghts[j] ); } diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 224e4dddb..7fb58941b 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -1211,11 +1211,7 @@ void noise_est_fx( /* calculation of energy in the rest of bands */ Ltmp2 = sum32_fx( &fr_bands[10], sub( st_fx->max_band, 9 ) ); -#ifdef ISSUE_1796_replace_shl_o - wtmp = shl_sat( 1, sub( add( Q_new, QSCALE ), 1 ) ); -#else wtmp = shl_o( 1, sub( add( Q_new, QSCALE ), 1 ), &Overflow ); -#endif test(); IF( L_msu( Ltmp, 100, wtmp ) < 0 || L_msu( Ltmp2, 100, wtmp ) < 0 ) @@ -1232,11 +1228,7 @@ void noise_est_fx( ExpDen = norm_l( Ltmp ); den = extract_h( L_shl( Ltmp, ExpDen ) ); num = div_s( num, den ); -#ifdef ISSUE_1799_replace_L_shr_o - noise_chartmp = extract_h( L_shr_sat( num, add( sub( ExpNum, ExpDen ), 4 - 16 ) ) ); /* Q11 */ -#else noise_chartmp = extract_h( L_shr_o( num, add( sub( ExpNum, ExpDen ), 4 - 16 ), &Overflow ) ); /* Q11 */ -#endif } noise_chartmp = s_min( noise_chartmp, (Word16) 10 << 11 ); /* Q11 */ @@ -1335,11 +1327,7 @@ void noise_est_fx( den = extract_h( L_shl( Lden, ExpDen ) ); num = div_s( num, den ); Ltmp = Mult_32_16( non_sta, num ); -#ifdef ISSUE_1799_replace_L_shr_o - non_sta = L_shr_sat( Ltmp, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */ @@ -1374,11 +1362,7 @@ void noise_est_fx( den = extract_h( L_shl( Lden, ExpDen ) ); num = div_s( num, den ); Ltmp1 = Mult_32_16( Lnon_sta2, num ); -#ifdef ISSUE_1799_replace_L_shr_o - Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] @@ -2564,12 +2548,8 @@ void noise_est_ivas_fx( ELSE { /* ftemp2 /= ftemp */ - num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp -#ifdef ISSUE_1796_replace_shl_o - noise_chartmp = shl_sat( num, sub( sub( exp, exp2 ), 4 ) ); // 15+exp2-exp1 -> Q11 -#else - noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 -#endif + num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp + noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 } if ( ncharX != NULL ) @@ -2697,13 +2677,9 @@ void noise_est_ivas_fx( ExpDen = norm_l( Lden ); den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16 - num = div_s( num, den ); // 15+ExpNum-ExpDen - Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15 -#ifdef ISSUE_1799_replace_L_shr_o - non_sta = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + num = div_s( num, den ); // 15+ExpNum-ExpDen + Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15 + non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */ @@ -2740,13 +2716,9 @@ void noise_est_ivas_fx( ExpDen = norm_l( Lden ); den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16 - num = div_s( num, den ); // 15+ExpNum-ExpDen - Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15 -#ifdef ISSUE_1799_replace_L_shr_o - Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + num = div_s( num, den ); // 15+ExpNum-ExpDen + Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15 + Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] + (1.0f - alpha2) * (enr[i]) */ diff --git a/lib_enc/pitch_ol2_fx.c b/lib_enc/pitch_ol2_fx.c index de47d85af..cbeea8f1d 100644 --- a/lib_enc/pitch_ol2_fx.c +++ b/lib_enc/pitch_ol2_fx.c @@ -294,11 +294,7 @@ void StableHighPitchDetect_fx( tmp = abs_s( tmp ); tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1799_replace_L_shr_o - diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) ); -#else diff = L_negate( L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ) ); -#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } @@ -306,11 +302,7 @@ void StableHighPitchDetect_fx( { tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1799_replace_L_shr_o - diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ); -#else diff = L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } @@ -517,11 +509,7 @@ void StableHighPitchDetect_ivas_fx( tmp = abs_s( tmp ); tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1799_replace_L_shr_o - diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) ); -#else diff = L_negate( L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ) ); -#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } @@ -529,11 +517,7 @@ void StableHighPitchDetect_ivas_fx( { tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1799_replace_L_shr_o - diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ); -#else diff = L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } diff --git a/lib_enc/pitch_ol_fx.c b/lib_enc/pitch_ol_fx.c index d4e3284da..79c55821e 100644 --- a/lib_enc/pitch_ol_fx.c +++ b/lib_enc/pitch_ol_fx.c @@ -751,11 +751,7 @@ void pitch_ol_fx( Ltmp = L_mult0( cor_buf[ind], enr1 ); qCorX = add( sub( 15, enr1_exp ), sub( 14, pt_exp1[ind] ) ); -#ifdef ISSUE_1799_replace_L_shr_o - corX[i][j] = extract_h( L_shr_sat( Ltmp, sub( qCorX, 31 ) ) ); -#else corX[i][j] = extract_h( L_shr_o( Ltmp, sub( qCorX, 31 ), &Overflow ) ); -#endif qCorX = 31; move16(); @@ -792,11 +788,7 @@ void pitch_ol_fx( Ltmp = L_mult0( cor_buf[ind1 + len_x], enr1 ); qCorX = add( sub( 15, enr1_exp ), sub( 14, pt_exp3[ind1] ) ); -#ifdef ISSUE_1799_replace_L_shr_o - corX[i][j + NSECT] = extract_h( L_shr_sat( Ltmp, qCorX - 31 ) ); -#else corX[i][j + NSECT] = extract_h( L_shr_o( Ltmp, qCorX - 31, &Overflow ) ); -#endif qCorX = 31; move16(); diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 8a3cf1a00..dc3ec020a 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -126,11 +126,9 @@ void pre_proc_fx( LPD_state_HANDLE hLPDmem = st->hLPDmem; FD_BWE_ENC_HANDLE hBWE_FD = st->hBWE_FD; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif /*------------------------------------------------------------------* @@ -1048,11 +1046,7 @@ void pre_proc_fx( test(); IF( ( ( st->tcxonly == 0 ) || ( EQ_16( st->codec_mode, MODE1 ) ) ) && GT_32( st->input_Fs, 8000 ) ) { -#ifdef ISSUE_1796_replace_shl_o - st->mem_preemph_enc = shl_sat( new_inp_16k[sub( L_frame_tmp, 1 )], 1 ); -#else st->mem_preemph_enc = shl_o( new_inp_16k[sub( L_frame_tmp, 1 )], 1, &Overflow ); -#endif move16(); } diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index a5e193461..e2d5fb264 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,11 +267,9 @@ void pvq_encode_frame_ivas_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -333,11 +331,7 @@ void pvq_encode_frame_ivas_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o - gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); -#else gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); -#endif move16(); if ( gopt[is] == 0 ) @@ -397,11 +391,9 @@ void pvq_encode_frame_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -463,11 +455,7 @@ void pvq_encode_frame_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o - gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); -#else gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); -#endif move16(); if ( gopt[is] == 0 ) { @@ -943,11 +931,9 @@ static void densityIndexSymbolEncode_ivas_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif sym_freq = L_deposit_l( 1 ); @@ -955,11 +941,7 @@ static void densityIndexSymbolEncode_ivas_fx( IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); -#ifdef ISSUE_1796_replace_shl_o - angle = shl_sat( angle, 1 ); -#else angle = shl_o( angle, 1, &Overflow ); -#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); @@ -1026,11 +1008,9 @@ static void densityIndexSymbolEncode_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif sym_freq = L_deposit_l( 1 ); @@ -1038,11 +1018,7 @@ static void densityIndexSymbolEncode_fx( IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); -#ifdef ISSUE_1796_replace_shl_o - angle = shl_sat( angle, 1 ); -#else angle = shl_o( angle, 1, &Overflow ); -#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); diff --git a/lib_enc/pvq_encode_fx.c b/lib_enc/pvq_encode_fx.c index d08b8a902..749a39ed9 100644 --- a/lib_enc/pvq_encode_fx.c +++ b/lib_enc/pvq_encode_fx.c @@ -359,12 +359,8 @@ void pvq_encode_ivas_fx( } Mpy_32_16_ss( L_isqrt, tmp, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) +1 */ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 +1 */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ -#else - L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ -#endif - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ + L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ + xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ move16(); L_xq[i] = L_tmp; /* Q31 currently unused */ move32(); @@ -571,12 +567,8 @@ void pvq_encode_fx( } Mpy_32_16_ss( L_isqrt, tmp, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) +1 */ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 +1 */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ -#else - L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ -#endif - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ + L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ + xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ move16(); L_xq[i] = L_tmp; /* Q31 currently unused */ move32(); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index 32633c89d..76eae22b7 100644 --- a/lib_enc/scale_enc_fx.c +++ b/lib_enc/scale_enc_fx.c @@ -98,11 +98,7 @@ void Preemph_scaled( BASOP_SATURATE_WARNING_OFF_EVS Overflow = 0; -#ifdef ISSUE_1796_replace_shl_o - QVal = shl_sat( 1, sub( 15, bits ) ); -#else QVal = shl_o( 1, sub( 15, bits ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS mu = shr( Preemph_factor, bits ); /* Q15 --> Q(15-bits) */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 0c4a4ec23..59f3b35f6 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1500,19 +1500,11 @@ static Word16 attack_det_fx( /* o : attack flag exp1 = norm_s( att_3lsub_pos ); tmp = div_s( shl( 1, sub( 14, exp1 ) ), att_3lsub_pos ); /*Q(29-exp1) */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( finc[0], Qx ); /*Qx */ -#else - L_tmp = L_shr_o( finc[0], Qx, &Overflow ); /*Qx */ -#endif + L_tmp = L_shr_o( finc[0], Qx, &Overflow ); /*Qx */ FOR( i = 1; i < att_3lsub_pos; i++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i], Qx ), &Overflow ); /*Qx */ -#else - L_tmp = L_add_o( L_tmp, L_shr_o( finc[i], Qx, &Overflow ), &Overflow ); /*Qx */ -#endif + L_tmp = L_add_o( L_tmp, L_shr_o( finc[i], Qx, &Overflow ), &Overflow ); /*Qx */ } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ @@ -1521,18 +1513,10 @@ static Word16 attack_det_fx( /* o : attack flag exp1 = norm_s( tmp1 ); tmp = div_s( shl( 1, sub( 14, exp1 ) ), tmp1 ); /*Q(29-exp1) */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( finc[attack], Qx ); /*Qx */ -#else - L_tmp = L_shr_o( finc[attack], Qx, &Overflow ); /*Qx */ -#endif + L_tmp = L_shr_o( finc[attack], Qx, &Overflow ); /*Qx */ FOR( i = 1; i < tmp1; i++ ) { -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i + attack], Qx ), &Overflow ); /*Qx */ -#else L_tmp = L_add_o( L_tmp, L_shr_o( finc[i + attack], Qx, &Overflow ), &Overflow ); /*Qx */ -#endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp2 = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ @@ -3778,11 +3762,7 @@ static void spec_analysis_fx( test(); IF( GT_16( peak_idx[k], valey_idx[i] ) && LT_16( peak_idx[k], valey_idx[i + 1] ) ) { -#ifdef ISSUE_1796_replace_shl_o - p2v[k] = sub_o( shl_sat( peak[k], 1 ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); -#else p2v[k] = sub_o( shl_o( peak[k], 1, &Overflow ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); -#endif move16(); k = add( k, 1 ); } diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 40fefd684..6b309c334 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -1059,20 +1059,12 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class expd = sub( sub( 30, expd ), shl( st_fx->prev_Q_shb, 1 ) ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - num = shl_sat( num, scale ); -#else num = shl_o( num, scale, &Overflow ); -#endif expn = sub( expn, scale ); tmp = div_s( num, den ); expn = sub( expn, expd ); -#ifdef ISSUE_1796_replace_shl_o - gain_tmp = shl_sat( tmp, sub( expn, 1 ) ); /*Q14 */ -#else gain_tmp = shl_o( tmp, sub( expn, 1 ), &Overflow ); /*Q14 */ -#endif } test(); IF( EQ_16( hBWE_FD->prev_mode, TRANSIENT ) ) @@ -1172,11 +1164,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class } test(); -#ifdef ISSUE_1796_replace_shl_o - IF( GT_16( sharp, 4608 ) && GT_16( peak, shl_sat( 1, add( Q_syn, 3 ) ) ) ) -#else IF( GT_16( sharp, 4608 ) && GT_16( peak, shl_o( 1, add( Q_syn, 3 ), &Overflow ) ) ) -#endif { k = add( k, 1 ); move16(); diff --git a/lib_enc/swb_bwe_enc_hr_fx.c b/lib_enc/swb_bwe_enc_hr_fx.c index f510a1cb6..8b5a17353 100644 --- a/lib_enc/swb_bwe_enc_hr_fx.c +++ b/lib_enc/swb_bwe_enc_hr_fx.c @@ -767,11 +767,7 @@ void swb_bwe_enc_hr_fx( FOR( i = 0; i < Nsv2 * WIDTH_BAND; i++ ) { L_tmp = L_mult( temp, t_audio_fx[i] ); -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( L_tmp, temp2 ); -#else L_tmp = L_shr_o( L_tmp, temp2, &Overflow ); -#endif t_audio_fx[i] = round_fx_o( L_tmp, &Overflow ); move16(); } diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index 3c92c7f89..938cdd971 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -174,15 +174,14 @@ static Word16 GetSubbandCorrIndex2_har_fx( /* o : L_corr_sq = L_mult_o( corr_sq_hi_fx, corr_sq_hi_fx, &Overflow ); /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */ L_corr_sq = L_shr_o( L_corr_sq, s_min( shl( exp_norm, 1 ), 31 ), &Overflow ); /* (QCorr-16)*2+1 */ - if ( Overflow != 0 ) + IF( Overflow != 0 ) { L_corr_sq = 0x0L; - move32(); + move16(); + Overflow = 0; + move16(); } - Overflow = 0; - move16(); - /* normalize for L_lagCorr_sq and L_corr_sq */ L_buf = L_or( L_lagCorr_sq, L_corr_sq ); exp_corr = norm_l( L_buf ); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index d396418e4..ec11d2837 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4683,29 +4683,17 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); -#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - sig = shl_sat( oriSHB[i], scaling ); -#else sig = shl_o( oriSHB[i], scaling, &Overflow ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -4884,29 +4872,17 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); -#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - sig = shl_sat( oriSHB[i], scaling ); -#else sig = shl_o( oriSHB[i], scaling, &Overflow ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -6238,11 +6214,9 @@ static void determine_gain_weights_fx( Word16 j; Word16 exp, exp1, frac, tmp, exp2; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif FOR( j = 0; j < dims; j++ ) @@ -6264,11 +6238,7 @@ static void determine_gain_weights_fx( { exp2 = sub( exp, 2 ); } -#ifdef ISSUE_1796_replace_shl_o - weights[j] = shl_sat( tmp, exp2 ); -#else weights[j] = shl_o( tmp, exp2, &Overflow ); -#endif move16(); /* Q12 */ } ELSE @@ -7455,12 +7425,8 @@ void fb_tbe_enc_fx( { tmp = div_s( tmp2, tmp ); L_tmp = L_deposit_h( tmp ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*Q(31-exp)*/ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_max( L_shr_sat( L_tmp, sub( 31, exp ) ), 0x1 ); /* Q0 */ -#else + L_tmp = Isqrt_lc( L_tmp, &exp ); /*Q(31-exp)*/ L_tmp = L_max( L_shr_o( L_tmp, sub( 31, exp ), &Overflow ), 0x1 ); /* Q0 */ -#endif } ELSE { diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index a069f99b4..84f83a311 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -86,12 +86,10 @@ static void tcx_ltp_pitch_search( Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif delta = 16; @@ -183,11 +181,7 @@ static void tcx_ltp_pitch_search( temp_m = divide1616( extract_h( L_shl( cor_max, s ) ), temp_m ); temp_e = sub( negate( s ), temp_e ); -#ifdef ISSUE_1796_replace_shl_o - *norm_corr = shl_sat( temp_m, temp_e ); -#else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); -#endif IF( GE_16( t1, pitfr1 ) ) { @@ -301,11 +295,9 @@ static void tcx_ltp_pitch_search_ivas_fx( Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif delta = 16; @@ -393,11 +385,7 @@ static void tcx_ltp_pitch_search_ivas_fx( temp_m = divide1616( extract_h( L_shl( cor_max, s ) ), temp_m ); temp_e = sub( negate( s ), temp_e ); -#ifdef ISSUE_1796_replace_shl_o - *norm_corr = shl_sat( temp_m, temp_e ); -#else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); -#endif test(); IF( check_border_case && EQ_16( t1, t0_min ) ) @@ -544,11 +532,7 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - g = shl_sat( g, sub( s1, s2 ) ); -#else g = shl_o( g, sub( s1, s2 ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ @@ -599,11 +583,7 @@ static void tcx_ltp_find_gain_ivas_fx( Word16 *speech /*Qx*/, Word16 *pred_speec g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ -#else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ -#endif BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index bdf473aab..0b94e74fa 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2072,18 +2072,12 @@ void QuantizeGain( Word16 n, Word16 *pGain, Word16 *pGain_e, Word16 *pQuantizedG Word16 ener, ener_e, enerInv, enerInv_e, gain, gain_e; Word16 quantizedGain; Word32 tmp32; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif -#ifdef ISSUE_1796_replace_shl_o - ener = mult_r( shl_sat( n, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#else ener = mult_r( shl_o( n, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#endif ener_e = 15 - 5 - 7; move16(); IF( GE_16( n, 1024 ) ) @@ -2153,12 +2147,10 @@ void tcx_noise_factor_fx( Word16 c1, c2; Word16 att; /* noise level attenuation factor for transient windows */ Word32 xMax; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif assert( nTransWidth <= 16 ); @@ -2254,11 +2246,7 @@ void tcx_noise_factor_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ -#ifdef ISSUE_1796_replace_shl_o - att = shl_sat( att, s ); -#else att = shl_o( att, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2461,11 +2449,7 @@ void tcx_noise_factor_fx( tmp1 = BASOP_Util_Divide3232_Scale( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); s = add( add( add( s, x_orig_e ), inv_gain2_e ), 7 - 15 ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o - tmp1 = shl_sat( tmp1, s ); -#else tmp1 = shl_o( tmp1, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2621,11 +2605,7 @@ void tcx_noise_factor_ivas_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ -#ifdef ISSUE_1796_replace_shl_o - att = shl_sat( att, s ); -#else att = shl_o( att, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 955c7c74d..8f1fb6985 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1014,11 +1014,7 @@ Word16 wb_vad_fx( m_num = shr( m_num, 1 ); shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); -#ifdef ISSUE_1799_replace_L_shr_o - L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ -#else L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ -#endif } ELSE { @@ -1051,11 +1047,7 @@ Word16 wb_vad_fx( shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); -#ifdef ISSUE_1799_replace_L_shr_o - L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ -#else L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ -#endif } ELSE { @@ -1087,11 +1079,7 @@ Word16 wb_vad_fx( snr_sumt = add( snr_sumt, shr( snr, 4 ) ); /*Q4 */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ -#else - tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ -#endif + tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ IF( LT_16( i, 2 ) ) { tmp = add_o( tmp, delta1, &Overflow ); /*Q13 */ @@ -1160,11 +1148,7 @@ Word16 wb_vad_fx( shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); -#ifdef ISSUE_1799_replace_L_shr_o - L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ -#else - L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ -#endif + L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ } ELSE { diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 0de0285d5..8081b2909 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -558,11 +558,7 @@ ivas_error ppp_voiced_encoder_fx( } /* Bump up if big change between the previous and the current CWs */ -#ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { /*if ( res_enratio > 5.0 && tmp < 0.65 ) */ /* 5 in Q11, 0.65 in Q15 // L_shl(tmp_fx,sub(31,Qtmp)) makes tmp_fx FIXED Q31 */ @@ -589,11 +585,7 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampdown frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ -#ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif + IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ { /* if (res_enratio < 0.025) */ IF( LT_32( L_shl_o( res_enratio_fx, 4, &Overflow ), 819 ) ) /*0x0333 = 0.025 in Q15, res_enratio_fx in Q15 after shl 4 */ @@ -621,11 +613,7 @@ ivas_error ppp_voiced_encoder_fx( /* if (min(res_enratio, sp_enratio) < 0.075 && tmp < -0.5f)) : 2458 = 0.075 in Q15 */ test(); -#ifdef ISSUE_1796_replace_shl_o - if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_sat( -1, sub( Qtmp, 1 ) ) ) ) -#else if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_o( -1, sub( Qtmp, 1 ), &Overflow ) ) ) -#endif { hSC_VBR->bump_up = 1; move16(); @@ -633,11 +621,7 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampup frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ -#ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { IF( GT_32( res_enratio_fx, 29696 ) ) /*14.5 in Q11 */ { @@ -756,11 +740,7 @@ ivas_error ppp_voiced_encoder_fx( expb = sub( 30, add( expb, Qadj ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fracb = shl_sat( fracb, scale ); -#else fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -793,11 +773,7 @@ ivas_error ppp_voiced_encoder_fx( /* Ltmp1_32 = 0.8f * st->prev_cw_en */ Ltmp1_32 = Mult_32_16( hSC_VBR->prev_cw_en_fx, 26214 ); /* Q = (Q_prev_cw_en_fx + Q15+1)-Q16 = Q_prev_cw_en_fx */ -#ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { /* if ( DTFS_getEngy(*CURRP_NQ) > 0.8f * st->prev_cw_en && max(pos_nq, neg_nq) > 3.0f && st->rate_control ) */ /* pos_nq_fx and neg_nq_fx in Q28 ???? */ @@ -917,11 +893,7 @@ ivas_error ppp_voiced_encoder_fx( test(); test(); test(); -#ifdef ISSUE_1796_replace_shl_o - IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_sat( 1, sub( Qtmpres, 1 ) ) ) ) ) -#else IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_o( 1, sub( Qtmpres, 1 ), &Overflow ) ) ) ) -#endif { /* if ((pos_q > neg_q) && ((pos_q>3.0*pos_nq0) || ((pos_q > 1.5*pos_nq0) && (neg_q < 1.5*neg_nq0)))) */ test(); @@ -1098,11 +1070,7 @@ ivas_error ppp_voiced_encoder_fx( move16(); } -#ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ -#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ -#endif { /* if ((( tmp < 3.05 && max(res_enratio,sp_enratio) > 0.8 ) && (st->rate_control))|| (( tmp < 2.8 && max(res_enratio,sp_enratio) > 0.65 ) && (!st->rate_control))) */ @@ -1437,11 +1405,7 @@ static Word32 DTFS_freq_corr_fx( scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fracb = shl_sat( fracb, scale ); -#else fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); -- GitLab From 3b69f3108345453e10767d720bcdafce7d3129c7 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 11:49:20 +0200 Subject: [PATCH 060/103] checkout lib_com from main --- lib_com/arith_coder_fx.c | 30 +- lib_com/basop_util.c | 45 --- lib_com/bitalloc_fx.c | 22 +- lib_com/cldfb_evs_fx.c | 16 -- lib_com/cldfb_fx.c | 15 - lib_com/cng_exc_fx.c | 97 +------ lib_com/codec_tcx_common_fx.c | 22 -- lib_com/deemph_fx.c | 51 +--- lib_com/edct_fx.c | 50 +--- lib_com/env_stab_fx.c | 12 - lib_com/fd_cng_com_fx.c | 42 +-- lib_com/fft_fx_evs.c | 436 +---------------------------- lib_com/frame_ener_fx.c | 38 +-- lib_com/get_gain_fx.c | 19 -- lib_com/gs_bitallocation_fx.c | 14 +- lib_com/gs_bitallocation_ivas_fx.c | 13 - lib_com/gs_gains_fx.c | 64 +---- lib_com/gs_noisefill_fx.c | 90 ++---- lib_com/hp50_fx.c | 70 ----- lib_com/hq2_bit_alloc_fx.c | 13 - lib_com/hq2_core_com_fx.c | 27 -- lib_com/hq2_noise_inject_fx.c | 66 +---- lib_com/ifft_rel_fx.c | 82 ------ lib_com/interpol_fx.c | 13 - lib_com/low_rate_band_att_fx.c | 37 +-- lib_com/lpc_tools_fx.c | 130 +-------- lib_com/lsf_tools_fx.c | 132 ++------- lib_com/lsp_conv_poly_fx.c | 86 ------ lib_com/math_op.c | 30 -- lib_com/modif_fs_fx.c | 196 ++----------- lib_com/oper_32b.c | 28 -- lib_com/options.h | 72 ----- lib_com/phase_dispersion_fx.c | 16 -- lib_com/ppp_fx.c | 16 -- lib_com/pred_lt4_fx.c | 40 +-- lib_com/preemph_fx.c | 44 --- lib_com/pvq_com_fx.c | 19 -- lib_com/residu_fx.c | 46 --- lib_com/stat_noise_uv_mod_fx.c | 44 +-- lib_com/swb_bwe_com_fx.c | 20 -- lib_com/swb_bwe_com_lr_fx.c | 196 +++++-------- lib_com/swb_tbe_com_fx.c | 265 ++---------------- lib_com/syn_filt_fx.c | 50 ---- lib_com/tcx_ltp_fx.c | 15 - lib_com/tcx_mdct_fx.c | 26 +- lib_com/tcx_utils_fx.c | 36 +-- lib_com/tns_base.c | 12 - lib_com/tools_fx.c | 203 +------------- lib_com/weight_a_fx.c | 13 - lib_com/wi_fx.c | 419 ++------------------------- lib_com/window_fx.c | 18 +- 51 files changed, 288 insertions(+), 3268 deletions(-) mode change 100644 => 100755 lib_com/options.h diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index ff272b8c8..846b4dcea 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -10,12 +10,6 @@ #include "basop_proto_func.h" #include "cnst.h" -#ifndef ISSUE_1836_FILEACTIVE_arith_coder_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /* Fixed point implementation of exp(negate()) */ Word32 expfp( /* o: Q31 */ const Word16 x, /* i: mantissa Q-e */ @@ -200,12 +194,10 @@ void tcx_arith_scale_envelope( Word16 statesi, bits; Word32 mean, a, s, L_tmp; Word16 mean_e, tmp, tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif lob_bits = 0; @@ -231,12 +223,8 @@ void tcx_arith_scale_envelope( tmp = norm_l( env[k] ); tmp2 = sub( 15, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = Inv16( round_fx_sat( L_shl( env[k], tmp ) ), &tmp2 ); /* exp(tmp2) */ -#else tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */ -#endif - ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ + ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ move32(); mean = L_add( mean, ienv[k] ); /* Q16 */ } @@ -268,11 +256,7 @@ void tcx_arith_scale_envelope( b_e = add( b_e, mean_e ); /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ) ); -#else tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow ); -#endif IF( tmp <= 0 ) { @@ -287,11 +271,7 @@ void tcx_arith_scale_envelope( tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); /* exp(scale) */ scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = shl_sat( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */ -#else scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */ -#endif /* iscale = 1.0f / scale; */ iscale_e = 0; @@ -340,11 +320,7 @@ void tcx_arith_scale_envelope( L_tmp = L_add( L_tmp, L_shl( Mpy_32_16_1( env[k], mult_r( 1147 /*0.035f Q15*/, iscale ) ), iscale_e ) ); /* Q16 */ tmp = norm_l( L_tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - statesi = mult_r( statesi, round_fx_sat( L_shl( L_tmp, tmp ) ) ); -#else statesi = mult_r( statesi, round_fx_o( L_shl_o( L_tmp, tmp, &Overflow ), &Overflow ) ); -#endif bits = add( bits, sub( 15, tmp ) ); tmp = norm_s( statesi ); @@ -431,11 +407,7 @@ void tcx_arith_scale_envelope( *s_env_e = sub( add( 15, iscale_e ), tmp ); move16(); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - a = L_shl_sat( 1265000, sub( 15, *s_env_e ) ); -#else a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; FOR( k = 0; k < L_frame; k++ ) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index dd3310a7f..ee959cf6f 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -45,13 +45,6 @@ #include "basop_settings.h" #include "cnst.h" -#ifndef ISSUE_1836_FILEACTIVE_basop_util_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - extern const Word32 SqrtTable[32]; // Q31 extern const Word16 SqrtDiffTable[32]; /* Q15 */ @@ -274,11 +267,9 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a Word16 preShift, postShift; Word16 m; Word32 m32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif assert( b_m != 0 ); @@ -312,11 +303,7 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a /* normalize result */ postShift = norm_l( m32 ); -#ifdef ISSUE_1836_replace_overflow_libcom - m = round_fx_sat( L_shl( m32, postShift ) ); -#else m = round_fx_o( L_shl( m32, postShift ), &Overflow ); -#endif /* exponent */ *ptrResult_e = sub( add( add( a_e, sub( 1, b_e ) ), preShift ), postShift ); @@ -332,9 +319,7 @@ static Word16 Sqrt16_common( Word16 m, Word16 e ) { Word16 index, frac; -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; -#endif assert( ( m >= 0x4000 ) || ( m == 0 ) ); @@ -349,13 +334,9 @@ static Word16 Sqrt16_common( Word16 m, /* interpolate */ if ( m != 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - m = mac_r_sat( SqrtTable[index], SqrtDiffTable[index], frac ); -#else BASOP_SATURATE_WARNING_OFF_EVS; m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow ); BASOP_SATURATE_WARNING_ON_EVS; -#endif } /* handle odd exponents */ @@ -371,19 +352,13 @@ static Word32 Sqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif assert( ( m >= 0x40000000 ) || ( m == 0 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - m16 = round_fx_sat( m ); -#else m16 = round_fx_o( m, &Overflow ); -#endif /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 9) - 32; */ @@ -439,23 +414,16 @@ static Word32 ISqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif assert( m >= 0x40000000 ); -#ifdef ISSUE_1836_replace_overflow_libcom - m16 = round_fx_sat( m ); -#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL m16 = round_fx_o( m, &Overflow ); #else m16 = round_fx( m ); #endif -#endif - /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 25) - 32; */ @@ -922,11 +890,9 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) { Word16 z; Word32 sign; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif sign = L_and( L_xor( L_num, L_denom ), (Word32) 0x80000000 ); @@ -940,11 +906,7 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) L_denom = L_shl( L_denom, z ); /* round_fx instead of extract_h improves spectral distortion in E_UTIL_lev_dur (schur version). */ -#ifdef ISSUE_1836_replace_overflow_libcom - z = div_l( L_num, round_fx_sat( L_denom ) ); -#else z = div_l( L_num, round_fx_o( L_denom, &Overflow ) ); -#endif if ( 0 != sign ) { z = negate( z ); @@ -2088,21 +2050,14 @@ Word32 norm_llQ31( /* o : normalized result Q31 */ Word16 i; Word32 L_tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; -#endif Flag Carry = 0; #endif /* BASOP_NOGLOB */ /* Move MSBit of L_sum into L_c */ Carry = 0; -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1 */ - L_c = L_add_c( L_c, L_c, &Carry ); -#else L_tmp = L_add_co( L_sum, L_sum, &Carry, &Overflow ); /* L_tmp = L_sum << 1 */ L_c = L_add_co( L_c, L_c, &Carry, &Overflow ); -#endif L_add( 0, 0 ); test(); IF( ( L_c != (Word32) 0L ) && ( L_c != (Word32) 0xFFFFFFFFL ) ) diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index c3bcd3c8a..30ae2d47b 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_bitalloc_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif void bitalloc_fx( Word16 *y, /* i : reordered norm of sub-vectors Q0 */ Word16 *idx, /* i : reordered sub-vector indices Q0 */ @@ -29,11 +23,9 @@ void bitalloc_fx( Word16 diff, temp; Word16 fac; Word16 ii; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Word16 SFM_thr = SFM_G1G2; move16(); @@ -62,11 +54,7 @@ void bitalloc_fx( move16(); FOR( m = 1; m < im; m++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - v = sub_sat( temp, y[m] ); /* Q0 */ -#else - v = sub_o( temp, y[m], &Overflow ); /* Q0 */ -#endif + v = sub_o( temp, y[m], &Overflow ); /* Q0 */ temp = s_max( temp, y[m] ); if ( v < 0 ) { @@ -257,11 +245,9 @@ Word16 BitAllocF_fx( Word16 tmp, exp1, exp2; Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */ Word16 B_w16_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif set32_fx( Rsubband_w32_fx, 0, NB_SFM ); @@ -456,11 +442,7 @@ Word16 BitAllocF_fx( exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ -#ifdef ISSUE_1836_replace_overflow_libcom - m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ -#else - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ -#endif + m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ if ( L_tmp1 < 0 ) { m_fx = negate( m_fx ); diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 77437a485..51c9ee6f9 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -48,12 +48,6 @@ #define N40 ( 20 ) #define N60 ( 30 ) -#ifndef ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs ); @@ -1246,11 +1240,9 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( k = 0; k < numberCols; k++ ) @@ -1337,11 +1329,7 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } @@ -1364,11 +1352,7 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 877e2f48f..886a23758 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -51,11 +51,6 @@ #define restrict #endif -#ifndef ISSUE_1836_FILEACTIVE_cldfb_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*-------------------------------------------------------------------* * Local prototypes @@ -1506,11 +1501,9 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( k = 0; k < numberCols; k++ ) @@ -1597,11 +1590,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } @@ -1624,11 +1613,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 1f4ee4da4..e335e9435 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" #include "ivas_rom_com_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_cng_exc_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ @@ -621,11 +615,9 @@ void cng_params_postupd_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); @@ -652,16 +644,10 @@ void cng_params_postupd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ -#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -739,11 +725,9 @@ void cng_params_postupd_ivas_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); @@ -770,16 +754,10 @@ void cng_params_postupd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ -#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); // To do : Saturation to be re-validated. sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); @@ -883,12 +861,10 @@ void cng_params_upd_fx( Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif /* update the pointer to circular buffer of old LSP vectors */ @@ -926,15 +902,9 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); - pt_exc2++; - L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#endif } } ELSE /* L_FRAME16k */ @@ -945,22 +915,12 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); - pt_exc2++; - L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#endif } } -#ifdef ISSUE_1836_replace_overflow_libcom - L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#else - L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#endif + L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; @@ -994,16 +954,10 @@ void cng_params_upd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -1086,11 +1040,9 @@ void cng_params_upd_ivas_fx( move16(); Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* update the pointer to circular buffer of old LSP vectors */ @@ -1128,15 +1080,9 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); - pt_exc2++; - L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#endif } } ELSE /* L_FRAME16k */ @@ -1147,22 +1093,12 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); - pt_exc2++; - L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#endif } } -#ifdef ISSUE_1836_replace_overflow_libcom - L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#else - L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#endif + L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; @@ -1196,21 +1132,12 @@ void cng_params_upd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ - L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ - tmp = add( add( Q_exc, Q_exc ), 1 ); - sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); -#endif move32(); /* Q6 */ ptR++; ptI--; diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index a3c8cb258..52c7d0614 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -11,12 +11,6 @@ #include "rom_basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif #define inv_int InvIntTable Word16 tcxGetNoiseFillingTilt( @@ -67,11 +61,9 @@ void tcxFormantEnhancement( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ @@ -147,11 +139,7 @@ void tcxFormantEnhancement( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); -#else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -239,11 +227,9 @@ void tcxFormantEnhancement_with_shift( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ @@ -323,11 +309,7 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); -#else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -372,11 +354,7 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); -#else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index e0720a44f..9516202c1 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -39,12 +39,7 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_deemph_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif void deemph_fx_32( Word32 *signal, /* i/o: signal Qx*/ const Word16 mu, /* i : deemphasis factor Q15*/ @@ -98,34 +93,22 @@ void deemph_fx( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); #endif + L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/ signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ -#else - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ - L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ - signal[0] = round_fx_sat( L_tmp ); /*Qx*/ -#endif - - move16(); FOR( i = 1; i < L; i++ ) { - L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ - signal[i] = round_fx_sat( L_tmp ); /*Qx*/ -#else - L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ - signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ -#endif + L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ + L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ + signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ move16(); } @@ -148,12 +131,10 @@ void Deemph2( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); -#endif #endif /* saturation can occur in L_mac() */ @@ -163,12 +144,8 @@ void Deemph2( FOR( i = 1; i < L; i++ ) { - L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ -#ifdef ISSUE_1836_replace_overflow_libcom - x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ -#else - x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ -#endif + L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ + x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ move16(); } @@ -198,12 +175,10 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); -#endif #endif /* signal[0] = signal[0] + mu * (*mem); */ @@ -213,13 +188,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W shift = shr( -32768, shift ); /*Q15 - shift*/ FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/ - x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ -#else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ -#endif + L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ move16(); } } @@ -227,13 +197,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/ - x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ -#else L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ -#endif move16(); } } diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 3c3f6fafb..1b303d285 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -13,11 +13,6 @@ #include "math_32.h" -#ifndef ISSUE_1836_FILEACTIVE_edct_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */ { @@ -401,12 +396,10 @@ void edct_16fx( const Word16 *px, *pt; Word16 *py; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); -#endif #endif /*COMPLETE: some eDCT sub function are missing */ @@ -462,22 +455,13 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */ - re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ - move16(); - L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ - Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */ - im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ -#else + L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow ); /*Q(Qx+16) */ re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ move16(); L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ Lacc = L_msu_o( L_tmp, x[i2], *pt, &Overflow ); /*Q(Qx+16) */ im2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ -#endif move16(); px -= 2; pt--; @@ -502,20 +486,12 @@ void edct_16fx( fact = round_fx( L_shl( L_tmp, 2 ) ); /*Q15 */ FOR( i = 0; i < shr( length, 1 ); i++ ) { - tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ -#ifdef ISSUE_1836_replace_overflow_libcom - re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */ -#else - re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ -#endif + tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ + re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ move16(); - tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ -#ifdef ISSUE_1836_replace_overflow_libcom - im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */ -#else - im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ -#endif + tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ + im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ move16(); } @@ -526,24 +502,14 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ - move16(); - - L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ - Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ - *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ -#else - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ + Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ -#endif move16(); py -= 2; diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index 839d39c4f..a3140b4e4 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -43,12 +43,6 @@ #include "rom_com.h" #include "wmc_auto.h" #include "stl.h" - -#ifndef ISSUE_1836_FILEACTIVE_env_stab_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*--------------------------------------------------------------------------* * Local constants *--------------------------------------------------------------------------*/ @@ -193,11 +187,9 @@ Word16 env_stab_smo_fx( /* Q0 */ Word16 maxval, pp[NUM_ENV_STAB_PLC_STATES], pa[NUM_ENV_STAB_PLC_STATES]; Word16 i; Word16 tmp, sum, exp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* get previous state */ prev_state = maximum_fx( env_stab_state_p, NUM_ENV_STAB_PLC_STATES, &maxval ); @@ -234,11 +226,7 @@ Word16 env_stab_smo_fx( /* Q0 */ /*tmp = shl(tmp, add(exp, 1));*/ /* Q15 */ FOR( i = 0; i < NUM_ENV_STAB_PLC_STATES; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - env_stab_state_p[i] = round_fx_sat( L_shl_sat( L_mult_sat( env_stab_state_p[i], tmp ), add( exp, 1 ) ) ); /* Q15 */ -#else env_stab_state_p[i] = round_fx_o( L_shl_o( L_mult_o( env_stab_state_p[i], tmp, &Overflow ), add( exp, 1 ), &Overflow ), &Overflow ); /* Q15 */ -#endif move16(); } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 8ff5eb489..7cc536822 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -21,12 +21,6 @@ #define CNG_HS 4 /* 4 bit headroom for dot product */ #define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */ -#ifndef ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------- * Local function prototypes *-------------------------------------------------------------------*/ @@ -653,13 +647,12 @@ void minimum_statistics( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif + len2 = i_mult( MSNUMSUBFR, len ); msM_win = hFdCngCom->msM_win; @@ -757,11 +750,7 @@ void minimum_statistics( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } -#ifdef ISSUE_1836_replace_overflow_libcom - scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); -#else scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); -#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -911,11 +900,7 @@ void minimum_statistics( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); -#else tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); -#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -1003,13 +988,8 @@ void minimum_statistics( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); - move32(); -#else msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); move32(); -#endif BASOP_SATURATE_WARNING_ON_EVS; } } @@ -1266,12 +1246,10 @@ void minimum_statistics_fx( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif len2 = i_mult( MSNUMSUBFR, len ); @@ -1371,11 +1349,7 @@ void minimum_statistics_fx( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } -#ifdef ISSUE_1836_replace_overflow_libcom - scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); -#else scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); -#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -1532,11 +1506,7 @@ void minimum_statistics_fx( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); -#else tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); -#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -1624,11 +1594,7 @@ void minimum_statistics_fx( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); -#else msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); -#endif move32(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -2313,12 +2279,10 @@ static void getmidbands( ) { Word16 j, max_psize, shift; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif max_psize = psize[0]; @@ -2352,11 +2316,7 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp) -#else psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) -#endif move16(); } /* minimum_statistics needs fixed exponent of 6 */ diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index ce1bd52ea..b6f2bb2ac 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -32,12 +32,6 @@ static void fft64_16fx( Word16 *x, Word16 *y, const Word16 *Idx ); static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx ); static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w ); -#ifndef ISSUE_1836_FILEACTIVE_fft_fx_evs_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #include "math_32.h" /*-----------------------------------------------------------------* @@ -1192,11 +1186,9 @@ static void fft5_32_16fx( Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7; Word16 i0, i1, i2, i3, i4; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif i0 = Idx[0]; move16(); @@ -1224,15 +1216,9 @@ static void fft5_32_16fx( move16(); T6 = zRe[i3]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - T7 = add_sat( T5, T6 ); //??sat - T8 = add_sat( T4, T7 ); //??sat - Tt = sub_sat( T5, T6 ); //??sat -#else T7 = add_o( T5, T6, &Overflow ); T8 = add_o( T4, T7, &Overflow ); Tt = sub_o( T5, T6, &Overflow ); -#endif /* T9 = KP559016994 * (T4 - T7); */ L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) T9 = round_fx_sat( L_tmp ); // Qx @@ -1254,17 +1240,11 @@ static void fft5_32_16fx( L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) Tn = round_fx_sat( L_tmp ); // Qx -#ifdef ISSUE_1836_replace_overflow_libcom - zRe[i0] = add_sat( T1, T8 ); //??sat - move16(); - zIm[i0] = add_sat( To, Tp ); //??sat - move32(); -#else + zRe[i0] = add_o( T1, T8, &Overflow ); move16(); zIm[i0] = add_o( To, Tp, &Overflow ); move32(); -#endif /*T2 = KP951056516*Te + KP587785252*Th; */ L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x) @@ -1281,16 +1261,6 @@ static void fft5_32_16fx( T4 = add_sat( T9, T6 ); T5 = sub_sat( T6, T9 ); -#ifdef ISSUE_1836_replace_overflow_libcom - zRe[i3] = sub_sat( T4, T2 ); //??sat - move32(); - zRe[i1] = add_sat( T5, T3 ); //??sat - move32(); - zRe[i2] = add_sat( T4, T2 ); //??sat - move32(); - zRe[i4] = sub_sat( T5, T3 ); //??sat - move32(); -#else zRe[i3] = sub_o( T4, T2, &Overflow ); move32(); zRe[i1] = add_o( T5, T3, &Overflow ); @@ -1299,7 +1269,6 @@ static void fft5_32_16fx( move32(); zRe[i4] = sub_o( T5, T3, &Overflow ); move32(); -#endif /* T2 = KP951056516 * Ts + KP587785252 * Tt; */ L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x) @@ -1706,11 +1675,9 @@ static void cftfsub_16fx( { Word16 j, j1, j2, j3, l; Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif l = 2; @@ -1764,15 +1731,6 @@ static void cftfsub_16fx( { FOR( j = 0; j < l; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - x0r = sub_sat( a[j], a[j1] ); //??sat - x0i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - a[j] = add_sat( a[j], a[j1] ); //??sat - move16(); - a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); //??sat - move16(); -#else j1 = add_o( j, l, &Overflow ); x0r = sub_o( a[j], a[j1], &Overflow ); x0i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); @@ -1780,7 +1738,6 @@ static void cftfsub_16fx( move16(); a[j + 1] = add_o( a[j + 1], a[j1 + 1], &Overflow ); move16(); -#endif a[j1] = x0r; move16(); a[j1 + 1] = x0i; @@ -1805,84 +1762,11 @@ static void cft1st_16fx( Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; Word16 tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif - -#ifdef ISSUE_1836_replace_overflow_libcom - x0r = add_sat( a[0], a[2] ); //??sat - x0i = add_sat( a[1], a[3] ); //??sat - x1r = sub_sat( a[0], a[2] ); //??sat - x1i = sub_sat( a[1], a[3] ); //??sat - x2r = add_sat( a[4], a[6] ); //??sat - x2i = add_sat( a[5], a[7] ); //??sat - x3r = sub_sat( a[4], a[6] ); //??sat - x3i = sub_sat( a[5], a[7] ); //??sat - a[0] = add_sat( x0r, x2r ); //??sat - move16(); - a[1] = add_sat( x0i, x2i ); //??sat - move16(); - a[4] = sub_sat( x0r, x2r ); //??sat - move16(); - a[5] = sub_sat( x0i, x2i ); //??sat - move16(); - a[2] = sub_sat( x1r, x3i ); //??sat - move16(); - a[3] = add_sat( x1i, x3r ); //??sat - move16(); - a[6] = add_sat( x1r, x3i ); //??sat - move16(); - a[7] = sub_sat( x1i, x3r ); //??sat - wk1r = w[2]; - move32(); - - x0r = add_sat( a[8], a[10] ); //??sat - x0i = add_sat( a[9], a[11] ); //??sat - x1r = sub_sat( a[8], a[10] ); //??sat - x1i = sub_sat( a[9], a[11] ); //??sat - x2r = add_sat( a[12], a[14] ); //??sat - x2i = add_sat( a[13], a[15] ); //??sat - x3r = sub_sat( a[12], a[14] ); //??sat - x3i = sub_sat( a[13], a[15] ); //??sat - a[8] = add_sat( x0r, x2r ); //??sat - move16(); - a[9] = add_sat( x0i, x2i ); //??sat - move16(); - a[12] = sub_sat( x2i, x0i ); //??sat - move16(); - a[13] = sub_sat( x0r, x2r ); //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - tmp = sub_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - - a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - tmp = add_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat - a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct)*/ //??sat - move16(); - - x0r = add_sat( x3i, x1r ); //??sat - x0i = sub_sat( x3r, x1i ); //??sat - tmp = sub_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat - a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - tmp = add_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - k1 = 0; - move16(); -#else x0r = add_o( a[0], a[2], &Overflow ); x0i = add_o( a[1], a[3], &Overflow ); x1r = sub_o( a[0], a[2], &Overflow ); @@ -1952,7 +1836,6 @@ static void cft1st_16fx( move16(); k1 = 0; move16(); -#endif FOR( j = 16; j < n; j += 16 ) { @@ -1973,118 +1856,6 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ -#ifdef ISSUE_1836_replace_overflow_libcom - x0r = add_sat( a[j], a[j + 2] ); //??sat - x0i = add_sat( a[j + 1], a[j + 3] ); //??sat - x1r = sub_sat( a[j], a[j + 2] ); //??sat - x1i = sub_sat( a[j + 1], a[j + 3] ); //??sat - x2r = add_sat( a[j + 4], a[j + 6] ); //??sat - x2i = add_sat( a[j + 5], a[j + 7] ); //??sat - x3r = sub_sat( a[j + 4], a[j + 6] ); //??sat - x3i = sub_sat( a[j + 5], a[j + 7] ); //??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat - move16(); - - x0r = sub_sat( x0r, x2r ); //??sat - x0i = sub_sat( x0i, x2i ); //??sat - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); - x0i = add_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = add_sat( x1r, x3i ); - x0i = sub_sat( x1i, x3r ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - wk1r = w[k2 + 2]; - move32(); - wk1i = w[k2 + 3]; - move32(); - L_tmp = L_shl( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ - wk3r = L_sub( wk1r, L_shl( L_tmp, 1 ) ); /*Q30 */ - - L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ - wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ - - x0r = add_sat( a[j + 8], a[j + 10] ); //??sat - x0i = add_sat( a[j + 9], a[j + 11] ); //??sat - x1r = sub_sat( a[j + 8], a[j + 10] ); //??sat - x1i = sub_sat( a[j + 9], a[j + 11] ); //??sat - x2r = add_sat( a[j + 12], a[j + 14] ); //??sat - x2i = add_sat( a[j + 13], a[j + 15] ); //??sat - x3r = sub_sat( a[j + 12], a[j + 14] ); //??sat - x3i = sub_sat( a[j + 13], a[j + 15] ); //??sat - a[j + 8] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 9] = add_sat( x0i, x2i ); //??sat - move16(); - - x0r = sub_sat( x0r, x2r ); //??sat - x0i = sub_sat( x0i, x2i ); //??sat - tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = add_sat( x1r, x3i ); //??sat - x0i = sub_sat( x1i, x3r ); //??sat - - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); -#else x0r = add_o( a[j], a[j + 2], &Overflow ); x0i = add_o( a[j + 1], a[j + 3], &Overflow ); x1r = sub_o( a[j], a[j + 2], &Overflow ); @@ -2195,7 +1966,6 @@ static void cft1st_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 15] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); -#endif } return; @@ -2218,44 +1988,13 @@ static void cftmdl_16fx( Word16 tmp, tmp2; Word32 L_tmp; Word32 L_x0r, L_x0i; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif m = shl( l, 2 ); FOR( j = 0; j < l; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat - move16(); - a[j2] = sub_sat( x0r, x2r ); //??sat - move16(); - a[j2 + 1] = sub_sat( x0i, x2i ); //??sat - move16(); - a[j1] = sub_sat( x1r, x3i ); //??sat - move16(); - a[j1 + 1] = add_sat( x1i, x3r ); //??sat - move16(); - a[j3] = add_sat( x1r, x3i ); //??sat - move16(); - a[j3 + 1] = sub_sat( x1i, x3r ); //??sat - move16(); -#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2283,7 +2022,6 @@ static void cftmdl_16fx( move16(); a[j3 + 1] = sub_o( x1i, x3r, &Overflow ); move16(); -#endif } wk1r = w[2]; @@ -2291,51 +2029,6 @@ static void cftmdl_16fx( tmp2 = add( l, m ); FOR( j = m; j < tmp2; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat - move16(); - a[j2] = sub_sat( x2i, x0i ); //??sat - move16(); - a[j2 + 1] = sub_sat( x0r, x2r ); //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - tmp = sub_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - tmp = add_sat( x0r, x0i ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = add_sat( x3i, x1r ); //??sat - x0i = sub_sat( x3r, x1i ); //??sat - tmp = sub_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - tmp = add_sat( x0i, x0r ); //??sat - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); -#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2379,7 +2072,6 @@ static void cftmdl_16fx( L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); -#endif } k1 = 0; @@ -2406,63 +2098,6 @@ static void cftmdl_16fx( tmp2 = add( l, k ); FOR( j = k; j < tmp2; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat - move16(); - - x0r = sub_sat( x0r, x2r ); //??sat - x0i = sub_sat( x0i, x2i ); //??sat - - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_x0r = L_add( (Word32) x1r, (Word32) x3i ); - L_x0i = L_sub( (Word32) x1i, (Word32) x3r ); - x0r = extract_l( L_x0r ); - x0i = extract_l( L_x0i ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); -#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2518,88 +2153,20 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); -#endif } wk1r = w[k2 + 2]; move32(); wk1i = w[k2 + 3]; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ //??sat - wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ //??sat - - L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ //??sat - wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ //??sat - tmp2 = add( l, add( k, m ) ); -#else L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */ wk3r = L_sub_o( wk1r, L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q30 */ L_tmp = L_shl_o( Mult_32_32( wk2r, wk1r ), 1, &Overflow ); /*Q29 */ wk3i = L_sub_o( L_shl_o( L_tmp, 1, &Overflow ), wk1i, &Overflow ); /*Q30 */ tmp2 = add( l, add( k, m ) ); -#endif FOR( j = add( k, m ); j < tmp2; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - j1 = add_sat( j, l ); //??sat - j2 = add_sat( j1, l ); //??sat - j3 = add_sat( j2, l ); //??sat - x0r = add_sat( a[j], a[j1] ); //??sat - x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat - x1r = sub_sat( a[j], a[j1] ); //??sat - x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat - x2r = add_sat( a[j2], a[j3] ); //??sat - x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat - x3r = sub_sat( a[j2], a[j3] ); //??sat - x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat - a[j] = add_sat( x0r, x2r ); //??sat - move16(); - a[j + 1] = add_sat( x0i, x2i ); //??sat - move16(); - - x0r = sub_sat( x0r, x2r ); //??sat - x0i = sub_sat( x0i, x2i ); //??sat - - tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = sub_sat( x1r, x3i ); //??sat - x0i = add_sat( x1i, x3r ); //??sat - - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - x0r = add_sat( x1r, x3i ); //??sat - x0i = sub_sat( x1i, x3r ); //??sat - - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat - move16(); -#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2656,7 +2223,6 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); -#endif } } diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index ed46494ee..68fdf33c3 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -40,13 +40,6 @@ #include "cnst.h" #include "prot_fx.h" #include "wmc_auto.h" - -#ifndef ISSUE_1836_FILEACTIVE_frame_ener_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*----------------------------------------------------------------------------------* * fer_energy() * @@ -246,20 +239,14 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 const Word16 *pt1; Word16 tmp16, exp1, exp2, tmp1, tmp2; Word16 len, enern; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif /* len = (0.5f * (pitch[2]/64.0 + pitch[3]/64.0) + 0.5f) */ -#ifdef ISSUE_1836_replace_overflow_libcom - len = mult_r( add_sat( pitch[2], pitch[3] ), 256 ); //??sat -#else len = mult_r( add_o( pitch[2], pitch[3], &Overflow ), 256 ); -#endif if ( LT_16( len, L_SUBFR ) ) { @@ -289,29 +276,16 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 exp1 = sub( 15 + exp1, tmp2 ); /*add ld(2^exp1)=exp1 but check format, first*/ - tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ //??sat -#else - Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ -#endif - exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/ //??sat -#else - Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ -#endif + tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ + Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ + exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ + Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ /*make 10*log10 out of log2*/ - Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ -#ifdef ISSUE_1836_replace_overflow_libcom - *frame_ener = extract_h( L_shl_sat( Ltmp, add( tmp16, 1 ) ) ); /*Q8*/ //??sat - move16(); - enern = sub_sat( *frame_ener, lp_speech ); /*Q8*/ //??sat -#else + Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ *frame_ener = extract_h( L_shl_o( Ltmp, add( tmp16, 1 ), &Overflow ) ); /*Q8*/ move16(); enern = sub_o( *frame_ener, lp_speech, &Overflow ); /*Q8*/ -#endif + return enern; } diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index ab7024371..8ec4f5a40 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -39,12 +39,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_get_gain_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*----------------------------------------------------------------------------------* * get_gain() * @@ -59,12 +53,10 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 exp_c, exp_e, exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif tcorr = L_deposit_l( 0 ); @@ -78,13 +70,8 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) tcorr = Dot_product16HQ( 0, x, y, n, &exp_c ); tener = Dot_productSq16HQ( 0, y, n, &exp_e ); -#ifdef ISSUE_1836_replace_overflow_libcom - BASOP_Util_Divide_MantExp( round_fx_sat( tcorr ), exp_c, s_max( round_fx_sat( tener ), 1 ), exp_e, &tmp, &exp ); //??sat - Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat -#else BASOP_Util_Divide_MantExp( round_fx_o( tcorr, &Overflow ), exp_c, s_max( round_fx_o( tener, &Overflow ), 1 ), exp_e, &tmp, &exp ); Lgain = L_shl_o( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ), &Overflow ) /*Q16*/; -#endif return Lgain; } @@ -97,11 +84,9 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 m_corr, m_ener, negative, Q_corr, Q_ener; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif negative = 0; @@ -145,11 +130,7 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) Q_corr = sub( Q_corr, Q_ener ); -#ifdef ISSUE_1836_replace_overflow_libcom - Lgain = L_shl_sat( L_deposit_l( m_corr ), add( Q_corr, 1 ) ); /* Lgain in Q16 */ //??sat -#else Lgain = L_shl_o( L_deposit_l( m_corr ), add( Q_corr, 1 ), &Overflow ); /* Lgain in Q16 */ -#endif if ( negative != 0 ) { diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index beb402b5d..0ce59482f 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -9,12 +9,6 @@ #include "assert.h" /* Debug prototypes */ #include "stl.h" -#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*==================================================================================*/ /* FUNCTION : void bands_and_bit_alloc_fx(); */ /*----------------------------------------------------------------------------------*/ @@ -83,10 +77,8 @@ void bands_and_bit_alloc_fx( Word16 w_sum_bit; (void) GSC_IVAS_mode; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif nb_tot_bands = MBANDS_GN; move16(); @@ -101,12 +93,8 @@ void bands_and_bit_alloc_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ -#ifdef ISSUE_1836_replace_overflow_libcom - ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ //??sat -#else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ -#endif - Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ + Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; move16(); IF( EQ_16( L_frame, L_FRAME16k ) ) diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 601eb92d7..9243f640e 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -33,13 +33,6 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const #define Q31_0_02 42949673 /* 0.02 */ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ - -#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -112,10 +105,8 @@ void bands_and_bit_alloc_ivas_fx( Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; /* Q18 */ Word16 w_sum_bit; Word16 fzero_val; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif nb_tot_bands = MBANDS_GN; move16(); @@ -129,11 +120,7 @@ void bands_and_bit_alloc_ivas_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ -#ifdef ISSUE_1836_replace_overflow_libcom - ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ //??sat -#else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ -#endif move16(); Copy( Ener_per_bd_iQ + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index a00fbd829..f28af742f 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -43,12 +43,6 @@ #include "stl.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_gs_gains_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -90,11 +84,9 @@ void Comp_and_apply_gain_fx( Word16 y_gain; Word16 L16, frac, exp1, tmp_exp; Word32 L32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Recreate excitation for local synthesis and decoder */ @@ -116,15 +108,9 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */ //??sat - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */ //??sat - move16(); -#else L32 = L_shl_o( L_mult( exc_diffQ[i], y_gain ), tmp_exp, &Overflow ); /*Q_exc+16 */ exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc */ move16(); -#endif } } ELSE @@ -140,22 +126,14 @@ void Comp_and_apply_gain_fx( y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); -#else Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); -#endif move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */ //??sat //??sat -#else + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ exc_diffQ[i] = round_fx_o( L_shl_o( L32, tmp_exp, &Overflow ), &Overflow ); /*Q_exc */ -#endif move16(); } } @@ -179,11 +157,9 @@ void Comp_and_apply_gain_ivas_fx( Word16 L16, frac, exp1, tmp_exp; Word32 L32; Word16 Q_exc_diffQ[L_FRAME16k]; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Recreate excitation for local synthesis and decoder */ @@ -205,12 +181,8 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat -#else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ -#endif + L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ move16(); IF( exc_diffQ[i] ) { @@ -229,29 +201,21 @@ void Comp_and_apply_gain_ivas_fx( * y_gain = pow(10.0, (Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) * = pow(2, 3.321928*(Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) *-----------------------------------------------------------------*/ - L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ - L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ - L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ - y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ -#else - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ -#endif - move16(); /*Q1 */ + L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ + L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ + L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ + frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ + y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ + Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ + move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat -#else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ -#endif + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ move16(); IF( exc_diffQ[i] ) { diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index bc350e165..208f20569 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -6,12 +6,6 @@ #include "rom_com.h" #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * gs_noisf() * @@ -417,11 +411,9 @@ static void Decreas_freqPeak_fx( Word16 lsf_new_diff[M]; Word16 tmp, tmp1, exp; Word16 tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif move16(); /*ptr init*/ lsf_new_diff[0] = 0; /* prevent unitialized value */ @@ -478,15 +470,11 @@ static void Decreas_freqPeak_fx( { tmp = abs_s( *src ); exp = norm_s( max_val ); - tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ - L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat -#else + tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ + L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ -#endif - tmp = sub( 32767, tmp ); /*Q14 */ - L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ + tmp = sub( 32767, tmp ); /*Q14 */ + L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ tmp = round_fx( L_shl( L_tmp, 1 ) ); tmp1 = negate( tmp ); @@ -540,11 +528,9 @@ static void envelop_modify_fx( Word16 weight_fx; Word32 L_exc_diffQ_fx[L_FRAME16k], exc_diffQ_max; Word16 Q_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif start_band = i_mult( last_bin, 16 ); @@ -579,11 +565,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat -#else - Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ -#endif + Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ FOR( j = 0; j < 16; j++ ) { @@ -609,11 +591,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat -#else - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ -#endif + Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ src_fx = &exc_diffQ_fx[224]; FOR( j = 0; j < 32; j++ ) @@ -712,11 +690,9 @@ void highband_exc_dct_in_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -732,15 +708,9 @@ void highband_exc_dct_in_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = shl_sat( tmp, exp ); //??sat - move16(); - ener = add_sat( tmp1, ener ); /*Q0 */ //??sat -#else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ -#endif + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ } test(); @@ -969,14 +939,10 @@ void highband_exc_dct_in_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat -#else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ -#endif + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ } } @@ -1011,15 +977,9 @@ void highband_exc_dct_in_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; -#ifdef ISSUE_1836_replace_overflow_libcom - *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat - move16(); - tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat -#else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ -#endif if ( tmp2 > 0 ) { *src = tmp; @@ -1108,11 +1068,9 @@ void highband_exc_dct_in_ivas_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -1128,15 +1086,9 @@ void highband_exc_dct_in_ivas_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = shl_sat( tmp, exp ); //??sat - move16(); - ener = add_sat( tmp1, ener ); /*Q0 */ //??sat -#else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ -#endif + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ } test(); @@ -1480,14 +1432,10 @@ void highband_exc_dct_in_ivas_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat -#else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ -#endif + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ } } @@ -1522,15 +1470,9 @@ void highband_exc_dct_in_ivas_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; -#ifdef ISSUE_1836_replace_overflow_libcom - *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat - move16(); - tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat -#else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ -#endif IF( tmp2 > 0 ) { *src = tmp; diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index f3eb49db6..4a055e073 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -40,11 +40,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_hp50_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif #define HP20_COEFF_SCALE ( 2 ) /* @@ -91,11 +86,9 @@ static void filter_2nd_order( Word16 i; Word16 x2, x1; Word32 L_sum, L_y1, L_y2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif /* @@ -114,18 +107,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat -#else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); -#endif - BASOP_SATURATE_WARNING_ON_EVS BASOP_SATURATE_ERROR_ON_EVS @@ -136,17 +121,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat -#else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS move16(); @@ -162,17 +140,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat -#else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS /* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */ BASOP_SATURATE_ERROR_ON_EVS @@ -183,17 +154,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat -#else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS move16(); } @@ -226,11 +190,9 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { Word32 a1, b1, a2, b2; Word16 prescale, prescaleOld, diff; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif prescale = getScaleFactor16( signal, lg ); @@ -240,11 +202,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { prescale = s_min( prescale, diff ); } -#ifdef ISSUE_1836_replace_overflow_libcom - diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat -#else diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); -#endif if ( mem[3] != 0 ) { prescale = s_min( prescale, diff ); @@ -254,15 +212,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * IF( prescale != prescaleOld ) { diff = sub( prescale, prescaleOld ); -#ifdef ISSUE_1836_replace_overflow_libcom - mem[0] = L_shr_sat( mem[0], diff ); //??sat - move32(); - mem[1] = L_shr_sat( mem[1], diff ); //??sat - move32(); - mem[2] = L_shr_sat( mem[2], diff ); //??sat - move32(); - mem[3] = L_shr_sat( mem[3], diff ); //?sat -#else mem[0] = L_shr_o( mem[0], diff, &Overflow ); move32(); mem[1] = L_shr_o( mem[1], diff, &Overflow ); @@ -270,7 +219,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * mem[2] = L_shr_o( mem[2], diff, &Overflow ); move32(); mem[3] = L_shr_o( mem[3], diff, &Overflow ); -#endif move32(); mem[4] = L_deposit_l( prescale ); } @@ -355,9 +303,7 @@ void hp20_fx_32( Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; -#endif Word16 prescale, prescaleOld, prescale_current_frame, diff; prescale = getScaleFactor32( signal_fx, lg ); @@ -366,14 +312,8 @@ void hp20_fx_32( prescaleOld = extract_l( mem_fx[4] ); -#ifdef ISSUE_1836_replace_overflow_libcom - diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat - diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat -#else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); -#endif - diff = L_max( diff_pos, diff_neg ); @@ -385,15 +325,6 @@ void hp20_fx_32( prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); -#ifdef ISSUE_1836_replace_overflow_libcom - mem_fx[0] = L_shr_sat( mem_fx[0], diff ); - move32(); - mem_fx[1] = L_shr_sat( mem_fx[1], diff ); - move32(); - mem_fx[2] = L_shr_sat( mem_fx[2], diff ); - move32(); - mem_fx[3] = L_shr_sat( mem_fx[3], diff ); -#else mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); move32(); mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); @@ -401,7 +332,6 @@ void hp20_fx_32( mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); -#endif move32(); mem_fx[4] = L_deposit_l( prescale_current_frame ); move32(); diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 02d3590c0..61d00ce98 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -35,13 +35,6 @@ #include "prot_fx.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - #define MIN_BITS_FIX 0 /* QRk=18 */ #define HQ_16k40_BIT ( HQ_16k40 / 50 ) /* 16400/50=328 */ #define Qbf 14 /* Q value for bits_fact */ @@ -319,11 +312,9 @@ void hq2_bit_alloc_har_fx( Word16 exp_shift; -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; Overflow = 0; move32(); -#endif L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk ); L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); @@ -579,13 +570,9 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat -#else lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ move32(); -#endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index f071689d4..bf0af5e87 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -37,13 +37,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * @@ -95,11 +88,9 @@ void mdct_spectrum_denorm_fx( Word16 cond_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ -#endif #endif exp_safe = 4; /* safe bit for overflow */ @@ -172,12 +163,8 @@ void mdct_spectrum_denorm_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat -#else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; -#endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { @@ -209,11 +196,7 @@ void mdct_spectrum_denorm_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat -#else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); -#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } @@ -277,11 +260,9 @@ void mdct_spectrum_denorm_ivas_fx( Word16 cond_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ -#endif #endif exp_safe = 4; /* safe bit for overflow */ @@ -354,12 +335,8 @@ void mdct_spectrum_denorm_ivas_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat -#else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; -#endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { @@ -391,11 +368,7 @@ void mdct_spectrum_denorm_ivas_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat -#else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); -#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 04bd5af34..bc96fe0f8 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -36,12 +36,6 @@ #include "oper_32b.h" #include "move.h" -#ifndef ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*--------------------------------------------------------------------------* * hq2_noise_inject() * @@ -86,11 +80,9 @@ void hq2_noise_inject_fx( Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos; Word16 sb = bands; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif satur = 0; @@ -98,11 +90,7 @@ void hq2_noise_inject_fx( FOR( i = 0; i < bands; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat -#else - Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ -#endif + Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ move32(); } @@ -167,11 +155,7 @@ void hq2_noise_inject_fx( Q_env_fx[k] = sub( 31, exp2 ); move16(); tmp = sub( 17, Q_env_fx[k] ); -#ifdef ISSUE_1836_replace_overflow_libcom - env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat -#else env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ -#endif peak_fx[k] = 0; move16(); count[k] = 0; @@ -182,11 +166,7 @@ void hq2_noise_inject_fx( FOR( i = band_start[k]; i <= band_end[k]; i++ ) { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat -#else Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); -#endif move32(); /* Q0 */ IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) ) { @@ -406,12 +386,8 @@ void hq2_noise_inject_fx( } ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { - L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ -#else + L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */ -#endif } } @@ -491,11 +467,7 @@ void hq2_noise_inject_fx( } L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ -#ifdef ISSUE_1836_replace_overflow_libcom - ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat -#else ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); -#endif move32(); /*Q17 */ } ELSE @@ -617,22 +589,14 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */ tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat -#else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ -#endif + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ } ELSE { tmp = 0x7fff; /*Q0 */ L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat -#else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ -#endif + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -644,12 +608,8 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat -#else - tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ -#endif - tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ + tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ + tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE { @@ -658,16 +618,12 @@ void hq2_noise_inject_fx( move16(); move16(); } - tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ - L_tmp = L_mult( tmp1, j ); /*Q13 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat -#else + tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ + L_tmp = L_mult( tmp1, j ); /*Q13 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ -#endif - tmp = sub( fac_fx, tmp ); /*Q12 */ - L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ + tmp = sub( fac_fx, tmp ); /*Q12 */ + L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); move32(); /*Q12 */ } diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index f0add9252..9e64a4e25 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -39,13 +39,6 @@ #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" - -#ifndef ISSUE_1836_FILEACTIVE_ifft_rel_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ @@ -84,12 +77,10 @@ void ifft_rel_fx( Word16 cc1, cc3, ss1, ss3; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif -#endif /*-----------------------------------------------------------------* @@ -117,17 +108,6 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat - *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat - move16(); - *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat - move16(); - *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat - move16(); - *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat - move16(); -#else t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); @@ -137,23 +117,9 @@ void ifft_rel_fx( move16(); *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ move16(); -#endif IF( NE_16( n4, 1 ) ) { -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat - t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat - - *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat - move16(); - *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat - move16(); - *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat - move16(); - *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat - move16(); -#else t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ @@ -165,7 +131,6 @@ void ifft_rel_fx( move16(); *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ move16(); -#endif } xi1 += id; xi2 += id; @@ -213,45 +178,6 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat - *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat - move16(); - xup1 += n4; - xdn6 -= n4; - - t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat - *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat - move16(); - - xdn6 += n4; - t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat - *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/ //??sat - move16(); - - xup3 += n4; - xdn8 -= n4; - - t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat - *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/ //??sat - move16(); - - t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat - t1 = add_sat( t1, t4 ); /*Qx*/ //??sat - t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat - t2 = add_sat( t2, t3 ); /*Qx*/ //??sat - *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/ //??sat - move16(); - xup3 -= n4; - *xup3 = add_sat( mult_r( t5, cc1 ), mult_r( t4, ss1 ) ); /*Qx*/ //??sat - move16(); - *xdn8 = sub_sat( mult_r( t5, ss1 ), mult_r( t4, cc1 ) ); /*Qx*/ //??sat - move16(); - - xdn8 += n4; - *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/ //??sat - move16(); -#else t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/ *xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ move16(); @@ -289,7 +215,6 @@ void ifft_rel_fx( xdn8 += n4; *xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/ move16(); -#endif xup1 -= n4; xup1 += id; @@ -320,17 +245,10 @@ void ifft_rel_fx( { r1 = *xi0; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat - move16(); - *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat - move16(); -#else *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); *xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); -#endif xi0 += id; xi1 += id; } diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index 38fc55792..abcc6092f 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -41,12 +41,7 @@ #include "rom_com.h" #include "prot_fx_enc.h" -#ifndef ISSUE_1836_FILEACTIVE_interpol_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif Word32 Interpol_lc_fx( /* o : interpolated value Q15 */ const Word16 *x, /* i : input vector Q0 */ const Word16 *win, /* i : interpolation window Q14 */ @@ -88,10 +83,8 @@ Word16 Interpol_4( /* Qx o : interpolated value */ { Word16 i; Word32 L_sum; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif x = x - L_INTERPOL1 + 1; @@ -109,13 +102,7 @@ Word16 Interpol_4( /* Qx o : interpolated value */ } BASOP_SATURATE_WARNING_OFF_EVS /* Here, saturation might occur by intention */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_shl_sat( L_sum, 1 ); /*Qx+14+2*/ - BASOP_SATURATE_WARNING_ON_EVS - return round_fx_sat( L_sum ); /*Qx*/ //??sat -#else L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/ BASOP_SATURATE_WARNING_ON_EVS return round_fx_o( L_sum, &Overflow ); /*Qx*/ -#endif } diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 1a6e91a22..8ffaf0bfb 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,11 +8,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*--------------------------------------------------------------------------* * fine_gain_pred() @@ -44,11 +39,9 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -88,11 +81,7 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat -#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -107,12 +96,8 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -169,11 +154,9 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -204,13 +187,9 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat -#else + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -225,12 +204,8 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index bc7ebe478..1035f017a 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,12 +42,6 @@ #include "rom_com.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local constants @@ -415,10 +409,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -435,11 +427,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_shl_sat( L_32, 2 ); //??sat -#else L_32 = L_shl_o( L_32, 2, &Overflow ); -#endif return ( L_32 ); } @@ -475,11 +463,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -540,21 +526,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -569,11 +546,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -612,11 +585,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -652,11 +621,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); -#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -692,11 +657,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -757,21 +720,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -786,11 +740,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -829,11 +779,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -869,11 +815,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat -#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -909,13 +851,10 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -# -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -976,21 +915,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); - t0 = L_msu_sat( t0, Rh[i], -32768 ); -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -1005,11 +935,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -1048,11 +974,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1088,11 +1010,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = L_shl_sat( t0, k ); //??sat -#else A[i] = L_shl_o( t0, k, &Overflow ); -#endif move16(); } @@ -1560,11 +1478,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* half length FFT */ @@ -1740,22 +1656,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat - move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat - move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat - move16(); -#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1770,7 +1670,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1791,22 +1690,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat - move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat - move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat - move16(); -#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1821,7 +1704,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c5d20ef21..4b3e200a4 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,12 +40,6 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -75,10 +69,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif cheb = norm_s( x ); @@ -116,26 +108,16 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -143,15 +125,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -169,14 +146,9 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat - cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat -#else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ -#endif - cheb = s_max( -32767, cheb ); /* to avoid saturation */ + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -190,10 +162,8 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------* @@ -316,11 +286,7 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom - y = sub_sat( yhigh, ylow ); -#else y = sub_o( yhigh, ylow, &Overflow ); -#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1256,11 +1222,9 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif /*-----------------------------------------------------* @@ -1291,11 +1255,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat -#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); -#endif move32(); } @@ -1305,19 +1265,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = 1; i <= nc; i++ ) - { - t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); - t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); - } -#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } -#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1331,16 +1283,6 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_add_sat( f1[i], f2[i] ); //??sat - t0 = L_shl( t0, k ); - a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat - - /* a[j] = 0.5*(f1[i] - f2[i]) */ - t0 = L_sub_sat( f1[i], f2[i] ); //??sat - t0 = L_shl( t0, k ); - a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat -#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1348,8 +1290,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ -#endif + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ j--; } @@ -1793,10 +1734,8 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1857,16 +1796,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat - L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ - L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat -#else + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ @@ -1874,23 +1804,15 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ -#endif } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - move16(); -#else + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); -#endif } } @@ -2342,10 +2264,8 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------------* @@ -2391,18 +2311,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat -#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ -#endif - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat -#else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ -#endif + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ tmp = s_max( tmp, 0 ); @@ -2439,10 +2351,8 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------------* @@ -2494,11 +2404,7 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat -#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ -#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3857,10 +3763,8 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3928,13 +3832,9 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat -#else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ -#endif + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index ddd8f88f6..4f493cacd 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,12 +9,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants @@ -342,10 +336,8 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif exp_den = norm_l( in32 ); @@ -353,17 +345,10 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - exp_den = shl( exp_den, 1 ); - - div_out = div_s( 8192, m_den ); - Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat -#else exp_den = shl_o( exp_den, 1, &Overflow ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ -#endif return Ltmp; } @@ -379,10 +364,8 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif IF( re == 0 ) @@ -395,11 +378,7 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat -#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -414,11 +393,7 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); -#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -448,11 +423,7 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat -#else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ -#endif return ( L_tmp ); } @@ -530,10 +501,8 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*---------------------------------------------------------------------* @@ -556,11 +525,7 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - r[0] = L_add_sat( r[0], G[i] ); -#else r[0] = L_add_o( r[0], G[i], &Overflow ); -#endif move32(); } @@ -594,47 +559,18 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - gp = L_add_sat( G[i], G[N - i - 1] ); //??sat -#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); -#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); -#ifdef ISSUE_1836_replace_overflow_libcom - r[1] = L_add_sat( r[1], mh ); //??sat -#else r[1] = L_add_o( r[1], mh, &Overflow ); -#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - c[j] = mult_r( c[j - 1], x[i - 1] ); - move16(); - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat - move16(); - - /*r[j] = L_mac(r[j], c[j], gp);*/ - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat - move32(); - - c[j + 1] = mult_r( c[j], x[i - 1] ); - move16(); - c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat - move16(); - - /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ - Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); - r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat - move32(); -#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -654,55 +590,33 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); -#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat - move16(); - - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat - move32(); -#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); -#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat - gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); - - r[0] = L_add_sat( r[0], gp ); //??sat -#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); -#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat - L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat -#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); -#endif } return; diff --git a/lib_com/math_op.c b/lib_com/math_op.c index caa17b3ae..7014988b8 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,12 +23,6 @@ #include #include -#ifndef ISSUE_1836_FILEACTIVE_math_op_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | @@ -234,30 +228,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat - FOR( i = 1; i < lg; i++ ) - { - L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat - } -#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } -#endif } IF( expi < 0 ) { @@ -267,24 +251,11 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat -#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); -#endif } } IF( expi > 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( x[0], expi ); //??sat - L_sum = L_mac_sat( 1, tmp, tmp ); //??sat - FOR( i = 1; i < lg; i++ ) - { - tmp = shl_sat( x[i], expi ); //??sat - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat - } -#else tmp = shl_o( x[0], expi, &Overflow ); L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) @@ -292,7 +263,6 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val tmp = shl_o( x[i], expi, &Overflow ); L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } -#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 60a15c5d0..46e24e31a 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,12 +15,6 @@ #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -81,11 +75,9 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -285,11 +277,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { -#ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat -#else num_den = shl_o( num_den, 1, &Overflow ); -#endif *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } @@ -370,11 +358,9 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -571,11 +557,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat -#else num_den = shl_o( num_den, 1, &Overflow ); -#endif #else num_den = shl( num_den, 1 ); #endif @@ -947,11 +929,9 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); @@ -961,103 +941,60 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat -#else + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ -#endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat -#else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ -#endif - mem[1] = extract_h( Lacc ); /* Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat - move16(); -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); -#endif } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ -#endif - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat - temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ - move16(); - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat -#else + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1068,18 +1005,11 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat -#else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1087,23 +1017,9 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ - temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1114,8 +1030,7 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1231,11 +1146,9 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1243,34 +1156,11 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - - mem[0] = round_fx_sat( Lacc1 ); //??sat - move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat - Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat - Lacc = L_deposit_h( temp1 ); - - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat - move16(); - - Lacc1 = L_deposit_h( temp2 ); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat - out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat - move16(); -#else - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1289,36 +1179,13 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); -#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - - mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat - - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_deposit_h( temp1 ); - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc1 = L_deposit_h( temp2 ); - out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat - move16(); - mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat - move16(); -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1339,7 +1206,6 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); -#endif } return; diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index 91e22a9d6..be34a1248 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -27,12 +27,6 @@ #define WMC_TOOL_SKIP -#ifndef ISSUE_1836_FILEACTIVE_oper_32b_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /***************************************************************************** * * * Function L_Extract() * @@ -130,20 +124,13 @@ Word32 L_Comp( Word16 hi, Word16 lo ) Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif L_32 = L_mult( hi1, hi2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat - L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat -#else L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); -#endif return ( L_32 ); } @@ -172,21 +159,13 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat - L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat - L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat -#else L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); -#endif return ( L_32 ); } @@ -214,19 +193,12 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Sqr_32( Word16 hi, Word16 lo ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mult_sat( hi, hi ); //??sat - L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 ); //??sat -#else L_32 = L_mult_o( hi, hi, &Overflow ); L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); -#endif return ( L_32 ); } diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index 5e3405456..ffdebc813 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,78 +113,6 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ -//#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ - -#define ISSUE_1836_FILEACTIVE_arith_coder_fx_c -#define ISSUE_1836_FILEACTIVE_basop32_c -#define ISSUE_1836_FILEACTIVE_basop32_h -#define ISSUE_1836_FILEACTIVE_basop_lsf_tools_c -#define ISSUE_1836_FILEACTIVE_basop_util_c -#define ISSUE_1836_FILEACTIVE_bitalloc_fx_c -#define ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c -#define ISSUE_1836_FILEACTIVE_cldfb_fx_c -#define ISSUE_1836_FILEACTIVE_cng_exc_fx_c -#define ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c -#define ISSUE_1836_FILEACTIVE_deemph_fx_c -#define ISSUE_1836_FILEACTIVE_edct_fx_c -#define ISSUE_1836_FILEACTIVE_enh1632_c -#define ISSUE_1836_FILEACTIVE_enh1632_h -#define ISSUE_1836_FILEACTIVE_enh32_c -#define ISSUE_1836_FILEACTIVE_enh40_c -#define ISSUE_1836_FILEACTIVE_enh40_h -#define ISSUE_1836_FILEACTIVE_enh64_c -#define ISSUE_1836_FILEACTIVE_enh64_h -#define ISSUE_1836_FILEACTIVE_enhUL32_c -#define ISSUE_1836_FILEACTIVE_enr_1_az_fx_c -#define ISSUE_1836_FILEACTIVE_edct_fx_c -#define ISSUE_1836_FILEACTIVE_env_stab_fx_c -#define ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c -#define ISSUE_1836_FILEACTIVE_fft_fx_evs_c -#define ISSUE_1836_FILEACTIVE_fft_rel_fx_c -#define ISSUE_1836_FILEACTIVE_frame_ener_fx_c -#define ISSUE_1836_FILEACTIVE_get_gain_fx_c -#define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c -#define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c -#if 0 -#define ISSUE_1836_FILEACTIVE_gs_gains_fx_c -#define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c -#define ISSUE_1836_FILEACTIVE_hp50_fx_c -#define ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c -#define ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c -#define ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c -#define ISSUE_1836_FILEACTIVE_ifft_rel_fx_c -#define ISSUE_1836_FILEACTIVE_igf_base_fx_c -#define ISSUE_1836_FILEACTIVE_interpol_fx_c -#define ISSUE_1836_FILEACTIVE_log2_c -#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c -#define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -#define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -#define ISSUE_1836_FILEACTIVE_math_op_c -#define ISSUE_1836_FILEACTIVE_math_op_h -#define ISSUE_1836_FILEACTIVE_modif_fs_fx_c -#define ISSUE_1836_FILEACTIVE_oper_32b_c -#define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c -#define ISSUE_1836_FILEACTIVE_ppp_fx_c -#define ISSUE_1836_FILEACTIVE_pred_lt4_fx_c -#define ISSUE_1836_FILEACTIVE_preemph_fx_c -#define ISSUE_1836_FILEACTIVE_prot_fx_h -#define ISSUE_1836_FILEACTIVE_pvq_com_fx_c -#define ISSUE_1836_FILEACTIVE_residu_fx_c -#define ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c -#define ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c -#define ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c -#define ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c -#define ISSUE_1836_FILEACTIVE_syn_filt_fx_c -#define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c -#define ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c -#define ISSUE_1836_FILEACTIVE_tcx_utils_fx_c -#define ISSUE_1836_FILEACTIVE_tns_base_c -#define ISSUE_1836_FILEACTIVE_tools_fx_c -#define ISSUE_1836_FILEACTIVE_weight_a_fx_c -#define ISSUE_1836_FILEACTIVE_wi_fx_c -#define ISSUE_1836_FILEACTIVE_window_fx_c -#endif #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 3679ed372..3103723be 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -8,12 +8,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-----------------------------------------------------------------------* * phase_dispersion: * @@ -36,11 +30,9 @@ void phase_dispersion( Word32 x32[2 * L_SUBFR]; Word16 *code_real, *code_imag; const Word16 *h_real, *h_imag; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif move16(); @@ -65,11 +57,7 @@ void phase_dispersion( move16(); prev_gain_pit[0] = gain_pit; -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) ) //??sat -#else IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) ) -#endif { IF( LT_16( state, 2 ) ) { @@ -177,11 +165,7 @@ void phase_dispersion( scale2 = getScaleFactor32( x32, L_subfr ); FOR( i = 0; i < L_subfr; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) ); -#else code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); -#endif move16(); } j = sub( j, scale2 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index 0fceb9165..cc6b59bdb 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,12 +35,6 @@ #include "cnst.h" #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_ppp_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ /*-------------------------------------------------------------------*/ @@ -103,11 +97,9 @@ void deemph_lpc_fx( Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif b_fx[0] = 4096; move16(); /* 1 in Q12 */ @@ -123,11 +115,7 @@ void deemph_lpc_fx( { /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat -#else LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); -#endif move16(); /* Q12 */ } @@ -149,11 +137,7 @@ void deemph_lpc_fx( { /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat -#else LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); -#endif move16(); /* Q12 */ } } diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index c54ee5f39..465138bde 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -8,11 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_pred_lt4_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*-------------------------------------------------------------------* * Function pred_lt4: * @@ -40,11 +35,9 @@ void pred_lt4_ivas_fx( Word32 s; const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif x0 = &excI[-T0]; @@ -78,11 +71,7 @@ void pred_lt4_ivas_fx( s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } -#ifdef ISSUE_1836_replace_overflow_libcom - excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat -#else - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ -#endif + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); } return; @@ -102,11 +91,9 @@ void pred_lt4( Word16 i, j; Word32 s; const Word16 *x0, *x1, *x2, *c1, *c2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif x0 = &excI[-T0]; @@ -140,21 +127,12 @@ void pred_lt4( } s = W_sat_l( s64 ); /* Q_exc + Q14 */ } -#ifdef ISSUE_1836_replace_overflow_libcom -#if ( INTERP_EXP != -1 ) - s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ //??sat -#endif - - excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat - move16(); -#else #if ( INTERP_EXP != -1 ) s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ #endif excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); -#endif } return; } @@ -199,11 +177,9 @@ void pred_lt4_tc_fx( Word16 excO[L_SUBFR + 1]; Word32 L_sum; Word16 excI[2 * L_SUBFR]; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ @@ -236,25 +212,15 @@ void pred_lt4_tc_fx( k += UP_SAMP; L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat - excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat -#else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ -#endif - + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ move16(); x0++; } FOR( i = T0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */ //??sat -#else exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ -#endif move16(); } } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index b24aa9467..b7886cb65 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -22,23 +22,12 @@ void preemph_copy_fx( ) { Word16 i, temp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp = x[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = lg - 1; i > 0; i-- ) - { - y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */ - move16(); - } - y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */ //??sat - move16(); -#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ @@ -46,8 +35,6 @@ void preemph_copy_fx( } y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ move16(); -#endif - *mem = temp; /* Qx */ move16(); @@ -62,23 +49,12 @@ void preemph_copy_32fx( ) { Word16 i, temp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp = x[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = lg - 1; i > 0; i-- ) - { - y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ //??sat - move16(); - } - y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat - move16(); -#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */ @@ -86,7 +62,6 @@ void preemph_copy_32fx( } y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */ move16(); -#endif *mem = temp; /* Qx */ move16(); @@ -150,31 +125,13 @@ void E_UTIL_f_preemph2( { Word16 i, temp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp = signal[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = lg - 1; i > 0; i-- ) - { - L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat - L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ - signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat - move16(); - } - - L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat - L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ - signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat - move16(); -#else FOR( i = lg - 1; i > 0; i-- ) { L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ @@ -189,7 +146,6 @@ void E_UTIL_f_preemph2( L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); -#endif *mem = temp; /* Qx */ move16(); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 63eb26877..1adcdb7ae 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -7,13 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_pvq_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - /*! r: Approximate integer division for positive input using lookup table */ UWord32 intLimCDivPos_fx( UWord32 NUM, /* Qx */ @@ -434,11 +427,9 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); @@ -465,11 +456,7 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat -#else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ -#endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ @@ -540,11 +527,9 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -567,11 +552,7 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ -#ifdef ISSUE_1836_replace_overflow_libcom - gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat -#else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); -#endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index b1426dcb2..91d0ee30a 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_residu_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*--------------------------------------------------------------------* * residu_ivas_fx() * @@ -68,11 +62,9 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif q = add( norm_s( a[0] ), 1 ); @@ -80,36 +72,6 @@ void Residu3_lc_fx( { q = add( q, shift ); } -#ifdef ISSUE_1836_replace_overflow_libcom - *y++ = shl_sat( x[0], shift ); //??sat - move16(); - - FOR( i = 1; i < m; i++ ) - { - s = L_mult_sat( x[i], a[0] ); //??sat - /* Stop at i to Avoid Mults with Zeros */ - FOR( j = 1; j <= i; j++ ) - { - s = L_mac_sat( s, x[i - j], a[j] ); //??sat - } - - s = L_shl_sat( s, q ); //??sat - *y++ = round_fx_sat( s ); //??sat - } - - FOR( ; i < lg; i++ ) - { - s = L_mult_sat( x[i], a[0] ); //??sat - FOR( j = 1; j <= m; j++ ) - { - s = L_mac_sat( s, x[i - j], a[j] ); //??sat - } - - s = L_shl_sat( s, q ); //??sat - *y++ = round_fx_sat( s ); //??sat - } - -#else *y++ = shl_o( x[0], shift, &Overflow ); move16(); @@ -137,8 +99,6 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } - -#endif } /*--------------------------------------------------------------------* @@ -191,11 +151,9 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) @@ -212,11 +170,7 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( s32 ); //??sat -#else y[i] = round_fx_o( s32, &Overflow ); -#endif move16(); } } diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index cf4b5edc3..c259745f2 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -16,12 +16,6 @@ #define P1 ( 32768 - ISP_SMOOTHING_QUANT_A1_FX - 1 ) #define P9 ( 32767 - P1 ) -#ifndef ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*---------------------------------------------------------* * Local functions *---------------------------------------------------------*/ @@ -80,11 +74,9 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*---------------------------------------------------------* @@ -117,11 +109,7 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - min_alpha = add_sat( tmp_res, 16384 ); //??sat -#else min_alpha = add_o( tmp_res, 16384, &Overflow ); -#endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ @@ -172,12 +160,8 @@ void stat_noise_uv_mod_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat -#else + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ -#endif PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe ); } @@ -202,11 +186,7 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat -#else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); -#endif alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); *act_count = 0; @@ -270,11 +250,7 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat -#else - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ -#endif + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -408,11 +384,9 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*---------------------------------------------------------* @@ -442,11 +416,7 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - min_alpha = add_sat( tmp_res, 16384 ); //??sat -#else min_alpha = add_o( tmp_res, 16384, &Overflow ); -#endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); @@ -496,12 +466,8 @@ void stat_noise_uv_mod_ivas_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat -#else + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ -#endif PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe ); } @@ -526,11 +492,7 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat -#else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); -#endif alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); *act_count = 0; diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index ab3efa10d..0c6e30547 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -36,12 +36,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*==========================================================================*/ /* FUNCTION : Word16 WB_BWE_gain_pred_fx () */ @@ -601,12 +595,7 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 tmp1 = mult_ro( *ptr++, 8192 /*0.25 in Q15 */, &Overflow ); /* Divide by 4 */ L_ener = L_mac0_o( L_ener, tmp1, tmp1, &Overflow ); } -#ifdef ISSUE_1799_replace_L_shr_o - /*Overflow will never happen because exp2 is always positive*/ - L_ener = L_shr( L_ener, exp2 ); -#else L_ener = L_shr_o( L_ener, exp2, &Overflow ); -#endif L_temp = L_add_o( L_ener_tot, L_ener, &Overflow ); IF( Overflow != 0 ) { @@ -619,21 +608,12 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat -#else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); -#endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat - tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat -#else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); -#endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 4dba49139..8fd876f1c 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,12 +38,6 @@ #include -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -933,11 +927,9 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *Qss = 10; @@ -994,11 +986,7 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat -#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ -#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1020,119 +1008,109 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( L_inBuf_pss[j] >= 0 ){ - outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat - move16(); - } -#else - IF( L_inBuf_pss[j] >= 0 ){ + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) + { + IF( L_inBuf_pss[j] >= 0 ) + { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } + } + ELSE + { + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; + move16(); + if ( L_inBuf_pss[j] < 0x0L ) + { + outBuf_pss_fx[j] = -0x2800; + move16(); + } + } + j++; } -#endif } - ELSE + + k = 0; + move16(); + m = 0; + move16(); + n = 0; + move16(); + reset_flag = 0; + move16(); + n_list[0] = 0; + move16(); + FOR( j = 0; j < num_subband_smooth_fx; j++ ) { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; + cnt_zero_cont = 0; move16(); - if ( L_inBuf_pss[j] < 0x0L ) + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[j] = -0x2800; - move16(); + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) + { + cnt_zero_cont = 0; + move16(); + } + k = add( k, 1 ); } - } - j++; -} -} -k = 0; -move16(); -m = 0; -move16(); -n = 0; -move16(); -reset_flag = 0; -move16(); -n_list[0] = 0; -move16(); -FOR( j = 0; j < num_subband_smooth_fx; j++ ) -{ - cnt_zero_cont = 0; - move16(); - FOR( i = 0; i < L_SB; i++ ) - { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) + IF( cnt_zero_cont != 0 ) { - cnt_zero_cont = 0; + test(); + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + { + n = 0; + move16(); + reset_flag = 1; + move16(); + } + n_list[n] = j; move16(); + n = add( n, 1 ); } - k = add( k, 1 ); - } - IF( cnt_zero_cont != 0 ) - { test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) { - n = 0; - move16(); - reset_flag = 1; + m = 0; move16(); } - n_list[n] = j; - move16(); - n = add( n, 1 ); - } - - test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) - { - m = 0; - move16(); - } - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ - { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ { - if ( outBuf_pss_fx[pk + i] == 0 ) + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); + if ( outBuf_pss_fx[pk + i] == 0 ) + { + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); + } } + m = add( m, 1 ); } - m = add( m, 1 ); } -} -FOR( i = 0; i < fLen; i++ ) -{ - outBuf_fx[i] = 0x0; - move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + FOR( i = 0; i < fLen; i++ ) { - outBuf_fx[i] = outBuf_pss_fx[i]; + outBuf_fx[i] = 0x0; move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + { + outBuf_fx[i] = outBuf_pss_fx[i]; + move16(); + } } -} -return; + return; } /*-------------------------------------------------------------------* @@ -2247,11 +2225,9 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *QbeL = 3; @@ -2362,11 +2338,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat - E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); -#else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); -#endif IF( LT_16( E_r_shift_fx, 15729 ) ) /* E_r < 0.06 */ { /* avg_pe[k] = (float) sqrt(pow(2.0f,band_energy[i])/band_width[i]); */ @@ -2404,19 +2376,13 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat -#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) -#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } -#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); -#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3243,11 +3209,9 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif set16_fx( map_pulse_t_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); set16_fx( map_pulse_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); @@ -3282,11 +3246,7 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat -#else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ -#endif move16(); } p_L_En++; @@ -3356,11 +3316,7 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat -#else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); -#endif ni_scale_fx = s_min( 20408, ni_scale_fx ); /* 1.25=20408.0(Q14) */ ni_scale_fx = s_max( 12288, ni_scale_fx ); /* 0.75=12288.0(Q14) */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e8a74d834..2ca52b8e4 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,12 +12,6 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 @@ -1002,10 +996,9 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); -#endif + IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1045,11 +1038,7 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat -#else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); -#endif move16(); /*Q12 */ } @@ -1456,11 +1445,9 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1550,38 +1537,22 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible -#else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 -#endif - move16(); /* Q14 */ + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 - pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 - } -#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } -#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat -#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1611,11 +1582,7 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1623,13 +1590,8 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ - pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ -#endif + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } } @@ -1638,19 +1600,11 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ -#endif + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat -#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ -#endif move16(); } } @@ -1666,11 +1620,7 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat -#else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); -#endif } ELSE { @@ -1679,20 +1629,6 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat - move16(); - k++; - } -#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1705,7 +1641,6 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } -#endif } } } @@ -1760,11 +1695,9 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); move16(); @@ -1856,11 +1789,7 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excTmp2_frac[i] = shl( excTmp2[i], n1 ); -#else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); -#endif move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); @@ -1868,23 +1797,14 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ - pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat -#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat -#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1915,11 +1835,7 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1927,13 +1843,8 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat - pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ } } @@ -1942,23 +1853,13 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ - sc = sub( add( n2, Q_bwe_exc ), 14 ); - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat - move16(); - } -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } -#endif } ELSE { @@ -1972,12 +1873,8 @@ void GenShapedWBExcitation_fx( IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat -#else + tmp_vfac = min(1, tmp_vfac);*/ tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); -#endif } ELSE { @@ -1986,20 +1883,6 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat - move16(); - k = add( k, 1 ); - } -#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -2012,7 +1895,6 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } -#endif } } } @@ -5787,12 +5669,10 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5891,20 +5771,12 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat -#else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ -#endif + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ } } @@ -5927,12 +5799,8 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif } ELSE { @@ -5981,20 +5849,12 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /*Q14 */ -#else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ -#endif + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ } } @@ -6061,12 +5921,10 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6165,20 +6023,12 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat -#else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ -#endif + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ } } @@ -6201,12 +6051,8 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat -#else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ } ELSE { @@ -6255,20 +6101,12 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat -#else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ -#endif + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ } } @@ -7003,11 +6841,9 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -7066,11 +6902,7 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat -#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, expb ); num_flag = 0; @@ -7194,11 +7026,9 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7213,11 +7043,7 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat -#else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ -#endif + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ test(); test(); @@ -7246,19 +7072,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ -#ifdef ISSUE_1836_replace_overflow_libcom - gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat - FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) - { - L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ - L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat - L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat - L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ - bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat - move16(); - } -#else + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7269,7 +7083,6 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } -#endif } ELSE { @@ -7283,17 +7096,10 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat - - tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat -#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ -#endif + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ move16(); } } @@ -7302,14 +7108,9 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat -#else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ -#endif + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ move16(); } } @@ -7317,15 +7118,9 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ - tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat - bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat -#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ -#endif move16(); } } @@ -7361,10 +7156,8 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /* Smoothen tilt value */ @@ -7392,11 +7185,7 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); -#else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); -#endif return formant_fac; /*Q15 */ } diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 8b044f2f7..7724e596c 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -9,24 +9,13 @@ #include "prot_fx.h" #include "stl.h" -#ifndef ISSUE_1836_FILEACTIVE_syn_filt_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); -#else - L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat - return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat -#endif } static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] ) @@ -352,11 +341,9 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif if ( EQ_16( m, 6 ) ) @@ -390,13 +377,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat - *y++ = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); /* Filtering from Input + Mix of Memory & Output Signal Past */ @@ -406,24 +388,15 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Process Output Signal Past */ FOR( j = 1; j <= i; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_msu_sat( L_tmp, a[j], y[-j] ); //??sat -#else L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow ); -#endif } /* Process Memory */ FOR( ; j <= m; j++ ) { L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat - *y++ = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } @@ -431,13 +404,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W FOR( ; i < lg; i++ ) { L_tmp = syn_kern( L_mult( a0, *x++ ), a, y ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); - *y++ = round_fx_sat( L_tmp ); -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } @@ -484,10 +452,8 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); -#endif if ( EQ_16( m, 6 ) ) { @@ -514,22 +480,14 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ mem += m; /*move32();*/ -#ifdef ISSUE_1836_replace_overflow_libcom - a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat -#else a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ -#endif /*-----------------------------------------------------------------------* * Do the filtering *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); @@ -547,11 +505,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); } @@ -560,11 +514,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] FOR( ; i < lg; i++ ) { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); } diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 0bf0fb1c9..322549a6f 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -8,12 +8,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ @@ -395,11 +389,9 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); @@ -416,17 +408,10 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat - s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat - s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat - excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat -#else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ -#endif move16(); x0++; diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 8ef395423..b2cee32e6 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -8,12 +8,6 @@ #include "prot_fx.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ @@ -113,11 +107,9 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); @@ -134,11 +126,7 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat -#else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ -#endif + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ move32(); } FOR( i = 0; i < m / 2; i++ ) @@ -148,11 +136,7 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ -#else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ -#endif move32(); } @@ -179,11 +163,9 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); @@ -200,11 +182,7 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat -#else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ -#endif + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ move32(); } FOR( i = 0; i < m / 2; i++ ) diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index e86f48eed..c5ff95e04 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -12,12 +12,6 @@ #define inv_int InvIntTable -#ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * getInvFrameLen() * @@ -997,10 +991,8 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /* FDNS_NPTS = 64 */ @@ -1052,11 +1044,7 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ -#else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ -#endif + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ move32(); x++; } @@ -1075,11 +1063,7 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ -#else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ -#endif + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ move32(); x += k; gains++; @@ -1405,11 +1389,9 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif assert( lpcGains[0] >= 0x4000 ); @@ -1456,12 +1438,8 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_tmp ); /* Q15 */ -#else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ -#endif - fac = tmp; /* Q15 */ + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ @@ -2103,10 +2081,8 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif maxX = L_deposit_l( 1 ); @@ -2153,11 +2129,7 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ -#else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ -#endif if ( corr < 0 ) tmp = negate( tmp ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 35394f8f9..aaf262786 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -22,12 +22,6 @@ #define MAX_SUBDIVISIONS 3 -#ifndef ISSUE_1836_FILEACTIVE_tns_base_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ @@ -445,11 +439,9 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); @@ -483,11 +475,7 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ -#else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ -#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 2cbc58cd4..2f5c3c8d3 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -52,12 +52,6 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ @@ -314,36 +308,24 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat - idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ -#endif - idx = s_min( idx, sub( cbsize, 1 ) ); idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom - *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ -#else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ -#endif + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ return idx; } /*-------------------------------------------------------------------* @@ -409,20 +391,14 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ -#else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ -#endif + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ } return L_tmp; @@ -476,21 +452,15 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); -#else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); -#endif } return L_tmp; @@ -710,11 +680,9 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( exp0 == 0 ) { @@ -737,11 +705,7 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = shl_sat( x[i], exp0 ); //??sat -#else y[i] = shl_o( x[i], exp0, &Overflow ); -#endif move16(); /* saturation can occur here */ } } @@ -759,12 +723,10 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( exp0 == 0 ) @@ -781,11 +743,7 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat -#else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); -#endif move32(); } return; @@ -798,11 +756,7 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( 1, exp0 ); //??sat -#else tmp = shl_o( 1, exp0, &Overflow ); -#endif FOR( i = 0; i < lg; i++ ) { y[i] = L_mult0( x[i], tmp ); @@ -819,12 +773,10 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( exp0 == 0 ) @@ -841,20 +793,12 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat -#else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); -#endif move32(); } return; } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat -#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); -#endif IF( L_tmp >= 0x7FFF ) { @@ -886,11 +830,9 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif tmp = add( 16, exp0 ); @@ -898,11 +840,7 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); -#else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); -#endif move16(); } } @@ -910,11 +848,7 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( x[i] ); //??sat -#else y[i] = round_fx_o( x[i], &Overflow ); -#endif move16(); } } @@ -932,11 +866,9 @@ void Scale_sig32( ) { Word16 i; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( 0 == exp0 ) { @@ -945,11 +877,7 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - x[i] = L_shl_sat( x[i], exp0 ); -#else x[i] = L_shl_o( x[i], exp0, &Overflow ); -#endif move32(); /* saturation can occur here */ } } @@ -1944,12 +1872,10 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif idx = 0; @@ -1966,28 +1892,6 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat - if ( weights[3] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat - if ( weights[2] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat - if ( weights[1] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat - if ( weights[0] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } -#else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { @@ -2008,7 +1912,6 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } -#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2038,28 +1941,6 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat - if ( weights[0] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat - if ( weights[1] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat - if ( weights[2] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat - if ( weights[3] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } -#else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { @@ -2080,7 +1961,6 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } -#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2547,11 +2427,9 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) @@ -2562,27 +2440,15 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); -#ifdef ISSUE_1836_replace_overflow_libcom - num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat -#else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); -#endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); -#ifdef ISSUE_1836_replace_overflow_libcom - den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat -#else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); -#endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat - num = shl_sat( num, scale ); -#else num = shl_o( num, scale, &Overflow ); -#endif exp_num = sub( exp_num, scale ); tmp = div_s( num, den ); @@ -2738,11 +2604,9 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); @@ -2755,27 +2619,14 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_mult_sat( buf_in[K + i], h[0] ); //??sat -#else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); -#endif FOR( j = 1; j <= K; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat -#else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); -#endif } -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_shl_sat( s, shift ); //??sat - y[i] = round_fx_sat( s ); /*Qx */ //??sat -#else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ -#endif move16(); } } @@ -2911,10 +2762,8 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif idx = 0; @@ -2925,18 +2774,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x, cb[c] ); -#else tmp = sub_o( x, cb[c], &Overflow ); -#endif /*dist += tmp*tmp; */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat -#else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); -#endif if ( LT_32( L_dist, L_mindist ) ) { @@ -3074,11 +2915,9 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( exp0 == 0 ) { @@ -3093,20 +2932,12 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_shl_sat( x[i], tmp ); //??sat -#else y[i] = L_shl_o( x[i], tmp, &Overflow ); -#endif move16(); } return; } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat -#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); -#endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); @@ -3283,11 +3114,9 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); @@ -3295,11 +3124,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat -#else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#endif move16(); } } @@ -3307,11 +3132,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat -#else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#endif move16(); } } @@ -3438,11 +3259,7 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ -#ifdef ISSUE_1836_replace_overflow_libcom - temp = mult_r( *signal++, 16384 ); -#else temp = mult_ro( *signal++, 16384, &Overflow ); -#endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ @@ -3452,19 +3269,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - temp = mult_r( *signal++, 16384 ); -#else temp = mult_ro( *signal++, 16384, &Overflow ); -#endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } -#ifdef ISSUE_1799_replace_L_shr_o - /*Overfloe will never happen because temp2 is always positive*/ - L_temp = L_shr( L_temp, temp2 ); -#else + L_temp = L_shr_o( L_temp, temp2, &Overflow ); -#endif /* Here we try the addition just to check if we can sum the energy of the small (8 Iterations) loop with the total energy calculated so far without an overflow. diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index b2d44e1d4..7bea66ea0 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -7,13 +7,6 @@ #include "prot_fx.h" #include - -#ifndef ISSUE_1836_FILEACTIVE_weight_a_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------ * weight_a_subfr() * @@ -107,12 +100,10 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); -#endif #endif fac = gamma; /* Q15 */ @@ -131,11 +122,7 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat -#else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ -#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 1fe679094..591645017 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -22,12 +22,6 @@ #define WI_THRESHLD 0.8 #define WI_SAMPLE_THLD 20 -#ifndef ISSUE_1836_FILEACTIVE_wi_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */ /*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */ /*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */ @@ -270,11 +264,9 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -328,17 +320,10 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat - ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat - move16(); - move16(); -#else ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ move16(); move16(); -#endif } start = sub( Eshift, Adiff_fx ); @@ -359,13 +344,8 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat - corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat -#else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); -#endif move32(); move32(); temp = add( temp, temp1 ); @@ -378,18 +358,6 @@ static Word16 DTFS_alignment_weight_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat - wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat - IF( GE_16( Qmaxcorr, Qcorr ) ) - { - diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ - } - ELSE - { - diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ - } -#else temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ IF( GE_16( Qmaxcorr, Qcorr ) ) @@ -400,7 +368,6 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ } -#endif IF( diff_corr > 0 ) { @@ -450,11 +417,9 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Calculating the expected alignment shift */ @@ -488,13 +453,8 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat - ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat -#else ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ -#endif } IF( FR_flag == 0 ) { @@ -524,15 +484,9 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - temp = add_sat( temp, temp1 ); //??sat -#else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); temp = add_o( temp, temp1, &Overflow ); -#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -638,11 +592,9 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp2 = L_deposit_l( 0 ); @@ -654,15 +606,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat - X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat - temp2 = L_add_sat( temp2, (Word32) ph ); //??sat -#else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); -#endif move16(); move16(); } @@ -674,15 +620,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat - X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat - temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat -#else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); -#endif move16(); move16(); } @@ -786,11 +726,9 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( !FR_flag ) @@ -827,16 +765,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ - diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat - - exp = norm_s( diff_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ - L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat - nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -844,8 +773,7 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ -#endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -868,13 +796,8 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat - inv_lag = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); -#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -888,13 +811,8 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat - L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat -#else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ -#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -931,22 +849,13 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat - L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat -#else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ + L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); -#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat -#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ -#endif } La[k] = L_shl( L_a, 7 ); @@ -971,30 +880,6 @@ void DTFS_to_fs_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( k = 1; k <= nH; k++ ) - { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - move16(); - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ - X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - move16(); - X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ - } - - /* IF ( N%2 == 0 ) */ - IF( s_and( N, 1 ) == 0 ) - { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ - X_fx->b_fx[k] = 0; - move16(); - } -#else FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ @@ -1017,7 +902,6 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } -#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1313,11 +1197,9 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qmin = 32767; move16(); @@ -1335,22 +1217,6 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat - temp2 = add( temp2, temp ); - } - - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat - - /* Calculate the circular convolution */ - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - - L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat -#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); temp2 = add( temp2, temp ); @@ -1363,8 +1229,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ -#endif + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1384,13 +1249,8 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat - X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat -#else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ -#endif move32(); move32(); @@ -1406,17 +1266,9 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat -#else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); -#endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat -#else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); -#endif move16(); /* Q(Q+Qmin) */ } @@ -1661,11 +1513,9 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); @@ -1675,23 +1525,15 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat -#else + en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat -#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); -#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1699,13 +1541,9 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat -#else + en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1736,23 +1574,6 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); - HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); - FOR( k = 1; k <= HalfLag_fx; k++ ) - { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat - } - en_fx = L_shr( en_fx, 1 ); - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat - /* IF (X_fx->lag_fx%2 == 0) */ - IF( s_and( X_fx->lag_fx, 1 ) == 0 ) - { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat - } -#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1772,7 +1593,7 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); } -#endif + return en_fx; /* 2*X1.Q */ } @@ -1899,23 +1720,17 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat -#else + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ -#endif - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -2022,12 +1837,10 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -2039,11 +1852,7 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat -#else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ -#endif + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -2058,13 +1867,8 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat -#else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ -#endif count = add( count, 1 ); } } @@ -2077,11 +1881,7 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat -#else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); -#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -2092,11 +1892,7 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat -#else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); -#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -2134,11 +1930,7 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat -#else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ -#endif + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ move16(); } @@ -2202,11 +1994,9 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif num_flag = 0; move16(); @@ -2275,11 +2065,8 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat -#else + IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) -#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2292,11 +2079,7 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( Ltemp3, expa ) ); -#else fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); -#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2305,11 +2088,7 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = extract_h( L_shl( Ltemp2, expb ) ); //??sat -#else fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); -#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2326,11 +2105,7 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = shl_sat( fraca, scale ); //??sat -#else fraca = shl_o( fraca, scale, &Overflow ); -#endif expa = sub( expa, scale ); tmp = div_s( fraca, fracb ); /* 15-exp */ @@ -2346,13 +2121,8 @@ static void cubicPhase_fx( tmp = negate( tmp ); } -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat - Lacc = L_add_sat( Lacc, 0x08000 ); //??sat -#else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); -#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2478,11 +2248,7 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //??sat //?sat -#else Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ -#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2540,11 +2306,9 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; @@ -2610,11 +2374,7 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat -#else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ -#endif + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ move16(); IF( GT_16( count[i], 1 ) ) { @@ -2686,11 +2446,9 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Word16 *erb_fx = NULL; /*move16(); */ @@ -2773,33 +2531,7 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ //??sat //??sat - move16(); - IF( GT_16( out_fx[j], 1 ) ) - { - expb = norm_l( mf_fx[j] ); - fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) ); //??sat //??sat - expb = sub( 30, add( expb, 20 ) ); - - - expa = norm_l( out_fx[j] ); - fraca = extract_h( L_shl( out_fx[j], expa ) ); - expa = sub( 30, expa ); - - scale = shr( sub( fraca, fracb ), 15 ); - fracb = shl( fracb, scale ); - expb = sub( expb, scale ); - - tmp = div_s( fracb, fraca ); - exp = sub( expb, expa ); - L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat - - mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat - move16(); - } -#else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -2823,7 +2555,6 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); move16(); } -#endif } return; } @@ -2873,11 +2604,9 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) @@ -2963,11 +2692,7 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ //??sat //??sat -#else X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ -#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3709,11 +3434,9 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3758,31 +3481,17 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); - expa = sub( 30, add( expa, 1 ) ); - - - expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat -#else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif - expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat -#else fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -3806,30 +3515,17 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat - expa = sub( Q29, expa ); // 30 - expa - 1; - - - expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat -#else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat -#else fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -4309,11 +4005,9 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif retX_fx->lag_fx = X1_fx->lag_fx; @@ -4324,13 +4018,8 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat - Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat -#else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ -#endif + Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4372,17 +4061,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat - sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ - move16(); - - Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat - cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ -#else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ @@ -4392,7 +4070,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ -#endif move16(); } k = sub( k, 1 ); @@ -4446,11 +4123,9 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif en = L_deposit_l( 0 ); @@ -4486,12 +4161,8 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat -#else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4501,21 +4172,13 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat -#else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat -#else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ -#endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4541,11 +4204,7 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); //??sat -#else Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); -#endif } ELSE { @@ -4594,11 +4253,9 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qmin = 32767; move16(); @@ -4613,38 +4270,21 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat -#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ -#endif temp2 = add( temp2, k ); } -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat - /* Calculate the circular convolution */ - sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ - - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat -#else - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ -#endif + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ IF( sum ) { exp = norm_l( sum ); @@ -4743,11 +4383,9 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); @@ -4761,13 +4399,8 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifndef ISSUE_1836_replace_overflow_libcom sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ -#else - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat -#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 71a986408..a1ff625b0 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -21,12 +21,6 @@ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_window_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - void ham_cos_window( Word16 *fh, /* o: 0Q15 */ const Word16 n1, /* i: */ @@ -35,12 +29,10 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif -#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -54,11 +46,7 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat -#else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -75,11 +63,7 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat -#else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ -#endif + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ move16(); cc = L_add( cc, cte ); } -- GitLab From d6ecd13b145513759f929a680f3f2d54b685e119 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 12:13:11 +0200 Subject: [PATCH 061/103] checkout a* b* c* from lib_com and options.h from #fb1b910 --- lib_com/arith_coder_fx.c | 30 ++++++++++- lib_com/basop_util.c | 45 ++++++++++++++++ lib_com/bitalloc_fx.c | 22 +++++++- lib_com/cldfb_evs_fx.c | 16 ++++++ lib_com/cldfb_fx.c | 15 ++++++ lib_com/cng_exc_fx.c | 97 ++++++++++++++++++++++++++++++----- lib_com/codec_tcx_common_fx.c | 22 ++++++++ lib_com/options.h | 72 ++++++++++++++++++++++++++ 8 files changed, 304 insertions(+), 15 deletions(-) mode change 100755 => 100644 lib_com/options.h diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 846b4dcea..ff272b8c8 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -10,6 +10,12 @@ #include "basop_proto_func.h" #include "cnst.h" +#ifndef ISSUE_1836_FILEACTIVE_arith_coder_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /* Fixed point implementation of exp(negate()) */ Word32 expfp( /* o: Q31 */ const Word16 x, /* i: mantissa Q-e */ @@ -194,10 +200,12 @@ void tcx_arith_scale_envelope( Word16 statesi, bits; Word32 mean, a, s, L_tmp; Word16 mean_e, tmp, tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif lob_bits = 0; @@ -223,8 +231,12 @@ void tcx_arith_scale_envelope( tmp = norm_l( env[k] ); tmp2 = sub( 15, tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = Inv16( round_fx_sat( L_shl( env[k], tmp ) ), &tmp2 ); /* exp(tmp2) */ +#else tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */ - ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ +#endif + ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ move32(); mean = L_add( mean, ienv[k] ); /* Q16 */ } @@ -256,7 +268,11 @@ void tcx_arith_scale_envelope( b_e = add( b_e, mean_e ); /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ) ); +#else tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow ); +#endif IF( tmp <= 0 ) { @@ -271,7 +287,11 @@ void tcx_arith_scale_envelope( tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); /* exp(scale) */ scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale = shl_sat( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */ +#else scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */ +#endif /* iscale = 1.0f / scale; */ iscale_e = 0; @@ -320,7 +340,11 @@ void tcx_arith_scale_envelope( L_tmp = L_add( L_tmp, L_shl( Mpy_32_16_1( env[k], mult_r( 1147 /*0.035f Q15*/, iscale ) ), iscale_e ) ); /* Q16 */ tmp = norm_l( L_tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + statesi = mult_r( statesi, round_fx_sat( L_shl( L_tmp, tmp ) ) ); +#else statesi = mult_r( statesi, round_fx_o( L_shl_o( L_tmp, tmp, &Overflow ), &Overflow ) ); +#endif bits = add( bits, sub( 15, tmp ) ); tmp = norm_s( statesi ); @@ -407,7 +431,11 @@ void tcx_arith_scale_envelope( *s_env_e = sub( add( 15, iscale_e ), tmp ); move16(); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + a = L_shl_sat( 1265000, sub( 15, *s_env_e ) ); +#else a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; FOR( k = 0; k < L_frame; k++ ) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index ee959cf6f..dd3310a7f 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -45,6 +45,13 @@ #include "basop_settings.h" #include "cnst.h" +#ifndef ISSUE_1836_FILEACTIVE_basop_util_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + extern const Word32 SqrtTable[32]; // Q31 extern const Word16 SqrtDiffTable[32]; /* Q15 */ @@ -267,9 +274,11 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a Word16 preShift, postShift; Word16 m; Word32 m32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif assert( b_m != 0 ); @@ -303,7 +312,11 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a /* normalize result */ postShift = norm_l( m32 ); +#ifdef ISSUE_1836_replace_overflow_libcom + m = round_fx_sat( L_shl( m32, postShift ) ); +#else m = round_fx_o( L_shl( m32, postShift ), &Overflow ); +#endif /* exponent */ *ptrResult_e = sub( add( add( a_e, sub( 1, b_e ) ), preShift ), postShift ); @@ -319,7 +332,9 @@ static Word16 Sqrt16_common( Word16 m, Word16 e ) { Word16 index, frac; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; +#endif assert( ( m >= 0x4000 ) || ( m == 0 ) ); @@ -334,9 +349,13 @@ static Word16 Sqrt16_common( Word16 m, /* interpolate */ if ( m != 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + m = mac_r_sat( SqrtTable[index], SqrtDiffTable[index], frac ); +#else BASOP_SATURATE_WARNING_OFF_EVS; m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow ); BASOP_SATURATE_WARNING_ON_EVS; +#endif } /* handle odd exponents */ @@ -352,13 +371,19 @@ static Word32 Sqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif assert( ( m >= 0x40000000 ) || ( m == 0 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + m16 = round_fx_sat( m ); +#else m16 = round_fx_o( m, &Overflow ); +#endif /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 9) - 32; */ @@ -414,16 +439,23 @@ static Word32 ISqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif assert( m >= 0x40000000 ); +#ifdef ISSUE_1836_replace_overflow_libcom + m16 = round_fx_sat( m ); +#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL m16 = round_fx_o( m, &Overflow ); #else m16 = round_fx( m ); #endif +#endif + /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 25) - 32; */ @@ -890,9 +922,11 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) { Word16 z; Word32 sign; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif sign = L_and( L_xor( L_num, L_denom ), (Word32) 0x80000000 ); @@ -906,7 +940,11 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) L_denom = L_shl( L_denom, z ); /* round_fx instead of extract_h improves spectral distortion in E_UTIL_lev_dur (schur version). */ +#ifdef ISSUE_1836_replace_overflow_libcom + z = div_l( L_num, round_fx_sat( L_denom ) ); +#else z = div_l( L_num, round_fx_o( L_denom, &Overflow ) ); +#endif if ( 0 != sign ) { z = negate( z ); @@ -2050,14 +2088,21 @@ Word32 norm_llQ31( /* o : normalized result Q31 */ Word16 i; Word32 L_tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; +#endif Flag Carry = 0; #endif /* BASOP_NOGLOB */ /* Move MSBit of L_sum into L_c */ Carry = 0; +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1 */ + L_c = L_add_c( L_c, L_c, &Carry ); +#else L_tmp = L_add_co( L_sum, L_sum, &Carry, &Overflow ); /* L_tmp = L_sum << 1 */ L_c = L_add_co( L_c, L_c, &Carry, &Overflow ); +#endif L_add( 0, 0 ); test(); IF( ( L_c != (Word32) 0L ) && ( L_c != (Word32) 0xFFFFFFFFL ) ) diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 30ae2d47b..c3bcd3c8a 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_bitalloc_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif void bitalloc_fx( Word16 *y, /* i : reordered norm of sub-vectors Q0 */ Word16 *idx, /* i : reordered sub-vector indices Q0 */ @@ -23,9 +29,11 @@ void bitalloc_fx( Word16 diff, temp; Word16 fac; Word16 ii; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Word16 SFM_thr = SFM_G1G2; move16(); @@ -54,7 +62,11 @@ void bitalloc_fx( move16(); FOR( m = 1; m < im; m++ ) { - v = sub_o( temp, y[m], &Overflow ); /* Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + v = sub_sat( temp, y[m] ); /* Q0 */ +#else + v = sub_o( temp, y[m], &Overflow ); /* Q0 */ +#endif temp = s_max( temp, y[m] ); if ( v < 0 ) { @@ -245,9 +257,11 @@ Word16 BitAllocF_fx( Word16 tmp, exp1, exp2; Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */ Word16 B_w16_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif set32_fx( Rsubband_w32_fx, 0, NB_SFM ); @@ -442,7 +456,11 @@ Word16 BitAllocF_fx( exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ +#ifdef ISSUE_1836_replace_overflow_libcom + m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ +#else + m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ +#endif if ( L_tmp1 < 0 ) { m_fx = negate( m_fx ); diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 51c9ee6f9..77437a485 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -48,6 +48,12 @@ #define N40 ( 20 ) #define N60 ( 30 ) +#ifndef ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs ); @@ -1240,9 +1246,11 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( k = 0; k < numberCols; k++ ) @@ -1329,7 +1337,11 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); +#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); +#endif } } @@ -1352,7 +1364,11 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); +#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); +#endif } } diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 886a23758..877e2f48f 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -51,6 +51,11 @@ #define restrict #endif +#ifndef ISSUE_1836_FILEACTIVE_cldfb_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*-------------------------------------------------------------------* * Local prototypes @@ -1501,9 +1506,11 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( k = 0; k < numberCols; k++ ) @@ -1590,7 +1597,11 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); +#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); +#endif } } @@ -1613,7 +1624,11 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); +#else nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); +#endif } } diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index e335e9435..1f4ee4da4 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" #include "ivas_rom_com_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_cng_exc_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ @@ -615,9 +621,11 @@ void cng_params_postupd_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); @@ -644,10 +652,16 @@ void cng_params_postupd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ +#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ +#endif + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -725,9 +739,11 @@ void cng_params_postupd_ivas_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); @@ -754,10 +770,16 @@ void cng_params_postupd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ +#else L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ +#endif + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); // To do : Saturation to be re-validated. sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); @@ -861,10 +883,12 @@ void cng_params_upd_fx( Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif /* update the pointer to circular buffer of old LSP vectors */ @@ -902,9 +926,15 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); + pt_exc2++; + L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ +#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ +#endif } } ELSE /* L_FRAME16k */ @@ -915,12 +945,22 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); + pt_exc2++; + L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ +#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ +#endif } } - L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ +#else + L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ +#endif /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; @@ -954,10 +994,16 @@ void cng_params_upd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ +#else + L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ +#endif + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -1040,9 +1086,11 @@ void cng_params_upd_ivas_fx( move16(); Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* update the pointer to circular buffer of old LSP vectors */ @@ -1080,9 +1128,15 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); + pt_exc2++; + L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ +#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ +#endif } } ELSE /* L_FRAME16k */ @@ -1093,12 +1147,22 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); + pt_exc2++; + L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ +#else L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); pt_exc2++; L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ +#endif } } - L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ +#else + L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ +#endif /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; @@ -1132,12 +1196,21 @@ void cng_params_upd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ + L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + tmp = add( add( Q_exc, Q_exc ), 1 ); + sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); +#else + L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ + L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); +#endif move32(); /* Q6 */ ptR++; ptI--; diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 52c7d0614..a3c8cb258 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -11,6 +11,12 @@ #include "rom_basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif #define inv_int InvIntTable Word16 tcxGetNoiseFillingTilt( @@ -61,9 +67,11 @@ void tcxFormantEnhancement( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ @@ -139,7 +147,11 @@ void tcxFormantEnhancement( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); +#else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -227,9 +239,11 @@ void tcxFormantEnhancement_with_shift( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ @@ -309,7 +323,11 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); +#else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -354,7 +372,11 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); +#else xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index ffdebc813..5e3405456 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,6 +113,78 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ +//#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ + +#define ISSUE_1836_FILEACTIVE_arith_coder_fx_c +#define ISSUE_1836_FILEACTIVE_basop32_c +#define ISSUE_1836_FILEACTIVE_basop32_h +#define ISSUE_1836_FILEACTIVE_basop_lsf_tools_c +#define ISSUE_1836_FILEACTIVE_basop_util_c +#define ISSUE_1836_FILEACTIVE_bitalloc_fx_c +#define ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c +#define ISSUE_1836_FILEACTIVE_cldfb_fx_c +#define ISSUE_1836_FILEACTIVE_cng_exc_fx_c +#define ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c +#define ISSUE_1836_FILEACTIVE_deemph_fx_c +#define ISSUE_1836_FILEACTIVE_edct_fx_c +#define ISSUE_1836_FILEACTIVE_enh1632_c +#define ISSUE_1836_FILEACTIVE_enh1632_h +#define ISSUE_1836_FILEACTIVE_enh32_c +#define ISSUE_1836_FILEACTIVE_enh40_c +#define ISSUE_1836_FILEACTIVE_enh40_h +#define ISSUE_1836_FILEACTIVE_enh64_c +#define ISSUE_1836_FILEACTIVE_enh64_h +#define ISSUE_1836_FILEACTIVE_enhUL32_c +#define ISSUE_1836_FILEACTIVE_enr_1_az_fx_c +#define ISSUE_1836_FILEACTIVE_edct_fx_c +#define ISSUE_1836_FILEACTIVE_env_stab_fx_c +#define ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c +#define ISSUE_1836_FILEACTIVE_fft_fx_evs_c +#define ISSUE_1836_FILEACTIVE_fft_rel_fx_c +#define ISSUE_1836_FILEACTIVE_frame_ener_fx_c +#define ISSUE_1836_FILEACTIVE_get_gain_fx_c +#define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c +#define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c +#if 0 +#define ISSUE_1836_FILEACTIVE_gs_gains_fx_c +#define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c +#define ISSUE_1836_FILEACTIVE_hp50_fx_c +#define ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c +#define ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c +#define ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c +#define ISSUE_1836_FILEACTIVE_ifft_rel_fx_c +#define ISSUE_1836_FILEACTIVE_igf_base_fx_c +#define ISSUE_1836_FILEACTIVE_interpol_fx_c +#define ISSUE_1836_FILEACTIVE_log2_c +#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c +#define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c +#define ISSUE_1836_FILEACTIVE_math_op_c +#define ISSUE_1836_FILEACTIVE_math_op_h +#define ISSUE_1836_FILEACTIVE_modif_fs_fx_c +#define ISSUE_1836_FILEACTIVE_oper_32b_c +#define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c +#define ISSUE_1836_FILEACTIVE_ppp_fx_c +#define ISSUE_1836_FILEACTIVE_pred_lt4_fx_c +#define ISSUE_1836_FILEACTIVE_preemph_fx_c +#define ISSUE_1836_FILEACTIVE_prot_fx_h +#define ISSUE_1836_FILEACTIVE_pvq_com_fx_c +#define ISSUE_1836_FILEACTIVE_residu_fx_c +#define ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c +#define ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c +#define ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c +#define ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c +#define ISSUE_1836_FILEACTIVE_syn_filt_fx_c +#define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c +#define ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c +#define ISSUE_1836_FILEACTIVE_tcx_utils_fx_c +#define ISSUE_1836_FILEACTIVE_tns_base_c +#define ISSUE_1836_FILEACTIVE_tools_fx_c +#define ISSUE_1836_FILEACTIVE_weight_a_fx_c +#define ISSUE_1836_FILEACTIVE_wi_fx_c +#define ISSUE_1836_FILEACTIVE_window_fx_c +#endif #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ -- GitLab From 11f0d8cb45b8c5a3090328e57e9aa2f27aa65577 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 13:04:29 +0200 Subject: [PATCH 062/103] activate macros --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5e3405456..4903698b8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,7 +113,7 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ -//#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ +#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ #define ISSUE_1836_FILEACTIVE_arith_coder_fx_c #define ISSUE_1836_FILEACTIVE_basop32_c @@ -145,7 +145,7 @@ #define ISSUE_1836_FILEACTIVE_get_gain_fx_c #define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c #define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c -#if 0 +#if 1 #define ISSUE_1836_FILEACTIVE_gs_gains_fx_c #define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c #define ISSUE_1836_FILEACTIVE_hp50_fx_c -- GitLab From c81133771aced8e24899d2843d5568f92f3341bf Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 13:20:56 +0200 Subject: [PATCH 063/103] checkout d* e* f* g* from lib_com from #fb1b910 --- lib_com/deemph_fx.c | 51 +++- lib_com/edct_fx.c | 50 +++- lib_com/env_stab_fx.c | 12 + lib_com/fd_cng_com_fx.c | 42 ++- lib_com/fft_fx_evs.c | 436 ++++++++++++++++++++++++++++- lib_com/frame_ener_fx.c | 38 ++- lib_com/get_gain_fx.c | 19 ++ lib_com/gs_bitallocation_fx.c | 14 +- lib_com/gs_bitallocation_ivas_fx.c | 13 + lib_com/gs_gains_fx.c | 64 ++++- lib_com/gs_noisefill_fx.c | 90 ++++-- 11 files changed, 774 insertions(+), 55 deletions(-) diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 9516202c1..e0720a44f 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -39,7 +39,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_deemph_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif void deemph_fx_32( Word32 *signal, /* i/o: signal Qx*/ const Word16 mu, /* i : deemphasis factor Q15*/ @@ -93,22 +98,34 @@ void deemph_fx( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); #endif - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/ signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ +#else + L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ + L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ + signal[0] = round_fx_sat( L_tmp ); /*Qx*/ +#endif + + move16(); FOR( i = 1; i < L; i++ ) { - L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ - L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ - signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ + L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ + signal[i] = round_fx_sat( L_tmp ); /*Qx*/ +#else + L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ + signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ +#endif move16(); } @@ -131,10 +148,12 @@ void Deemph2( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif /* saturation can occur in L_mac() */ @@ -144,8 +163,12 @@ void Deemph2( FOR( i = 1; i < L; i++ ) { - L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ - x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ + L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ +#else + x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ +#endif move16(); } @@ -175,10 +198,12 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif /* signal[0] = signal[0] + mu * (*mem); */ @@ -188,8 +213,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W shift = shr( -32768, shift ); /*Q15 - shift*/ FOR( i = 0; i < L; i++ ) { - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/ + x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ +#else + L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ + x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ +#endif move16(); } } @@ -197,8 +227,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { FOR( i = 0; i < L; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/ + x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ +#else L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ +#endif move16(); } } diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 1b303d285..3c3f6fafb 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -13,6 +13,11 @@ #include "math_32.h" +#ifndef ISSUE_1836_FILEACTIVE_edct_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */ { @@ -396,10 +401,12 @@ void edct_16fx( const Word16 *px, *pt; Word16 *py; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif /*COMPLETE: some eDCT sub function are missing */ @@ -455,13 +462,22 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ + L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */ + re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ + move16(); + L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ + Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */ + im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ +#else Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow ); /*Q(Qx+16) */ re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ move16(); L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ Lacc = L_msu_o( L_tmp, x[i2], *pt, &Overflow ); /*Q(Qx+16) */ im2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ +#endif move16(); px -= 2; pt--; @@ -486,12 +502,20 @@ void edct_16fx( fact = round_fx( L_shl( L_tmp, 2 ) ); /*Q15 */ FOR( i = 0; i < shr( length, 1 ); i++ ) { - tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ - re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ + tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ +#ifdef ISSUE_1836_replace_overflow_libcom + re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */ +#else + re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ +#endif move16(); - tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ - im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ + tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ +#ifdef ISSUE_1836_replace_overflow_libcom + im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */ +#else + im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ +#endif move16(); } @@ -502,14 +526,24 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ + move16(); + + L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ + Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ + *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ +#else + Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ + y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ move16(); L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ +#endif move16(); py -= 2; diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index a3140b4e4..839d39c4f 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -43,6 +43,12 @@ #include "rom_com.h" #include "wmc_auto.h" #include "stl.h" + +#ifndef ISSUE_1836_FILEACTIVE_env_stab_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*--------------------------------------------------------------------------* * Local constants *--------------------------------------------------------------------------*/ @@ -187,9 +193,11 @@ Word16 env_stab_smo_fx( /* Q0 */ Word16 maxval, pp[NUM_ENV_STAB_PLC_STATES], pa[NUM_ENV_STAB_PLC_STATES]; Word16 i; Word16 tmp, sum, exp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* get previous state */ prev_state = maximum_fx( env_stab_state_p, NUM_ENV_STAB_PLC_STATES, &maxval ); @@ -226,7 +234,11 @@ Word16 env_stab_smo_fx( /* Q0 */ /*tmp = shl(tmp, add(exp, 1));*/ /* Q15 */ FOR( i = 0; i < NUM_ENV_STAB_PLC_STATES; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + env_stab_state_p[i] = round_fx_sat( L_shl_sat( L_mult_sat( env_stab_state_p[i], tmp ), add( exp, 1 ) ) ); /* Q15 */ +#else env_stab_state_p[i] = round_fx_o( L_shl_o( L_mult_o( env_stab_state_p[i], tmp, &Overflow ), add( exp, 1 ), &Overflow ), &Overflow ); /* Q15 */ +#endif move16(); } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 7cc536822..8ff5eb489 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -21,6 +21,12 @@ #define CNG_HS 4 /* 4 bit headroom for dot product */ #define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */ +#ifndef ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------- * Local function prototypes *-------------------------------------------------------------------*/ @@ -647,11 +653,12 @@ void minimum_statistics( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif - +#endif len2 = i_mult( MSNUMSUBFR, len ); @@ -750,7 +757,11 @@ void minimum_statistics( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); +#else scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); +#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -900,7 +911,11 @@ void minimum_statistics( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); +#else tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); +#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -988,8 +1003,13 @@ void minimum_statistics( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); + move32(); +#else msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); move32(); +#endif BASOP_SATURATE_WARNING_ON_EVS; } } @@ -1246,10 +1266,12 @@ void minimum_statistics_fx( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif len2 = i_mult( MSNUMSUBFR, len ); @@ -1349,7 +1371,11 @@ void minimum_statistics_fx( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); +#else scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); +#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -1506,7 +1532,11 @@ void minimum_statistics_fx( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); +#else tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); +#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -1594,7 +1624,11 @@ void minimum_statistics_fx( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); +#else msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); +#endif move32(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -2279,10 +2313,12 @@ static void getmidbands( ) { Word16 j, max_psize, shift; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif max_psize = psize[0]; @@ -2316,7 +2352,11 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp) +#else psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) +#endif move16(); } /* minimum_statistics needs fixed exponent of 6 */ diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index b6f2bb2ac..ce1bd52ea 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -32,6 +32,12 @@ static void fft64_16fx( Word16 *x, Word16 *y, const Word16 *Idx ); static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx ); static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w ); +#ifndef ISSUE_1836_FILEACTIVE_fft_fx_evs_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #include "math_32.h" /*-----------------------------------------------------------------* @@ -1186,9 +1192,11 @@ static void fft5_32_16fx( Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7; Word16 i0, i1, i2, i3, i4; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif i0 = Idx[0]; move16(); @@ -1216,9 +1224,15 @@ static void fft5_32_16fx( move16(); T6 = zRe[i3]; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + T7 = add_sat( T5, T6 ); //??sat + T8 = add_sat( T4, T7 ); //??sat + Tt = sub_sat( T5, T6 ); //??sat +#else T7 = add_o( T5, T6, &Overflow ); T8 = add_o( T4, T7, &Overflow ); Tt = sub_o( T5, T6, &Overflow ); +#endif /* T9 = KP559016994 * (T4 - T7); */ L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) T9 = round_fx_sat( L_tmp ); // Qx @@ -1240,11 +1254,17 @@ static void fft5_32_16fx( L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) Tn = round_fx_sat( L_tmp ); // Qx - +#ifdef ISSUE_1836_replace_overflow_libcom + zRe[i0] = add_sat( T1, T8 ); //??sat + move16(); + zIm[i0] = add_sat( To, Tp ); //??sat + move32(); +#else zRe[i0] = add_o( T1, T8, &Overflow ); move16(); zIm[i0] = add_o( To, Tp, &Overflow ); move32(); +#endif /*T2 = KP951056516*Te + KP587785252*Th; */ L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x) @@ -1261,6 +1281,16 @@ static void fft5_32_16fx( T4 = add_sat( T9, T6 ); T5 = sub_sat( T6, T9 ); +#ifdef ISSUE_1836_replace_overflow_libcom + zRe[i3] = sub_sat( T4, T2 ); //??sat + move32(); + zRe[i1] = add_sat( T5, T3 ); //??sat + move32(); + zRe[i2] = add_sat( T4, T2 ); //??sat + move32(); + zRe[i4] = sub_sat( T5, T3 ); //??sat + move32(); +#else zRe[i3] = sub_o( T4, T2, &Overflow ); move32(); zRe[i1] = add_o( T5, T3, &Overflow ); @@ -1269,6 +1299,7 @@ static void fft5_32_16fx( move32(); zRe[i4] = sub_o( T5, T3, &Overflow ); move32(); +#endif /* T2 = KP951056516 * Ts + KP587785252 * Tt; */ L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x) @@ -1675,9 +1706,11 @@ static void cftfsub_16fx( { Word16 j, j1, j2, j3, l; Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif l = 2; @@ -1731,6 +1764,15 @@ static void cftfsub_16fx( { FOR( j = 0; j < l; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); //??sat + x0r = sub_sat( a[j], a[j1] ); //??sat + x0i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + a[j] = add_sat( a[j], a[j1] ); //??sat + move16(); + a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); //??sat + move16(); +#else j1 = add_o( j, l, &Overflow ); x0r = sub_o( a[j], a[j1], &Overflow ); x0i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); @@ -1738,6 +1780,7 @@ static void cftfsub_16fx( move16(); a[j + 1] = add_o( a[j + 1], a[j1 + 1], &Overflow ); move16(); +#endif a[j1] = x0r; move16(); a[j1 + 1] = x0i; @@ -1762,11 +1805,84 @@ static void cft1st_16fx( Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; Word16 tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif + +#ifdef ISSUE_1836_replace_overflow_libcom + x0r = add_sat( a[0], a[2] ); //??sat + x0i = add_sat( a[1], a[3] ); //??sat + x1r = sub_sat( a[0], a[2] ); //??sat + x1i = sub_sat( a[1], a[3] ); //??sat + x2r = add_sat( a[4], a[6] ); //??sat + x2i = add_sat( a[5], a[7] ); //??sat + x3r = sub_sat( a[4], a[6] ); //??sat + x3i = sub_sat( a[5], a[7] ); //??sat + a[0] = add_sat( x0r, x2r ); //??sat + move16(); + a[1] = add_sat( x0i, x2i ); //??sat + move16(); + a[4] = sub_sat( x0r, x2r ); //??sat + move16(); + a[5] = sub_sat( x0i, x2i ); //??sat + move16(); + a[2] = sub_sat( x1r, x3i ); //??sat + move16(); + a[3] = add_sat( x1i, x3r ); //??sat + move16(); + a[6] = add_sat( x1r, x3i ); //??sat + move16(); + a[7] = sub_sat( x1i, x3r ); //??sat + wk1r = w[2]; + move32(); + + x0r = add_sat( a[8], a[10] ); //??sat + x0i = add_sat( a[9], a[11] ); //??sat + x1r = sub_sat( a[8], a[10] ); //??sat + x1i = sub_sat( a[9], a[11] ); //??sat + x2r = add_sat( a[12], a[14] ); //??sat + x2i = add_sat( a[13], a[15] ); //??sat + x3r = sub_sat( a[12], a[14] ); //??sat + x3i = sub_sat( a[13], a[15] ); //??sat + a[8] = add_sat( x0r, x2r ); //??sat + move16(); + a[9] = add_sat( x0i, x2i ); //??sat + move16(); + a[12] = sub_sat( x2i, x0i ); //??sat + move16(); + a[13] = sub_sat( x0r, x2r ); //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + tmp = sub_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + + a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + tmp = add_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat + a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct)*/ //??sat + move16(); + + x0r = add_sat( x3i, x1r ); //??sat + x0i = sub_sat( x3r, x1i ); //??sat + tmp = sub_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ //??sat + a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + tmp = add_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + k1 = 0; + move16(); +#else x0r = add_o( a[0], a[2], &Overflow ); x0i = add_o( a[1], a[3], &Overflow ); x1r = sub_o( a[0], a[2], &Overflow ); @@ -1836,6 +1952,7 @@ static void cft1st_16fx( move16(); k1 = 0; move16(); +#endif FOR( j = 16; j < n; j += 16 ) { @@ -1856,6 +1973,118 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ +#ifdef ISSUE_1836_replace_overflow_libcom + x0r = add_sat( a[j], a[j + 2] ); //??sat + x0i = add_sat( a[j + 1], a[j + 3] ); //??sat + x1r = sub_sat( a[j], a[j + 2] ); //??sat + x1i = sub_sat( a[j + 1], a[j + 3] ); //??sat + x2r = add_sat( a[j + 4], a[j + 6] ); //??sat + x2i = add_sat( a[j + 5], a[j + 7] ); //??sat + x3r = sub_sat( a[j + 4], a[j + 6] ); //??sat + x3i = sub_sat( a[j + 5], a[j + 7] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat + move16(); + + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); + x0i = add_sat( x1i, x3r ); + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = add_sat( x1r, x3i ); + x0i = sub_sat( x1i, x3r ); + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + wk1r = w[k2 + 2]; + move32(); + wk1i = w[k2 + 3]; + move32(); + L_tmp = L_shl( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ + wk3r = L_sub( wk1r, L_shl( L_tmp, 1 ) ); /*Q30 */ + + L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ + wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ + + x0r = add_sat( a[j + 8], a[j + 10] ); //??sat + x0i = add_sat( a[j + 9], a[j + 11] ); //??sat + x1r = sub_sat( a[j + 8], a[j + 10] ); //??sat + x1i = sub_sat( a[j + 9], a[j + 11] ); //??sat + x2r = add_sat( a[j + 12], a[j + 14] ); //??sat + x2i = add_sat( a[j + 13], a[j + 15] ); //??sat + x3r = sub_sat( a[j + 12], a[j + 14] ); //??sat + x3i = sub_sat( a[j + 13], a[j + 15] ); //??sat + a[j + 8] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 9] = add_sat( x0i, x2i ); //??sat + move16(); + + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat + tmp = negate( x0r ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + tmp = negate( x0i ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = add_sat( x1r, x3i ); //??sat + x0i = sub_sat( x1i, x3r ); //??sat + + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); +#else x0r = add_o( a[j], a[j + 2], &Overflow ); x0i = add_o( a[j + 1], a[j + 3], &Overflow ); x1r = sub_o( a[j], a[j + 2], &Overflow ); @@ -1966,6 +2195,7 @@ static void cft1st_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 15] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } return; @@ -1988,13 +2218,44 @@ static void cftmdl_16fx( Word16 tmp, tmp2; Word32 L_tmp; Word32 L_x0r, L_x0i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif m = shl( l, 2 ); FOR( j = 0; j < l; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat + move16(); + a[j2] = sub_sat( x0r, x2r ); //??sat + move16(); + a[j2 + 1] = sub_sat( x0i, x2i ); //??sat + move16(); + a[j1] = sub_sat( x1r, x3i ); //??sat + move16(); + a[j1 + 1] = add_sat( x1i, x3r ); //??sat + move16(); + a[j3] = add_sat( x1r, x3i ); //??sat + move16(); + a[j3 + 1] = sub_sat( x1i, x3r ); //??sat + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2022,6 +2283,7 @@ static void cftmdl_16fx( move16(); a[j3 + 1] = sub_o( x1i, x3r, &Overflow ); move16(); +#endif } wk1r = w[2]; @@ -2029,6 +2291,51 @@ static void cftmdl_16fx( tmp2 = add( l, m ); FOR( j = m; j < tmp2; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat + move16(); + a[j2] = sub_sat( x2i, x0i ); //??sat + move16(); + a[j2 + 1] = sub_sat( x0r, x2r ); //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + tmp = sub_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + tmp = add_sat( x0r, x0i ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = add_sat( x3i, x1r ); //??sat + x0i = sub_sat( x3r, x1i ); //??sat + tmp = sub_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + tmp = add_sat( x0i, x0r ); //??sat + L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2072,6 +2379,7 @@ static void cftmdl_16fx( L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } k1 = 0; @@ -2098,6 +2406,63 @@ static void cftmdl_16fx( tmp2 = add( l, k ); FOR( j = k; j < tmp2; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat + move16(); + + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat + + L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_x0r = L_add( (Word32) x1r, (Word32) x3i ); + L_x0i = L_sub( (Word32) x1i, (Word32) x3r ); + x0r = extract_l( L_x0r ); + x0i = extract_l( L_x0i ); + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2153,20 +2518,88 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } wk1r = w[k2 + 2]; move32(); wk1i = w[k2 + 3]; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ //??sat + wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ //??sat + + L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ //??sat + wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ //??sat + tmp2 = add( l, add( k, m ) ); +#else L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */ wk3r = L_sub_o( wk1r, L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q30 */ L_tmp = L_shl_o( Mult_32_32( wk2r, wk1r ), 1, &Overflow ); /*Q29 */ wk3i = L_sub_o( L_shl_o( L_tmp, 1, &Overflow ), wk1i, &Overflow ); /*Q30 */ tmp2 = add( l, add( k, m ) ); +#endif FOR( j = add( k, m ); j < tmp2; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + j1 = add_sat( j, l ); //??sat + j2 = add_sat( j1, l ); //??sat + j3 = add_sat( j2, l ); //??sat + x0r = add_sat( a[j], a[j1] ); //??sat + x0i = add_sat( a[j + 1], a[j1 + 1] ); //??sat + x1r = sub_sat( a[j], a[j1] ); //??sat + x1i = sub_sat( a[j + 1], a[j1 + 1] ); //??sat + x2r = add_sat( a[j2], a[j3] ); //??sat + x2i = add_sat( a[j2 + 1], a[j3 + 1] ); //??sat + x3r = sub_sat( a[j2], a[j3] ); //??sat + x3i = sub_sat( a[j2 + 1], a[j3 + 1] ); //??sat + a[j] = add_sat( x0r, x2r ); //??sat + move16(); + a[j + 1] = add_sat( x0i, x2i ); //??sat + move16(); + + x0r = sub_sat( x0r, x2r ); //??sat + x0i = sub_sat( x0i, x2i ); //??sat + + tmp = negate( x0r ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ + a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + tmp = negate( x0i ); + L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ + a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = sub_sat( x1r, x3i ); //??sat + x0i = add_sat( x1i, x3r ); //??sat + + L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + x0r = add_sat( x1r, x3i ); //??sat + x0i = sub_sat( x1i, x3r ); //??sat + + L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ + L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ + a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); + + L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ + L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ + a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ //??sat + move16(); +#else j1 = add_o( j, l, &Overflow ); j2 = add_o( j1, l, &Overflow ); j3 = add_o( j2, l, &Overflow ); @@ -2223,6 +2656,7 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ move16(); +#endif } } diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index 68fdf33c3..ed46494ee 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -40,6 +40,13 @@ #include "cnst.h" #include "prot_fx.h" #include "wmc_auto.h" + +#ifndef ISSUE_1836_FILEACTIVE_frame_ener_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*----------------------------------------------------------------------------------* * fer_energy() * @@ -239,14 +246,20 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 const Word16 *pt1; Word16 tmp16, exp1, exp2, tmp1, tmp2; Word16 len, enern; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif /* len = (0.5f * (pitch[2]/64.0 + pitch[3]/64.0) + 0.5f) */ +#ifdef ISSUE_1836_replace_overflow_libcom + len = mult_r( add_sat( pitch[2], pitch[3] ), 256 ); //??sat +#else len = mult_r( add_o( pitch[2], pitch[3], &Overflow ), 256 ); +#endif if ( LT_16( len, L_SUBFR ) ) { @@ -276,16 +289,29 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 exp1 = sub( 15 + exp1, tmp2 ); /*add ld(2^exp1)=exp1 but check format, first*/ - tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ - Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ - exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ - Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ + tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ //??sat +#else + Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ +#endif + exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/ //??sat +#else + Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ +#endif /*make 10*log10 out of log2*/ - Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ + Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ +#ifdef ISSUE_1836_replace_overflow_libcom + *frame_ener = extract_h( L_shl_sat( Ltmp, add( tmp16, 1 ) ) ); /*Q8*/ //??sat + move16(); + enern = sub_sat( *frame_ener, lp_speech ); /*Q8*/ //??sat +#else *frame_ener = extract_h( L_shl_o( Ltmp, add( tmp16, 1 ), &Overflow ) ); /*Q8*/ move16(); enern = sub_o( *frame_ener, lp_speech, &Overflow ); /*Q8*/ - +#endif return enern; } diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index 8ec4f5a40..ab7024371 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -39,6 +39,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_get_gain_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*----------------------------------------------------------------------------------* * get_gain() * @@ -53,10 +59,12 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 exp_c, exp_e, exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif tcorr = L_deposit_l( 0 ); @@ -70,8 +78,13 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) tcorr = Dot_product16HQ( 0, x, y, n, &exp_c ); tener = Dot_productSq16HQ( 0, y, n, &exp_e ); +#ifdef ISSUE_1836_replace_overflow_libcom + BASOP_Util_Divide_MantExp( round_fx_sat( tcorr ), exp_c, s_max( round_fx_sat( tener ), 1 ), exp_e, &tmp, &exp ); //??sat + Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat +#else BASOP_Util_Divide_MantExp( round_fx_o( tcorr, &Overflow ), exp_c, s_max( round_fx_o( tener, &Overflow ), 1 ), exp_e, &tmp, &exp ); Lgain = L_shl_o( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ), &Overflow ) /*Q16*/; +#endif return Lgain; } @@ -84,9 +97,11 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 m_corr, m_ener, negative, Q_corr, Q_ener; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif negative = 0; @@ -130,7 +145,11 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) Q_corr = sub( Q_corr, Q_ener ); +#ifdef ISSUE_1836_replace_overflow_libcom + Lgain = L_shl_sat( L_deposit_l( m_corr ), add( Q_corr, 1 ) ); /* Lgain in Q16 */ //??sat +#else Lgain = L_shl_o( L_deposit_l( m_corr ), add( Q_corr, 1 ), &Overflow ); /* Lgain in Q16 */ +#endif if ( negative != 0 ) { diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 0ce59482f..beb402b5d 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -9,6 +9,12 @@ #include "assert.h" /* Debug prototypes */ #include "stl.h" +#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*==================================================================================*/ /* FUNCTION : void bands_and_bit_alloc_fx(); */ /*----------------------------------------------------------------------------------*/ @@ -77,8 +83,10 @@ void bands_and_bit_alloc_fx( Word16 w_sum_bit; (void) GSC_IVAS_mode; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif nb_tot_bands = MBANDS_GN; move16(); @@ -93,8 +101,12 @@ void bands_and_bit_alloc_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ +#ifdef ISSUE_1836_replace_overflow_libcom + ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ //??sat +#else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ - Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ +#endif + Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; move16(); IF( EQ_16( L_frame, L_FRAME16k ) ) diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 9243f640e..601eb92d7 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -33,6 +33,13 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const #define Q31_0_02 42949673 /* 0.02 */ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ + +#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -105,8 +112,10 @@ void bands_and_bit_alloc_ivas_fx( Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; /* Q18 */ Word16 w_sum_bit; Word16 fzero_val; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif nb_tot_bands = MBANDS_GN; move16(); @@ -120,7 +129,11 @@ void bands_and_bit_alloc_ivas_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ +#ifdef ISSUE_1836_replace_overflow_libcom + ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ //??sat +#else ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ +#endif move16(); Copy( Ener_per_bd_iQ + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index f28af742f..a00fbd829 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -43,6 +43,12 @@ #include "stl.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_gs_gains_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -84,9 +90,11 @@ void Comp_and_apply_gain_fx( Word16 y_gain; Word16 L16, frac, exp1, tmp_exp; Word32 L32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Recreate excitation for local synthesis and decoder */ @@ -108,9 +116,15 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */ //??sat + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */ //??sat + move16(); +#else L32 = L_shl_o( L_mult( exc_diffQ[i], y_gain ), tmp_exp, &Overflow ); /*Q_exc+16 */ exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc */ move16(); +#endif } } ELSE @@ -126,14 +140,22 @@ void Comp_and_apply_gain_fx( y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); +#else Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); +#endif move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */ //??sat //??sat +#else exc_diffQ[i] = round_fx_o( L_shl_o( L32, tmp_exp, &Overflow ), &Overflow ); /*Q_exc */ +#endif move16(); } } @@ -157,9 +179,11 @@ void Comp_and_apply_gain_ivas_fx( Word16 L16, frac, exp1, tmp_exp; Word32 L32; Word16 Q_exc_diffQ[L_FRAME16k]; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Recreate excitation for local synthesis and decoder */ @@ -181,8 +205,12 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ + L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat +#else + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ +#endif move16(); IF( exc_diffQ[i] ) { @@ -201,21 +229,29 @@ void Comp_and_apply_gain_ivas_fx( * y_gain = pow(10.0, (Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) * = pow(2, 3.321928*(Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) *-----------------------------------------------------------------*/ - L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ - L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ - L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ - y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ - move16(); /*Q1 */ + L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ + L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ + L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ + frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ + y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ +#else + Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ +#endif + move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ //??sat +#else + exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ +#endif move16(); IF( exc_diffQ[i] ) { diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 208f20569..bc350e165 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -6,6 +6,12 @@ #include "rom_com.h" #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * gs_noisf() * @@ -411,9 +417,11 @@ static void Decreas_freqPeak_fx( Word16 lsf_new_diff[M]; Word16 tmp, tmp1, exp; Word16 tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif move16(); /*ptr init*/ lsf_new_diff[0] = 0; /* prevent unitialized value */ @@ -470,11 +478,15 @@ static void Decreas_freqPeak_fx( { tmp = abs_s( *src ); exp = norm_s( max_val ); - tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ - L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ + tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ + L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ - tmp = sub( 32767, tmp ); /*Q14 */ - L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ +#endif + tmp = sub( 32767, tmp ); /*Q14 */ + L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ tmp = round_fx( L_shl( L_tmp, 1 ) ); tmp1 = negate( tmp ); @@ -528,9 +540,11 @@ static void envelop_modify_fx( Word16 weight_fx; Word32 L_exc_diffQ_fx[L_FRAME16k], exc_diffQ_max; Word16 Q_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif start_band = i_mult( last_bin, 16 ); @@ -565,7 +579,11 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); - Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat +#else + Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ +#endif FOR( j = 0; j < 16; j++ ) { @@ -591,7 +609,11 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ //??sat +#else + Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ +#endif src_fx = &exc_diffQ_fx[224]; FOR( j = 0; j < 32; j++ ) @@ -690,9 +712,11 @@ void highband_exc_dct_in_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -708,9 +732,15 @@ void highband_exc_dct_in_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = shl_sat( tmp, exp ); //??sat + move16(); + ener = add_sat( tmp1, ener ); /*Q0 */ //??sat +#else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ +#endif } test(); @@ -939,10 +969,14 @@ void highband_exc_dct_in_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat +#else + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ +#endif } } @@ -977,9 +1011,15 @@ void highband_exc_dct_in_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; +#ifdef ISSUE_1836_replace_overflow_libcom + *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat + move16(); + tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat +#else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ +#endif if ( tmp2 > 0 ) { *src = tmp; @@ -1068,9 +1108,11 @@ void highband_exc_dct_in_ivas_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -1086,9 +1128,15 @@ void highband_exc_dct_in_ivas_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = shl_sat( tmp, exp ); //??sat + move16(); + ener = add_sat( tmp1, ener ); /*Q0 */ //??sat +#else tmp1 = shl_o( tmp, exp, &Overflow ); move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ + ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ +#endif } test(); @@ -1432,10 +1480,14 @@ void highband_exc_dct_in_ivas_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ //??sat //??sat +#else + exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ +#endif } } @@ -1470,9 +1522,15 @@ void highband_exc_dct_in_ivas_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; +#ifdef ISSUE_1836_replace_overflow_libcom + *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ //??sat + move16(); + tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ //??sat +#else *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ +#endif IF( tmp2 > 0 ) { *src = tmp; -- GitLab From 791028ead5c50653c3b2ab4693fc60447c471cdd Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 13:37:39 +0200 Subject: [PATCH 064/103] checkout h* i* *j *k *l *m from lib_com from #fb1b910 --- lib_com/hp50_fx.c | 70 ++++++++++++ lib_com/hq2_bit_alloc_fx.c | 13 +++ lib_com/hq2_core_com_fx.c | 27 +++++ lib_com/hq2_noise_inject_fx.c | 66 +++++++++-- lib_com/ifft_rel_fx.c | 82 ++++++++++++++ lib_com/interpol_fx.c | 13 +++ lib_com/low_rate_band_att_fx.c | 37 ++++++- lib_com/lpc_tools_fx.c | 130 +++++++++++++++++++++- lib_com/lsf_tools_fx.c | 132 +++++++++++++++++++--- lib_com/lsp_conv_poly_fx.c | 86 +++++++++++++++ lib_com/math_op.c | 30 +++++ lib_com/modif_fs_fx.c | 196 +++++++++++++++++++++++++++------ 12 files changed, 812 insertions(+), 70 deletions(-) diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 4a055e073..f3eb49db6 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -40,6 +40,11 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_hp50_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif #define HP20_COEFF_SCALE ( 2 ) /* @@ -86,9 +91,11 @@ static void filter_2nd_order( Word16 i; Word16 x2, x1; Word32 L_sum, L_y1, L_y2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif /* @@ -107,10 +114,18 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat //??sat +#else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); +#endif + BASOP_SATURATE_WARNING_ON_EVS BASOP_SATURATE_ERROR_ON_EVS @@ -121,10 +136,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat +#else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS move16(); @@ -140,10 +162,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); //??sat +#else L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS /* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */ BASOP_SATURATE_ERROR_ON_EVS @@ -154,10 +183,17 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); //??sat + BASOP_SATURATE_ERROR_OFF_EVS + BASOP_SATURATE_WARNING_OFF_EVS + signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); //??sat +#else L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS move16(); } @@ -190,9 +226,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { Word32 a1, b1, a2, b2; Word16 prescale, prescaleOld, diff; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif prescale = getScaleFactor16( signal, lg ); @@ -202,7 +240,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { prescale = s_min( prescale, diff ); } +#ifdef ISSUE_1836_replace_overflow_libcom + diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); //??sat +#else diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); +#endif if ( mem[3] != 0 ) { prescale = s_min( prescale, diff ); @@ -212,6 +254,15 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * IF( prescale != prescaleOld ) { diff = sub( prescale, prescaleOld ); +#ifdef ISSUE_1836_replace_overflow_libcom + mem[0] = L_shr_sat( mem[0], diff ); //??sat + move32(); + mem[1] = L_shr_sat( mem[1], diff ); //??sat + move32(); + mem[2] = L_shr_sat( mem[2], diff ); //??sat + move32(); + mem[3] = L_shr_sat( mem[3], diff ); //?sat +#else mem[0] = L_shr_o( mem[0], diff, &Overflow ); move32(); mem[1] = L_shr_o( mem[1], diff, &Overflow ); @@ -219,6 +270,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * mem[2] = L_shr_o( mem[2], diff, &Overflow ); move32(); mem[3] = L_shr_o( mem[3], diff, &Overflow ); +#endif move32(); mem[4] = L_deposit_l( prescale ); } @@ -303,7 +355,9 @@ void hp20_fx_32( Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; +#endif Word16 prescale, prescaleOld, prescale_current_frame, diff; prescale = getScaleFactor32( signal_fx, lg ); @@ -312,8 +366,14 @@ void hp20_fx_32( prescaleOld = extract_l( mem_fx[4] ); +#ifdef ISSUE_1836_replace_overflow_libcom + diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat + diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); //??sat +#else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); +#endif + diff = L_max( diff_pos, diff_neg ); @@ -325,6 +385,15 @@ void hp20_fx_32( prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); +#ifdef ISSUE_1836_replace_overflow_libcom + mem_fx[0] = L_shr_sat( mem_fx[0], diff ); + move32(); + mem_fx[1] = L_shr_sat( mem_fx[1], diff ); + move32(); + mem_fx[2] = L_shr_sat( mem_fx[2], diff ); + move32(); + mem_fx[3] = L_shr_sat( mem_fx[3], diff ); +#else mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); move32(); mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); @@ -332,6 +401,7 @@ void hp20_fx_32( mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); +#endif move32(); mem_fx[4] = L_deposit_l( prescale_current_frame ); move32(); diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 61d00ce98..02d3590c0 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -35,6 +35,13 @@ #include "prot_fx.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + #define MIN_BITS_FIX 0 /* QRk=18 */ #define HQ_16k40_BIT ( HQ_16k40 / 50 ) /* 16400/50=328 */ #define Qbf 14 /* Q value for bits_fact */ @@ -312,9 +319,11 @@ void hq2_bit_alloc_har_fx( Word16 exp_shift; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow; Overflow = 0; move32(); +#endif L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk ); L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); @@ -570,9 +579,13 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); //??sat +#else lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ move32(); +#endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index bf0af5e87..f071689d4 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -37,6 +37,13 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * @@ -88,9 +95,11 @@ void mdct_spectrum_denorm_fx( Word16 cond_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ +#endif #endif exp_safe = 4; /* safe bit for overflow */ @@ -163,8 +172,12 @@ void mdct_spectrum_denorm_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); +#ifdef ISSUE_1836_replace_overflow_libcom + cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat +#else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; +#endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { @@ -196,7 +209,11 @@ void mdct_spectrum_denorm_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat +#else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); +#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } @@ -260,9 +277,11 @@ void mdct_spectrum_denorm_ivas_fx( Word16 cond_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); /* allow overflow happen. */ +#endif #endif exp_safe = 4; /* safe bit for overflow */ @@ -335,8 +354,12 @@ void mdct_spectrum_denorm_ivas_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); +#ifdef ISSUE_1836_replace_overflow_libcom + cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ //??sat +#else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ Overflow = 0; +#endif move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { @@ -368,7 +391,11 @@ void mdct_spectrum_denorm_ivas_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); //??sat +#else gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); +#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index bc96fe0f8..04bd5af34 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -36,6 +36,12 @@ #include "oper_32b.h" #include "move.h" +#ifndef ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*--------------------------------------------------------------------------* * hq2_noise_inject() * @@ -80,9 +86,11 @@ void hq2_noise_inject_fx( Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos; Word16 sb = bands; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif satur = 0; @@ -90,7 +98,11 @@ void hq2_noise_inject_fx( FOR( i = 0; i < bands; i++ ) { - Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ //??sat +#else + Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ +#endif move32(); } @@ -155,7 +167,11 @@ void hq2_noise_inject_fx( Q_env_fx[k] = sub( 31, exp2 ); move16(); tmp = sub( 17, Q_env_fx[k] ); +#ifdef ISSUE_1836_replace_overflow_libcom + env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ //??sat +#else env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ +#endif peak_fx[k] = 0; move16(); count[k] = 0; @@ -166,7 +182,11 @@ void hq2_noise_inject_fx( FOR( i = band_start[k]; i <= band_end[k]; i++ ) { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); //??sat +#else Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); +#endif move32(); /* Q0 */ IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) ) { @@ -386,8 +406,12 @@ void hq2_noise_inject_fx( } ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { - L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ + L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ +#else fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */ +#endif } } @@ -467,7 +491,11 @@ void hq2_noise_inject_fx( } L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ +#ifdef ISSUE_1836_replace_overflow_libcom + ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); //??sat +#else ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); +#endif move32(); /*Q17 */ } ELSE @@ -589,14 +617,22 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */ tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat +#else + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ +#endif } ELSE { tmp = 0x7fff; /*Q0 */ L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ //??sat +#else + tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ +#endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -608,8 +644,12 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); - tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ - tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ //??sat +#else + tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ +#endif + tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE { @@ -618,12 +658,16 @@ void hq2_noise_inject_fx( move16(); move16(); } - tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ - L_tmp = L_mult( tmp1, j ); /*Q13 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ + tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ + L_tmp = L_mult( tmp1, j ); /*Q13 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ //??sat +#else tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ - tmp = sub( fac_fx, tmp ); /*Q12 */ - L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ +#endif + tmp = sub( fac_fx, tmp ); /*Q12 */ + L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); move32(); /*Q12 */ } diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index 9e64a4e25..f0add9252 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -39,6 +39,13 @@ #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" + +#ifndef ISSUE_1836_FILEACTIVE_ifft_rel_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ @@ -77,10 +84,12 @@ void ifft_rel_fx( Word16 cc1, cc3, ss1, ss3; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif +#endif /*-----------------------------------------------------------------* @@ -108,6 +117,17 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ //??sat + *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ //??sat + move16(); + *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ //??sat + move16(); + *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat + move16(); + *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ //??sat + move16(); +#else t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); @@ -117,9 +137,23 @@ void ifft_rel_fx( move16(); *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ move16(); +#endif IF( NE_16( n4, 1 ) ) { +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat + t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ //??sat + + *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/ //??sat + move16(); + *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/ //??sat + move16(); + *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/ //??sat + move16(); + *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ //??sat + move16(); +#else t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ @@ -131,6 +165,7 @@ void ifft_rel_fx( move16(); *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ move16(); +#endif } xi1 += id; xi2 += id; @@ -178,6 +213,45 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + move16(); + xup1 += n4; + xdn6 -= n4; + + t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/ //??sat + *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/ //??sat + move16(); + + xdn6 += n4; + t3 = add_sat( *xdn8, *xup3 ); /*Qx*/ //??sat + *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/ //??sat + move16(); + + xup3 += n4; + xdn8 -= n4; + + t4 = add_sat( *xup3, *xdn8 ); /*Qx*/ //??sat + *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/ //??sat + move16(); + + t5 = sub_sat( t1, t4 ); /*Qx*/ //??sat + t1 = add_sat( t1, t4 ); /*Qx*/ //??sat + t4 = sub_sat( t2, t3 ); /*Qx*/ //??sat + t2 = add_sat( t2, t3 ); /*Qx*/ //??sat + *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/ //??sat + move16(); + xup3 -= n4; + *xup3 = add_sat( mult_r( t5, cc1 ), mult_r( t4, ss1 ) ); /*Qx*/ //??sat + move16(); + *xdn8 = sub_sat( mult_r( t5, ss1 ), mult_r( t4, cc1 ) ); /*Qx*/ //??sat + move16(); + + xdn8 += n4; + *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/ //??sat + move16(); +#else t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/ *xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ move16(); @@ -215,6 +289,7 @@ void ifft_rel_fx( xdn8 += n4; *xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/ move16(); +#endif xup1 -= n4; xup1 += id; @@ -245,10 +320,17 @@ void ifft_rel_fx( { r1 = *xi0; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + *xi0 = add_sat( r1, *xi1 ); /*Qx*/ //??sat + move16(); + *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ //??sat + move16(); +#else *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); *xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/ move16(); +#endif xi0 += id; xi1 += id; } diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index abcc6092f..38fc55792 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -41,7 +41,12 @@ #include "rom_com.h" #include "prot_fx_enc.h" +#ifndef ISSUE_1836_FILEACTIVE_interpol_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif Word32 Interpol_lc_fx( /* o : interpolated value Q15 */ const Word16 *x, /* i : input vector Q0 */ const Word16 *win, /* i : interpolation window Q14 */ @@ -83,8 +88,10 @@ Word16 Interpol_4( /* Qx o : interpolated value */ { Word16 i; Word32 L_sum; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif x = x - L_INTERPOL1 + 1; @@ -102,7 +109,13 @@ Word16 Interpol_4( /* Qx o : interpolated value */ } BASOP_SATURATE_WARNING_OFF_EVS /* Here, saturation might occur by intention */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_shl_sat( L_sum, 1 ); /*Qx+14+2*/ + BASOP_SATURATE_WARNING_ON_EVS + return round_fx_sat( L_sum ); /*Qx*/ //??sat +#else L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/ BASOP_SATURATE_WARNING_ON_EVS return round_fx_o( L_sum, &Overflow ); /*Qx*/ +#endif } diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 8ffaf0bfb..1a6e91a22 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,6 +8,11 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*--------------------------------------------------------------------------* * fine_gain_pred() @@ -39,9 +44,11 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -81,7 +88,11 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -96,8 +107,12 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat +#else + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -154,9 +169,11 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -187,9 +204,13 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -204,8 +225,12 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat +#else + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 1035f017a..bc7ebe478 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,6 +42,12 @@ #include "rom_com.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local constants @@ -409,8 +415,10 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -427,7 +435,11 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_shl_sat( L_32, 2 ); //??sat +#else L_32 = L_shl_o( L_32, 2, &Overflow ); +#endif return ( L_32 ); } @@ -463,9 +475,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -526,12 +540,21 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -546,7 +569,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -585,7 +612,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -621,7 +652,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -657,9 +692,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -720,12 +757,21 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -740,7 +786,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -779,7 +829,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -815,7 +869,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -851,10 +909,13 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +# +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -915,12 +976,21 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); + t0 = L_msu_sat( t0, Rh[i], -32768 ); +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -935,7 +1005,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -974,7 +1048,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1010,7 +1088,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = L_shl_sat( t0, k ); //??sat +#else A[i] = L_shl_o( t0, k, &Overflow ); +#endif move16(); } @@ -1478,9 +1560,11 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* half length FFT */ @@ -1656,6 +1740,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1670,6 +1770,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1690,6 +1791,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1704,6 +1821,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 4b3e200a4..c5d20ef21 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,6 +40,12 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -69,8 +75,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif cheb = norm_s( x ); @@ -108,16 +116,26 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ +#endif + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ +#endif + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -125,10 +143,15 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ +#endif + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -146,9 +169,14 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ - cheb = s_max( -32767, cheb ); /* to avoid saturation */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat + cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat +#else + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ +#endif + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -162,8 +190,10 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------* @@ -286,7 +316,11 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + y = sub_sat( yhigh, ylow ); +#else y = sub_o( yhigh, ylow, &Overflow ); +#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1222,9 +1256,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif /*-----------------------------------------------------* @@ -1255,7 +1291,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat +#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); +#endif move32(); } @@ -1265,11 +1305,19 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 1; i <= nc; i++ ) + { + t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); + t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); + } +#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } +#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1283,6 +1331,16 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_add_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat + + /* a[j] = 0.5*(f1[i] - f2[i]) */ + t0 = L_sub_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat +#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1290,7 +1348,8 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ +#endif j--; } @@ -1734,8 +1793,10 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1796,7 +1857,16 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat + L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat +#else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ @@ -1804,15 +1874,23 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ +#endif } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + move16(); +#else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); +#endif } } @@ -2264,8 +2342,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2311,10 +2391,18 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ +#endif - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat +#else + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ +#endif tmp = s_max( tmp, 0 ); @@ -2351,8 +2439,10 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2404,7 +2494,11 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ +#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3763,8 +3857,10 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3832,9 +3928,13 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat +#else + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ +#endif if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 4f493cacd..ddd8f88f6 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,6 +9,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants @@ -336,8 +342,10 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif exp_den = norm_l( in32 ); @@ -345,10 +353,17 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + exp_den = shl( exp_den, 1 ); + + div_out = div_s( 8192, m_den ); + Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat +#else exp_den = shl_o( exp_den, 1, &Overflow ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ +#endif return Ltmp; } @@ -364,8 +379,10 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif IF( re == 0 ) @@ -378,7 +395,11 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -393,7 +414,11 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -423,7 +448,11 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat +#else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ +#endif return ( L_tmp ); } @@ -501,8 +530,10 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*---------------------------------------------------------------------* @@ -525,7 +556,11 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + r[0] = L_add_sat( r[0], G[i] ); +#else r[0] = L_add_o( r[0], G[i], &Overflow ); +#endif move32(); } @@ -559,18 +594,47 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_add_sat( G[i], G[N - i - 1] ); //??sat +#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); +#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); +#ifdef ISSUE_1836_replace_overflow_libcom + r[1] = L_add_sat( r[1], mh ); //??sat +#else r[1] = L_add_o( r[1], mh, &Overflow ); +#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = mult_r( c[j - 1], x[i - 1] ); + move16(); + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + /*r[j] = L_mac(r[j], c[j], gp);*/ + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); + + c[j + 1] = mult_r( c[j], x[i - 1] ); + move16(); + c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat + move16(); + + /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ + Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); + r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat + move32(); +#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -590,33 +654,55 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); +#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); +#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); +#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat + gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); + + r[0] = L_add_sat( r[0], gp ); //??sat +#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); +#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat + L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat +#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); +#endif } return; diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 7014988b8..caa17b3ae 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,6 +23,12 @@ #include #include +#ifndef ISSUE_1836_FILEACTIVE_math_op_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | @@ -228,20 +234,30 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat + FOR( i = 1; i < lg; i++ ) + { + L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat + } +#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } +#endif } IF( expi < 0 ) { @@ -251,11 +267,24 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat +#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); +#endif } } IF( expi > 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( x[0], expi ); //??sat + L_sum = L_mac_sat( 1, tmp, tmp ); //??sat + FOR( i = 1; i < lg; i++ ) + { + tmp = shl_sat( x[i], expi ); //??sat + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat + } +#else tmp = shl_o( x[0], expi, &Overflow ); L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) @@ -263,6 +292,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val tmp = shl_o( x[i], expi, &Overflow ); L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } +#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 46e24e31a..60a15c5d0 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,6 +15,12 @@ #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -75,9 +81,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -277,7 +285,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat +#else num_den = shl_o( num_den, 1, &Overflow ); +#endif *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } @@ -358,9 +370,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -557,7 +571,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat +#else num_den = shl_o( num_den, 1, &Overflow ); +#endif #else num_den = shl( num_den, 1 ); #endif @@ -929,9 +947,11 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -941,60 +961,103 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ - mem[0] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ - mem[1] = extract_h( Lacc ); /* Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat +#else + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ +#endif + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat + move16(); +#else out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat +#else + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ +#endif + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat + temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ + move16(); + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1005,11 +1068,18 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1017,9 +1087,23 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ + temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ +#else + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1030,7 +1114,8 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1146,9 +1231,11 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1156,11 +1243,34 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[0] = round_fx_sat( Lacc1 ); //??sat + move16(); + Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat + Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat + Lacc = L_deposit_h( temp1 ); + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat + move16(); + + Lacc1 = L_deposit_h( temp2 ); + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat + out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat + move16(); +#else + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1179,13 +1289,36 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_deposit_h( temp1 ); + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( temp2 ); + out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat + move16(); + mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat + move16(); +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1206,6 +1339,7 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } return; -- GitLab From 9806f3e39eed4660e87daadaedb5c4117bda61b4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 14:57:50 +0200 Subject: [PATCH 065/103] checkout *k *l from lib_com from main --- lib_com/low_rate_band_att_fx.c | 37 ++------- lib_com/lpc_tools_fx.c | 130 ++------------------------------ lib_com/lsf_tools_fx.c | 132 ++++----------------------------- lib_com/lsp_conv_poly_fx.c | 86 --------------------- 4 files changed, 28 insertions(+), 357 deletions(-) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 1a6e91a22..8ffaf0bfb 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,11 +8,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*--------------------------------------------------------------------------* * fine_gain_pred() @@ -44,11 +39,9 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -88,11 +81,7 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat -#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -107,12 +96,8 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -169,11 +154,9 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -204,13 +187,9 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat -#else + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -225,12 +204,8 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index bc7ebe478..1035f017a 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,12 +42,6 @@ #include "rom_com.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local constants @@ -415,10 +409,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -435,11 +427,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_shl_sat( L_32, 2 ); //??sat -#else L_32 = L_shl_o( L_32, 2, &Overflow ); -#endif return ( L_32 ); } @@ -475,11 +463,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -540,21 +526,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -569,11 +546,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -612,11 +585,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -652,11 +621,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); -#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -692,11 +657,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -757,21 +720,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -786,11 +740,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -829,11 +779,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -869,11 +815,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat -#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -909,13 +851,10 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -# -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -976,21 +915,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); - t0 = L_msu_sat( t0, Rh[i], -32768 ); -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -1005,11 +935,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -1048,11 +974,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1088,11 +1010,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = L_shl_sat( t0, k ); //??sat -#else A[i] = L_shl_o( t0, k, &Overflow ); -#endif move16(); } @@ -1560,11 +1478,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* half length FFT */ @@ -1740,22 +1656,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat - move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat - move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat - move16(); -#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1770,7 +1670,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1791,22 +1690,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat - move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat - move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat - move16(); -#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1821,7 +1704,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c5d20ef21..4b3e200a4 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,12 +40,6 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -75,10 +69,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif cheb = norm_s( x ); @@ -116,26 +108,16 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -143,15 +125,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -169,14 +146,9 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat - cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat -#else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ -#endif - cheb = s_max( -32767, cheb ); /* to avoid saturation */ + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -190,10 +162,8 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------* @@ -316,11 +286,7 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom - y = sub_sat( yhigh, ylow ); -#else y = sub_o( yhigh, ylow, &Overflow ); -#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1256,11 +1222,9 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif /*-----------------------------------------------------* @@ -1291,11 +1255,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat -#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); -#endif move32(); } @@ -1305,19 +1265,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = 1; i <= nc; i++ ) - { - t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); - t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); - } -#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } -#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1331,16 +1283,6 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_add_sat( f1[i], f2[i] ); //??sat - t0 = L_shl( t0, k ); - a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat - - /* a[j] = 0.5*(f1[i] - f2[i]) */ - t0 = L_sub_sat( f1[i], f2[i] ); //??sat - t0 = L_shl( t0, k ); - a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat -#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1348,8 +1290,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ -#endif + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ j--; } @@ -1793,10 +1734,8 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1857,16 +1796,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat - L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ - L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat -#else + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ @@ -1874,23 +1804,15 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ -#endif } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - move16(); -#else + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); -#endif } } @@ -2342,10 +2264,8 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------------* @@ -2391,18 +2311,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat -#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ -#endif - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat -#else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ -#endif + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ tmp = s_max( tmp, 0 ); @@ -2439,10 +2351,8 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------------* @@ -2494,11 +2404,7 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat -#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ -#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3857,10 +3763,8 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3928,13 +3832,9 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat -#else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ -#endif + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index ddd8f88f6..4f493cacd 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,12 +9,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants @@ -342,10 +336,8 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif exp_den = norm_l( in32 ); @@ -353,17 +345,10 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - exp_den = shl( exp_den, 1 ); - - div_out = div_s( 8192, m_den ); - Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat -#else exp_den = shl_o( exp_den, 1, &Overflow ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ -#endif return Ltmp; } @@ -379,10 +364,8 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif IF( re == 0 ) @@ -395,11 +378,7 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat -#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -414,11 +393,7 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); -#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -448,11 +423,7 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat -#else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ -#endif return ( L_tmp ); } @@ -530,10 +501,8 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*---------------------------------------------------------------------* @@ -556,11 +525,7 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - r[0] = L_add_sat( r[0], G[i] ); -#else r[0] = L_add_o( r[0], G[i], &Overflow ); -#endif move32(); } @@ -594,47 +559,18 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - gp = L_add_sat( G[i], G[N - i - 1] ); //??sat -#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); -#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); -#ifdef ISSUE_1836_replace_overflow_libcom - r[1] = L_add_sat( r[1], mh ); //??sat -#else r[1] = L_add_o( r[1], mh, &Overflow ); -#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - c[j] = mult_r( c[j - 1], x[i - 1] ); - move16(); - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat - move16(); - - /*r[j] = L_mac(r[j], c[j], gp);*/ - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat - move32(); - - c[j + 1] = mult_r( c[j], x[i - 1] ); - move16(); - c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat - move16(); - - /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ - Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); - r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat - move32(); -#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -654,55 +590,33 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); -#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat - move16(); - - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat - move32(); -#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); -#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat - gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); - - r[0] = L_add_sat( r[0], gp ); //??sat -#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); -#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat - L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat -#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); -#endif } return; -- GitLab From 723943ca225b97801fee2b0b8f5e3c4ae60ef8e1 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 15:20:10 +0200 Subject: [PATCH 066/103] checkout *m from lib_com from main --- lib_com/math_op.c | 30 ------- lib_com/modif_fs_fx.c | 196 +++++++----------------------------------- 2 files changed, 31 insertions(+), 195 deletions(-) diff --git a/lib_com/math_op.c b/lib_com/math_op.c index caa17b3ae..7014988b8 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,12 +23,6 @@ #include #include -#ifndef ISSUE_1836_FILEACTIVE_math_op_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | @@ -234,30 +228,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat - FOR( i = 1; i < lg; i++ ) - { - L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat - } -#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } -#endif } IF( expi < 0 ) { @@ -267,24 +251,11 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat -#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); -#endif } } IF( expi > 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( x[0], expi ); //??sat - L_sum = L_mac_sat( 1, tmp, tmp ); //??sat - FOR( i = 1; i < lg; i++ ) - { - tmp = shl_sat( x[i], expi ); //??sat - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat - } -#else tmp = shl_o( x[0], expi, &Overflow ); L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) @@ -292,7 +263,6 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val tmp = shl_o( x[i], expi, &Overflow ); L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } -#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 60a15c5d0..46e24e31a 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,12 +15,6 @@ #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -81,11 +75,9 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -285,11 +277,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { -#ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat -#else num_den = shl_o( num_den, 1, &Overflow ); -#endif *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } @@ -370,11 +358,9 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -571,11 +557,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat -#else num_den = shl_o( num_den, 1, &Overflow ); -#endif #else num_den = shl( num_den, 1 ); #endif @@ -947,11 +929,9 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); @@ -961,103 +941,60 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat -#else + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ -#endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat -#else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ -#endif - mem[1] = extract_h( Lacc ); /* Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat - move16(); -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); -#endif } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ -#endif - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat - temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ - move16(); - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat -#else + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1068,18 +1005,11 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat -#else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1087,23 +1017,9 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ - temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1114,8 +1030,7 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1231,11 +1146,9 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1243,34 +1156,11 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - - mem[0] = round_fx_sat( Lacc1 ); //??sat - move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat - Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat - Lacc = L_deposit_h( temp1 ); - - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat - move16(); - - Lacc1 = L_deposit_h( temp2 ); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat - out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat - move16(); -#else - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1289,36 +1179,13 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); -#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - - mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat - - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_deposit_h( temp1 ); - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc1 = L_deposit_h( temp2 ); - out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat - move16(); - mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat - move16(); -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1339,7 +1206,6 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); -#endif } return; -- GitLab From f14b0bb5afbc59b927bdaa2cfb745ac942b47db3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 15:31:42 +0200 Subject: [PATCH 067/103] take *, *m from fb1b910, deactivate low_rate_band_att_fx and lpc_tools_fx --- lib_com/low_rate_band_att_fx.c | 37 ++++++- lib_com/lpc_tools_fx.c | 130 +++++++++++++++++++++- lib_com/lsf_tools_fx.c | 132 +++++++++++++++++++--- lib_com/lsp_conv_poly_fx.c | 86 +++++++++++++++ lib_com/math_op.c | 30 +++++ lib_com/modif_fs_fx.c | 196 +++++++++++++++++++++++++++------ lib_com/options.h | 6 +- 7 files changed, 555 insertions(+), 62 deletions(-) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 8ffaf0bfb..1a6e91a22 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,6 +8,11 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*--------------------------------------------------------------------------* * fine_gain_pred() @@ -39,9 +44,11 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -81,7 +88,11 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -96,8 +107,12 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat +#else + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -154,9 +169,11 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -187,9 +204,13 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -204,8 +225,12 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat +#else + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 1035f017a..bc7ebe478 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,6 +42,12 @@ #include "rom_com.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local constants @@ -409,8 +415,10 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -427,7 +435,11 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_shl_sat( L_32, 2 ); //??sat +#else L_32 = L_shl_o( L_32, 2, &Overflow ); +#endif return ( L_32 ); } @@ -463,9 +475,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -526,12 +540,21 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -546,7 +569,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -585,7 +612,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -621,7 +652,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -657,9 +692,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -720,12 +757,21 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -740,7 +786,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -779,7 +829,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -815,7 +869,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -851,10 +909,13 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +# +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -915,12 +976,21 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); + t0 = L_msu_sat( t0, Rh[i], -32768 ); +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -935,7 +1005,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -974,7 +1048,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1010,7 +1088,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = L_shl_sat( t0, k ); //??sat +#else A[i] = L_shl_o( t0, k, &Overflow ); +#endif move16(); } @@ -1478,9 +1560,11 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* half length FFT */ @@ -1656,6 +1740,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1670,6 +1770,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1690,6 +1791,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1704,6 +1821,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 4b3e200a4..c5d20ef21 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,6 +40,12 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -69,8 +75,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif cheb = norm_s( x ); @@ -108,16 +116,26 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ +#endif + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ +#endif + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -125,10 +143,15 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ +#endif + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -146,9 +169,14 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ - cheb = s_max( -32767, cheb ); /* to avoid saturation */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat + cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat +#else + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ +#endif + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -162,8 +190,10 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------* @@ -286,7 +316,11 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + y = sub_sat( yhigh, ylow ); +#else y = sub_o( yhigh, ylow, &Overflow ); +#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1222,9 +1256,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif /*-----------------------------------------------------* @@ -1255,7 +1291,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat +#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); +#endif move32(); } @@ -1265,11 +1305,19 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 1; i <= nc; i++ ) + { + t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); + t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); + } +#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } +#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1283,6 +1331,16 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_add_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat + + /* a[j] = 0.5*(f1[i] - f2[i]) */ + t0 = L_sub_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat +#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1290,7 +1348,8 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ +#endif j--; } @@ -1734,8 +1793,10 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1796,7 +1857,16 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat + L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat +#else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ @@ -1804,15 +1874,23 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ +#endif } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + move16(); +#else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); +#endif } } @@ -2264,8 +2342,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2311,10 +2391,18 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ +#endif - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat +#else + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ +#endif tmp = s_max( tmp, 0 ); @@ -2351,8 +2439,10 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2404,7 +2494,11 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ +#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3763,8 +3857,10 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3832,9 +3928,13 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat +#else + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ +#endif if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 4f493cacd..ddd8f88f6 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,6 +9,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants @@ -336,8 +342,10 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif exp_den = norm_l( in32 ); @@ -345,10 +353,17 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + exp_den = shl( exp_den, 1 ); + + div_out = div_s( 8192, m_den ); + Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat +#else exp_den = shl_o( exp_den, 1, &Overflow ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ +#endif return Ltmp; } @@ -364,8 +379,10 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif IF( re == 0 ) @@ -378,7 +395,11 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -393,7 +414,11 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -423,7 +448,11 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat +#else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ +#endif return ( L_tmp ); } @@ -501,8 +530,10 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*---------------------------------------------------------------------* @@ -525,7 +556,11 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + r[0] = L_add_sat( r[0], G[i] ); +#else r[0] = L_add_o( r[0], G[i], &Overflow ); +#endif move32(); } @@ -559,18 +594,47 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_add_sat( G[i], G[N - i - 1] ); //??sat +#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); +#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); +#ifdef ISSUE_1836_replace_overflow_libcom + r[1] = L_add_sat( r[1], mh ); //??sat +#else r[1] = L_add_o( r[1], mh, &Overflow ); +#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = mult_r( c[j - 1], x[i - 1] ); + move16(); + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + /*r[j] = L_mac(r[j], c[j], gp);*/ + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); + + c[j + 1] = mult_r( c[j], x[i - 1] ); + move16(); + c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat + move16(); + + /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ + Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); + r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat + move32(); +#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -590,33 +654,55 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); +#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); +#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); +#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat + gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); + + r[0] = L_add_sat( r[0], gp ); //??sat +#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); +#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat + L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat +#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); +#endif } return; diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 7014988b8..caa17b3ae 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,6 +23,12 @@ #include #include +#ifndef ISSUE_1836_FILEACTIVE_math_op_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | @@ -228,20 +234,30 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat + FOR( i = 1; i < lg; i++ ) + { + L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat + } +#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } +#endif } IF( expi < 0 ) { @@ -251,11 +267,24 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat +#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); +#endif } } IF( expi > 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( x[0], expi ); //??sat + L_sum = L_mac_sat( 1, tmp, tmp ); //??sat + FOR( i = 1; i < lg; i++ ) + { + tmp = shl_sat( x[i], expi ); //??sat + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat + } +#else tmp = shl_o( x[0], expi, &Overflow ); L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) @@ -263,6 +292,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val tmp = shl_o( x[i], expi, &Overflow ); L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } +#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 46e24e31a..60a15c5d0 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,6 +15,12 @@ #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -75,9 +81,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -277,7 +285,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat +#else num_den = shl_o( num_den, 1, &Overflow ); +#endif *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } @@ -358,9 +370,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -557,7 +571,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat +#else num_den = shl_o( num_den, 1, &Overflow ); +#endif #else num_den = shl( num_den, 1 ); #endif @@ -929,9 +947,11 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -941,60 +961,103 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ - mem[0] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ - mem[1] = extract_h( Lacc ); /* Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat +#else + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ +#endif + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat + move16(); +#else out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat +#else + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ +#endif + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat + temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ + move16(); + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1005,11 +1068,18 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1017,9 +1087,23 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ + temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ +#else + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1030,7 +1114,8 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1146,9 +1231,11 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1156,11 +1243,34 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[0] = round_fx_sat( Lacc1 ); //??sat + move16(); + Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat + Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat + Lacc = L_deposit_h( temp1 ); + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat + move16(); + + Lacc1 = L_deposit_h( temp2 ); + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat + out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat + move16(); +#else + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1179,13 +1289,36 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_deposit_h( temp1 ); + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( temp2 ); + out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat + move16(); + mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat + move16(); +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1206,6 +1339,7 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } return; diff --git a/lib_com/options.h b/lib_com/options.h index 4903698b8..4157b3c96 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,9 +155,9 @@ #define ISSUE_1836_FILEACTIVE_ifft_rel_fx_c #define ISSUE_1836_FILEACTIVE_igf_base_fx_c #define ISSUE_1836_FILEACTIVE_interpol_fx_c -#define ISSUE_1836_FILEACTIVE_log2_c -#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +// #define ISSUE_1836_FILEACTIVE_log2_c //nothing done +//#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +//#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c #define ISSUE_1836_FILEACTIVE_math_op_c -- GitLab From 9a1ddeb19acf99625574c1d345a0a7783398d28a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 15:48:33 +0200 Subject: [PATCH 068/103] deactivate low_rate_band_att_fx --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4157b3c96..36fe13035 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,7 @@ #define ISSUE_1836_FILEACTIVE_interpol_fx_c // #define ISSUE_1836_FILEACTIVE_log2_c //nothing done //#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -//#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c #define ISSUE_1836_FILEACTIVE_math_op_c -- GitLab From 42610d2c4dc6c67ba42266211f2e974f5193676a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 Aug 2025 16:11:26 +0200 Subject: [PATCH 069/103] replaced some L_shl with L_shl_sat --- lib_com/lpc_tools_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index bc7ebe478..b8267b53a 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -541,7 +541,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR } #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ + t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif @@ -758,7 +758,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 } #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ + t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif @@ -977,7 +977,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* } #ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat + t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif -- GitLab From 83408b67adf863799329d0a4632aec69b2780a55 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 08:16:11 +0200 Subject: [PATCH 070/103] clang patch --- lib_com/lsf_tools_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 3b91c4542..c5d20ef21 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -2401,7 +2401,7 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); -- GitLab From 90ce7e89f4edd5c6a531e36b2768f61d4a3a4737 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 09:40:20 +0200 Subject: [PATCH 071/103] reactivate all changes and macros --- lib_com/oper_32b.c | 28 +++ lib_com/phase_dispersion_fx.c | 16 ++ lib_com/ppp_fx.c | 16 ++ lib_com/pred_lt4_fx.c | 40 +++- lib_com/preemph_fx.c | 44 ++++ lib_com/pvq_com_fx.c | 19 ++ lib_com/residu_fx.c | 46 ++++ lib_com/stat_noise_uv_mod_fx.c | 44 +++- lib_com/swb_bwe_com_fx.c | 20 ++ lib_com/swb_bwe_com_lr_fx.c | 191 ++++++++++------- lib_com/swb_tbe_com_fx.c | 217 ++++++++++++++++++- lib_com/syn_filt_fx.c | 50 +++++ lib_com/tcx_ltp_fx.c | 15 ++ lib_com/tcx_mdct_fx.c | 22 ++ lib_com/tcx_utils_fx.c | 28 +++ lib_com/tns_base.c | 12 ++ lib_com/tools_fx.c | 194 ++++++++++++++++- lib_com/weight_a_fx.c | 13 ++ lib_com/wi_fx.c | 378 ++++++++++++++++++++++++++++++++- lib_com/window_fx.c | 16 ++ 20 files changed, 1320 insertions(+), 89 deletions(-) diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index be34a1248..91e22a9d6 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -27,6 +27,12 @@ #define WMC_TOOL_SKIP +#ifndef ISSUE_1836_FILEACTIVE_oper_32b_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /***************************************************************************** * * * Function L_Extract() * @@ -124,13 +130,20 @@ Word32 L_Comp( Word16 hi, Word16 lo ) Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif L_32 = L_mult( hi1, hi2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat +#else L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); +#endif return ( L_32 ); } @@ -159,13 +172,21 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat +#else L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); +#endif return ( L_32 ); } @@ -193,12 +214,19 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Sqr_32( Word16 hi, Word16 lo ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mult_sat( hi, hi ); //??sat + L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 ); //??sat +#else L_32 = L_mult_o( hi, hi, &Overflow ); L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); +#endif return ( L_32 ); } diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 3103723be..3679ed372 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-----------------------------------------------------------------------* * phase_dispersion: * @@ -30,9 +36,11 @@ void phase_dispersion( Word32 x32[2 * L_SUBFR]; Word16 *code_real, *code_imag; const Word16 *h_real, *h_imag; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif move16(); @@ -57,7 +65,11 @@ void phase_dispersion( move16(); prev_gain_pit[0] = gain_pit; +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) ) //??sat +#else IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) ) +#endif { IF( LT_16( state, 2 ) ) { @@ -165,7 +177,11 @@ void phase_dispersion( scale2 = getScaleFactor32( x32, L_subfr ); FOR( i = 0; i < L_subfr; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) ); +#else code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); +#endif move16(); } j = sub( j, scale2 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index cc6b59bdb..0fceb9165 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,6 +35,12 @@ #include "cnst.h" #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_ppp_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ /*-------------------------------------------------------------------*/ @@ -97,9 +103,11 @@ void deemph_lpc_fx( Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif b_fx[0] = 4096; move16(); /* 1 in Q12 */ @@ -115,7 +123,11 @@ void deemph_lpc_fx( { /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat +#else LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); +#endif move16(); /* Q12 */ } @@ -137,7 +149,11 @@ void deemph_lpc_fx( { /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat +#else LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); +#endif move16(); /* Q12 */ } } diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 465138bde..c54ee5f39 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -8,6 +8,11 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_pred_lt4_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*-------------------------------------------------------------------* * Function pred_lt4: * @@ -35,9 +40,11 @@ void pred_lt4_ivas_fx( Word32 s; const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0]; @@ -71,7 +78,11 @@ void pred_lt4_ivas_fx( s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ +#ifdef ISSUE_1836_replace_overflow_libcom + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat +#else + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ +#endif move16(); } return; @@ -91,9 +102,11 @@ void pred_lt4( Word16 i, j; Word32 s; const Word16 *x0, *x1, *x2, *c1, *c2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0]; @@ -127,12 +140,21 @@ void pred_lt4( } s = W_sat_l( s64 ); /* Q_exc + Q14 */ } +#ifdef ISSUE_1836_replace_overflow_libcom +#if ( INTERP_EXP != -1 ) + s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ //??sat +#endif + + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat + move16(); +#else #if ( INTERP_EXP != -1 ) s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ #endif excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); +#endif } return; } @@ -177,9 +199,11 @@ void pred_lt4_tc_fx( Word16 excO[L_SUBFR + 1]; Word32 L_sum; Word16 excI[2 * L_SUBFR]; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ @@ -212,15 +236,25 @@ void pred_lt4_tc_fx( k += UP_SAMP; L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat + excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat +#else + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ +#endif + move16(); x0++; } FOR( i = T0; i < L_SUBFR; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */ //??sat +#else exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ +#endif move16(); } } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index b7886cb65..b24aa9467 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -22,12 +22,23 @@ void preemph_copy_fx( ) { Word16 i, temp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = x[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */ + move16(); + } + y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ @@ -35,6 +46,8 @@ void preemph_copy_fx( } y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ move16(); +#endif + *mem = temp; /* Qx */ move16(); @@ -49,12 +62,23 @@ void preemph_copy_32fx( ) { Word16 i, temp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = x[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ //??sat + move16(); + } + y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */ @@ -62,6 +86,7 @@ void preemph_copy_32fx( } y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */ move16(); +#endif *mem = temp; /* Qx */ move16(); @@ -125,13 +150,31 @@ void E_UTIL_f_preemph2( { Word16 i, temp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = signal[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + move16(); + } + + L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ @@ -146,6 +189,7 @@ void E_UTIL_f_preemph2( L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); +#endif *mem = temp; /* Qx */ move16(); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 1adcdb7ae..63eb26877 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -7,6 +7,13 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_pvq_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + /*! r: Approximate integer division for positive input using lookup table */ UWord32 intLimCDivPos_fx( UWord32 NUM, /* Qx */ @@ -427,9 +434,11 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); @@ -456,7 +465,11 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat +#else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ +#endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ @@ -527,9 +540,11 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -552,7 +567,11 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat +#else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); +#endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 91d0ee30a..b1426dcb2 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_residu_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*--------------------------------------------------------------------* * residu_ivas_fx() * @@ -62,9 +68,11 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif q = add( norm_s( a[0] ), 1 ); @@ -72,6 +80,36 @@ void Residu3_lc_fx( { q = add( q, shift ); } +#ifdef ISSUE_1836_replace_overflow_libcom + *y++ = shl_sat( x[0], shift ); //??sat + move16(); + + FOR( i = 1; i < m; i++ ) + { + s = L_mult_sat( x[i], a[0] ); //??sat + /* Stop at i to Avoid Mults with Zeros */ + FOR( j = 1; j <= i; j++ ) + { + s = L_mac_sat( s, x[i - j], a[j] ); //??sat + } + + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat + } + + FOR( ; i < lg; i++ ) + { + s = L_mult_sat( x[i], a[0] ); //??sat + FOR( j = 1; j <= m; j++ ) + { + s = L_mac_sat( s, x[i - j], a[j] ); //??sat + } + + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat + } + +#else *y++ = shl_o( x[0], shift, &Overflow ); move16(); @@ -99,6 +137,8 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } + +#endif } /*--------------------------------------------------------------------* @@ -151,9 +191,11 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) @@ -170,7 +212,11 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( s32 ); //??sat +#else y[i] = round_fx_o( s32, &Overflow ); +#endif move16(); } } diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index c259745f2..cf4b5edc3 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -16,6 +16,12 @@ #define P1 ( 32768 - ISP_SMOOTHING_QUANT_A1_FX - 1 ) #define P9 ( 32767 - P1 ) +#ifndef ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*---------------------------------------------------------* * Local functions *---------------------------------------------------------*/ @@ -74,9 +80,11 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*---------------------------------------------------------* @@ -109,7 +117,11 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + min_alpha = add_sat( tmp_res, 16384 ); //??sat +#else min_alpha = add_o( tmp_res, 16384, &Overflow ); +#endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ @@ -160,8 +172,12 @@ void stat_noise_uv_mod_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat +#else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ +#endif PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe ); } @@ -186,7 +202,11 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat +#else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); +#endif alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); *act_count = 0; @@ -250,7 +270,11 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat +#else + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ +#endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -384,9 +408,11 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*---------------------------------------------------------* @@ -416,7 +442,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + min_alpha = add_sat( tmp_res, 16384 ); //??sat +#else min_alpha = add_o( tmp_res, 16384, &Overflow ); +#endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); @@ -466,8 +496,12 @@ void stat_noise_uv_mod_ivas_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat +#else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ +#endif PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe ); } @@ -492,7 +526,11 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat +#else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); +#endif alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); *act_count = 0; diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 0c6e30547..ab3efa10d 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -36,6 +36,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*==========================================================================*/ /* FUNCTION : Word16 WB_BWE_gain_pred_fx () */ @@ -595,7 +601,12 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 tmp1 = mult_ro( *ptr++, 8192 /*0.25 in Q15 */, &Overflow ); /* Divide by 4 */ L_ener = L_mac0_o( L_ener, tmp1, tmp1, &Overflow ); } +#ifdef ISSUE_1799_replace_L_shr_o + /*Overflow will never happen because exp2 is always positive*/ + L_ener = L_shr( L_ener, exp2 ); +#else L_ener = L_shr_o( L_ener, exp2, &Overflow ); +#endif L_temp = L_add_o( L_ener_tot, L_ener, &Overflow ); IF( Overflow != 0 ) { @@ -608,12 +619,21 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat +#else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); +#endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat + tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat +#else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); +#endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 8fd876f1c..fed63821e 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,6 +38,12 @@ #include +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -927,9 +933,11 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *Qss = 10; @@ -986,7 +994,11 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat +#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ +#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1010,107 +1022,120 @@ void SpectrumSmoothing_fx( } ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) { +#ifdef ISSUE_1836_replace_overflow_libcom IF( L_inBuf_pss[j] >= 0 ) { - outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); - } - } - ELSE - { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; - move16(); - if ( L_inBuf_pss[j] < 0x0L ) + outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat + move16(); + } +#else + IF( L_inBuf_pss[j] >= 0 ) { - outBuf_pss_fx[j] = -0x2800; - move16(); - } - } - j++; + outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); } +#endif } - - k = 0; - move16(); - m = 0; - move16(); - n = 0; - move16(); - reset_flag = 0; - move16(); - n_list[0] = 0; - move16(); - FOR( j = 0; j < num_subband_smooth_fx; j++ ) + ELSE { - cnt_zero_cont = 0; + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; move16(); - FOR( i = 0; i < L_SB; i++ ) + if ( L_inBuf_pss[j] < 0x0L ) { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) - { - cnt_zero_cont = 0; - move16(); - } - k = add( k, 1 ); + outBuf_pss_fx[j] = -0x2800; + move16(); } + } + j++; +} +} - IF( cnt_zero_cont != 0 ) +k = 0; +move16(); +m = 0; +move16(); +n = 0; +move16(); +reset_flag = 0; +move16(); +n_list[0] = 0; +move16(); +FOR( j = 0; j < num_subband_smooth_fx; j++ ) +{ + cnt_zero_cont = 0; + move16(); + FOR( i = 0; i < L_SB; i++ ) + { + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) { - test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) - { - n = 0; - move16(); - reset_flag = 1; - move16(); - } - n_list[n] = j; + cnt_zero_cont = 0; move16(); - n = add( n, 1 ); } + k = add( k, 1 ); + } + IF( cnt_zero_cont != 0 ) + { test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) { - m = 0; + n = 0; + move16(); + reset_flag = 1; move16(); } + n_list[n] = j; + move16(); + n = add( n, 1 ); + } + + test(); + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + { + m = 0; + move16(); + } - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + { + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + if ( outBuf_pss_fx[pk + i] == 0 ) { - if ( outBuf_pss_fx[pk + i] == 0 ) - { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); - } + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); } - m = add( m, 1 ); } + m = add( m, 1 ); } +} - FOR( i = 0; i < fLen; i++ ) +FOR( i = 0; i < fLen; i++ ) +{ + outBuf_fx[i] = 0x0; + move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) { - outBuf_fx[i] = 0x0; + outBuf_fx[i] = outBuf_pss_fx[i]; move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) - { - outBuf_fx[i] = outBuf_pss_fx[i]; - move16(); - } } +} - return; +return; } /*-------------------------------------------------------------------* @@ -2225,9 +2250,11 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *QbeL = 3; @@ -2338,7 +2365,11 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); +#ifdef ISSUE_1836_replace_overflow_libcom //??sat + E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); +#else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); +#endif IF( LT_16( E_r_shift_fx, 15729 ) ) /* E_r < 0.06 */ { /* avg_pe[k] = (float) sqrt(pow(2.0f,band_energy[i])/band_width[i]); */ @@ -2376,13 +2407,19 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat +#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) +#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } +#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); +#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3209,9 +3246,11 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif set16_fx( map_pulse_t_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); set16_fx( map_pulse_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); @@ -3246,7 +3285,11 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); +#ifdef ISSUE_1836_replace_overflow_libcom + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat +#else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ +#endif move16(); } p_L_En++; @@ -3316,7 +3359,11 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); +#ifdef ISSUE_1836_replace_overflow_libcom + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat +#else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); +#endif ni_scale_fx = s_min( 20408, ni_scale_fx ); /* 1.25=20408.0(Q14) */ ni_scale_fx = s_max( 12288, ni_scale_fx ); /* 0.75=12288.0(Q14) */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 2ca52b8e4..b662fd1b7 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,6 +12,12 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 @@ -996,9 +1002,10 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); - +#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1038,7 +1045,11 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat +#else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); +#endif move16(); /*Q12 */ } @@ -1445,9 +1456,11 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1537,22 +1550,38 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible +#else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 +#endif move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 + pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 + } +#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } +#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1582,7 +1611,11 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1590,8 +1623,13 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ + pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ +#else L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ +#endif } } @@ -1600,11 +1638,19 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat +#else scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat +#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ +#endif move16(); } } @@ -1620,7 +1666,11 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat +#else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); +#endif } ELSE { @@ -1629,6 +1679,20 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k++; + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1641,6 +1705,7 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } +#endif } } } @@ -1695,9 +1760,11 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); move16(); @@ -1789,7 +1856,11 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); +#else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); +#endif move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); @@ -1797,14 +1868,23 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ + pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat +#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1835,7 +1915,11 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1843,8 +1927,13 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat + pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ +#else L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } @@ -1853,6 +1942,15 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ + sc = sub( add( n2, Q_bwe_exc ), 14 ); + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + move16(); + } +#else scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1860,6 +1958,7 @@ void GenShapedWBExcitation_fx( exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } +#endif } ELSE { @@ -1873,8 +1972,12 @@ void GenShapedWBExcitation_fx( IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ + tmp_vfac = min(1, tmp_vfac);*/ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat +#else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); +#endif } ELSE { @@ -1883,6 +1986,20 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k = add( k, 1 ); + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -1895,6 +2012,7 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } +#endif } } } @@ -5669,10 +5787,12 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5771,12 +5891,20 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat +#else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ +#endif } } @@ -5800,7 +5928,11 @@ void non_linearity_fx( { exp = norm_s( max_val ); tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -5849,12 +5981,20 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /*Q14 */ +#else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ +#endif } } @@ -5921,10 +6061,12 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6023,12 +6165,20 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat +#else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ +#endif } } @@ -6052,7 +6202,11 @@ void non_linearity_ivas_fx( { exp = norm_s( max_val ); tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -6101,12 +6255,20 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat +#else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ +#endif } } @@ -6841,9 +7003,11 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -6902,7 +7066,11 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, expb ); num_flag = 0; @@ -7026,9 +7194,11 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7043,7 +7213,11 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat +#else pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ +#endif test(); test(); @@ -7073,6 +7247,18 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat + FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) + { + L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ + L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat + L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat + L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ + bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat + move16(); + } +#else gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7083,6 +7269,7 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } +#endif } ELSE { @@ -7096,10 +7283,17 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat + + tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat +#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7109,8 +7303,13 @@ void prep_tbe_exc_fx( { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat +#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7118,9 +7317,15 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ + tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat + bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat +#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ +#endif move16(); } } @@ -7156,8 +7361,10 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* Smoothen tilt value */ @@ -7185,7 +7392,11 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); +#else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); +#endif return formant_fac; /*Q15 */ } diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 7724e596c..8b044f2f7 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -9,13 +9,24 @@ #include "prot_fx.h" #include "stl.h" +#ifndef ISSUE_1836_FILEACTIVE_syn_filt_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); +#else + L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat + return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat +#endif } static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] ) @@ -341,9 +352,11 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif if ( EQ_16( m, 6 ) ) @@ -377,8 +390,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); /* Filtering from Input + Mix of Memory & Output Signal Past */ @@ -388,15 +406,24 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Process Output Signal Past */ FOR( j = 1; j <= i; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( L_tmp, a[j], y[-j] ); //??sat +#else L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow ); +#endif } /* Process Memory */ FOR( ; j <= m; j++ ) { L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); } @@ -404,8 +431,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W FOR( ; i < lg; i++ ) { L_tmp = syn_kern( L_mult( a0, *x++ ), a, y ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); + *y++ = round_fx_sat( L_tmp ); +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); } @@ -452,8 +484,10 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); +#endif if ( EQ_16( m, 6 ) ) { @@ -480,14 +514,22 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ mem += m; /*move32();*/ +#ifdef ISSUE_1836_replace_overflow_libcom + a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat +#else a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ +#endif /*-----------------------------------------------------------------------* * Do the filtering *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); @@ -505,7 +547,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); } @@ -514,7 +560,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] FOR( ; i < lg; i++ ) { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); } diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 322549a6f..0bf0fb1c9 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ @@ -389,9 +395,11 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); @@ -408,10 +416,17 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat + excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat +#else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ +#endif move16(); x0++; diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index b2cee32e6..a2646ae42 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -8,6 +8,12 @@ #include "prot_fx.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ @@ -107,9 +113,11 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); @@ -126,7 +134,11 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat +#else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } FOR( i = 0; i < m / 2; i++ ) @@ -136,7 +148,11 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ +#else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } @@ -163,9 +179,11 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); @@ -182,7 +200,11 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat +#else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } FOR( i = 0; i < m / 2; i++ ) diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index c5ff95e04..b572f7cce 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -12,6 +12,12 @@ #define inv_int InvIntTable +#ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * getInvFrameLen() * @@ -991,8 +997,10 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* FDNS_NPTS = 64 */ @@ -1044,7 +1052,11 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ +#else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#endif move32(); x++; } @@ -1063,7 +1075,11 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ +#else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#endif move32(); x += k; gains++; @@ -1389,9 +1405,11 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif assert( lpcGains[0] >= 0x4000 ); @@ -1438,7 +1456,11 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_tmp ); /* Q15 */ +#else tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ +#endif fac = tmp; /* Q15 */ move16(); @@ -2081,8 +2103,10 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif maxX = L_deposit_l( 1 ); @@ -2129,7 +2153,11 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ +#else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ +#endif if ( corr < 0 ) tmp = negate( tmp ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index aaf262786..35394f8f9 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -22,6 +22,12 @@ #define MAX_SUBDIVISIONS 3 +#ifndef ISSUE_1836_FILEACTIVE_tns_base_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ @@ -439,9 +445,11 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -475,7 +483,11 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ +#else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ +#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 2f5c3c8d3..1ba79b42d 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -52,6 +52,12 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ @@ -308,16 +314,23 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat + idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat +#else L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ +#endif idx = s_min( idx, sub( cbsize, 1 ) ); idx = s_max( idx, 0 ); @@ -325,7 +338,11 @@ Word16 usquant_fx( /* o: index of the winning codeword */ /* *xq = idx*delta + qlow; */ L_tmp = L_deposit_l( qlow ); /*Qx */ L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ +#else *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ +#endif return idx; } /*-------------------------------------------------------------------* @@ -391,14 +408,20 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ +#else L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ +#endif } return L_tmp; @@ -452,15 +475,21 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); +#else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); +#endif } return L_tmp; @@ -680,9 +709,11 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( exp0 == 0 ) { @@ -705,7 +736,11 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = shl_sat( x[i], exp0 ); //??sat +#else y[i] = shl_o( x[i], exp0, &Overflow ); +#endif move16(); /* saturation can occur here */ } } @@ -723,10 +758,12 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( exp0 == 0 ) @@ -743,7 +780,11 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat +#else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); +#endif move32(); } return; @@ -756,7 +797,11 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( 1, exp0 ); //??sat +#else tmp = shl_o( 1, exp0, &Overflow ); +#endif FOR( i = 0; i < lg; i++ ) { y[i] = L_mult0( x[i], tmp ); @@ -773,10 +818,12 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( exp0 == 0 ) @@ -793,12 +840,20 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat +#else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); +#endif move32(); } return; } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat +#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); +#endif IF( L_tmp >= 0x7FFF ) { @@ -830,9 +885,11 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif tmp = add( 16, exp0 ); @@ -840,7 +897,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); +#else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); +#endif move16(); } } @@ -848,7 +909,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( x[i] ); //??sat +#else y[i] = round_fx_o( x[i], &Overflow ); +#endif move16(); } } @@ -866,9 +931,11 @@ void Scale_sig32( ) { Word16 i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( 0 == exp0 ) { @@ -877,7 +944,11 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + x[i] = L_shl_sat( x[i], exp0 ); +#else x[i] = L_shl_o( x[i], exp0, &Overflow ); +#endif move32(); /* saturation can occur here */ } } @@ -1872,10 +1943,12 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif idx = 0; @@ -1892,6 +1965,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + if ( weights[3] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + if ( weights[2] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + if ( weights[1] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + if ( weights[0] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } +#else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { @@ -1912,6 +2007,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } +#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -1941,6 +2037,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + if ( weights[0] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + if ( weights[1] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + if ( weights[2] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + if ( weights[3] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } +#else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { @@ -1961,6 +2079,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } +#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2427,9 +2546,11 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) @@ -2440,15 +2561,27 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); +#ifdef ISSUE_1836_replace_overflow_libcom + num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat +#else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); +#endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); +#ifdef ISSUE_1836_replace_overflow_libcom + den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat +#else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); +#endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); +#ifdef ISSUE_1836_replace_overflow_libcom //??sat + num = shl_sat( num, scale ); +#else num = shl_o( num, scale, &Overflow ); +#endif exp_num = sub( exp_num, scale ); tmp = div_s( num, den ); @@ -2604,9 +2737,11 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); @@ -2619,14 +2754,27 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mult_sat( buf_in[K + i], h[0] ); //??sat +#else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); +#endif FOR( j = 1; j <= K; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat +#else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); +#endif } +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_shl_sat( s, shift ); //??sat + y[i] = round_fx_sat( s ); /*Qx */ //??sat +#else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ +#endif move16(); } } @@ -2762,8 +2910,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif idx = 0; @@ -2774,10 +2924,18 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x, cb[c] ); +#else tmp = sub_o( x, cb[c], &Overflow ); +#endif /*dist += tmp*tmp; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat +#else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); +#endif if ( LT_32( L_dist, L_mindist ) ) { @@ -2915,9 +3073,11 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( exp0 == 0 ) { @@ -2932,12 +3092,20 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_shl_sat( x[i], tmp ); //??sat +#else y[i] = L_shl_o( x[i], tmp, &Overflow ); +#endif move16(); } return; } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat +#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); +#endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); @@ -3114,9 +3282,11 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); @@ -3124,7 +3294,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat +#else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); +#endif move16(); } } @@ -3132,7 +3306,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat +#else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); +#endif move16(); } } @@ -3259,7 +3437,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ +#ifdef ISSUE_1836_replace_overflow_libcom + temp = mult_r( *signal++, 16384 ); +#else temp = mult_ro( *signal++, 16384, &Overflow ); +#endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ @@ -3269,11 +3451,19 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + temp = mult_r( *signal++, 16384 ); +#else temp = mult_ro( *signal++, 16384, &Overflow ); +#endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } - +#ifdef ISSUE_1799_replace_L_shr_o + /*Overfloe will never happen because temp2 is always positive*/ + L_temp = L_shr( L_temp, temp2 ); +#else L_temp = L_shr_o( L_temp, temp2, &Overflow ); +#endif /* Here we try the addition just to check if we can sum the energy of the small (8 Iterations) loop with the total energy calculated so far without an overflow. diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index 7bea66ea0..b2d44e1d4 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -7,6 +7,13 @@ #include "prot_fx.h" #include + +#ifndef ISSUE_1836_FILEACTIVE_weight_a_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------ * weight_a_subfr() * @@ -100,10 +107,12 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif fac = gamma; /* Q15 */ @@ -122,7 +131,11 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat +#else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ +#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 591645017..e92a4cead 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -22,6 +22,12 @@ #define WI_THRESHLD 0.8 #define WI_SAMPLE_THLD 20 +#ifndef ISSUE_1836_FILEACTIVE_wi_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */ /*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */ /*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */ @@ -264,9 +270,11 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -320,10 +328,17 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat + ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat + move16(); + move16(); +#else ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ move16(); move16(); +#endif } start = sub( Eshift, Adiff_fx ); @@ -344,8 +359,13 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat + corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat +#else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); +#endif move32(); move32(); temp = add( temp, temp1 ); @@ -358,6 +378,18 @@ static Word16 DTFS_alignment_weight_fx( move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat + wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat + IF( GE_16( Qmaxcorr, Qcorr ) ) + { + diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ + } + ELSE + { + diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ + } +#else temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ IF( GE_16( Qmaxcorr, Qcorr ) ) @@ -368,6 +400,7 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ } +#endif IF( diff_corr > 0 ) { @@ -417,9 +450,11 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Calculating the expected alignment shift */ @@ -453,8 +488,13 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat + ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat +#else ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ +#endif } IF( FR_flag == 0 ) { @@ -484,9 +524,15 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + temp = add_sat( temp, temp1 ); //??sat +#else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); temp = add_o( temp, temp1, &Overflow ); +#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -592,9 +638,11 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp2 = L_deposit_l( 0 ); @@ -606,9 +654,15 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat + X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat + temp2 = L_add_sat( temp2, (Word32) ph ); //??sat +#else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); +#endif move16(); move16(); } @@ -620,9 +674,15 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat + X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat + temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat +#else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); +#endif move16(); move16(); } @@ -726,9 +786,11 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( !FR_flag ) @@ -766,6 +828,15 @@ void DTFS_to_fs_fx( exp = norm_s( X_fx->lag_fx ); tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ + diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat + + exp = norm_s( diff_fx ); + tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ + L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat + nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat +#else L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -773,6 +844,7 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ +#endif nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) @@ -796,8 +868,13 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat + inv_lag = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); +#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -811,8 +888,13 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat + L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat +#else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ +#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -849,13 +931,22 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat + L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat +#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); +#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat +#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ +#endif } La[k] = L_shl( L_a, 7 ); @@ -880,6 +971,30 @@ void DTFS_to_fs_fx( move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( k = 1; k <= nH; k++ ) + { + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + move16(); + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ + X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + move16(); + X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ + } + + /* IF ( N%2 == 0 ) */ + IF( s_and( N, 1 ) == 0 ) + { + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ + X_fx->b_fx[k] = 0; + move16(); + } +#else FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ @@ -902,6 +1017,7 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } +#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1197,9 +1313,11 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qmin = 32767; move16(); @@ -1217,6 +1335,22 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat + temp2 = add( temp2, temp ); + } + + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + + /* Calculate the circular convolution */ + L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); + L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat + L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); + + L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat +#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); temp2 = add( temp2, temp ); @@ -1230,6 +1364,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ +#endif /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1249,8 +1384,13 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat + X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat +#else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ +#endif move32(); move32(); @@ -1266,9 +1406,17 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat +#else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); +#endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat +#else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); +#endif move16(); /* Q(Q+Qmin) */ } @@ -1513,9 +1661,11 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); @@ -1525,15 +1675,23 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); - +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); +#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); +#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1541,9 +1699,13 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); - +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); +#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1574,6 +1736,23 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); + HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); + FOR( k = 1; k <= HalfLag_fx; k++ ) + { + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + } + en_fx = L_shr( en_fx, 1 ); + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat + /* IF (X_fx->lag_fx%2 == 0) */ + IF( s_and( X_fx->lag_fx, 1 ) == 0 ) + { + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + } +#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1593,7 +1772,7 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); } - +#endif return en_fx; /* 2*X1.Q */ } @@ -1720,16 +1899,22 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat +#else Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ +#endif Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) @@ -1837,10 +2022,12 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -1852,7 +2039,11 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat +#else Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ +#endif Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -1867,8 +2058,13 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat +#else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ +#endif count = add( count, 1 ); } } @@ -1881,7 +2077,11 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat +#else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); +#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -1892,7 +2092,11 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); +#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -1930,7 +2134,11 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat +#else X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ +#endif move16(); } @@ -1994,9 +2202,11 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif num_flag = 0; move16(); @@ -2065,8 +2275,11 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ - +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat +#else IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) +#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2079,7 +2292,11 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( Ltemp3, expa ) ); +#else fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); +#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2088,7 +2305,11 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = extract_h( L_shl( Ltemp2, expb ) ); //??sat +#else fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); +#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2105,7 +2326,11 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = shl_sat( fraca, scale ); //??sat +#else fraca = shl_o( fraca, scale, &Overflow ); +#endif expa = sub( expa, scale ); tmp = div_s( fraca, fracb ); /* 15-exp */ @@ -2121,8 +2346,13 @@ static void cubicPhase_fx( tmp = negate( tmp ); } +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat + Lacc = L_add_sat( Lacc, 0x08000 ); //??sat +#else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); +#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2248,7 +2478,11 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //??sat //?sat +#else Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ +#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2306,9 +2540,11 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; @@ -2374,7 +2610,11 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat +#else out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ +#endif move16(); IF( GT_16( count[i], 1 ) ) { @@ -2446,9 +2686,11 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Word16 *erb_fx = NULL; /*move16(); */ @@ -2531,6 +2773,32 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ //??sat //??sat + move16(); + IF( GT_16( out_fx[j], 1 ) ) + { + expb = norm_l( mf_fx[j] ); + fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) ); //??sat //??sat + expb = sub( 30, add( expb, 20 ) ); + + + expa = norm_l( out_fx[j] ); + fraca = extract_h( L_shl( out_fx[j], expa ) ); + expa = sub( 30, expa ); + + scale = shr( sub( fraca, fracb ), 15 ); + fracb = shl( fracb, scale ); + expb = sub( expb, scale ); + + tmp = div_s( fracb, fraca ); + exp = sub( expb, expa ); + L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat + + mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat + move16(); + } +#else mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) @@ -2555,6 +2823,7 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); move16(); } +#endif } return; } @@ -2604,9 +2873,11 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) @@ -2692,7 +2963,11 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ //??sat //??sat +#else X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ +#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3434,9 +3709,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3481,17 +3758,31 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); + expa = sub( 30, add( expa, 1 ) ); + + + expb = norm_l( L_sum ); + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat +#else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); +#endif + expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = shl_sat( fracb, scale ); //??sat +#else fracb = shl_o( fracb, scale, &Overflow ); +#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -3515,17 +3806,30 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat + expa = sub( Q29, expa ); // 30 - expa - 1; + + + expb = norm_l( L_sum ); + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat +#else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = shl_sat( fracb, scale ); //??sat +#else fracb = shl_o( fracb, scale, &Overflow ); +#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -4005,9 +4309,11 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif retX_fx->lag_fx = X1_fx->lag_fx; @@ -4018,8 +4324,13 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat + Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat +#else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ +#endif exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4061,6 +4372,17 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat + sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ + move16(); + + Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat + cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ +#else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ @@ -4070,6 +4392,7 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ +#endif move16(); } k = sub( k, 1 ); @@ -4123,9 +4446,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif en = L_deposit_l( 0 ); @@ -4161,8 +4486,12 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat +#else Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ - n = add( n, k4 ); /* n=4*i*k */ +#endif + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4172,12 +4501,20 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat +#else Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ +#endif n = add( n, k4 ); /* n=4*i*k */ } Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat +#else Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ +#endif Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ @@ -4204,7 +4541,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); //??sat +#else Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); +#endif } ELSE { @@ -4253,9 +4594,11 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qmin = 32767; move16(); @@ -4270,12 +4613,27 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat +#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ +#endif temp2 = add( temp2, k ); } +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + /* Calculate the circular convolution */ + sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ + L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); + L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); + L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat +#else temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ @@ -4285,6 +4643,7 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ +#endif IF( sum ) { exp = norm_l( sum ); @@ -4383,9 +4742,11 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); @@ -4399,8 +4760,13 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { +#ifndef ISSUE_1836_replace_overflow_libcom sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ +#else + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat +#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index a1ff625b0..7358abf95 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -21,6 +21,12 @@ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_window_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + void ham_cos_window( Word16 *fh, /* o: 0Q15 */ const Word16 n1, /* i: */ @@ -29,10 +35,12 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif +#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -46,7 +54,11 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat +#else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -63,7 +75,11 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ +#ifdef ISSUE_1836_replace_overflow_libcom + fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat +#else fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ +#endif move16(); cc = L_add( cc, cte ); } -- GitLab From 17ae5e8d1207846f1e89c02a44bae7e59705b7cd Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 09:54:10 +0200 Subject: [PATCH 072/103] clang patch --- lib_com/swb_bwe_com_lr_fx.c | 9 +++---- lib_com/swb_tbe_com_fx.c | 48 ++++++++++++++++++------------------- lib_com/tcx_mdct_fx.c | 4 ++-- lib_com/tcx_utils_fx.c | 10 ++++---- lib_com/tools_fx.c | 12 +++++----- lib_com/wi_fx.c | 48 ++++++++++++++++++------------------- lib_com/window_fx.c | 2 +- 7 files changed, 65 insertions(+), 68 deletions(-) diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index fed63821e..4dba49139 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -1020,11 +1020,9 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) - { + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ #ifdef ISSUE_1836_replace_overflow_libcom - IF( L_inBuf_pss[j] >= 0 ) - { + IF( L_inBuf_pss[j] >= 0 ){ outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat move32(); } @@ -1034,8 +1032,7 @@ void SpectrumSmoothing_fx( move16(); } #else - IF( L_inBuf_pss[j] >= 0 ) - { + IF( L_inBuf_pss[j] >= 0 ){ outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); move32(); } diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index b662fd1b7..e8a74d834 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1555,7 +1555,7 @@ void GenShapedWBExcitation_ivas_fx( #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif - move16(); /* Q14 */ + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1614,7 +1614,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ #else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ #endif move16(); } @@ -1627,8 +1627,8 @@ void GenShapedWBExcitation_ivas_fx( L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ #endif } } @@ -1641,7 +1641,7 @@ void GenShapedWBExcitation_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1931,8 +1931,8 @@ void GenShapedWBExcitation_fx( L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ #else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ #endif } } @@ -1951,7 +1951,7 @@ void GenShapedWBExcitation_fx( move16(); } #else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { @@ -5894,7 +5894,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5903,7 +5903,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5927,7 +5927,7 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else @@ -5984,7 +5984,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -5993,7 +5993,7 @@ void non_linearity_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6168,7 +6168,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -6177,7 +6177,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6201,11 +6201,11 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ #ifdef ISSUE_1836_replace_overflow_libcom scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat #else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ #endif } ELSE @@ -6258,7 +6258,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ #endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ @@ -6267,7 +6267,7 @@ void non_linearity_ivas_fx( #ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -7216,7 +7216,7 @@ void prep_tbe_exc_fx( #ifdef ISSUE_1836_replace_overflow_libcom pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7246,7 +7246,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ #ifdef ISSUE_1836_replace_overflow_libcom gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) @@ -7302,13 +7302,13 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ #ifdef ISSUE_1836_replace_overflow_libcom Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat #else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ #endif move16(); } diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index a2646ae42..8ef395423 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -137,7 +137,7 @@ void TCX_MDCT( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } @@ -203,7 +203,7 @@ void TCX_MDST( #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index b572f7cce..e86f48eed 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -1055,7 +1055,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x++; @@ -1078,7 +1078,7 @@ void mdct_shaping( #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x += k; @@ -1457,11 +1457,11 @@ void PsychAdaptLowFreqDeemph( L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ #ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_tmp ); /* Q15 */ + tmp = round_fx_sat( L_tmp ); /* Q15 */ #else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ #endif - fac = tmp; /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 1ba79b42d..0e11980cd 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -336,12 +336,12 @@ Word16 usquant_fx( /* o: index of the winning codeword */ idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ #ifdef ISSUE_1836_replace_overflow_libcom - *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ + *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #endif return idx; } @@ -418,9 +418,9 @@ Word32 sum2_fx( /* o : sum of all squared vector elements FOR( i = 0; i < lvec; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ + L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ #else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ #endif } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index e92a4cead..6f6bcb066 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -827,7 +827,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat @@ -845,7 +845,7 @@ void DTFS_to_fs_fx( L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ #endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -935,7 +935,7 @@ void DTFS_to_fs_fx( L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat #else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ + L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); #endif /*temp= negate(temp); */ @@ -1363,7 +1363,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ #endif /* normalization */ na = norm_l( L_temp1 ); @@ -1909,13 +1909,13 @@ void DTFS_car2pol_fx( FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat + Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat #else Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ #endif - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -2042,7 +2042,7 @@ Word32 DTFS_setEngyHarm_fx( #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat #else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ #endif Lacc_max = L_max( Lacc_max, Lacc ); @@ -2135,9 +2135,9 @@ Word32 DTFS_setEngyHarm_fx( /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ #ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat + X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat #else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ #endif move16(); } @@ -2613,7 +2613,7 @@ void DTFS_to_erb_fx( #ifdef ISSUE_1836_replace_overflow_libcom out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat #else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ #endif move16(); IF( GT_16( count[i], 1 ) ) @@ -2799,7 +2799,7 @@ void erb_slot_fx( move16(); } #else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -4329,7 +4329,7 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat #else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ + Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ #endif exp = norm_l( Lacc_fx ); @@ -4487,9 +4487,9 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, { /* Compute Re */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat + Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ #endif n = add( n, k4 ); /* n=4*i*k */ } @@ -4502,20 +4502,20 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, { /* Compute Im */ #ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat + Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat #else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ #endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ + Im = L_shr( Lacc, 1 ); /* Q27 */ /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ #ifdef ISSUE_1836_replace_overflow_libcom Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat #else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ #endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4634,15 +4634,15 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat #else - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ #endif IF( sum ) { diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 7358abf95..71a986408 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -78,7 +78,7 @@ void ham_cos_window( #ifdef ISSUE_1836_replace_overflow_libcom fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From 70e43fe4d3470f835367571983c9e31024f950f4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 10:54:10 +0200 Subject: [PATCH 073/103] deactivate all macros in files lib_com from l* on --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c82c6eb29..b0134f295 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ #define ISSUE_1836_FILEACTIVE_get_gain_fx_c #define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c #define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c -#if 1 #define ISSUE_1836_FILEACTIVE_gs_gains_fx_c #define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c #define ISSUE_1836_FILEACTIVE_hp50_fx_c @@ -159,7 +158,8 @@ #define ISSUE_1836_FILEACTIVE_igf_base_fx_c #define ISSUE_1836_FILEACTIVE_interpol_fx_c // #define ISSUE_1836_FILEACTIVE_log2_c //nothing done -//#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#if 0 +#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c #define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -- GitLab From 414954af66ec339c21ec3fdccaeb769da737bde9 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 11:14:13 +0200 Subject: [PATCH 074/103] cosmetic --- lib_com/options.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index b0134f295..4aa81f198 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,6 +166,7 @@ #define ISSUE_1836_FILEACTIVE_math_op_c #define ISSUE_1836_FILEACTIVE_math_op_h #define ISSUE_1836_FILEACTIVE_modif_fs_fx_c + #define ISSUE_1836_FILEACTIVE_oper_32b_c #define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c #define ISSUE_1836_FILEACTIVE_ppp_fx_c @@ -173,6 +174,7 @@ #define ISSUE_1836_FILEACTIVE_preemph_fx_c #define ISSUE_1836_FILEACTIVE_prot_fx_h #define ISSUE_1836_FILEACTIVE_pvq_com_fx_c + #define ISSUE_1836_FILEACTIVE_residu_fx_c #define ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c #define ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c @@ -180,6 +182,7 @@ #define ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c #define ISSUE_1836_FILEACTIVE_syn_filt_fx_c #define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c + #define ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c #define ISSUE_1836_FILEACTIVE_tcx_utils_fx_c #define ISSUE_1836_FILEACTIVE_tns_base_c -- GitLab From 521f8efc2200c22e71de9e0bd93526a1a4f6e832 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 11:18:19 +0200 Subject: [PATCH 075/103] take all files in libenc and lib dec from main --- lib_dec/FEC_HQ_core_fx.c | 34 +-- lib_dec/LD_music_post_filter_fx.c | 14 +- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 2 +- lib_dec/ivas_init_dec_fx.c | 284 ++++++++++++++++++++++- lib_dec/ivas_ism_dec_fx.c | 6 +- lib_dec/ivas_jbm_dec_fx.c | 6 +- lib_dec/ivas_lfe_dec_fx.c | 3 - lib_dec/ivas_masa_dec_fx.c | 2 +- lib_dec/ivas_mc_paramupmix_dec_fx.c | 2 +- lib_dec/ivas_mct_dec_fx.c | 6 +- lib_dec/ivas_omasa_dec_fx.c | 6 +- lib_dec/ivas_sba_dec_fx.c | 6 +- lib_dec/lib_dec_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 22 -- lib_enc/enc_gen_voic_fx.c | 34 +-- lib_enc/find_tilt_fx.c | 18 +- lib_enc/hvq_enc_fx.c | 44 +--- lib_enc/nois_est_fx.c | 48 +--- lib_enc/set_impulse_fx.c | 5 - lib_enc/vad_fx.c | 20 +- 20 files changed, 330 insertions(+), 234 deletions(-) diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 1be7453ab..a69584a32 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,11 +43,9 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Initialize */ @@ -80,11 +78,7 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); -#ifdef ISSUE_1796_replace_shl_o - b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ -#else b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ -#endif move32(); } @@ -168,11 +162,9 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; @@ -390,11 +382,7 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { -#ifdef ISSUE_1796_replace_shl_o - hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); -#else hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); -#endif move16(); k = add( k, 1 ); } @@ -530,12 +518,8 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } -#ifdef ISSUE_1796_replace_shl_o - tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ -#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ -#endif - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -819,12 +803,8 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } -#ifdef ISSUE_1796_replace_shl_o - tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ -#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ -#endif - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -1015,11 +995,9 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); // d1m @@ -1085,12 +1063,8 @@ static Word16 find_best_delay_fx( exp2 = norm_l( min_corr_fx ); L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); - tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ -#else - tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ -#endif + tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ + tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ } *false_flag = 0; diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index 4c3fa3728..12a13a4ec 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -599,11 +599,7 @@ static void spectrum_mod_dct_fx( Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/ e_binE = sub( add( e_tmp, e_binE ), 15 ); -#ifdef ISSUE_1799_replace_L_shr_o - Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ -#else - Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ -#endif + Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/ } @@ -905,10 +901,8 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif move32(); @@ -929,11 +923,7 @@ static Word16 norm_lfe( exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */ /* Need to shl by 3 to take into account the 3 multiplications */ } -#ifdef ISSUE_1796_replace_shl_o - tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ -#else - tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ -#endif + tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ return tmp16; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 5b4c7f472..c8ad991af 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -577,7 +577,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( hDecoderConfig = st_ivas->hDecoderConfig; - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); /* special case, if there was one transport channel in the previous frame and more than one in the current frame, remove the second CLDFB here, it was for CNA/CNG */ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index bab1a909f..aaff34f2f 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -2666,7 +2666,7 @@ ivas_error ivas_init_decoder_fx( * CLDFB handles for rendering *-----------------------------------------------------------------*/ - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); FOR( i = 0; i < numCldfbAnalyses; i++ ) { @@ -2809,9 +2809,9 @@ ivas_error ivas_init_decoder_fx( /*-----------------------------------------------------------------* * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ - st_ivas->p_out_len = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->p_out_len = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); move16(); - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { /* note: these are intra-frame heap memories */ IF( ( st_ivas->p_output_fx[n] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL ) @@ -3321,7 +3321,7 @@ void ivas_destroy_dec_fx( *-------------------------------------------------------------------*/ /*! r: number of cldfb instances */ -void ivas_init_dec_get_num_cldfb_instances_fx( +void ivas_init_dec_get_num_cldfb_instances( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ Word16 *numCldfbAnalyses, /* o : number of needed CLDFB analysis instances */ Word16 *numCldfbSyntheses /* o : number of needed CLDFB synthesis instances */ @@ -3566,12 +3566,286 @@ void ivas_init_dec_get_num_cldfb_instances_fx( *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; move16(); move16(); - BREAK; + break; case RENDERER_OMASA_MIX_EXT: *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); *numCldfbSyntheses = 0; move16(); + break; +#endif + default: + assert( 0 && "Renderer not handled for CLDFB reservation." ); + } + test(); + test(); + IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) ) + { + test(); + test(); + IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) + { + *numCldfbAnalyses = s_max( MC_PARAMUPMIX_MAX_INPUT_CHANS, *numCldfbAnalyses ); + move16(); + } + ELSE + { + *numCldfbAnalyses = s_max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbAnalyses ); + move16(); + } + *numCldfbSyntheses = s_max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbSyntheses ); + move16(); + } + + return; +} + +void ivas_init_dec_get_num_cldfb_instances_ivas_fx( + Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ + Word16 *numCldfbAnalyses, /* o : number of needed CLDFB analysis instances */ + Word16 *numCldfbSyntheses /* o : number of needed CLDFB synthesis instances */ +) +{ + IVAS_FORMAT ivas_format; + *numCldfbAnalyses = st_ivas->nchan_transport; + move16(); + *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; + move16(); + ivas_format = st_ivas->ivas_format; + move32(); + + test(); + IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) + { + ivas_format = SBA_FORMAT; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */ + move32(); + } + + SWITCH( st_ivas->renderer_type ) + { + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + case RENDERER_STEREO_PARAMETRIC: + IF( EQ_16( st_ivas->nchan_transport, 1 ) ) + { + *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); + move16(); + } + test(); + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && st_ivas->hOutSetup.separateChannelEnabled ) + { + *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); + move16(); + } + + IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) + { + IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) + { + *numCldfbAnalyses = add( *numCldfbAnalyses, st_ivas->nchan_ism ); + move16(); + } + } + + IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) ) + { + test(); + IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) + { + *numCldfbAnalyses = add( *numCldfbAnalyses, st_ivas->nchan_ism ); + move16(); + } + ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + { + *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); + move16(); + } + } + IF( st_ivas->hDiracDecBin[0]->useTdDecorr ) + { + *numCldfbAnalyses = add( *numCldfbAnalyses, 2 ); + move16(); + } BREAK; + case RENDERER_NON_DIEGETIC_DOWNMIX: + case RENDERER_MONO_DOWNMIX: + test(); + test(); + IF( EQ_32( ivas_format, ISM_FORMAT ) || EQ_32( ivas_format, MASA_ISM_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) + { + /* CLDFB not used in rendering */ + *numCldfbAnalyses = 0; + move16(); + *numCldfbSyntheses = 0; + move16(); + } + BREAK; + case RENDERER_DIRAC: + IF( EQ_32( ivas_format, SBA_FORMAT ) ) + { + *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; + move16(); + test(); + IF( st_ivas->hOutSetup.is_loudspeaker_setup && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) + { + *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; + move16(); + } + ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) ) + { + *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; + move16(); + } + ELSE + { + *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; + move16(); + } + } + IF( NE_32( ivas_format, SBA_FORMAT ) ) + { + test(); + test(); + IF( GT_16( st_ivas->nchan_transport, 2 ) && ( st_ivas->sba_planar != 0 ) ) + { + *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); + move16(); + } + ELSE IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_32( st_ivas->hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); + move16(); + } + } + BREAK; + case RENDERER_MC_PARAMMC: + IF( LE_16( st_ivas->hDecoderConfig->nchan_out, 2 ) ) + { + /* CLDFB not used in rendering */ + *numCldfbAnalyses = 0; + move16(); + *numCldfbSyntheses = 0; + move16(); + } + ELSE + { + *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas ); + move16(); + } + BREAK; + case RENDERER_PARAM_ISM: + /* Already correct with no exception */ + BREAK; + case RENDERER_DISABLE: + /* CLDFB not used */ + *numCldfbAnalyses = 0; + move16(); + *numCldfbSyntheses = 0; + move16(); + BREAK; + case RENDERER_MC: + case RENDERER_SBA_LINEAR_DEC: + case RENDERER_TD_PANNING: + case RENDERER_BINAURAL_OBJECTS_TD: + case RENDERER_MCMASA_MONO_STEREO: + case RENDERER_BINAURAL_MIXER_CONV: + case RENDERER_BINAURAL_MIXER_CONV_ROOM: + case RENDERER_BINAURAL_FASTCONV: + case RENDERER_BINAURAL_FASTCONV_ROOM: + case RENDERER_OSBA_STEREO: + case RENDERER_OSBA_AMBI: + case RENDERER_OSBA_LS: + test(); + IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) + { + IF( st_ivas->sba_dirac_stereo_flag != 0 ) + { + *numCldfbAnalyses = 0; + move16(); + *numCldfbSyntheses = 0; + move16(); + } + ELSE + { + *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; + move16(); + + test(); + IF( st_ivas->hOutSetup.is_loudspeaker_setup && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) + { + *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; + move16(); + } + ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) ) + { + *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; + move16(); + } + ELSE + { + *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; + move16(); + } + + test(); + IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) + { + *numCldfbAnalyses = add( st_ivas->nchan_ism, st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans ); + move16(); + } + } + } + ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) + { + /* do nothing for ParamMC */ + } + ELSE + { + /* CLDFB not used in rendering */ + *numCldfbAnalyses = 0; + move16(); + *numCldfbSyntheses = 0; + move16(); + } + BREAK; + case RENDERER_SBA_LINEAR_ENC: + IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) + { + *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas ); + move16(); + } + ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) + { + *numCldfbSyntheses = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe ); + move16(); + } + ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) + { + *numCldfbAnalyses = st_ivas->nchan_transport; + move16(); + *numCldfbSyntheses = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe ); + move16(); + } + ELSE + { + /* CLDFB not used in rendering */ + *numCldfbAnalyses = 0; + move16(); + *numCldfbSyntheses = 0; + move16(); + } + BREAK; +#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT + case RENDERER_OMASA_OBJECT_EXT: + *numCldfbAnalyses = st_ivas->nchan_transport; + *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; + move16(); + move16(); + break; + case RENDERER_OMASA_MIX_EXT: + *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); + *numCldfbSyntheses = 0; + move16(); + break; #endif default: assert( 0 && "Renderer not handled for CLDFB reservation." ); diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index a4588aadf..95ee97b2d 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -78,10 +78,10 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( move16(); st_ivas->ism_mode = last_ism_mode; move16(); - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->ism_mode = ism_mode; move16(); - nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ), IVAS_ERR_OK ) ) { @@ -320,7 +320,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( *-----------------------------------------------------------------*/ { - nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 47db837a9..032946c48 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -124,12 +124,12 @@ ivas_error ivas_jbm_dec_tc_fx( IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) { - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k ); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } - st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); move16(); } @@ -2627,7 +2627,7 @@ ivas_error ivas_jbm_dec_render_fx( IF( st_ivas->hTcBuffer->n_samples_discard > 0 ) { - FOR( n = 0; n < s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ ) + FOR( n = 0; n < s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ ) { p_output_fx[n] += st_ivas->hTcBuffer->n_samples_discard; } diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index 45e72438a..11406a10b 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -402,9 +402,6 @@ void ivas_lfe_dec_fx( move32(); j = add( j, shr( output_frame, 5 ) ); } -#ifdef NONBE_FIX_MC_LFE_LPF - q_out = Q9; -#endif } IF( hLFE->filter_state.order > 0 ) diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 974312b5c..a6ab0ab41 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -1702,7 +1702,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( move16(); } - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index 7c3581c93..af2506b95 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -287,7 +287,7 @@ void ivas_mc_paramupmix_dec_render( ivas_mc_paramupmix_dec_sf( st_ivas, output_local_fx ); - Word16 num_ch = s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ) ); + Word16 num_ch = s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); FOR( ch = 0; ch < num_ch; ch++ ) { output_local_fx[ch] += n_samples_sf; diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 8d6005ee5..10b9897b1 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -919,7 +919,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( move32(); nchan_transport_old = st_ivas->nchan_transport; move16(); - nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); last_mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ /* temporally set the current mc_mode back to the previous one to make sure the following call to @@ -928,7 +928,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( move32(); st_ivas->mc_mode = last_mc_mode; move32(); - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->mc_mode = mc_mode; move32(); @@ -1645,7 +1645,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index bde77e968..e0401b941 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -462,8 +462,8 @@ ivas_error ivas_omasa_dec_config_fx( move16(); st_ivas->ivas_format = st_ivas->last_ivas_format; move16(); - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); - nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); move16(); st_ivas->ivas_format = ivas_format_orig; @@ -821,7 +821,7 @@ ivas_error ivas_omasa_dec_config_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { return error; diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 1189abd24..0afec8a42 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -149,9 +149,9 @@ ivas_error ivas_sba_dec_reconfigure_fx( * Save old SBA high-level parameters *-----------------------------------------------------------------*/ - nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate ); - ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nchan_hp20_old = getNumChanSynthesis( st_ivas ); IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) @@ -786,7 +786,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/ + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/ if ( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index cc985f288..6252a5aac 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1793,7 +1793,7 @@ static ivas_error IVAS_DEC_GetTcSamples( IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) { - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { set32_fx( st_ivas->p_output_fx[n], 0, L_FRAME48k ); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; // Q11 diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index c598af538..640a5ba3c 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,11 +1657,7 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); -#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS @@ -1781,11 +1777,7 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ -#ifdef ISSUE_1796_replace_shl_o - tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#else tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#endif s = 15 - 5 - 7; IF( L_spec >= 1024 ) { @@ -2745,11 +2737,7 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); -#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); -#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; @@ -3256,11 +3244,7 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o - hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); -#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS if ( GT_16( hTcxEnc->tcx_target_bits_fac, 20480 /*1.25 in Q14*/ ) ) @@ -4023,11 +4007,9 @@ void InternalTCXDecoder_fx( Word16 Aq_old_fx[M + 1]; Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1]; Word16 *xn_buf16 = (Word16 *) xn_buf32; -#if !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy32( x_quant_fx, spectrum_fx, s_max( L_frame, L_spec ) ); @@ -4677,11 +4659,7 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); -#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); -#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 4595dc206..fc1f3e993 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -9,29 +9,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ - -#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE -static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr ) -{ - Word16 i; - Word16 tmp; - Word32 loffset = 0; - move32(); - - tmp = shl( 2, norm_s( l_subfr ) ); /* l_subfr is expected to be based 2 */ - FOR( i = 0; i < l_subfr; i++ ) - { - loffset = L_mac( loffset, in[i], tmp ); - } - tmp = round_fx_sat( loffset ); - FOR( i = 0; i < l_subfr; i++ ) - { - out[i] = sub( in[i], tmp ); - move16(); - } -} -#endif - /*======================================================================*/ /* FUNCTION : encod_gen_voic_fx() */ /*----------------------------------------------------------------------*/ @@ -588,16 +565,7 @@ void encod_gen_voic_ivas_fx( Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); -#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE - test(); - test(); - IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) ) - { - /* During core transition, when the temporal correlation is non existent */ - rem_offset( xn_fx, xn_fx, L_SUBFR ); - rem_offset( cn_fx, cn_fx, L_SUBFR ); - } -#endif + *pt_pitch_fx = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */ move16(); diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index d2e946098..17a3a2b2b 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -175,11 +175,7 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_cnt ); /* exp(e_tmp + e_cnt) */ e_tmp = sub( e_tmp, e_cnt ); -#ifdef ISSUE_1799_replace_L_shr_o - lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ -#else - lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ -#endif + lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */ } @@ -207,11 +203,7 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_hpE ); /* exp(e_tmp + e_hpE) */ e_tmp = sub( e_tmp, e_hpE ); -#ifdef ISSUE_1799_replace_L_shr_o - ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ -#else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ -#endif + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ } ELSE IF( lp_E == 0 ) { @@ -474,11 +466,7 @@ void find_tilt_ivas_fx( m_hpE = extract_h( L_shl( hp_E[i], e_hpE ) ); // e_hpE+q_bckr-16 m_tmp = div_s( m_tmp, m_hpE ); // Q15+(e_tmp+q_lp_E)-(e_hpE+q_bckr) e_tmp = sub( add( e_tmp, q_lp_E ), add( e_hpE, q_bckr ) ); -#ifdef ISSUE_1799_replace_L_shr_o - ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ -#else - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ -#endif + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ move32(); } diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index f6c45dab2..a0acd0bfd 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -145,12 +145,8 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -180,22 +176,14 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */ expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */ /* Number of bits required to adjust to Q15 */ - adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif - IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ + adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ { lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o - Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#else Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#endif } ELSE { @@ -334,12 +322,8 @@ Word16 hvq_enc_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -369,22 +353,14 @@ Word16 hvq_enc_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */ expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */ /* Number of bits required to adjust to Q15 */ - adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1799_replace_L_shr_o - lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ -#endif - IF( lb_nfpe > 16384 ) /* in Q15 */ + adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + IF( lb_nfpe > 16384 ) /* in Q15 */ { lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o - Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#else Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#endif } ELSE { diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 224e4dddb..7fb58941b 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -1211,11 +1211,7 @@ void noise_est_fx( /* calculation of energy in the rest of bands */ Ltmp2 = sum32_fx( &fr_bands[10], sub( st_fx->max_band, 9 ) ); -#ifdef ISSUE_1796_replace_shl_o - wtmp = shl_sat( 1, sub( add( Q_new, QSCALE ), 1 ) ); -#else wtmp = shl_o( 1, sub( add( Q_new, QSCALE ), 1 ), &Overflow ); -#endif test(); IF( L_msu( Ltmp, 100, wtmp ) < 0 || L_msu( Ltmp2, 100, wtmp ) < 0 ) @@ -1232,11 +1228,7 @@ void noise_est_fx( ExpDen = norm_l( Ltmp ); den = extract_h( L_shl( Ltmp, ExpDen ) ); num = div_s( num, den ); -#ifdef ISSUE_1799_replace_L_shr_o - noise_chartmp = extract_h( L_shr_sat( num, add( sub( ExpNum, ExpDen ), 4 - 16 ) ) ); /* Q11 */ -#else noise_chartmp = extract_h( L_shr_o( num, add( sub( ExpNum, ExpDen ), 4 - 16 ), &Overflow ) ); /* Q11 */ -#endif } noise_chartmp = s_min( noise_chartmp, (Word16) 10 << 11 ); /* Q11 */ @@ -1335,11 +1327,7 @@ void noise_est_fx( den = extract_h( L_shl( Lden, ExpDen ) ); num = div_s( num, den ); Ltmp = Mult_32_16( non_sta, num ); -#ifdef ISSUE_1799_replace_L_shr_o - non_sta = L_shr_sat( Ltmp, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */ @@ -1374,11 +1362,7 @@ void noise_est_fx( den = extract_h( L_shl( Lden, ExpDen ) ); num = div_s( num, den ); Ltmp1 = Mult_32_16( Lnon_sta2, num ); -#ifdef ISSUE_1799_replace_L_shr_o - Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] @@ -2564,12 +2548,8 @@ void noise_est_ivas_fx( ELSE { /* ftemp2 /= ftemp */ - num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp -#ifdef ISSUE_1796_replace_shl_o - noise_chartmp = shl_sat( num, sub( sub( exp, exp2 ), 4 ) ); // 15+exp2-exp1 -> Q11 -#else - noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 -#endif + num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp + noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 } if ( ncharX != NULL ) @@ -2697,13 +2677,9 @@ void noise_est_ivas_fx( ExpDen = norm_l( Lden ); den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16 - num = div_s( num, den ); // 15+ExpNum-ExpDen - Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15 -#ifdef ISSUE_1799_replace_L_shr_o - non_sta = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + num = div_s( num, den ); // 15+ExpNum-ExpDen + Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15 + non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */ @@ -2740,13 +2716,9 @@ void noise_est_ivas_fx( ExpDen = norm_l( Lden ); den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16 - num = div_s( num, den ); // 15+ExpNum-ExpDen - Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15 -#ifdef ISSUE_1799_replace_L_shr_o - Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ -#else - Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ -#endif + num = div_s( num, den ); // 15+ExpNum-ExpDen + Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15 + Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ } /* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] + (1.0f - alpha2) * (enr[i]) */ diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index 7a2224611..e48ed476d 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,12 +201,7 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); - -#ifdef ISSUE_1796_replace_shl_o - krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ -#else krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ -#endif IF( GT_16( krit_fx, krit_max_fx ) ) { diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 955c7c74d..8f1fb6985 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1014,11 +1014,7 @@ Word16 wb_vad_fx( m_num = shr( m_num, 1 ); shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); -#ifdef ISSUE_1799_replace_L_shr_o - L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ -#else L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ -#endif } ELSE { @@ -1051,11 +1047,7 @@ Word16 wb_vad_fx( shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); -#ifdef ISSUE_1799_replace_L_shr_o - L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ -#else L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ -#endif } ELSE { @@ -1087,11 +1079,7 @@ Word16 wb_vad_fx( snr_sumt = add( snr_sumt, shr( snr, 4 ) ); /*Q4 */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ -#else - tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ -#endif + tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ IF( LT_16( i, 2 ) ) { tmp = add_o( tmp, delta1, &Overflow ); /*Q13 */ @@ -1160,11 +1148,7 @@ Word16 wb_vad_fx( shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); -#ifdef ISSUE_1799_replace_L_shr_o - L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ -#else - L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ -#endif + L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ } ELSE { -- GitLab From ce3006906dcf480f647ef25bf7e40a92e0401946 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 11:21:06 +0200 Subject: [PATCH 076/103] take all files in libenc and lib dec from main --- lib_dec/FEC_HQ_core_fx.c | 34 ++- lib_dec/FEC_fx.c | 23 ++ lib_dec/LD_music_post_filter_fx.c | 14 +- lib_dec/acelp_core_switch_dec_fx.c | 6 + lib_dec/dec_higher_acelp_fx.c | 6 + lib_dec/dec_pit_exc_fx.c | 6 + lib_dec/dec_post_fx.c | 6 +- lib_dec/er_util_fx.c | 6 + lib_dec/igf_dec_fx.c | 12 + lib_dec/ivas_corecoder_dec_reconfig_fx.c | 2 +- lib_dec/ivas_dirac_dec_fx.c | 6 + lib_dec/ivas_init_dec_fx.c | 284 +---------------------- lib_dec/ivas_ism_dec_fx.c | 6 +- lib_dec/ivas_jbm_dec_fx.c | 6 +- lib_dec/ivas_lfe_dec_fx.c | 3 + lib_dec/ivas_masa_dec_fx.c | 2 +- lib_dec/ivas_mc_paramupmix_dec_fx.c | 2 +- lib_dec/ivas_mct_dec_fx.c | 6 +- lib_dec/ivas_omasa_dec_fx.c | 6 +- lib_dec/ivas_sba_dec_fx.c | 6 +- lib_dec/ivas_stereo_dft_plc_fx.c | 6 + lib_dec/lib_dec_fx.c | 2 +- lib_dec/pvq_core_dec_fx.c | 6 + lib_dec/pvq_decode_fx.c | 4 + lib_dec/swb_tbe_dec_fx.c | 8 + lib_dec/syn_outp_fx.c | 6 + lib_enc/arith_coder_enc_fx.c | 18 ++ lib_enc/bass_psfilter_enc_fx.c | 10 +- lib_enc/bw_detect_fx.c | 4 + lib_enc/cod_tcx_fx.c | 22 ++ lib_enc/core_enc_ol_fx.c | 4 + lib_enc/enc_acelp_fx.c | 4 + lib_enc/enc_gen_voic_fx.c | 34 ++- lib_enc/enc_higher_acelp_fx.c | 8 + lib_enc/enc_pit_exc_fx.c | 12 +- lib_enc/energy_fx.c | 6 + lib_enc/find_tilt_fx.c | 18 +- lib_enc/find_uv_fx.c | 8 + lib_enc/hvq_enc_fx.c | 44 +++- lib_enc/lsf_enc_fx.c | 56 ++++- lib_enc/lsf_msvq_ma_enc_fx.c | 4 + lib_enc/nois_est_fx.c | 48 +++- lib_enc/pitch_ol2_fx.c | 16 ++ lib_enc/pitch_ol_fx.c | 8 + lib_enc/pre_proc_fx.c | 6 + lib_enc/pvq_core_enc_fx.c | 24 ++ lib_enc/pvq_encode_fx.c | 16 +- lib_enc/scale_enc_fx.c | 4 + lib_enc/set_impulse_fx.c | 5 + lib_enc/speech_music_classif_fx.c | 26 ++- lib_enc/swb_bwe_enc_fx.c | 12 + lib_enc/swb_bwe_enc_hr_fx.c | 4 + lib_enc/swb_bwe_enc_lr_fx.c | 9 +- lib_enc/swb_tbe_enc_fx.c | 36 ++- lib_enc/tcx_ltp_enc_fx.c | 20 ++ lib_enc/tcx_utils_enc_fx.c | 20 ++ lib_enc/vad_fx.c | 20 +- lib_enc/voiced_enc_fx.c | 38 ++- 58 files changed, 689 insertions(+), 349 deletions(-) diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index a69584a32..1be7453ab 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,9 +43,11 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Initialize */ @@ -78,7 +80,11 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); +#ifdef ISSUE_1796_replace_shl_o + b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ +#else b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ +#endif move32(); } @@ -162,9 +168,11 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; @@ -382,7 +390,11 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); +#else hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); +#endif move16(); k = add( k, 1 ); } @@ -518,8 +530,12 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } +#ifdef ISSUE_1796_replace_shl_o + tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ +#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ +#endif + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -803,8 +819,12 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } +#ifdef ISSUE_1796_replace_shl_o + tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ +#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ +#endif + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -995,9 +1015,11 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); // d1m @@ -1063,8 +1085,12 @@ static Word16 find_best_delay_fx( exp2 = norm_l( min_corr_fx ); L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); - tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ - tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ + tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ +#else + tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ +#endif } *false_flag = 0; diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 48d91a87a..78594558b 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -126,7 +126,11 @@ void FEC_exc_estim_fx( gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */ } +#ifdef ISSUE_1796_replace_shl_o + tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 ); +#else tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow ); +#endif gainCNG = s_min( gainCNG, tmp1 ); set16_fx( exc_dct_in, 0, L_FRAME16k ); @@ -187,9 +191,15 @@ void FEC_exc_estim_fx( { test(); test(); +#ifdef ISSUE_1796_replace_shl_o + IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && + GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ + GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ +#else IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) && GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ +#endif { /* take the pitch value of last subframe of the previous frame */ *tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ); @@ -200,9 +210,16 @@ void FEC_exc_estim_fx( { test(); test(); +#ifdef ISSUE_1796_replace_shl_o + IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && + GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ + GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ +#else IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) && GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ +#endif + { /* take the pitch value of last subframe of the previous frame */ *tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ); @@ -751,9 +768,11 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 { Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e; Word32 tmp_pit2; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif tmp_pit = BASOP_Util_Divide1616_Scale( new_pit /*Q0*/, Tc /*Q0*/, &tmp_pit_e ) /*Q15*/; @@ -763,7 +782,11 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/ BASOP_SATURATE_WARNING_OFF_EVS /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/ +#ifdef ISSUE_1796_replace_shl_o + tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); +#else tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS *cond1 = sub( tmp_pit, negate( tmp_frame ) ); move16(); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index 12a13a4ec..4c3fa3728 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -599,7 +599,11 @@ static void spectrum_mod_dct_fx( Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/ e_binE = sub( add( e_tmp, e_binE ), 15 ); - Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ +#ifdef ISSUE_1799_replace_L_shr_o + Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ +#else + Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ +#endif Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/ } @@ -901,8 +905,10 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif move32(); @@ -923,7 +929,11 @@ static Word16 norm_lfe( exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */ /* Need to shl by 3 to take into account the 3 multiplications */ } - tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ +#ifdef ISSUE_1796_replace_shl_o + tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ +#else + tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ +#endif return tmp16; } diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 109f360cb..f3e7a8594 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -872,10 +872,12 @@ static void decod_gen_voic_core_switch_fx( Word16 *pt1; GSC_DEC_HANDLE hGSCDec; hGSCDec = st_fx->hGSCDec; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif +#endif /*----------------------------------------------------------------------* @@ -966,7 +968,11 @@ static void decod_gen_voic_core_switch_fx( IF( st_fx->prev_bfi ) { /*gain_code = min(gain_code, 0.5f*gain_code+0.5f*st->lp_gainc);*/ +#ifdef ISSUE_1796_replace_shl_o + gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_sat( 16384 >> 3, st_fx->Q_exc ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */ +#else gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_o( 16384 >> 3, st_fx->Q_exc, &Overflow ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */ +#endif } FOR( i = 0; i < L_SUBFR; i++ ) diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index 6144765a8..bc638b1a1 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -30,9 +30,11 @@ void transf_cdbk_dec_fx( Word32 L_tmp; Word32 dct_code32[L_SUBFR]; Word16 qdct; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Word16 avq_bit_sFlag; Word16 trgtSvPos; @@ -142,7 +144,11 @@ void transf_cdbk_dec_fx( } FOR( i = 0; i < L_SUBFR; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + code_preQ[i] = shl_sat( code_preQ[i], q_Code_preQ ); +#else code_preQ[i] = shl_o( code_preQ[i], q_Code_preQ, &Overflow ); +#endif move16(); /* code_preQ in Q6*/ } diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index ca6660fab..e82394fbb 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -73,9 +73,11 @@ void dec_pit_exc_fx( Word16 use_fcb; Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */ Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes */ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif use_fcb = 0; @@ -248,7 +250,11 @@ void dec_pit_exc_fx( gain_pit_fx = st_fx->lp_gainp_fx; move16(); } +#ifdef ISSUE_1796_replace_shl_o + gain_code_fx = L_mult0( s_max( sub( 32767, shl_sat( gain_pit_fx, 1 ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/ +#else gain_code_fx = L_mult0( s_max( sub( 32767, shl_o( gain_pit_fx, 1, &Overflow ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/ +#endif } /*----------------------------------------------------------------------* diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index 37d088a8f..f11f851cb 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -493,7 +493,7 @@ static void modify_pst_param_fx( Word16 tmp; Word16 lp_noiseQ12; Word32 L_tmp; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; move16(); #endif @@ -502,7 +502,11 @@ static void modify_pst_param_fx( test(); IF( NE_16( coder_type, INACTIVE ) && LT_16( lp_noise, LP_NOISE_THR_FX ) ) { +#ifdef ISSUE_1796_replace_shl_o + lp_noiseQ12 = shl_sat( lp_noise, 4 ); /* to go from Q8 to Q12 */ +#else lp_noiseQ12 = shl_o( lp_noise, 4, &Overflow ); /* to go from Q8 to Q12 */ +#endif /* ftmp = lp_noise*BG1_FX + CG1_FX */ tmp = mac_r( CG1_FX * 65536L, lp_noiseQ12, BG1_FX * 8 ); /* x8 to go from Q12 to Q15 */ diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index cecbad294..330cb5d44 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -44,16 +44,22 @@ void minimumStatistics_fx( Word16 f, p, i; Word16 tmp, tmp2, tmp_e; Word32 tmp32; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif aOpt_e = 0; move16(); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) ) +#else IF( LT_16( shl_o( currentFrameLevel, currentFrameLevel_e, &Overflow ), PLC_MIN_CNG_LEV ) ) +#endif { BASOP_SATURATE_WARNING_ON_EVS currentFrameLevel = PLC_MIN_CNG_LEV; /*Q15*/ diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 79953aaca..40b02c823 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2975,9 +2975,11 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in Word16 sfb; Word16 tmp; Word16 delta; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif set16_fx( a, 0, IGF_MAX_SFB + 1 ); @@ -2992,7 +2994,11 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in move16(); tmp = add( tmp, 1 ); delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] ); +#ifdef ISSUE_1796_replace_shl_o + delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) ); +#else delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) ); +#endif a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) ); move16(); IF( s_and( a[tmp], 1 ) != 0 ) @@ -3023,9 +3029,11 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han Word16 sfb; Word16 tmp; Word16 delta; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif set16_fx( a, 0, IGF_MAX_SFB + 1 ); @@ -3040,7 +3048,11 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han move16(); tmp = add( tmp, 1 ); delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] ); +#ifdef ISSUE_1796_replace_shl_o + delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) ); +#else delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) ); +#endif a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) ); move16(); // Rounding off delta values >=t+0.5 to t+1 diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index c8ad991af..5b4c7f472 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -577,7 +577,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( hDecoderConfig = st_ivas->hDecoderConfig; - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); /* special case, if there was one transport channel in the previous frame and more than one in the current frame, remove the second CLDFB here, it was for CNA/CNG */ diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 370254a4e..9de2904b8 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3244,10 +3244,16 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac; +#ifndef ISSUE_1796_replace_shl_o Flag flag = 0; move32(); +#endif fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); +#ifdef ISSUE_1796_replace_shl_o + fac = shl_sat( fac, exp ); +#else fac = shl_o( fac, exp, &flag ); +#endif IF( LT_16( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) ) { diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index aaff34f2f..bab1a909f 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -2666,7 +2666,7 @@ ivas_error ivas_init_decoder_fx( * CLDFB handles for rendering *-----------------------------------------------------------------*/ - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); FOR( i = 0; i < numCldfbAnalyses; i++ ) { @@ -2809,9 +2809,9 @@ ivas_error ivas_init_decoder_fx( /*-----------------------------------------------------------------* * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ - st_ivas->p_out_len = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->p_out_len = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); move16(); - FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { /* note: these are intra-frame heap memories */ IF( ( st_ivas->p_output_fx[n] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL ) @@ -3321,7 +3321,7 @@ void ivas_destroy_dec_fx( *-------------------------------------------------------------------*/ /*! r: number of cldfb instances */ -void ivas_init_dec_get_num_cldfb_instances( +void ivas_init_dec_get_num_cldfb_instances_fx( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ Word16 *numCldfbAnalyses, /* o : number of needed CLDFB analysis instances */ Word16 *numCldfbSyntheses /* o : number of needed CLDFB synthesis instances */ @@ -3566,286 +3566,12 @@ void ivas_init_dec_get_num_cldfb_instances( *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; move16(); move16(); - break; - case RENDERER_OMASA_MIX_EXT: - *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); - *numCldfbSyntheses = 0; - move16(); - break; -#endif - default: - assert( 0 && "Renderer not handled for CLDFB reservation." ); - } - test(); - test(); - IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - test(); - test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) - { - *numCldfbAnalyses = s_max( MC_PARAMUPMIX_MAX_INPUT_CHANS, *numCldfbAnalyses ); - move16(); - } - ELSE - { - *numCldfbAnalyses = s_max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbAnalyses ); - move16(); - } - *numCldfbSyntheses = s_max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbSyntheses ); - move16(); - } - - return; -} - -void ivas_init_dec_get_num_cldfb_instances_ivas_fx( - Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ - Word16 *numCldfbAnalyses, /* o : number of needed CLDFB analysis instances */ - Word16 *numCldfbSyntheses /* o : number of needed CLDFB synthesis instances */ -) -{ - IVAS_FORMAT ivas_format; - *numCldfbAnalyses = st_ivas->nchan_transport; - move16(); - *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; - move16(); - ivas_format = st_ivas->ivas_format; - move32(); - - test(); - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) - { - ivas_format = SBA_FORMAT; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */ - move32(); - } - - SWITCH( st_ivas->renderer_type ) - { - case RENDERER_BINAURAL_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC_ROOM: - case RENDERER_STEREO_PARAMETRIC: - IF( EQ_16( st_ivas->nchan_transport, 1 ) ) - { - *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); - move16(); - } - test(); - IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && st_ivas->hOutSetup.separateChannelEnabled ) - { - *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); - move16(); - } - - IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - *numCldfbAnalyses = add( *numCldfbAnalyses, st_ivas->nchan_ism ); - move16(); - } - } - - IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) ) - { - test(); - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) - { - *numCldfbAnalyses = add( *numCldfbAnalyses, st_ivas->nchan_ism ); - move16(); - } - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) - { - *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); - move16(); - } - } - IF( st_ivas->hDiracDecBin[0]->useTdDecorr ) - { - *numCldfbAnalyses = add( *numCldfbAnalyses, 2 ); - move16(); - } BREAK; - case RENDERER_NON_DIEGETIC_DOWNMIX: - case RENDERER_MONO_DOWNMIX: - test(); - test(); - IF( EQ_32( ivas_format, ISM_FORMAT ) || EQ_32( ivas_format, MASA_ISM_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) - { - /* CLDFB not used in rendering */ - *numCldfbAnalyses = 0; - move16(); - *numCldfbSyntheses = 0; - move16(); - } - BREAK; - case RENDERER_DIRAC: - IF( EQ_32( ivas_format, SBA_FORMAT ) ) - { - *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; - move16(); - test(); - IF( st_ivas->hOutSetup.is_loudspeaker_setup && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) - { - *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; - move16(); - } - ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) ) - { - *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; - move16(); - } - ELSE - { - *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; - move16(); - } - } - IF( NE_32( ivas_format, SBA_FORMAT ) ) - { - test(); - test(); - IF( GT_16( st_ivas->nchan_transport, 2 ) && ( st_ivas->sba_planar != 0 ) ) - { - *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); - move16(); - } - ELSE IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_32( st_ivas->hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); - move16(); - } - } - BREAK; - case RENDERER_MC_PARAMMC: - IF( LE_16( st_ivas->hDecoderConfig->nchan_out, 2 ) ) - { - /* CLDFB not used in rendering */ - *numCldfbAnalyses = 0; - move16(); - *numCldfbSyntheses = 0; - move16(); - } - ELSE - { - *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas ); - move16(); - } - BREAK; - case RENDERER_PARAM_ISM: - /* Already correct with no exception */ - BREAK; - case RENDERER_DISABLE: - /* CLDFB not used */ - *numCldfbAnalyses = 0; - move16(); - *numCldfbSyntheses = 0; - move16(); - BREAK; - case RENDERER_MC: - case RENDERER_SBA_LINEAR_DEC: - case RENDERER_TD_PANNING: - case RENDERER_BINAURAL_OBJECTS_TD: - case RENDERER_MCMASA_MONO_STEREO: - case RENDERER_BINAURAL_MIXER_CONV: - case RENDERER_BINAURAL_MIXER_CONV_ROOM: - case RENDERER_BINAURAL_FASTCONV: - case RENDERER_BINAURAL_FASTCONV_ROOM: - case RENDERER_OSBA_STEREO: - case RENDERER_OSBA_AMBI: - case RENDERER_OSBA_LS: - test(); - IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) - { - IF( st_ivas->sba_dirac_stereo_flag != 0 ) - { - *numCldfbAnalyses = 0; - move16(); - *numCldfbSyntheses = 0; - move16(); - } - ELSE - { - *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; - move16(); - - test(); - IF( st_ivas->hOutSetup.is_loudspeaker_setup && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) - { - *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; - move16(); - } - ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) ) - { - *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; - move16(); - } - ELSE - { - *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; - move16(); - } - - test(); - IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) - { - *numCldfbAnalyses = add( st_ivas->nchan_ism, st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans ); - move16(); - } - } - } - ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) - { - /* do nothing for ParamMC */ - } - ELSE - { - /* CLDFB not used in rendering */ - *numCldfbAnalyses = 0; - move16(); - *numCldfbSyntheses = 0; - move16(); - } - BREAK; - case RENDERER_SBA_LINEAR_ENC: - IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) - { - *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas ); - move16(); - } - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) - { - *numCldfbSyntheses = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe ); - move16(); - } - ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) - { - *numCldfbAnalyses = st_ivas->nchan_transport; - move16(); - *numCldfbSyntheses = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe ); - move16(); - } - ELSE - { - /* CLDFB not used in rendering */ - *numCldfbAnalyses = 0; - move16(); - *numCldfbSyntheses = 0; - move16(); - } - BREAK; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT - case RENDERER_OMASA_OBJECT_EXT: - *numCldfbAnalyses = st_ivas->nchan_transport; - *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; - move16(); - move16(); - break; case RENDERER_OMASA_MIX_EXT: *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 ); *numCldfbSyntheses = 0; move16(); - break; + BREAK; #endif default: assert( 0 && "Renderer not handled for CLDFB reservation." ); diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 95ee97b2d..a4588aadf 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -78,10 +78,10 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( move16(); st_ivas->ism_mode = last_ism_mode; move16(); - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->ism_mode = ism_mode; move16(); - nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ), IVAS_ERR_OK ) ) { @@ -320,7 +320,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( *-----------------------------------------------------------------*/ { - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 032946c48..47db837a9 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -124,12 +124,12 @@ ivas_error ivas_jbm_dec_tc_fx( IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) { - FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k ); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } - st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); move16(); } @@ -2627,7 +2627,7 @@ ivas_error ivas_jbm_dec_render_fx( IF( st_ivas->hTcBuffer->n_samples_discard > 0 ) { - FOR( n = 0; n < s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ ) + FOR( n = 0; n < s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ ) { p_output_fx[n] += st_ivas->hTcBuffer->n_samples_discard; } diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index 11406a10b..45e72438a 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -402,6 +402,9 @@ void ivas_lfe_dec_fx( move32(); j = add( j, shr( output_frame, 5 ) ); } +#ifdef NONBE_FIX_MC_LFE_LPF + q_out = Q9; +#endif } IF( hLFE->filter_state.order > 0 ) diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index a6ab0ab41..974312b5c 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -1702,7 +1702,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( move16(); } - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index af2506b95..7c3581c93 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -287,7 +287,7 @@ void ivas_mc_paramupmix_dec_render( ivas_mc_paramupmix_dec_sf( st_ivas, output_local_fx ); - Word16 num_ch = s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); + Word16 num_ch = s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ) ); FOR( ch = 0; ch < num_ch; ch++ ) { output_local_fx[ch] += n_samples_sf; diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 10b9897b1..8d6005ee5 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -919,7 +919,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( move32(); nchan_transport_old = st_ivas->nchan_transport; move16(); - nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); last_mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ /* temporally set the current mc_mode back to the previous one to make sure the following call to @@ -928,7 +928,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( move32(); st_ivas->mc_mode = last_mc_mode; move32(); - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->mc_mode = mc_mode; move32(); @@ -1645,7 +1645,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index e0401b941..bde77e968 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -462,8 +462,8 @@ ivas_error ivas_omasa_dec_config_fx( move16(); st_ivas->ivas_format = st_ivas->last_ivas_format; move16(); - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); - nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); move16(); st_ivas->ivas_format = ivas_format_orig; @@ -821,7 +821,7 @@ ivas_error ivas_omasa_dec_config_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { return error; diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 0afec8a42..1189abd24 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -149,9 +149,9 @@ ivas_error ivas_sba_dec_reconfigure_fx( * Save old SBA high-level parameters *-----------------------------------------------------------------*/ - nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate ); - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nchan_hp20_old = getNumChanSynthesis( st_ivas ); IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) @@ -786,7 +786,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/ + nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/ if ( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 3fed308b2..fa4e914c5 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -655,7 +655,9 @@ void stereo_dft_res_subst_spec_fx( /* Apply phase adjustment of identified peaks, including Np=1 peak neighbors on each side */ FOR( i = *num_plocs - 1; i >= 0; i-- ) { +#ifndef ISSUE_1796_replace_shl_o Flag flg_ov; +#endif IF( k == 0 ) { Word32 op; @@ -707,7 +709,11 @@ void stereo_dft_res_subst_spec_fx( move32(); } +#ifdef ISSUE_1796_replace_shl_o + cos_F = shl_sat( getCosWord16( extract_l( corr_phase ) ), 1 ); +#else cos_F = shl_o( getCosWord16( extract_l( corr_phase ) ), 1, &flg_ov ); +#endif sin_F = getSinWord16( extract_l( corr_phase ) ); idx = s_max( 0, sub( plocs[i], Np ) ); /* Iterate over plocs[i]-1:plocs[i]+1, considering the edges of the spectrum */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 6252a5aac..cc985f288 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1793,7 +1793,7 @@ static ivas_error IVAS_DEC_GetTcSamples( IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) { - FOR( n = 0; n < ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { set32_fx( st_ivas->p_output_fx[n], 0, L_FRAME48k ); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; // Q11 diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c index 93da9c77a..f9c2db757 100644 --- a/lib_dec/pvq_core_dec_fx.c +++ b/lib_dec/pvq_core_dec_fx.c @@ -477,9 +477,11 @@ static void densitySymbolIndexDecode_fx( Word32 acc; Word16 alpha = 0; move16(); +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif IF( s_and( (Word16) 0xFFFE, density ) == 0 ) { @@ -492,7 +494,11 @@ static void densitySymbolIndexDecode_fx( sym_freq = L_deposit_l( 1 ); angle = atan2_fx( SQRT_DIM_fx[opp_sz], SQRT_DIM_fx[near_sz] ); // Q13 +#ifdef ISSUE_1796_replace_shl_o + angle = shl_sat( angle, 1 ); +#else angle = shl_o( angle, 1, &Overflow ); +#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); density_c = sub( density, c ); diff --git a/lib_dec/pvq_decode_fx.c b/lib_dec/pvq_decode_fx.c index 649840f55..c9ed050a2 100644 --- a/lib_dec/pvq_decode_fx.c +++ b/lib_dec/pvq_decode_fx.c @@ -103,7 +103,11 @@ void pvq_decode_fx( Mpy_32_16_ss( L_isqrt, shl( y[i], shift_num ), &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *2*/ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 *2*/ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( L_tmp, shift_tot ); +#else L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); +#endif xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15 , array move */ move16(); } diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 174f67f64..09f5eda03 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -962,7 +962,11 @@ void ivas_wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ +#else shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ +#endif move16(); } n = sub( 14, n ); @@ -1605,7 +1609,11 @@ void wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ +#else shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ +#endif move16(); } n = sub( 14, n ); diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index 133ff17b4..95b98e854 100644 --- a/lib_dec/syn_outp_fx.c +++ b/lib_dec/syn_outp_fx.c @@ -67,9 +67,11 @@ void unscale_AGC( { Word16 i, fac, tmp, frame_fac, max_val; Word32 L_tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*----------------------------------------------------------------* @@ -82,7 +84,11 @@ void unscale_AGC( max_val = s_max( max_val, abs_s( x[i] ) ); } BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( 30000, Qx ); /* saturation can occur here */ +#else tmp = shl_o( 30000, Qx, &Overflow ); /* saturation can occur here */ +#endif BASOP_SATURATE_WARNING_ON_EVS frame_fac = 0; move16(); diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 98a5173f5..2e88b1f00 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -367,10 +367,12 @@ static Word16 tcx_arith_rateloop( Word32 L_tmp; Word16 tmp, tmp3; Word32 tmp2; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif scale = tcx_arith_estimate_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, &tmp ); @@ -379,7 +381,11 @@ static Word16 tcx_arith_rateloop( scale_max = tcx_arith_find_max_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, exps, deadzone, scale_e ); +#ifdef ISSUE_1796_replace_shl_o + scale = shl_sat( scale, sub( tmp, *scale_e ) ); +#else scale = shl_o( scale, sub( tmp, *scale_e ), &Overflow ); +#endif scale = s_min( scale, scale_max ); scale_best = scale; @@ -440,7 +446,11 @@ static Word16 tcx_arith_rateloop( { /* Update estimator temporal compensation factor */ tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 1 << 9 ), bits, &s ); +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( mult_r( *target_bits_fac, tmp ), s ); +#else tmp = shl_o( mult_r( *target_bits_fac, tmp ), s, &Overflow ); +#endif tmp = s_min( tmp, 20480 /*1.25f Q14*/ ); tmp = s_max( tmp, 12288 /*0.75f Q14*/ ); *target_bits_fac = tmp; @@ -470,8 +480,16 @@ static Word16 tcx_arith_rateloop( { /* adjust = 1.25f * target_bits / (float)bits; */ tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 0x280 ), bits, &s ); +#ifdef ISSUE_1796_replace_shl_o + adjust = shl_sat( tmp, sub( s, 1 ) ); /* Q14 */ +#else adjust = shl_o( tmp, sub( s, 1 ), &Overflow ); /* Q14 */ +#endif +#ifdef ISSUE_1796_replace_shl_o + scale = shl_sat( mult_r( scale, adjust ), 1 ); +#else scale = shl_o( mult_r( scale, adjust ), 1, &Overflow ); +#endif scale = s_min( scale, scale_max ); } } diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index a241101ba..f417a0904 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -129,7 +129,11 @@ Word16 bass_pf_enc_fx( /* gain = tmp/nrg; */ gain = BASOP_Util_Divide3232_Scale( tmp, nrg, &tmp16 ); BASOP_SATURATE_WARNING_OFF_EVS; - gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ +#ifdef ISSUE_1796_replace_shl_o + gain = shl_sat( gain, tmp16 ); /* Q15 */ +#else + gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ +#endif BASOP_SATURATE_WARNING_ON_EVS; if ( gain < 0 ) @@ -210,7 +214,11 @@ Word16 bass_pf_enc_fx( tmp32 = L_deposit_l( 1 ); tmp16 = BASOP_Util_Divide3232_Scale( tmp, tmp32, &st ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1796_replace_shl_o + tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */ +#else tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */ +#endif if ( GT_16( tmp16, 16384 /*0.5f Q15*/ ) ) { diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index 6f2dad29a..eeaf56969 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -297,7 +297,11 @@ void bw_detect_fx( FOR( i = 0; i < BWD_TOTAL_WIDTH; i++ ) { +#ifdef ISSUE_1799_replace_L_shr_o + spect[i] = round_fx_o( L_shr_sat( spect32[i], Q_dct ), &Overflow ); +#else spect[i] = round_fx_o( L_shr_o( spect32[i], Q_dct, &Overflow ), &Overflow ); +#endif move16(); } Q_dct = -2; diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 640a5ba3c..c598af538 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,7 +1657,11 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); +#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS @@ -1777,7 +1781,11 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ +#ifdef ISSUE_1796_replace_shl_o + tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#else tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#endif s = 15 - 5 - 7; IF( L_spec >= 1024 ) { @@ -2737,7 +2745,11 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); +#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); +#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; @@ -3244,7 +3256,11 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); +#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS if ( GT_16( hTcxEnc->tcx_target_bits_fac, 20480 /*1.25 in Q14*/ ) ) @@ -4007,9 +4023,11 @@ void InternalTCXDecoder_fx( Word16 Aq_old_fx[M + 1]; Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1]; Word16 *xn_buf16 = (Word16 *) xn_buf32; +#if !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy32( x_quant_fx, spectrum_fx, s_max( L_frame, L_spec ) ); @@ -4659,7 +4677,11 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); +#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); +#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 18f48e904..2f2682b8e 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -552,7 +552,11 @@ void core_encode_openloop_fx( /*v_sub(lsf_uq_rf, lsf_q_1st_rf, lsf_q_d_rf, M);*/ FOR( i = 0; i < M; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 ); +#else lsf_q_d_rf[i] = shl_o( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5, &Overflow ); +#endif move16(); /*input value is in Qx2.56, convert to Q6 to match table, quantizer table kept at Q6 to avoid losing precision */ /*Assume this difference data max range can be represented by Q6*/ diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 4317bdbb3..f6a8e65b2 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +563,11 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn i = add( exp_xy, 1 - 1 ); /* -1 -> gain in Q14 */ i = sub( i, exp_yy ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + gain = shl_sat( gain, i ); /* saturation can occur here */ +#else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ +#endif BASOP_SATURATE_WARNING_ON_EVS /* gain = s_max(0, gain); */ /* see above xy < 0. */ diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index fc1f3e993..4595dc206 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -9,6 +9,29 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ + +#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE +static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr ) +{ + Word16 i; + Word16 tmp; + Word32 loffset = 0; + move32(); + + tmp = shl( 2, norm_s( l_subfr ) ); /* l_subfr is expected to be based 2 */ + FOR( i = 0; i < l_subfr; i++ ) + { + loffset = L_mac( loffset, in[i], tmp ); + } + tmp = round_fx_sat( loffset ); + FOR( i = 0; i < l_subfr; i++ ) + { + out[i] = sub( in[i], tmp ); + move16(); + } +} +#endif + /*======================================================================*/ /* FUNCTION : encod_gen_voic_fx() */ /*----------------------------------------------------------------------*/ @@ -565,7 +588,16 @@ void encod_gen_voic_ivas_fx( Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); - +#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE + test(); + test(); + IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) ) + { + /* During core transition, when the temporal correlation is non existent */ + rem_offset( xn_fx, xn_fx, L_SUBFR ); + rem_offset( cn_fx, cn_fx, L_SUBFR ); + } +#endif *pt_pitch_fx = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */ move16(); diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 5edc6229f..00b18f79d 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -287,7 +287,11 @@ void transf_cdbk_enc_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); +#else x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); +#endif move16(); } @@ -639,7 +643,11 @@ void transf_cdbk_enc_ivas_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); +#else x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); +#endif move16(); } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 548e3f904..5f173cd7f 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -517,7 +517,11 @@ void enc_pit_exc_fx( } } - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#ifdef ISSUE_1796_replace_shl_o + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ +#else + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#endif *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } @@ -989,6 +993,10 @@ void enc_pit_exc_ivas_fx( } } - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#ifdef ISSUE_1796_replace_shl_o + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ +#else + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#endif *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } diff --git a/lib_enc/energy_fx.c b/lib_enc/energy_fx.c index 0168e52b1..cc0001d4a 100644 --- a/lib_enc/energy_fx.c +++ b/lib_enc/energy_fx.c @@ -42,8 +42,10 @@ void est_energy_fx( const Word16 *Nregion_index; Word32 *sb_power = enerBuffer; Word32 Ltmp32 = 0; +#ifndef ISSUE_1799_replace_L_shr_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif move32(); SNR_sb_num = SNR_SUB_BAND_NUM[bandwidth - CLDFBVAD_NB_ID]; @@ -125,7 +127,11 @@ void est_energy_fx( tmpspec_amp = L_shl( sb_power[j], s16MaxCoefNorm ); /* sb_power_Q + s16MaxCoefNorm */ s32CopyPower = L_add( s32CopyPower, tmpspec_amp ); } +#ifdef ISSUE_1799_replace_L_shr_o + frame_sb_energy[i] = L_shr_sat( s32CopyPower, s16MaxCoefNorm ); /* sb_power_Q */ +#else frame_sb_energy[i] = L_shr_o( s32CopyPower, s16MaxCoefNorm, &Overflow ); /* sb_power_Q */ +#endif move32(); } diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index 17a3a2b2b..d2e946098 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -175,7 +175,11 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_cnt ); /* exp(e_tmp + e_cnt) */ e_tmp = sub( e_tmp, e_cnt ); - lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ +#ifdef ISSUE_1799_replace_L_shr_o + lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ +#else + lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ +#endif pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */ } @@ -203,7 +207,11 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_hpE ); /* exp(e_tmp + e_hpE) */ e_tmp = sub( e_tmp, e_hpE ); - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ +#ifdef ISSUE_1799_replace_L_shr_o + ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ +#else + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ +#endif } ELSE IF( lp_E == 0 ) { @@ -466,7 +474,11 @@ void find_tilt_ivas_fx( m_hpE = extract_h( L_shl( hp_E[i], e_hpE ) ); // e_hpE+q_bckr-16 m_tmp = div_s( m_tmp, m_hpE ); // Q15+(e_tmp+q_lp_E)-(e_hpE+q_bckr) e_tmp = sub( add( e_tmp, q_lp_E ), add( e_hpE, q_bckr ) ); - ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ +#ifdef ISSUE_1799_replace_L_shr_o + ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */ +#else + ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */ +#endif move32(); } diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c index 6114fb69b..792ddf265 100644 --- a/lib_enc/find_uv_fx.c +++ b/lib_enc/find_uv_fx.c @@ -178,7 +178,11 @@ Word16 find_uv_fx( /* o : coding type */ exp1 = sub( norm_l( *pt_enr_ssf1 ), 1 ); wtmp1 = extract_h( L_shl( *pt_enr_ssf1, exp1 ) ); fac = div_s( wtmp1, wtmp0 ); +#ifdef ISSUE_1799_replace_L_shr_o + fac_32 = L_shr_sat( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ) ); /* fac32 in Q13*/ +#else fac_32 = L_shr_o( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ), &Overflow ); /* fac32 in Q13*/ +#endif if ( GT_32( fac_32, dE1 ) ) { @@ -670,7 +674,11 @@ Word16 find_uv_ivas_fx( /* o : coding typ exp1 = sub( norm_l( *pt_enr_ssf1 ), 1 ); wtmp1 = extract_h( L_shl( *pt_enr_ssf1, exp1 ) ); fac = div_s( wtmp1, wtmp0 ); +#ifdef ISSUE_1799_replace_L_shr_o + fac_32 = L_shr_sat( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ) ); /* fac32 in Q13*/ +#else fac_32 = L_shr_o( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ), &Overflow ); /* fac32 in Q13*/ +#endif if ( GT_32( fac_32, dE1 ) ) { diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index a0acd0bfd..f6c45dab2 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -145,8 +145,12 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ +#ifdef ISSUE_1799_replace_L_shr_o + noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ +#else + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ +#endif move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -176,14 +180,22 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */ expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */ /* Number of bits required to adjust to Q15 */ - adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ - IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ + adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ +#ifdef ISSUE_1799_replace_L_shr_o + lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ +#else + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ +#endif + IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */ { lb_nfpe = 16384; move16(); } +#ifdef ISSUE_1796_replace_shl_o + Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ +#else Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ +#endif } ELSE { @@ -322,8 +334,12 @@ Word16 hvq_enc_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ - noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ +#ifdef ISSUE_1799_replace_L_shr_o + noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ +#else + noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ +#endif move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -353,14 +369,22 @@ Word16 hvq_enc_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */ expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */ /* Number of bits required to adjust to Q15 */ - adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ - lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ - IF( lb_nfpe > 16384 ) /* in Q15 */ + adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */ +#ifdef ISSUE_1799_replace_L_shr_o + lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ +#else + lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */ +#endif + IF( lb_nfpe > 16384 ) /* in Q15 */ { lb_nfpe = 16384; move16(); } +#ifdef ISSUE_1796_replace_shl_o + Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ +#else Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ +#endif } ELSE { diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 23ed7d0c2..8db83c2b9 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -784,7 +784,11 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); +#ifdef ISSUE_1796_replace_shl_o + En = L_mac_o( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ +#else En = L_mac_o( En, mult( pred_pow2[i], shl_o( w[i], 2, &Overflow ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ +#endif } cs = shl( cs, 1 ); @@ -2365,8 +2369,10 @@ static Word32 vq_lvq_lsf_enc( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif stagesVQ = sub( stages, 1 ); @@ -2418,13 +2424,25 @@ static Word32 vq_lvq_lsf_enc( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + diff[j] = shl_sat( diff[j], 4 ); +#else diff[j] = shl_o( diff[j], 4, &Overflow ); +#endif move16(); } - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else + L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif FOR( j = 1; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif } e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ move32(); @@ -2471,8 +2489,10 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif stagesVQ = sub( stages, 1 ); @@ -2541,13 +2561,25 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + diff[j] = shl_sat( diff[j], 4 ); +#else diff[j] = shl_o( diff[j], 4, &Overflow ); +#endif move16(); } - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else + L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif FOR( j = 1; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif } e[i] = L_tmp; move32(); @@ -3396,7 +3428,11 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); +#ifdef ISSUE_1796_replace_shl_o + temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow ); +#else temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_o( w_fx[i], 2, &Overflow ) ), yy_fx[i], &Overflow ); +#endif } cs = shl( cs, 1 ); temp_l = L_shr( temp_l, cs ); @@ -3600,9 +3636,17 @@ static void lsf_mid_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, 4 ); +#else tmp = shl_o( tmp, 4, &Overflow ); +#endif tmp = mult_ro( tmp, tmp, &Overflow ); +#ifdef ISSUE_1796_replace_shl_o + err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); +#else err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); +#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); @@ -3786,9 +3830,17 @@ static void lsf_mid_enc_ivas_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, 4 ); +#else tmp = shl_o( tmp, 4, &Overflow ); +#endif tmp = mult_ro( tmp, tmp, &Overflow ); +#ifdef ISSUE_1796_replace_shl_o + err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); +#else err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); +#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 6056c0c46..981c7e51c 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -1630,7 +1630,11 @@ void midlsf_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, 4 ); +#else tmp = shl_o( tmp, 4, &Overflow ); +#endif tmp = mult_ro( tmp, tmp, &Overflow ); err = L_mac( err, tmp, wghts[j] ); } diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 7fb58941b..224e4dddb 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -1211,7 +1211,11 @@ void noise_est_fx( /* calculation of energy in the rest of bands */ Ltmp2 = sum32_fx( &fr_bands[10], sub( st_fx->max_band, 9 ) ); +#ifdef ISSUE_1796_replace_shl_o + wtmp = shl_sat( 1, sub( add( Q_new, QSCALE ), 1 ) ); +#else wtmp = shl_o( 1, sub( add( Q_new, QSCALE ), 1 ), &Overflow ); +#endif test(); IF( L_msu( Ltmp, 100, wtmp ) < 0 || L_msu( Ltmp2, 100, wtmp ) < 0 ) @@ -1228,7 +1232,11 @@ void noise_est_fx( ExpDen = norm_l( Ltmp ); den = extract_h( L_shl( Ltmp, ExpDen ) ); num = div_s( num, den ); +#ifdef ISSUE_1799_replace_L_shr_o + noise_chartmp = extract_h( L_shr_sat( num, add( sub( ExpNum, ExpDen ), 4 - 16 ) ) ); /* Q11 */ +#else noise_chartmp = extract_h( L_shr_o( num, add( sub( ExpNum, ExpDen ), 4 - 16 ), &Overflow ) ); /* Q11 */ +#endif } noise_chartmp = s_min( noise_chartmp, (Word16) 10 << 11 ); /* Q11 */ @@ -1327,7 +1335,11 @@ void noise_est_fx( den = extract_h( L_shl( Lden, ExpDen ) ); num = div_s( num, den ); Ltmp = Mult_32_16( non_sta, num ); - non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ +#ifdef ISSUE_1799_replace_L_shr_o + non_sta = L_shr_sat( Ltmp, sub( ExpNum, ExpDen ) ); /* Q10 */ +#else + non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ +#endif } /* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */ @@ -1362,7 +1374,11 @@ void noise_est_fx( den = extract_h( L_shl( Lden, ExpDen ) ); num = div_s( num, den ); Ltmp1 = Mult_32_16( Lnon_sta2, num ); - Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ +#ifdef ISSUE_1799_replace_L_shr_o + Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ +#else + Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ +#endif } /* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] @@ -2548,8 +2564,12 @@ void noise_est_ivas_fx( ELSE { /* ftemp2 /= ftemp */ - num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp - noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 + num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp +#ifdef ISSUE_1796_replace_shl_o + noise_chartmp = shl_sat( num, sub( sub( exp, exp2 ), 4 ) ); // 15+exp2-exp1 -> Q11 +#else + noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 +#endif } if ( ncharX != NULL ) @@ -2677,9 +2697,13 @@ void noise_est_ivas_fx( ExpDen = norm_l( Lden ); den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16 - num = div_s( num, den ); // 15+ExpNum-ExpDen - Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15 - non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ + num = div_s( num, den ); // 15+ExpNum-ExpDen + Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15 +#ifdef ISSUE_1799_replace_L_shr_o + non_sta = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ +#else + non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ +#endif } /* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */ @@ -2716,9 +2740,13 @@ void noise_est_ivas_fx( ExpDen = norm_l( Lden ); den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16 - num = div_s( num, den ); // 15+ExpNum-ExpDen - Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15 - Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ + num = div_s( num, den ); // 15+ExpNum-ExpDen + Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15 +#ifdef ISSUE_1799_replace_L_shr_o + Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */ +#else + Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */ +#endif } /* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] + (1.0f - alpha2) * (enr[i]) */ diff --git a/lib_enc/pitch_ol2_fx.c b/lib_enc/pitch_ol2_fx.c index cbeea8f1d..de47d85af 100644 --- a/lib_enc/pitch_ol2_fx.c +++ b/lib_enc/pitch_ol2_fx.c @@ -294,7 +294,11 @@ void StableHighPitchDetect_fx( tmp = abs_s( tmp ); tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1799_replace_L_shr_o + diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) ); +#else diff = L_negate( L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ) ); +#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } @@ -302,7 +306,11 @@ void StableHighPitchDetect_fx( { tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1799_replace_L_shr_o + diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ); +#else diff = L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } @@ -509,7 +517,11 @@ void StableHighPitchDetect_ivas_fx( tmp = abs_s( tmp ); tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1799_replace_L_shr_o + diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) ); +#else diff = L_negate( L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ) ); +#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } @@ -517,7 +529,11 @@ void StableHighPitchDetect_ivas_fx( { tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1799_replace_L_shr_o + diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ); +#else diff = L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_o( diff, &Overflow ); } diff --git a/lib_enc/pitch_ol_fx.c b/lib_enc/pitch_ol_fx.c index 79c55821e..d4e3284da 100644 --- a/lib_enc/pitch_ol_fx.c +++ b/lib_enc/pitch_ol_fx.c @@ -751,7 +751,11 @@ void pitch_ol_fx( Ltmp = L_mult0( cor_buf[ind], enr1 ); qCorX = add( sub( 15, enr1_exp ), sub( 14, pt_exp1[ind] ) ); +#ifdef ISSUE_1799_replace_L_shr_o + corX[i][j] = extract_h( L_shr_sat( Ltmp, sub( qCorX, 31 ) ) ); +#else corX[i][j] = extract_h( L_shr_o( Ltmp, sub( qCorX, 31 ), &Overflow ) ); +#endif qCorX = 31; move16(); @@ -788,7 +792,11 @@ void pitch_ol_fx( Ltmp = L_mult0( cor_buf[ind1 + len_x], enr1 ); qCorX = add( sub( 15, enr1_exp ), sub( 14, pt_exp3[ind1] ) ); +#ifdef ISSUE_1799_replace_L_shr_o + corX[i][j + NSECT] = extract_h( L_shr_sat( Ltmp, qCorX - 31 ) ); +#else corX[i][j + NSECT] = extract_h( L_shr_o( Ltmp, qCorX - 31, &Overflow ) ); +#endif qCorX = 31; move16(); diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index dc3ec020a..8a3cf1a00 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -126,9 +126,11 @@ void pre_proc_fx( LPD_state_HANDLE hLPDmem = st->hLPDmem; FD_BWE_ENC_HANDLE hBWE_FD = st->hBWE_FD; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif /*------------------------------------------------------------------* @@ -1046,7 +1048,11 @@ void pre_proc_fx( test(); IF( ( ( st->tcxonly == 0 ) || ( EQ_16( st->codec_mode, MODE1 ) ) ) && GT_32( st->input_Fs, 8000 ) ) { +#ifdef ISSUE_1796_replace_shl_o + st->mem_preemph_enc = shl_sat( new_inp_16k[sub( L_frame_tmp, 1 )], 1 ); +#else st->mem_preemph_enc = shl_o( new_inp_16k[sub( L_frame_tmp, 1 )], 1, &Overflow ); +#endif move16(); } diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index e2d5fb264..a5e193461 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,9 +267,11 @@ void pvq_encode_frame_ivas_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -331,7 +333,11 @@ void pvq_encode_frame_ivas_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); +#ifdef ISSUE_1796_replace_shl_o + gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); +#else gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); +#endif move16(); if ( gopt[is] == 0 ) @@ -391,9 +397,11 @@ void pvq_encode_frame_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -455,7 +463,11 @@ void pvq_encode_frame_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); +#ifdef ISSUE_1796_replace_shl_o + gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); +#else gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); +#endif move16(); if ( gopt[is] == 0 ) { @@ -931,9 +943,11 @@ static void densityIndexSymbolEncode_ivas_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif sym_freq = L_deposit_l( 1 ); @@ -941,7 +955,11 @@ static void densityIndexSymbolEncode_ivas_fx( IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); +#ifdef ISSUE_1796_replace_shl_o + angle = shl_sat( angle, 1 ); +#else angle = shl_o( angle, 1, &Overflow ); +#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); @@ -1008,9 +1026,11 @@ static void densityIndexSymbolEncode_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif sym_freq = L_deposit_l( 1 ); @@ -1018,7 +1038,11 @@ static void densityIndexSymbolEncode_fx( IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); +#ifdef ISSUE_1796_replace_shl_o + angle = shl_sat( angle, 1 ); +#else angle = shl_o( angle, 1, &Overflow ); +#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); diff --git a/lib_enc/pvq_encode_fx.c b/lib_enc/pvq_encode_fx.c index 749a39ed9..d08b8a902 100644 --- a/lib_enc/pvq_encode_fx.c +++ b/lib_enc/pvq_encode_fx.c @@ -359,8 +359,12 @@ void pvq_encode_ivas_fx( } Mpy_32_16_ss( L_isqrt, tmp, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) +1 */ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 +1 */ - L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ +#else + L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ +#endif + xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ move16(); L_xq[i] = L_tmp; /* Q31 currently unused */ move32(); @@ -567,8 +571,12 @@ void pvq_encode_fx( } Mpy_32_16_ss( L_isqrt, tmp, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) +1 */ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 +1 */ - L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ +#else + L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); /* Q31+x */ +#endif + xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ move16(); L_xq[i] = L_tmp; /* Q31 currently unused */ move32(); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index 76eae22b7..32633c89d 100644 --- a/lib_enc/scale_enc_fx.c +++ b/lib_enc/scale_enc_fx.c @@ -98,7 +98,11 @@ void Preemph_scaled( BASOP_SATURATE_WARNING_OFF_EVS Overflow = 0; +#ifdef ISSUE_1796_replace_shl_o + QVal = shl_sat( 1, sub( 15, bits ) ); +#else QVal = shl_o( 1, sub( 15, bits ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS mu = shr( Preemph_factor, bits ); /* Q15 --> Q(15-bits) */ diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index e48ed476d..7a2224611 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,7 +201,12 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); + +#ifdef ISSUE_1796_replace_shl_o + krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ +#else krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ +#endif IF( GT_16( krit_fx, krit_max_fx ) ) { diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 59f3b35f6..0c4a4ec23 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1500,11 +1500,19 @@ static Word16 attack_det_fx( /* o : attack flag exp1 = norm_s( att_3lsub_pos ); tmp = div_s( shl( 1, sub( 14, exp1 ) ), att_3lsub_pos ); /*Q(29-exp1) */ - L_tmp = L_shr_o( finc[0], Qx, &Overflow ); /*Qx */ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( finc[0], Qx ); /*Qx */ +#else + L_tmp = L_shr_o( finc[0], Qx, &Overflow ); /*Qx */ +#endif FOR( i = 1; i < att_3lsub_pos; i++ ) { - L_tmp = L_add_o( L_tmp, L_shr_o( finc[i], Qx, &Overflow ), &Overflow ); /*Qx */ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i], Qx ), &Overflow ); /*Qx */ +#else + L_tmp = L_add_o( L_tmp, L_shr_o( finc[i], Qx, &Overflow ), &Overflow ); /*Qx */ +#endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ @@ -1513,10 +1521,18 @@ static Word16 attack_det_fx( /* o : attack flag exp1 = norm_s( tmp1 ); tmp = div_s( shl( 1, sub( 14, exp1 ) ), tmp1 ); /*Q(29-exp1) */ - L_tmp = L_shr_o( finc[attack], Qx, &Overflow ); /*Qx */ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( finc[attack], Qx ); /*Qx */ +#else + L_tmp = L_shr_o( finc[attack], Qx, &Overflow ); /*Qx */ +#endif FOR( i = 1; i < tmp1; i++ ) { +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i + attack], Qx ), &Overflow ); /*Qx */ +#else L_tmp = L_add_o( L_tmp, L_shr_o( finc[i + attack], Qx, &Overflow ), &Overflow ); /*Qx */ +#endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp2 = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ @@ -3762,7 +3778,11 @@ static void spec_analysis_fx( test(); IF( GT_16( peak_idx[k], valey_idx[i] ) && LT_16( peak_idx[k], valey_idx[i + 1] ) ) { +#ifdef ISSUE_1796_replace_shl_o + p2v[k] = sub_o( shl_sat( peak[k], 1 ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); +#else p2v[k] = sub_o( shl_o( peak[k], 1, &Overflow ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); +#endif move16(); k = add( k, 1 ); } diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 6b309c334..40fefd684 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -1059,12 +1059,20 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class expd = sub( sub( 30, expd ), shl( st_fx->prev_Q_shb, 1 ) ); scale = shr( sub( den, num ), 15 ); +#ifdef ISSUE_1796_replace_shl_o + num = shl_sat( num, scale ); +#else num = shl_o( num, scale, &Overflow ); +#endif expn = sub( expn, scale ); tmp = div_s( num, den ); expn = sub( expn, expd ); +#ifdef ISSUE_1796_replace_shl_o + gain_tmp = shl_sat( tmp, sub( expn, 1 ) ); /*Q14 */ +#else gain_tmp = shl_o( tmp, sub( expn, 1 ), &Overflow ); /*Q14 */ +#endif } test(); IF( EQ_16( hBWE_FD->prev_mode, TRANSIENT ) ) @@ -1164,7 +1172,11 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class } test(); +#ifdef ISSUE_1796_replace_shl_o + IF( GT_16( sharp, 4608 ) && GT_16( peak, shl_sat( 1, add( Q_syn, 3 ) ) ) ) +#else IF( GT_16( sharp, 4608 ) && GT_16( peak, shl_o( 1, add( Q_syn, 3 ), &Overflow ) ) ) +#endif { k = add( k, 1 ); move16(); diff --git a/lib_enc/swb_bwe_enc_hr_fx.c b/lib_enc/swb_bwe_enc_hr_fx.c index 8b5a17353..f510a1cb6 100644 --- a/lib_enc/swb_bwe_enc_hr_fx.c +++ b/lib_enc/swb_bwe_enc_hr_fx.c @@ -767,7 +767,11 @@ void swb_bwe_enc_hr_fx( FOR( i = 0; i < Nsv2 * WIDTH_BAND; i++ ) { L_tmp = L_mult( temp, t_audio_fx[i] ); +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( L_tmp, temp2 ); +#else L_tmp = L_shr_o( L_tmp, temp2, &Overflow ); +#endif t_audio_fx[i] = round_fx_o( L_tmp, &Overflow ); move16(); } diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index 938cdd971..3c92c7f89 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -174,14 +174,15 @@ static Word16 GetSubbandCorrIndex2_har_fx( /* o : L_corr_sq = L_mult_o( corr_sq_hi_fx, corr_sq_hi_fx, &Overflow ); /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */ L_corr_sq = L_shr_o( L_corr_sq, s_min( shl( exp_norm, 1 ), 31 ), &Overflow ); /* (QCorr-16)*2+1 */ - IF( Overflow != 0 ) + if ( Overflow != 0 ) { L_corr_sq = 0x0L; - move16(); - Overflow = 0; - move16(); + move32(); } + Overflow = 0; + move16(); + /* normalize for L_lagCorr_sq and L_corr_sq */ L_buf = L_or( L_lagCorr_sq, L_corr_sq ); exp_corr = norm_l( L_buf ); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index ec11d2837..d396418e4 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4683,17 +4683,29 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = shl_sat( oriSHB[i], scaling ); +#else sig = shl_o( oriSHB[i], scaling, &Overflow ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -4872,17 +4884,29 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = shl_sat( oriSHB[i], scaling ); +#else sig = shl_o( oriSHB[i], scaling, &Overflow ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -6214,9 +6238,11 @@ static void determine_gain_weights_fx( Word16 j; Word16 exp, exp1, frac, tmp, exp2; Word32 L_tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( j = 0; j < dims; j++ ) @@ -6238,7 +6264,11 @@ static void determine_gain_weights_fx( { exp2 = sub( exp, 2 ); } +#ifdef ISSUE_1796_replace_shl_o + weights[j] = shl_sat( tmp, exp2 ); +#else weights[j] = shl_o( tmp, exp2, &Overflow ); +#endif move16(); /* Q12 */ } ELSE @@ -7425,8 +7455,12 @@ void fb_tbe_enc_fx( { tmp = div_s( tmp2, tmp ); L_tmp = L_deposit_h( tmp ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*Q(31-exp)*/ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*Q(31-exp)*/ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_max( L_shr_sat( L_tmp, sub( 31, exp ) ), 0x1 ); /* Q0 */ +#else L_tmp = L_max( L_shr_o( L_tmp, sub( 31, exp ), &Overflow ), 0x1 ); /* Q0 */ +#endif } ELSE { diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 84f83a311..a069f99b4 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -86,10 +86,12 @@ static void tcx_ltp_pitch_search( Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif delta = 16; @@ -181,7 +183,11 @@ static void tcx_ltp_pitch_search( temp_m = divide1616( extract_h( L_shl( cor_max, s ) ), temp_m ); temp_e = sub( negate( s ), temp_e ); +#ifdef ISSUE_1796_replace_shl_o + *norm_corr = shl_sat( temp_m, temp_e ); +#else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); +#endif IF( GE_16( t1, pitfr1 ) ) { @@ -295,9 +301,11 @@ static void tcx_ltp_pitch_search_ivas_fx( Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif delta = 16; @@ -385,7 +393,11 @@ static void tcx_ltp_pitch_search_ivas_fx( temp_m = divide1616( extract_h( L_shl( cor_max, s ) ), temp_m ); temp_e = sub( negate( s ), temp_e ); +#ifdef ISSUE_1796_replace_shl_o + *norm_corr = shl_sat( temp_m, temp_e ); +#else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); +#endif test(); IF( check_border_case && EQ_16( t1, t0_min ) ) @@ -532,7 +544,11 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + g = shl_sat( g, sub( s1, s2 ) ); +#else g = shl_o( g, sub( s1, s2 ), &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ @@ -583,7 +599,11 @@ static void tcx_ltp_find_gain_ivas_fx( Word16 *speech /*Qx*/, Word16 *pred_speec g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ +#else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ +#endif BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 0b94e74fa..bdf473aab 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2072,12 +2072,18 @@ void QuantizeGain( Word16 n, Word16 *pGain, Word16 *pGain_e, Word16 *pQuantizedG Word16 ener, ener_e, enerInv, enerInv_e, gain, gain_e; Word16 quantizedGain; Word32 tmp32; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif +#ifdef ISSUE_1796_replace_shl_o + ener = mult_r( shl_sat( n, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#else ener = mult_r( shl_o( n, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#endif ener_e = 15 - 5 - 7; move16(); IF( GE_16( n, 1024 ) ) @@ -2147,10 +2153,12 @@ void tcx_noise_factor_fx( Word16 c1, c2; Word16 att; /* noise level attenuation factor for transient windows */ Word32 xMax; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif assert( nTransWidth <= 16 ); @@ -2246,7 +2254,11 @@ void tcx_noise_factor_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ +#ifdef ISSUE_1796_replace_shl_o + att = shl_sat( att, s ); +#else att = shl_o( att, s, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2449,7 +2461,11 @@ void tcx_noise_factor_fx( tmp1 = BASOP_Util_Divide3232_Scale( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); s = add( add( add( s, x_orig_e ), inv_gain2_e ), 7 - 15 ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1796_replace_shl_o + tmp1 = shl_sat( tmp1, s ); +#else tmp1 = shl_o( tmp1, s, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2605,7 +2621,11 @@ void tcx_noise_factor_ivas_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ +#ifdef ISSUE_1796_replace_shl_o + att = shl_sat( att, s ); +#else att = shl_o( att, s, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 8f1fb6985..955c7c74d 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1014,7 +1014,11 @@ Word16 wb_vad_fx( m_num = shr( m_num, 1 ); shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); +#ifdef ISSUE_1799_replace_L_shr_o + L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ +#else L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ +#endif } ELSE { @@ -1047,7 +1051,11 @@ Word16 wb_vad_fx( shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); +#ifdef ISSUE_1799_replace_L_shr_o + L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ +#else L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ +#endif } ELSE { @@ -1079,7 +1087,11 @@ Word16 wb_vad_fx( snr_sumt = add( snr_sumt, shr( snr, 4 ) ); /*Q4 */ - tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ +#else + tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ +#endif IF( LT_16( i, 2 ) ) { tmp = add_o( tmp, delta1, &Overflow ); /*Q13 */ @@ -1148,7 +1160,11 @@ Word16 wb_vad_fx( shift_snr = add( sub( e_num, e_noise ), 15 - 4 ); snr_tmp = div_s( m_num, m_noise_local ); - L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ +#ifdef ISSUE_1799_replace_L_shr_o + L_snr = L_shr_sat( snr_tmp, shift_snr ); /* L_snr in Q4 */ +#else + L_snr = L_shr_o( snr_tmp, shift_snr, &Overflow ); /* L_snr in Q4 */ +#endif } ELSE { diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 8081b2909..0de0285d5 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -558,7 +558,11 @@ ivas_error ppp_voiced_encoder_fx( } /* Bump up if big change between the previous and the current CWs */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { /*if ( res_enratio > 5.0 && tmp < 0.65 ) */ /* 5 in Q11, 0.65 in Q15 // L_shl(tmp_fx,sub(31,Qtmp)) makes tmp_fx FIXED Q31 */ @@ -585,7 +589,11 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampdown frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else + IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { /* if (res_enratio < 0.025) */ IF( LT_32( L_shl_o( res_enratio_fx, 4, &Overflow ), 819 ) ) /*0x0333 = 0.025 in Q15, res_enratio_fx in Q15 after shl 4 */ @@ -613,7 +621,11 @@ ivas_error ppp_voiced_encoder_fx( /* if (min(res_enratio, sp_enratio) < 0.075 && tmp < -0.5f)) : 2458 = 0.075 in Q15 */ test(); +#ifdef ISSUE_1796_replace_shl_o + if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_sat( -1, sub( Qtmp, 1 ) ) ) ) +#else if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_o( -1, sub( Qtmp, 1 ), &Overflow ) ) ) +#endif { hSC_VBR->bump_up = 1; move16(); @@ -621,7 +633,11 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampup frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { IF( GT_32( res_enratio_fx, 29696 ) ) /*14.5 in Q11 */ { @@ -740,7 +756,11 @@ ivas_error ppp_voiced_encoder_fx( expb = sub( 30, add( expb, Qadj ) ); scale = shr( sub( fraca, fracb ), 15 ); +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); +#else fracb = shl_o( fracb, scale, &Overflow ); +#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -773,7 +793,11 @@ ivas_error ppp_voiced_encoder_fx( /* Ltmp1_32 = 0.8f * st->prev_cw_en */ Ltmp1_32 = Mult_32_16( hSC_VBR->prev_cw_en_fx, 26214 ); /* Q = (Q_prev_cw_en_fx + Q15+1)-Q16 = Q_prev_cw_en_fx */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { /* if ( DTFS_getEngy(*CURRP_NQ) > 0.8f * st->prev_cw_en && max(pos_nq, neg_nq) > 3.0f && st->rate_control ) */ /* pos_nq_fx and neg_nq_fx in Q28 ???? */ @@ -893,7 +917,11 @@ ivas_error ppp_voiced_encoder_fx( test(); test(); test(); +#ifdef ISSUE_1796_replace_shl_o + IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_sat( 1, sub( Qtmpres, 1 ) ) ) ) ) +#else IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_o( 1, sub( Qtmpres, 1 ), &Overflow ) ) ) ) +#endif { /* if ((pos_q > neg_q) && ((pos_q>3.0*pos_nq0) || ((pos_q > 1.5*pos_nq0) && (neg_q < 1.5*neg_nq0)))) */ test(); @@ -1070,7 +1098,11 @@ ivas_error ppp_voiced_encoder_fx( move16(); } +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ +#endif { /* if ((( tmp < 3.05 && max(res_enratio,sp_enratio) > 0.8 ) && (st->rate_control))|| (( tmp < 2.8 && max(res_enratio,sp_enratio) > 0.65 ) && (!st->rate_control))) */ @@ -1405,7 +1437,11 @@ static Word32 DTFS_freq_corr_fx( scale = shr( sub( fraca, fracb ), 15 ); +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); +#else fracb = shl_o( fracb, scale, &Overflow ); +#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); -- GitLab From 3fe984fe7330d3c773d584ba505138adb94464fe Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 11:47:53 +0200 Subject: [PATCH 077/103] take all files in lib_com/ froml* on from main - return commit is ce300 --- lib_com/low_rate_band_att_fx.c | 37 +-- lib_com/lpc_tools_fx.c | 130 +--------- lib_com/lsf_tools_fx.c | 149 +++--------- lib_com/lsp_conv_poly_fx.c | 88 +------ lib_com/math_op.c | 36 +-- lib_com/modif_fs_fx.c | 196 +++------------ lib_com/oper_32b.c | 28 --- lib_com/phase_dispersion_fx.c | 16 -- lib_com/ppp_fx.c | 16 -- lib_com/pred_lt4_fx.c | 40 +--- lib_com/preemph_fx.c | 44 ---- lib_com/pvq_com_fx.c | 19 -- lib_com/residu_fx.c | 48 +--- lib_com/stat_noise_uv_mod_fx.c | 40 +--- lib_com/swb_bwe_com_fx.c | 15 -- lib_com/swb_bwe_com_lr_fx.c | 194 +++++++-------- lib_com/swb_tbe_com_fx.c | 261 ++++---------------- lib_com/syn_filt_fx.c | 50 +--- lib_com/tcx_ltp_fx.c | 15 -- lib_com/tcx_mdct_fx.c | 26 +- lib_com/tcx_utils_fx.c | 36 +-- lib_com/tns_base.c | 12 - lib_com/tools_fx.c | 196 ++------------- lib_com/weight_a_fx.c | 13 - lib_com/wi_fx.c | 424 ++++----------------------------- lib_com/window_fx.c | 18 +- 26 files changed, 309 insertions(+), 1838 deletions(-) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 1a6e91a22..8ffaf0bfb 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,11 +8,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*--------------------------------------------------------------------------* * fine_gain_pred() @@ -44,11 +39,9 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -88,11 +81,7 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat -#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -107,12 +96,8 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -169,11 +154,9 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -204,13 +187,9 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat -#else + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -225,12 +204,8 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index b8267b53a..1035f017a 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,12 +42,6 @@ #include "rom_com.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local constants @@ -415,10 +409,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -435,11 +427,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_shl_sat( L_32, 2 ); //??sat -#else L_32 = L_shl_o( L_32, 2, &Overflow ); -#endif return ( L_32 ); } @@ -475,11 +463,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -540,21 +526,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -569,11 +546,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -612,11 +585,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -652,11 +621,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); -#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -692,11 +657,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -757,21 +720,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat - t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -786,11 +740,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -829,11 +779,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -869,11 +815,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat -#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -909,13 +851,10 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -# -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -976,21 +915,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat -#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_mac_sat( t0, Rl[i], 1 ); - t0 = L_msu_sat( t0, Rh[i], -32768 ); -#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -1005,11 +935,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat -#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -1048,11 +974,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1088,11 +1010,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - A[i] = L_shl_sat( t0, k ); //??sat -#else A[i] = L_shl_o( t0, k, &Overflow ); -#endif move16(); } @@ -1560,11 +1478,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* half length FFT */ @@ -1740,22 +1656,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat - move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat - move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat - move16(); -#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1770,7 +1670,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1791,22 +1690,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat - move16(); - tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat - move16(); - tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat - move16(); -#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1821,7 +1704,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c5d20ef21..ea5e51cef 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,12 +40,6 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -75,10 +69,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif cheb = norm_s( x ); @@ -116,26 +108,16 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -143,15 +125,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - if ( !cheb ) - t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat -#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -169,14 +146,9 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat - cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat -#else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ -#endif - cheb = s_max( -32767, cheb ); /* to avoid saturation */ + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -190,10 +162,8 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------* @@ -316,11 +286,7 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom - y = sub_sat( yhigh, ylow ); -#else y = sub_o( yhigh, ylow, &Overflow ); -#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1256,11 +1222,9 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif /*-----------------------------------------------------* @@ -1291,11 +1255,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat -#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); -#endif move32(); } @@ -1305,19 +1265,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = 1; i <= nc; i++ ) - { - t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); - t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); - } -#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } -#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1331,16 +1283,6 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_add_sat( f1[i], f2[i] ); //??sat - t0 = L_shl( t0, k ); - a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat - - /* a[j] = 0.5*(f1[i] - f2[i]) */ - t0 = L_sub_sat( f1[i], f2[i] ); //??sat - t0 = L_shl( t0, k ); - a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat -#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1348,8 +1290,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ -#endif + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ j--; } @@ -1793,10 +1734,8 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1857,40 +1796,32 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat - L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ - L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat -#else + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ - f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ + L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ +#else + L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ + L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ #endif + f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat - f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat - move16(); -#else + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ - move16(); +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ +#else + L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ #endif + f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + move16(); } } @@ -2342,10 +2273,8 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------------* @@ -2391,17 +2320,13 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat -#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ -#endif tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); @@ -2439,10 +2364,8 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*-------------------------------------------------------------------* @@ -2494,11 +2417,7 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat -#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ -#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3857,10 +3776,8 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3928,13 +3845,9 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat -#else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ -#endif + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index ddd8f88f6..2e989cfbf 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,12 +9,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants @@ -342,10 +336,8 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif exp_den = norm_l( in32 ); @@ -353,17 +345,14 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - exp_den = shl( exp_den, 1 ); - - div_out = div_s( 8192, m_den ); - Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat +#ifdef ISSUE_1796_replace_shl_o + exp_den = shl_sat( exp_den, 1 ); #else exp_den = shl_o( exp_den, 1, &Overflow ); +#endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ -#endif return Ltmp; } @@ -379,10 +368,8 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif IF( re == 0 ) @@ -395,11 +382,7 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat -#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -414,11 +397,7 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); -#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -448,8 +427,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat +#ifdef ISSUE_1799_replace_L_shr_o + L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif @@ -530,10 +509,8 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /*---------------------------------------------------------------------* @@ -556,11 +533,7 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - r[0] = L_add_sat( r[0], G[i] ); -#else r[0] = L_add_o( r[0], G[i], &Overflow ); -#endif move32(); } @@ -594,47 +567,18 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - gp = L_add_sat( G[i], G[N - i - 1] ); //??sat -#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); -#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); -#ifdef ISSUE_1836_replace_overflow_libcom - r[1] = L_add_sat( r[1], mh ); //??sat -#else r[1] = L_add_o( r[1], mh, &Overflow ); -#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - c[j] = mult_r( c[j - 1], x[i - 1] ); - move16(); - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat - move16(); - - /*r[j] = L_mac(r[j], c[j], gp);*/ - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat - move32(); - - c[j + 1] = mult_r( c[j], x[i - 1] ); - move16(); - c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat - move16(); - - /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ - Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); - r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat - move32(); -#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -654,55 +598,33 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); -#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat - move16(); - - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_sat( r[j], mh ); //??sat - move32(); -#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); -#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat - gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); - - r[0] = L_add_sat( r[0], gp ); //??sat -#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); -#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat - L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat -#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); -#endif } return; diff --git a/lib_com/math_op.c b/lib_com/math_op.c index caa17b3ae..74143b8ed 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,12 +23,6 @@ #include #include -#ifndef ISSUE_1836_FILEACTIVE_math_op_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | @@ -234,30 +228,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat - FOR( i = 1; i < lg; i++ ) - { - L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat - } -#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } -#endif } IF( expi < 0 ) { @@ -267,32 +251,26 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat -#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); -#endif } } IF( expi > 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( x[0], expi ); //??sat - L_sum = L_mac_sat( 1, tmp, tmp ); //??sat - FOR( i = 1; i < lg; i++ ) - { - tmp = shl_sat( x[i], expi ); //??sat - L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat - } +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( x[0], expi ); #else tmp = shl_o( x[0], expi, &Overflow ); +#endif L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( x[i], expi ); +#else tmp = shl_o( x[i], expi, &Overflow ); +#endif L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } -#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 60a15c5d0..fae2a43c2 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,12 +15,6 @@ #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -81,7 +75,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -285,8 +279,8 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { -#ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + num_den = shl_sat( num_den, 1 ); #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -370,7 +364,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -571,8 +565,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifdef ISSUE_1836_replace_overflow_libcom - num_den = shl_sat( num_den, 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + num_den = shl_sat( num_den, 1 ); #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -947,11 +941,9 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); @@ -961,103 +953,60 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat -#else + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ -#endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat -#else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ -#endif - mem[1] = extract_h( Lacc ); /* Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat - move16(); -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); -#endif } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat - Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ -#endif - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat - temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ - move16(); - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat -#else + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1068,18 +1017,11 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat -#else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1087,23 +1029,9 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ - temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1114,8 +1042,7 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1231,11 +1158,9 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1243,34 +1168,11 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - - mem[0] = round_fx_sat( Lacc1 ); //??sat - move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat - Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat - Lacc = L_deposit_h( temp1 ); - - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat - move16(); - - Lacc1 = L_deposit_h( temp2 ); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat - out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat - move16(); -#else - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1289,36 +1191,13 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); -#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat - Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat - - mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat - - temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat - Lacc = L_deposit_h( temp1 ); - Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat - mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc1 = L_deposit_h( temp2 ); - out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat - move16(); - mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat - move16(); -#else + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1339,7 +1218,6 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); -#endif } return; diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index 91e22a9d6..be34a1248 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -27,12 +27,6 @@ #define WMC_TOOL_SKIP -#ifndef ISSUE_1836_FILEACTIVE_oper_32b_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /***************************************************************************** * * * Function L_Extract() * @@ -130,20 +124,13 @@ Word32 L_Comp( Word16 hi, Word16 lo ) Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif L_32 = L_mult( hi1, hi2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat - L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat -#else L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); -#endif return ( L_32 ); } @@ -172,21 +159,13 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat - L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat - L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat -#else L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); -#endif return ( L_32 ); } @@ -214,19 +193,12 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Sqr_32( Word16 hi, Word16 lo ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom - L_32 = L_mult_sat( hi, hi ); //??sat - L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 ); //??sat -#else L_32 = L_mult_o( hi, hi, &Overflow ); L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); -#endif return ( L_32 ); } diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 3679ed372..3103723be 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -8,12 +8,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-----------------------------------------------------------------------* * phase_dispersion: * @@ -36,11 +30,9 @@ void phase_dispersion( Word32 x32[2 * L_SUBFR]; Word16 *code_real, *code_imag; const Word16 *h_real, *h_imag; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif move16(); @@ -65,11 +57,7 @@ void phase_dispersion( move16(); prev_gain_pit[0] = gain_pit; -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) ) //??sat -#else IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) ) -#endif { IF( LT_16( state, 2 ) ) { @@ -177,11 +165,7 @@ void phase_dispersion( scale2 = getScaleFactor32( x32, L_subfr ); FOR( i = 0; i < L_subfr; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) ); -#else code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); -#endif move16(); } j = sub( j, scale2 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index 0fceb9165..cc6b59bdb 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,12 +35,6 @@ #include "cnst.h" #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_ppp_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ /*-------------------------------------------------------------------*/ @@ -103,11 +97,9 @@ void deemph_lpc_fx( Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif b_fx[0] = 4096; move16(); /* 1 in Q12 */ @@ -123,11 +115,7 @@ void deemph_lpc_fx( { /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat -#else LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); -#endif move16(); /* Q12 */ } @@ -149,11 +137,7 @@ void deemph_lpc_fx( { /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat -#else LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); -#endif move16(); /* Q12 */ } } diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index c54ee5f39..465138bde 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -8,11 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_pred_lt4_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*-------------------------------------------------------------------* * Function pred_lt4: * @@ -40,11 +35,9 @@ void pred_lt4_ivas_fx( Word32 s; const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif x0 = &excI[-T0]; @@ -78,11 +71,7 @@ void pred_lt4_ivas_fx( s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } -#ifdef ISSUE_1836_replace_overflow_libcom - excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat -#else - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ -#endif + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); } return; @@ -102,11 +91,9 @@ void pred_lt4( Word16 i, j; Word32 s; const Word16 *x0, *x1, *x2, *c1, *c2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif x0 = &excI[-T0]; @@ -140,21 +127,12 @@ void pred_lt4( } s = W_sat_l( s64 ); /* Q_exc + Q14 */ } -#ifdef ISSUE_1836_replace_overflow_libcom -#if ( INTERP_EXP != -1 ) - s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ //??sat -#endif - - excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat - move16(); -#else #if ( INTERP_EXP != -1 ) s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ #endif excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); -#endif } return; } @@ -199,11 +177,9 @@ void pred_lt4_tc_fx( Word16 excO[L_SUBFR + 1]; Word32 L_sum; Word16 excI[2 * L_SUBFR]; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ @@ -236,25 +212,15 @@ void pred_lt4_tc_fx( k += UP_SAMP; L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } -#ifdef ISSUE_1836_replace_overflow_libcom - L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat - excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat -#else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ -#endif - + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ move16(); x0++; } FOR( i = T0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */ //??sat -#else exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ -#endif move16(); } } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index b24aa9467..b7886cb65 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -22,23 +22,12 @@ void preemph_copy_fx( ) { Word16 i, temp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp = x[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = lg - 1; i > 0; i-- ) - { - y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */ - move16(); - } - y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */ //??sat - move16(); -#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ @@ -46,8 +35,6 @@ void preemph_copy_fx( } y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ move16(); -#endif - *mem = temp; /* Qx */ move16(); @@ -62,23 +49,12 @@ void preemph_copy_32fx( ) { Word16 i, temp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp = x[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = lg - 1; i > 0; i-- ) - { - y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ //??sat - move16(); - } - y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat - move16(); -#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */ @@ -86,7 +62,6 @@ void preemph_copy_32fx( } y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */ move16(); -#endif *mem = temp; /* Qx */ move16(); @@ -150,31 +125,13 @@ void E_UTIL_f_preemph2( { Word16 i, temp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp = signal[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = lg - 1; i > 0; i-- ) - { - L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat - L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ - signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat - move16(); - } - - L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat - L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ - signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat - move16(); -#else FOR( i = lg - 1; i > 0; i-- ) { L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ @@ -189,7 +146,6 @@ void E_UTIL_f_preemph2( L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); -#endif *mem = temp; /* Qx */ move16(); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 63eb26877..1adcdb7ae 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -7,13 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_pvq_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - /*! r: Approximate integer division for positive input using lookup table */ UWord32 intLimCDivPos_fx( UWord32 NUM, /* Qx */ @@ -434,11 +427,9 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); @@ -465,11 +456,7 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat -#else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ -#endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ @@ -540,11 +527,9 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -567,11 +552,7 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ -#ifdef ISSUE_1836_replace_overflow_libcom - gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat -#else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); -#endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index b1426dcb2..0ed9c9ac8 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_residu_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*--------------------------------------------------------------------* * residu_ivas_fx() * @@ -68,11 +62,9 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif q = add( norm_s( a[0] ), 1 ); @@ -80,37 +72,11 @@ void Residu3_lc_fx( { q = add( q, shift ); } -#ifdef ISSUE_1836_replace_overflow_libcom - *y++ = shl_sat( x[0], shift ); //??sat - move16(); - - FOR( i = 1; i < m; i++ ) - { - s = L_mult_sat( x[i], a[0] ); //??sat - /* Stop at i to Avoid Mults with Zeros */ - FOR( j = 1; j <= i; j++ ) - { - s = L_mac_sat( s, x[i - j], a[j] ); //??sat - } - - s = L_shl_sat( s, q ); //??sat - *y++ = round_fx_sat( s ); //??sat - } - - FOR( ; i < lg; i++ ) - { - s = L_mult_sat( x[i], a[0] ); //??sat - FOR( j = 1; j <= m; j++ ) - { - s = L_mac_sat( s, x[i - j], a[j] ); //??sat - } - - s = L_shl_sat( s, q ); //??sat - *y++ = round_fx_sat( s ); //??sat - } - +#ifdef ISSUE_1796_replace_shl_o + *y++ = shl_sat( x[0], shift ); #else *y++ = shl_o( x[0], shift, &Overflow ); +#endif move16(); FOR( i = 1; i < m; i++ ) @@ -137,8 +103,6 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } - -#endif } /*--------------------------------------------------------------------* @@ -191,11 +155,9 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) @@ -212,11 +174,7 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( s32 ); //??sat -#else y[i] = round_fx_o( s32, &Overflow ); -#endif move16(); } } diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index cf4b5edc3..8d1236b53 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -16,12 +16,6 @@ #define P1 ( 32768 - ISP_SMOOTHING_QUANT_A1_FX - 1 ) #define P9 ( 32767 - P1 ) -#ifndef ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*---------------------------------------------------------* * Local functions *---------------------------------------------------------*/ @@ -80,11 +74,9 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*---------------------------------------------------------* @@ -117,11 +109,7 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - min_alpha = add_sat( tmp_res, 16384 ); //??sat -#else min_alpha = add_o( tmp_res, 16384, &Overflow ); -#endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ @@ -173,8 +161,8 @@ void stat_noise_uv_mod_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat +#ifdef ISSUE_1796_replace_shl_o + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -202,8 +190,8 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat +#ifdef ISSUE_1796_replace_shl_o + tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif @@ -270,11 +258,7 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat -#else - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ -#endif + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -408,11 +392,9 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /*---------------------------------------------------------* @@ -442,11 +424,7 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - min_alpha = add_sat( tmp_res, 16384 ); //??sat -#else min_alpha = add_o( tmp_res, 16384, &Overflow ); -#endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); @@ -497,8 +475,8 @@ void stat_noise_uv_mod_ivas_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -526,8 +504,8 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index ab3efa10d..138fbd705 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -36,12 +36,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*==========================================================================*/ /* FUNCTION : Word16 WB_BWE_gain_pred_fx () */ @@ -619,21 +613,12 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat -#else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); -#endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat - tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat -#else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); -#endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 4dba49139..78422a292 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,12 +38,6 @@ #include -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -933,11 +927,9 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *Qss = 10; @@ -994,11 +986,7 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat -#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ -#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1020,119 +1008,109 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( L_inBuf_pss[j] >= 0 ){ - outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat - move16(); - } -#else - IF( L_inBuf_pss[j] >= 0 ){ + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) + { + IF( L_inBuf_pss[j] >= 0 ) + { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } + } + ELSE + { + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; + move16(); + if ( L_inBuf_pss[j] < 0x0L ) + { + outBuf_pss_fx[j] = -0x2800; + move16(); + } + } + j++; } -#endif } - ELSE + + k = 0; + move16(); + m = 0; + move16(); + n = 0; + move16(); + reset_flag = 0; + move16(); + n_list[0] = 0; + move16(); + FOR( j = 0; j < num_subband_smooth_fx; j++ ) { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; + cnt_zero_cont = 0; move16(); - if ( L_inBuf_pss[j] < 0x0L ) + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[j] = -0x2800; - move16(); + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) + { + cnt_zero_cont = 0; + move16(); + } + k = add( k, 1 ); } - } - j++; -} -} -k = 0; -move16(); -m = 0; -move16(); -n = 0; -move16(); -reset_flag = 0; -move16(); -n_list[0] = 0; -move16(); -FOR( j = 0; j < num_subband_smooth_fx; j++ ) -{ - cnt_zero_cont = 0; - move16(); - FOR( i = 0; i < L_SB; i++ ) - { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) + IF( cnt_zero_cont != 0 ) { - cnt_zero_cont = 0; + test(); + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + { + n = 0; + move16(); + reset_flag = 1; + move16(); + } + n_list[n] = j; move16(); + n = add( n, 1 ); } - k = add( k, 1 ); - } - IF( cnt_zero_cont != 0 ) - { test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) { - n = 0; - move16(); - reset_flag = 1; + m = 0; move16(); } - n_list[n] = j; - move16(); - n = add( n, 1 ); - } - test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) - { - m = 0; - move16(); - } - - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ - { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ { - if ( outBuf_pss_fx[pk + i] == 0 ) + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); + if ( outBuf_pss_fx[pk + i] == 0 ) + { + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); + } } + m = add( m, 1 ); } - m = add( m, 1 ); } -} -FOR( i = 0; i < fLen; i++ ) -{ - outBuf_fx[i] = 0x0; - move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + FOR( i = 0; i < fLen; i++ ) { - outBuf_fx[i] = outBuf_pss_fx[i]; + outBuf_fx[i] = 0x0; move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + { + outBuf_fx[i] = outBuf_pss_fx[i]; + move16(); + } } -} -return; + return; } /*-------------------------------------------------------------------* @@ -2247,11 +2225,9 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *QbeL = 3; @@ -2362,7 +2338,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat +#ifdef ISSUE_1796_replace_shl_o E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2404,19 +2380,13 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat -#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) -#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } -#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); -#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3243,7 +3213,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3282,8 +3252,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3356,8 +3326,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e8a74d834..beaef4614 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,12 +12,6 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 @@ -1002,10 +996,11 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; - move32(); #endif + move32(); + IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1045,8 +1040,8 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); #else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); #endif @@ -1456,11 +1451,9 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1550,8 +1543,8 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible +#ifdef ISSUE_1796_replace_shl_o + excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1 #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif @@ -1560,28 +1553,16 @@ void GenShapedWBExcitation_ivas_fx( n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 - pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 - } -#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } -#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat -#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1611,11 +1592,7 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1623,13 +1600,8 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ - pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ -#endif + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } } @@ -1638,19 +1610,11 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ -#endif + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat -#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ -#endif move16(); } } @@ -1666,8 +1630,8 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1679,20 +1643,6 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat - move16(); - k++; - } -#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1705,7 +1655,6 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } -#endif } } } @@ -1760,11 +1709,9 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); move16(); @@ -1856,8 +1803,8 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excTmp2_frac[i] = shl( excTmp2[i], n1 ); +#ifdef ISSUE_1796_replace_shl_o + excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); #endif @@ -1868,23 +1815,14 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ - pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat -#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat -#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1915,11 +1853,7 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1927,13 +1861,8 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat - pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ } } @@ -1942,23 +1871,13 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ - sc = sub( add( n2, Q_bwe_exc ), 14 ); - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat - move16(); - } -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } -#endif } ELSE { @@ -1973,8 +1892,8 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1986,20 +1905,6 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat - move16(); - k = add( k, 1 ); - } -#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -2012,7 +1917,6 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } -#endif } } } @@ -5787,12 +5691,10 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5891,19 +5793,15 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + scale_step = shl_sat( tmp, exp ); /* Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5927,12 +5825,8 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif } ELSE { @@ -5981,19 +5875,15 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom +#ifdef ISSUE_1796_replace_shl_o scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6061,12 +5951,10 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6165,19 +6053,15 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + scale_step = shl_sat( tmp, exp ); /* Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6201,12 +6085,8 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat -#else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ } ELSE { @@ -6255,19 +6135,15 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -7003,11 +6879,9 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -7066,11 +6940,7 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat -#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, expb ); num_flag = 0; @@ -7194,11 +7064,9 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7213,10 +7081,10 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat +#ifdef ISSUE_1796_replace_shl_o + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7246,19 +7114,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ -#ifdef ISSUE_1836_replace_overflow_libcom - gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat - FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) - { - L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ - L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat - L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat - L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ - bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat - move16(); - } -#else + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7269,7 +7125,6 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } -#endif } ELSE { @@ -7283,17 +7138,10 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat - - tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat -#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ -#endif + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ move16(); } } @@ -7302,14 +7150,9 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat -#else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ -#endif + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ move16(); } } @@ -7317,15 +7160,9 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ - tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat - bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat -#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ -#endif move16(); } } @@ -7361,7 +7198,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7392,8 +7229,8 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); +#ifdef ISSUE_1796_replace_shl_o + formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 8b044f2f7..e0315bbcb 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -9,24 +9,13 @@ #include "prot_fx.h" #include "stl.h" -#ifndef ISSUE_1836_FILEACTIVE_syn_filt_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); -#else - L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat - return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat -#endif } static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] ) @@ -352,11 +341,9 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif if ( EQ_16( m, 6 ) ) @@ -390,13 +377,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat - *y++ = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); /* Filtering from Input + Mix of Memory & Output Signal Past */ @@ -406,24 +388,15 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Process Output Signal Past */ FOR( j = 1; j <= i; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_msu_sat( L_tmp, a[j], y[-j] ); //??sat -#else L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow ); -#endif } /* Process Memory */ FOR( ; j <= m; j++ ) { L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat - *y++ = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } @@ -431,13 +404,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W FOR( ; i < lg; i++ ) { L_tmp = syn_kern( L_mult( a0, *x++ ), a, y ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); - *y++ = round_fx_sat( L_tmp ); -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } @@ -484,10 +452,8 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; -#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); -#endif if ( EQ_16( m, 6 ) ) { @@ -514,8 +480,8 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ mem += m; /*move32();*/ -#ifdef ISSUE_1836_replace_overflow_libcom - a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat +#ifdef ISSUE_1799_replace_L_shr_o + a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ #else a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ #endif @@ -525,11 +491,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); @@ -547,11 +509,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); } @@ -560,11 +518,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] FOR( ; i < lg; i++ ) { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( L_tmp, q ); //??sat -#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); } diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 0bf0fb1c9..322549a6f 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -8,12 +8,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ @@ -395,11 +389,9 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); @@ -416,17 +408,10 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat - s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat - s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat - excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat -#else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ -#endif move16(); x0++; diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 8ef395423..b2cee32e6 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -8,12 +8,6 @@ #include "prot_fx.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ @@ -113,11 +107,9 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); @@ -134,11 +126,7 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat -#else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ -#endif + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ move32(); } FOR( i = 0; i < m / 2; i++ ) @@ -148,11 +136,7 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ -#else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ -#endif move32(); } @@ -179,11 +163,9 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); @@ -200,11 +182,7 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat -#else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ -#endif + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ move32(); } FOR( i = 0; i < m / 2; i++ ) diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index e86f48eed..c5ff95e04 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -12,12 +12,6 @@ #define inv_int InvIntTable -#ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * getInvFrameLen() * @@ -997,10 +991,8 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif /* FDNS_NPTS = 64 */ @@ -1052,11 +1044,7 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ -#else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ -#endif + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ move32(); x++; } @@ -1075,11 +1063,7 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ -#else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ -#endif + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ move32(); x += k; gains++; @@ -1405,11 +1389,9 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif -#endif assert( lpcGains[0] >= 0x4000 ); @@ -1456,12 +1438,8 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_tmp ); /* Q15 */ -#else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ -#endif - fac = tmp; /* Q15 */ + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ @@ -2103,10 +2081,8 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif maxX = L_deposit_l( 1 ); @@ -2153,11 +2129,7 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ -#else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ -#endif if ( corr < 0 ) tmp = negate( tmp ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 35394f8f9..aaf262786 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -22,12 +22,6 @@ #define MAX_SUBDIVISIONS 3 -#ifndef ISSUE_1836_FILEACTIVE_tns_base_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ @@ -445,11 +439,9 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); @@ -483,11 +475,7 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom - tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ -#else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ -#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 0e11980cd..5e116a286 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -52,12 +52,6 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ @@ -314,21 +308,18 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat - idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ + L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ +#ifdef ISSUE_1796_replace_shl_o + idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ #else - L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ #endif @@ -336,13 +327,9 @@ Word16 usquant_fx( /* o: index of the winning codeword */ idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom - *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ -#else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ -#endif + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ return idx; } /*-------------------------------------------------------------------* @@ -408,20 +395,14 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ -#else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ -#endif + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ } return L_tmp; @@ -475,21 +456,15 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); -#else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); -#endif } return L_tmp; @@ -709,7 +684,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -736,8 +711,8 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = shl_sat( x[i], exp0 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + y[i] = shl_sat( x[i], exp0 ); #else y[i] = shl_o( x[i], exp0, &Overflow ); #endif @@ -758,7 +733,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -780,8 +755,8 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -797,8 +772,8 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( 1, exp0 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( 1, exp0 ); #else tmp = shl_o( 1, exp0, &Overflow ); #endif @@ -818,12 +793,10 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( exp0 == 0 ) @@ -840,8 +813,8 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -849,11 +822,7 @@ void Copy_Scale_sig_16_32_no_sat( } return; } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat -#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); -#endif IF( L_tmp >= 0x7FFF ) { @@ -885,11 +854,9 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif tmp = add( 16, exp0 ); @@ -897,11 +864,7 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); -#else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); -#endif move16(); } } @@ -909,11 +872,7 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = round_fx_sat( x[i] ); //??sat -#else y[i] = round_fx_o( x[i], &Overflow ); -#endif move16(); } } @@ -931,11 +890,9 @@ void Scale_sig32( ) { Word16 i; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( 0 == exp0 ) { @@ -944,11 +901,7 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - x[i] = L_shl_sat( x[i], exp0 ); -#else x[i] = L_shl_o( x[i], exp0, &Overflow ); -#endif move32(); /* saturation can occur here */ } } @@ -1943,12 +1896,10 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif idx = 0; @@ -1965,28 +1916,6 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat - if ( weights[3] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat - if ( weights[2] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat - if ( weights[1] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat - if ( weights[0] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } -#else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { @@ -2007,7 +1936,6 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } -#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2037,28 +1965,6 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat - if ( weights[0] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat - if ( weights[1] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat - if ( weights[2] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } - tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat - if ( weights[3] != 0 ) - { - dist = L_mac0_sat( dist, tmp, tmp ); //??sat - } -#else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { @@ -2079,7 +1985,6 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } -#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2546,11 +2451,9 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) @@ -2561,23 +2464,15 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); -#ifdef ISSUE_1836_replace_overflow_libcom - num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat -#else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); -#endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); -#ifdef ISSUE_1836_replace_overflow_libcom - den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat -#else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); -#endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat +#ifdef ISSUE_1796_replace_shl_o num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); @@ -2737,11 +2632,9 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); @@ -2754,27 +2647,14 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_mult_sat( buf_in[K + i], h[0] ); //??sat -#else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); -#endif FOR( j = 1; j <= K; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat -#else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); -#endif } -#ifdef ISSUE_1836_replace_overflow_libcom - s = L_shl_sat( s, shift ); //??sat - y[i] = round_fx_sat( s ); /*Qx */ //??sat -#else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ -#endif move16(); } } @@ -2910,10 +2790,8 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; -#endif #endif idx = 0; @@ -2924,18 +2802,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = sub_sat( x, cb[c] ); -#else tmp = sub_o( x, cb[c], &Overflow ); -#endif /*dist += tmp*tmp; */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat -#else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); -#endif if ( LT_32( L_dist, L_mindist ) ) { @@ -3073,11 +2943,9 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( exp0 == 0 ) { @@ -3092,20 +2960,12 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = L_shl_sat( x[i], tmp ); //??sat -#else y[i] = L_shl_o( x[i], tmp, &Overflow ); -#endif move16(); } return; } -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat -#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); -#endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); @@ -3282,11 +3142,9 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); @@ -3294,11 +3152,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat -#else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#endif move16(); } } @@ -3306,11 +3160,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat -#else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#endif move16(); } } @@ -3437,11 +3287,7 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ -#ifdef ISSUE_1836_replace_overflow_libcom - temp = mult_r( *signal++, 16384 ); -#else temp = mult_ro( *signal++, 16384, &Overflow ); -#endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ @@ -3451,11 +3297,7 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - temp = mult_r( *signal++, 16384 ); -#else temp = mult_ro( *signal++, 16384, &Overflow ); -#endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } #ifdef ISSUE_1799_replace_L_shr_o diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index b2d44e1d4..7bea66ea0 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -7,13 +7,6 @@ #include "prot_fx.h" #include - -#ifndef ISSUE_1836_FILEACTIVE_weight_a_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------ * weight_a_subfr() * @@ -107,12 +100,10 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); -#endif #endif fac = gamma; /* Q15 */ @@ -131,11 +122,7 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat -#else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ -#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 6f6bcb066..5a8ad35c5 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -22,12 +22,6 @@ #define WI_THRESHLD 0.8 #define WI_SAMPLE_THLD 20 -#ifndef ISSUE_1836_FILEACTIVE_wi_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */ /*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */ /*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */ @@ -270,11 +264,9 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -328,17 +320,10 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat - ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat - move16(); - move16(); -#else ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ move16(); move16(); -#endif } start = sub( Eshift, Adiff_fx ); @@ -359,13 +344,8 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat - corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat -#else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); -#endif move32(); move32(); temp = add( temp, temp1 ); @@ -378,20 +358,12 @@ static Word16 DTFS_alignment_weight_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat - wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat - IF( GE_16( Qmaxcorr, Qcorr ) ) - { - diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ - } - ELSE - { - diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ - } -#else temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ - wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#ifdef ISSUE_1796_replace_shl_o + wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#else + wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#endif IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ @@ -400,7 +372,6 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ } -#endif IF( diff_corr > 0 ) { @@ -450,11 +421,9 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Calculating the expected alignment shift */ @@ -488,13 +457,8 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat - ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat -#else ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ -#endif } IF( FR_flag == 0 ) { @@ -524,15 +488,9 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - temp = add_sat( temp, temp1 ); //??sat -#else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); temp = add_o( temp, temp1, &Overflow ); -#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -638,11 +596,9 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp2 = L_deposit_l( 0 ); @@ -654,15 +610,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat - X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat - temp2 = L_add_sat( temp2, (Word32) ph ); //??sat -#else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); -#endif move16(); move16(); } @@ -674,15 +624,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat - X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat - temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat -#else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); -#endif move16(); move16(); } @@ -786,11 +730,9 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( !FR_flag ) @@ -827,16 +769,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ - diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat - - exp = norm_s( diff_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ - L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat - nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -844,8 +777,7 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ -#endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -868,13 +800,8 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat - inv_lag = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); -#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -888,13 +815,8 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat - L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat -#else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ -#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -931,22 +853,13 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat - L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat -#else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ + L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); -#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat -#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ -#endif } La[k] = L_shl( L_a, 7 ); @@ -971,30 +884,6 @@ void DTFS_to_fs_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( k = 1; k <= nH; k++ ) - { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - move16(); - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ - X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - move16(); - X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ - } - - /* IF ( N%2 == 0 ) */ - IF( s_and( N, 1 ) == 0 ) - { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ - X_fx->b_fx[k] = 0; - move16(); - } -#else FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ @@ -1017,7 +906,6 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } -#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1313,11 +1201,9 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qmin = 32767; move16(); @@ -1335,22 +1221,6 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat - temp2 = add( temp2, temp ); - } - - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat - - /* Calculate the circular convolution */ - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - - L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat -#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); temp2 = add( temp2, temp ); @@ -1363,8 +1233,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ -#endif + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1384,13 +1253,8 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat - X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat -#else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ -#endif move32(); move32(); @@ -1406,14 +1270,14 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); #else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); #else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif @@ -1661,11 +1525,9 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); @@ -1675,23 +1537,15 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat -#else + en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat -#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); -#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1699,13 +1553,9 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat -#else + en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1736,23 +1586,6 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); - HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); - FOR( k = 1; k <= HalfLag_fx; k++ ) - { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat - } - en_fx = L_shr( en_fx, 1 ); - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat - /* IF (X_fx->lag_fx%2 == 0) */ - IF( s_and( X_fx->lag_fx, 1 ) == 0 ) - { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat - } -#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1772,7 +1605,7 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); } -#endif + return en_fx; /* 2*X1.Q */ } @@ -1899,23 +1732,17 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat -#else + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ -#endif - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -2022,12 +1849,10 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -2039,11 +1864,7 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat -#else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ -#endif + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -2058,13 +1879,8 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat -#else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ -#endif count = add( count, 1 ); } } @@ -2077,11 +1893,7 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat -#else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); -#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -2092,11 +1904,7 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat -#else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); -#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -2134,11 +1942,7 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat -#else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ -#endif + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ move16(); } @@ -2202,11 +2006,9 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif num_flag = 0; move16(); @@ -2275,11 +2077,8 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat -#else + IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) -#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2292,11 +2091,7 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( Ltemp3, expa ) ); -#else fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); -#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2305,11 +2100,7 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = extract_h( L_shl( Ltemp2, expb ) ); //??sat -#else fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); -#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2326,8 +2117,8 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = shl_sat( fraca, scale ); //??sat +#ifdef ISSUE_1796_replace_shl_o + fraca = shl_sat( fraca, scale ); #else fraca = shl_o( fraca, scale, &Overflow ); #endif @@ -2346,13 +2137,8 @@ static void cubicPhase_fx( tmp = negate( tmp ); } -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat - Lacc = L_add_sat( Lacc, 0x08000 ); //??sat -#else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); -#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2478,11 +2264,7 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //??sat //?sat -#else Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ -#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2540,11 +2322,9 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; @@ -2610,11 +2390,7 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat -#else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ -#endif + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ move16(); IF( GT_16( count[i], 1 ) ) { @@ -2686,11 +2462,9 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Word16 *erb_fx = NULL; /*move16(); */ @@ -2773,33 +2547,7 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ //??sat //??sat - move16(); - IF( GT_16( out_fx[j], 1 ) ) - { - expb = norm_l( mf_fx[j] ); - fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) ); //??sat //??sat - expb = sub( 30, add( expb, 20 ) ); - - - expa = norm_l( out_fx[j] ); - fraca = extract_h( L_shl( out_fx[j], expa ) ); - expa = sub( 30, expa ); - - scale = shr( sub( fraca, fracb ), 15 ); - fracb = shl( fracb, scale ); - expb = sub( expb, scale ); - - tmp = div_s( fracb, fraca ); - exp = sub( expb, expa ); - L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat - - mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat - move16(); - } -#else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -2823,7 +2571,6 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); move16(); } -#endif } return; } @@ -2873,11 +2620,9 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) @@ -2963,11 +2708,7 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ //??sat //??sat -#else X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ -#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3709,11 +3450,9 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3758,28 +3497,18 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); - expa = sub( 30, add( expa, 1 ) ); - - - expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat -#else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif - expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -3806,27 +3535,18 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat - expa = sub( Q29, expa ); // 30 - expa - 1; - - - expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat -#else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -4309,11 +4029,9 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif retX_fx->lag_fx = X1_fx->lag_fx; @@ -4324,13 +4042,8 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat - Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat -#else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ -#endif + Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4372,17 +4085,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat - sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ - move16(); - - Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat - cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ -#else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ @@ -4392,7 +4094,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ -#endif move16(); } k = sub( k, 1 ); @@ -4446,11 +4147,9 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif en = L_deposit_l( 0 ); @@ -4486,12 +4185,8 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat -#else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4501,21 +4196,13 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat -#else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat -#else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ -#endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4541,11 +4228,7 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); //??sat -#else Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); -#endif } ELSE { @@ -4594,11 +4277,9 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qmin = 32767; move16(); @@ -4613,37 +4294,21 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat -#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ -#endif temp2 = add( temp2, k ); } -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat - /* Calculate the circular convolution */ - sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat -#else - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ -#endif + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ IF( sum ) { exp = norm_l( sum ); @@ -4742,11 +4407,9 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); @@ -4760,13 +4423,8 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifndef ISSUE_1836_replace_overflow_libcom sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ -#else - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat -#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 71a986408..84302ff08 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -21,12 +21,6 @@ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_window_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - void ham_cos_window( Word16 *fh, /* o: 0Q15 */ const Word16 n1, /* i: */ @@ -35,12 +29,10 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif -#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -54,11 +46,7 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat -#else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -75,10 +63,10 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat +#ifdef ISSUE_1796_replace_shl_o + fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From 6421dfa9abb4b7c7ed0af5fbe6e1277e6b658a08 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 13:04:46 +0200 Subject: [PATCH 078/103] take files starting with l,m,n,o,p from ce30069 --- lib_com/low_rate_band_att_fx.c | 37 ++++++- lib_com/lpc_tools_fx.c | 130 +++++++++++++++++++++- lib_com/lsf_tools_fx.c | 149 +++++++++++++++++++------ lib_com/lsp_conv_poly_fx.c | 88 ++++++++++++++- lib_com/math_op.c | 36 ++++-- lib_com/modif_fs_fx.c | 196 ++++++++++++++++++++++++++------- lib_com/oper_32b.c | 28 +++++ lib_com/options.h | 2 +- lib_com/phase_dispersion_fx.c | 16 +++ lib_com/ppp_fx.c | 16 +++ lib_com/pred_lt4_fx.c | 40 ++++++- lib_com/preemph_fx.c | 44 ++++++++ lib_com/pvq_com_fx.c | 19 ++++ 13 files changed, 705 insertions(+), 96 deletions(-) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 8ffaf0bfb..1a6e91a22 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,6 +8,11 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*--------------------------------------------------------------------------* * fine_gain_pred() @@ -39,9 +44,11 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -81,7 +88,11 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -96,8 +107,12 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat +#else + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -154,9 +169,11 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -187,9 +204,13 @@ void fine_gain_pred_fx( exp = norm_l( xx ); L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ - Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ + Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat +#else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ +#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -204,8 +225,12 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat +#else + tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ +#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 1035f017a..b8267b53a 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,6 +42,12 @@ #include "rom_com.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local constants @@ -409,8 +415,10 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -427,7 +435,11 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_shl_sat( L_32, 2 ); //??sat +#else L_32 = L_shl_o( L_32, 2, &Overflow ); +#endif return ( L_32 ); } @@ -463,9 +475,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -526,12 +540,21 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -546,7 +569,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -585,7 +612,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -621,7 +652,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -657,9 +692,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -720,12 +757,21 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat + t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -740,7 +786,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -779,7 +829,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -815,7 +869,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat +#else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); +#endif move16(); } @@ -851,10 +909,13 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ +# +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif BASOP_SATURATE_WARNING_OFF_EVS @@ -915,12 +976,21 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat +#else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ +#endif + /* No overflow possible */ /* Compose and add R[i] in Q3 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_mac_sat( t0, Rl[i], 1 ); + t0 = L_msu_sat( t0, Rh[i], -32768 ); +#else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); +#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -935,7 +1005,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } +#ifdef ISSUE_1836_replace_overflow_libcom + t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat +#else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ +#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -974,7 +1048,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#ifdef ISSUE_1836_replace_overflow_libcom + t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat +#else + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ +#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1010,7 +1088,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + A[i] = L_shl_sat( t0, k ); //??sat +#else A[i] = L_shl_o( t0, k, &Overflow ); +#endif move16(); } @@ -1478,9 +1560,11 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* half length FFT */ @@ -1656,6 +1740,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); @@ -1670,6 +1770,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1690,6 +1791,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat + move16(); + tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat + move16(); + BASOP_SATURATE_WARNING_ON_EVS + RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); + move16(); + ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); + move16(); + BASOP_SATURATE_WARNING_OFF_EVS + tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat + move16(); + tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat + move16(); +#else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); @@ -1704,6 +1821,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); +#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index ea5e51cef..c5d20ef21 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,6 +40,12 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -69,8 +75,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif cheb = norm_s( x ); @@ -108,16 +116,26 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ +#endif + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ +#endif + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -125,10 +143,15 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + if ( !cheb ) + t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ //??sat +#else if ( !cheb ) t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ +#endif + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -146,9 +169,14 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ - cheb = s_max( -32767, cheb ); /* to avoid saturation */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ //??sat + cheb = round_fx_sat( t0 ); /* Result in Q14 */ //??sat +#else + t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ + cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ +#endif + cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); } @@ -162,8 +190,10 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------* @@ -286,7 +316,11 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + y = sub_sat( yhigh, ylow ); +#else y = sub_o( yhigh, ylow, &Overflow ); +#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1222,9 +1256,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) Word16 nc; Word32 t0; Word16 Ovf, Ovf2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif /*-----------------------------------------------------* @@ -1255,7 +1291,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat +#else f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); +#endif move32(); } @@ -1265,11 +1305,19 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 1; i <= nc; i++ ) + { + t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); + t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); + } +#else FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); } +#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1283,6 +1331,16 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ +#ifdef ISSUE_1836_replace_overflow_libcom + t0 = L_add_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat + + /* a[j] = 0.5*(f1[i] - f2[i]) */ + t0 = L_sub_sat( f1[i], f2[i] ); //??sat + t0 = L_shl( t0, k ); + a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ //??sat +#else t0 = L_add_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ @@ -1290,7 +1348,8 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub_o( f1[i], f2[i], &Overflow ); t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ + a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ +#endif j--; } @@ -1734,8 +1793,10 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); @@ -1796,32 +1857,40 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat + L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ + L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ //??sat +#else L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ - L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ -#else - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ + L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ + L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ + f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ #endif - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ - f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ - L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ //??sat + L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ //??sat + f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ //??sat + move16(); #else - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ -#endif - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ + L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ + f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ move16(); +#endif } } @@ -2273,8 +2342,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2320,13 +2391,17 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ +#endif tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ //??sat #else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ + tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ #endif tmp = s_max( tmp, 0 ); @@ -2364,8 +2439,10 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*-------------------------------------------------------------------* @@ -2417,7 +2494,11 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ //??sat //??sat +#else tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ +#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3776,8 +3857,10 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3845,9 +3928,13 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ //??sat +#else + Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ +#endif if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 2e989cfbf..ddd8f88f6 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,6 +9,12 @@ #include "prot_fx.h" #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * Local constants @@ -336,8 +342,10 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif exp_den = norm_l( in32 ); @@ -345,14 +353,17 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); -#ifdef ISSUE_1796_replace_shl_o - exp_den = shl_sat( exp_den, 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + exp_den = shl( exp_den, 1 ); + + div_out = div_s( 8192, m_den ); + Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #else exp_den = shl_o( exp_den, 1, &Overflow ); -#endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ +#endif return Ltmp; } @@ -368,8 +379,10 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif IF( re == 0 ) @@ -382,7 +395,11 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -397,7 +414,11 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); +#else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -427,8 +448,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); -#ifdef ISSUE_1799_replace_L_shr_o - L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif @@ -509,8 +530,10 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /*---------------------------------------------------------------------* @@ -533,7 +556,11 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + r[0] = L_add_sat( r[0], G[i] ); +#else r[0] = L_add_o( r[0], G[i], &Overflow ); +#endif move32(); } @@ -567,18 +594,47 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_add_sat( G[i], G[N - i - 1] ); //??sat +#else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); +#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); +#ifdef ISSUE_1836_replace_overflow_libcom + r[1] = L_add_sat( r[1], mh ); //??sat +#else r[1] = L_add_o( r[1], mh, &Overflow ); +#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = mult_r( c[j - 1], x[i - 1] ); + move16(); + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + /*r[j] = L_mac(r[j], c[j], gp);*/ + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); + + c[j + 1] = mult_r( c[j], x[i - 1] ); + move16(); + c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat + move16(); + + /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ + Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); + r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat + move32(); +#else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); @@ -598,33 +654,55 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); +#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat + move16(); + + Mpy_32_16_ss( gp, c[j], &mh, &ml ); + r[j] = L_add_sat( r[j], mh ); //??sat + move32(); +#else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); +#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat + gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); + + r[0] = L_add_sat( r[0], gp ); //??sat +#else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); +#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat + L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat +#else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); +#endif } return; diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 74143b8ed..caa17b3ae 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,6 +23,12 @@ #include #include +#ifndef ISSUE_1836_FILEACTIVE_math_op_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | @@ -228,20 +234,30 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat + FOR( i = 1; i < lg; i++ ) + { + L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat + } +#else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } +#endif } IF( expi < 0 ) { @@ -251,26 +267,32 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat +#else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); +#endif } } IF( expi > 0 ) { -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( x[0], expi ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( x[0], expi ); //??sat + L_sum = L_mac_sat( 1, tmp, tmp ); //??sat + FOR( i = 1; i < lg; i++ ) + { + tmp = shl_sat( x[i], expi ); //??sat + L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat + } #else tmp = shl_o( x[0], expi, &Overflow ); -#endif L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( x[i], expi ); -#else tmp = shl_o( x[i], expi, &Overflow ); -#endif L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } +#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index fae2a43c2..60a15c5d0 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,6 +15,12 @@ #include "wmc_auto.h" +#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -75,7 +81,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -279,8 +285,8 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { -#ifdef ISSUE_1796_replace_shl_o - num_den = shl_sat( num_den, 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -364,7 +370,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -565,8 +571,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifdef ISSUE_1796_replace_shl_o - num_den = shl_sat( num_den, 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + num_den = shl_sat( num_den, 1 ); //??sat #else num_den = shl_o( num_den, 1, &Overflow ); #endif @@ -941,9 +947,11 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -953,60 +961,103 @@ void Decimate_allpass_steep_fx( FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ //??sat +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ - mem[0] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ //??sat - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ - mem[1] = extract_h( Lacc ); /* Qx */ + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ //??sat +#else + Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ + + temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ +#endif + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ //??sat + move16(); +#else out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ //??sat + Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat +#else + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ +#endif + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat + temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ + move16(); + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ //??sat +#else Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -1017,11 +1068,18 @@ void Decimate_allpass_steep_fx( { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat +#else + Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ + Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ + temp1 = extract_h( Lacc ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ +#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); @@ -1029,9 +1087,23 @@ void Decimate_allpass_steep_fx( move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ //??sat + temp2 = extract_h( Lacc1 ); /* Qx */ + temp[1] = temp2; + move16(); + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ + + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); //??sat /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ + temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat /* Q(16+x) */ +#else + Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ @@ -1042,7 +1114,8 @@ void Decimate_allpass_steep_fx( Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ +#endif + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ @@ -1158,9 +1231,11 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -1168,11 +1243,34 @@ void Interpolate_allpass_steep_fx( FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[0] = round_fx_sat( Lacc1 ); //??sat + move16(); + Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ //??sat + Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat + Lacc = L_deposit_h( temp1 ); + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[1] = round_fx_sat( Lacc ); /* Qx */ //??sat + move16(); + + Lacc1 = L_deposit_h( temp2 ); + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ //??sat + out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat + move16(); + mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ //??sat //??sat + move16(); +#else + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ + Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); move16(); @@ -1191,13 +1289,36 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat + Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ + temp1 = round_fx_sat( Lacc ); /* Qx */ //??sat + Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */ //??sat + + mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 ); //??sat + Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ + Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat + + temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat + Lacc = L_deposit_h( temp1 ); + Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat + mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat + + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ + Lacc1 = L_deposit_h( temp2 ); + out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat + move16(); + mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat + move16(); +#else Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ @@ -1218,6 +1339,7 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ move16(); +#endif } return; diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index be34a1248..91e22a9d6 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -27,6 +27,12 @@ #define WMC_TOOL_SKIP +#ifndef ISSUE_1836_FILEACTIVE_oper_32b_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /***************************************************************************** * * * Function L_Extract() * @@ -124,13 +130,20 @@ Word32 L_Comp( Word16 hi, Word16 lo ) Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif L_32 = L_mult( hi1, hi2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat +#else L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); +#endif return ( L_32 ); } @@ -159,13 +172,21 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mac_sat( L_num, hi1, hi2 ); //??sat + L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); //??sat + L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); //??sat +#else L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); +#endif return ( L_32 ); } @@ -193,12 +214,19 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Sqr_32( Word16 hi, Word16 lo ) { Word32 L_32; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif +#ifdef ISSUE_1836_replace_overflow_libcom + L_32 = L_mult_sat( hi, hi ); //??sat + L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 ); //??sat +#else L_32 = L_mult_o( hi, hi, &Overflow ); L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); +#endif return ( L_32 ); } diff --git a/lib_com/options.h b/lib_com/options.h index 4aa81f198..185719332 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,7 @@ #define ISSUE_1836_FILEACTIVE_igf_base_fx_c #define ISSUE_1836_FILEACTIVE_interpol_fx_c // #define ISSUE_1836_FILEACTIVE_log2_c //nothing done -#if 0 +#if 1 #define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c #define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 3103723be..3679ed372 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-----------------------------------------------------------------------* * phase_dispersion: * @@ -30,9 +36,11 @@ void phase_dispersion( Word32 x32[2 * L_SUBFR]; Word16 *code_real, *code_imag; const Word16 *h_real, *h_imag; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif move16(); @@ -57,7 +65,11 @@ void phase_dispersion( move16(); prev_gain_pit[0] = gain_pit; +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) ) //??sat +#else IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) ) +#endif { IF( LT_16( state, 2 ) ) { @@ -165,7 +177,11 @@ void phase_dispersion( scale2 = getScaleFactor32( x32, L_subfr ); FOR( i = 0; i < L_subfr; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) ); +#else code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); +#endif move16(); } j = sub( j, scale2 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index cc6b59bdb..0fceb9165 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,6 +35,12 @@ #include "cnst.h" #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_ppp_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ /*-------------------------------------------------------------------*/ @@ -97,9 +103,11 @@ void deemph_lpc_fx( Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif b_fx[0] = 4096; move16(); /* 1 in Q12 */ @@ -115,7 +123,11 @@ void deemph_lpc_fx( { /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat +#else LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); +#endif move16(); /* Q12 */ } @@ -137,7 +149,11 @@ void deemph_lpc_fx( { /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); //??sat +#else LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); +#endif move16(); /* Q12 */ } } diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 465138bde..c54ee5f39 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -8,6 +8,11 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_pred_lt4_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif /*-------------------------------------------------------------------* * Function pred_lt4: * @@ -35,9 +40,11 @@ void pred_lt4_ivas_fx( Word32 s; const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0]; @@ -71,7 +78,11 @@ void pred_lt4_ivas_fx( s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ +#ifdef ISSUE_1836_replace_overflow_libcom + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat +#else + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ +#endif move16(); } return; @@ -91,9 +102,11 @@ void pred_lt4( Word16 i, j; Word32 s; const Word16 *x0, *x1, *x2, *c1, *c2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0]; @@ -127,12 +140,21 @@ void pred_lt4( } s = W_sat_l( s64 ); /* Q_exc + Q14 */ } +#ifdef ISSUE_1836_replace_overflow_libcom +#if ( INTERP_EXP != -1 ) + s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ //??sat +#endif + + excO[j] = round_fx_sat( s ); /* Q_exc */ //??sat + move16(); +#else #if ( INTERP_EXP != -1 ) s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ #endif excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ move16(); +#endif } return; } @@ -177,9 +199,11 @@ void pred_lt4_tc_fx( Word16 excO[L_SUBFR + 1]; Word32 L_sum; Word16 excI[2 * L_SUBFR]; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ @@ -212,15 +236,25 @@ void pred_lt4_tc_fx( k += UP_SAMP; L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ //??sat + excO[j] = round_fx_sat( L_sum ); /* Q0 */ //??sat +#else + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ +#endif + move16(); x0++; } FOR( i = T0; i < L_SUBFR; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */ //??sat +#else exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ +#endif move16(); } } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index b7886cb65..b24aa9467 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -22,12 +22,23 @@ void preemph_copy_fx( ) { Word16 i, temp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = x[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */ + move16(); + } + y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ @@ -35,6 +46,8 @@ void preemph_copy_fx( } y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ move16(); +#endif + *mem = temp; /* Qx */ move16(); @@ -49,12 +62,23 @@ void preemph_copy_32fx( ) { Word16 i, temp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = x[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ //??sat + move16(); + } + y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */ @@ -62,6 +86,7 @@ void preemph_copy_32fx( } y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */ move16(); +#endif *mem = temp; /* Qx */ move16(); @@ -125,13 +150,31 @@ void E_UTIL_f_preemph2( { Word16 i, temp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp = signal[lg - 1]; /* Qx */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) + { + L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + move16(); + } + + L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ + L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */ //??sat + L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ + signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ //??sat + move16(); +#else FOR( i = lg - 1; i > 0; i-- ) { L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ @@ -146,6 +189,7 @@ void E_UTIL_f_preemph2( L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); +#endif *mem = temp; /* Qx */ move16(); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 1adcdb7ae..63eb26877 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -7,6 +7,13 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ +#ifndef ISSUE_1836_FILEACTIVE_pvq_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + + /*! r: Approximate integer division for positive input using lookup table */ UWord32 intLimCDivPos_fx( UWord32 NUM, /* Qx */ @@ -427,9 +434,11 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); @@ -456,7 +465,11 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat +#else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ +#endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ @@ -527,9 +540,11 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif FOR( band = 0; band < num_sfm; band++ ) @@ -552,7 +567,11 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat +#else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); +#endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); -- GitLab From 8547bad73800f980c22937e0980d2c9b379f925a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 13:35:53 +0200 Subject: [PATCH 079/103] took files starting with r, s from ce30096 --- lib_com/options.h | 3 +- lib_com/residu_fx.c | 48 +++++- lib_com/stat_noise_uv_mod_fx.c | 40 +++-- lib_com/swb_bwe_com_fx.c | 15 ++ lib_com/swb_bwe_com_lr_fx.c | 194 +++++++++++++----------- lib_com/swb_tbe_com_fx.c | 261 ++++++++++++++++++++++++++------- lib_com/syn_filt_fx.c | 50 ++++++- 7 files changed, 465 insertions(+), 146 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 185719332..736cbae2d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,7 @@ #define ISSUE_1836_FILEACTIVE_igf_base_fx_c #define ISSUE_1836_FILEACTIVE_interpol_fx_c // #define ISSUE_1836_FILEACTIVE_log2_c //nothing done -#if 1 + #define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c #define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c @@ -181,6 +181,7 @@ #define ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c #define ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c #define ISSUE_1836_FILEACTIVE_syn_filt_fx_c +#if 1 #define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c #define ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 0ed9c9ac8..b1426dcb2 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -8,6 +8,12 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_residu_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*--------------------------------------------------------------------* * residu_ivas_fx() * @@ -62,9 +68,11 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif q = add( norm_s( a[0] ), 1 ); @@ -72,11 +80,37 @@ void Residu3_lc_fx( { q = add( q, shift ); } -#ifdef ISSUE_1796_replace_shl_o - *y++ = shl_sat( x[0], shift ); +#ifdef ISSUE_1836_replace_overflow_libcom + *y++ = shl_sat( x[0], shift ); //??sat + move16(); + + FOR( i = 1; i < m; i++ ) + { + s = L_mult_sat( x[i], a[0] ); //??sat + /* Stop at i to Avoid Mults with Zeros */ + FOR( j = 1; j <= i; j++ ) + { + s = L_mac_sat( s, x[i - j], a[j] ); //??sat + } + + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat + } + + FOR( ; i < lg; i++ ) + { + s = L_mult_sat( x[i], a[0] ); //??sat + FOR( j = 1; j <= m; j++ ) + { + s = L_mac_sat( s, x[i - j], a[j] ); //??sat + } + + s = L_shl_sat( s, q ); //??sat + *y++ = round_fx_sat( s ); //??sat + } + #else *y++ = shl_o( x[0], shift, &Overflow ); -#endif move16(); FOR( i = 1; i < m; i++ ) @@ -103,6 +137,8 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } + +#endif } /*--------------------------------------------------------------------* @@ -155,9 +191,11 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) @@ -174,7 +212,11 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( s32 ); //??sat +#else y[i] = round_fx_o( s32, &Overflow ); +#endif move16(); } } diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index 8d1236b53..cf4b5edc3 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -16,6 +16,12 @@ #define P1 ( 32768 - ISP_SMOOTHING_QUANT_A1_FX - 1 ) #define P9 ( 32767 - P1 ) +#ifndef ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*---------------------------------------------------------* * Local functions *---------------------------------------------------------*/ @@ -74,9 +80,11 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*---------------------------------------------------------* @@ -109,7 +117,11 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + min_alpha = add_sat( tmp_res, 16384 ); //??sat +#else min_alpha = add_o( tmp_res, 16384, &Overflow ); +#endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ @@ -161,8 +173,8 @@ void stat_noise_uv_mod_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1796_replace_shl_o - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -190,8 +202,8 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1796_replace_shl_o - tmp_res = shl_sat( tmp_res, tmp_shift ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif @@ -258,7 +270,11 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat +#else + tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ +#endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ @@ -392,9 +408,11 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /*---------------------------------------------------------* @@ -424,7 +442,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); +#ifdef ISSUE_1836_replace_overflow_libcom + min_alpha = add_sat( tmp_res, 16384 ); //??sat +#else min_alpha = add_o( tmp_res, 16384, &Overflow ); +#endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); @@ -475,8 +497,8 @@ void stat_noise_uv_mod_ivas_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1796_replace_shl_o - exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif @@ -504,8 +526,8 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1796_replace_shl_o - tmp_res = shl_sat( tmp_res, tmp_shift ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 138fbd705..ab3efa10d 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -36,6 +36,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*==========================================================================*/ /* FUNCTION : Word16 WB_BWE_gain_pred_fx () */ @@ -613,12 +619,21 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat +#else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); +#endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat + tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat +#else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); +#endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 78422a292..4dba49139 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,6 +38,12 @@ #include +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -927,9 +933,11 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *Qss = 10; @@ -986,7 +994,11 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat +#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ +#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1008,109 +1020,119 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) - { - IF( L_inBuf_pss[j] >= 0 ) - { + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ +#ifdef ISSUE_1836_replace_overflow_libcom + IF( L_inBuf_pss[j] >= 0 ){ + outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat + move16(); + } +#else + IF( L_inBuf_pss[j] >= 0 ){ outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); - } - } - ELSE - { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; - move16(); - if ( L_inBuf_pss[j] < 0x0L ) - { - outBuf_pss_fx[j] = -0x2800; - move16(); - } - } - j++; + move32(); } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } +#endif } - - k = 0; - move16(); - m = 0; - move16(); - n = 0; - move16(); - reset_flag = 0; - move16(); - n_list[0] = 0; - move16(); - FOR( j = 0; j < num_subband_smooth_fx; j++ ) + ELSE { - cnt_zero_cont = 0; + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; move16(); - FOR( i = 0; i < L_SB; i++ ) + if ( L_inBuf_pss[j] < 0x0L ) { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) - { - cnt_zero_cont = 0; - move16(); - } - k = add( k, 1 ); + outBuf_pss_fx[j] = -0x2800; + move16(); } + } + j++; +} +} - IF( cnt_zero_cont != 0 ) +k = 0; +move16(); +m = 0; +move16(); +n = 0; +move16(); +reset_flag = 0; +move16(); +n_list[0] = 0; +move16(); +FOR( j = 0; j < num_subband_smooth_fx; j++ ) +{ + cnt_zero_cont = 0; + move16(); + FOR( i = 0; i < L_SB; i++ ) + { + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) { - test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) - { - n = 0; - move16(); - reset_flag = 1; - move16(); - } - n_list[n] = j; + cnt_zero_cont = 0; move16(); - n = add( n, 1 ); } + k = add( k, 1 ); + } + IF( cnt_zero_cont != 0 ) + { test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) { - m = 0; + n = 0; + move16(); + reset_flag = 1; move16(); } + n_list[n] = j; + move16(); + n = add( n, 1 ); + } - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + test(); + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + { + m = 0; + move16(); + } + + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + { + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + if ( outBuf_pss_fx[pk + i] == 0 ) { - if ( outBuf_pss_fx[pk + i] == 0 ) - { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); - } + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); } - m = add( m, 1 ); } + m = add( m, 1 ); } +} - FOR( i = 0; i < fLen; i++ ) +FOR( i = 0; i < fLen; i++ ) +{ + outBuf_fx[i] = 0x0; + move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) { - outBuf_fx[i] = 0x0; + outBuf_fx[i] = outBuf_pss_fx[i]; move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) - { - outBuf_fx[i] = outBuf_pss_fx[i]; - move16(); - } } +} - return; +return; } /*-------------------------------------------------------------------* @@ -2225,9 +2247,11 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *QbeL = 3; @@ -2338,7 +2362,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom //??sat E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2380,13 +2404,19 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat +#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) +#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } +#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); +#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3213,7 +3243,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3252,8 +3282,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3326,8 +3356,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index beaef4614..e8a74d834 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,6 +12,12 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 @@ -996,11 +1002,10 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; -#endif move32(); - +#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1040,8 +1045,8 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1796_replace_shl_o - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat #else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); #endif @@ -1451,9 +1456,11 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1543,8 +1550,8 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1 +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif @@ -1553,16 +1560,28 @@ void GenShapedWBExcitation_ivas_fx( n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 + pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 + } +#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } +#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1592,7 +1611,11 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1600,8 +1623,13 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ + pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ +#else + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ +#endif } } @@ -1610,11 +1638,19 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat +#else + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat +#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ +#endif move16(); } } @@ -1630,8 +1666,8 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_vfac = shl_sat( voice_factors[i], 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1643,6 +1679,20 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k++; + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1655,6 +1705,7 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } +#endif } } } @@ -1709,9 +1760,11 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); move16(); @@ -1803,8 +1856,8 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); #endif @@ -1815,14 +1868,23 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ + pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat +#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1853,7 +1915,11 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1861,8 +1927,13 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat + pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ +#else + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } @@ -1871,13 +1942,23 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ + sc = sub( add( n2, Q_bwe_exc ), 14 ); + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + move16(); + } +#else + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } +#endif } ELSE { @@ -1892,8 +1973,8 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_vfac = shl_sat( voice_factors[i], 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1905,6 +1986,20 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k = add( k, 1 ); + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -1917,6 +2012,7 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } +#endif } } } @@ -5691,10 +5787,12 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5793,15 +5891,19 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /* Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5825,8 +5927,12 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -5875,15 +5981,19 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -5951,10 +6061,12 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6053,15 +6165,19 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /* Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6085,8 +6201,12 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -6135,15 +6255,19 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /*Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6879,9 +7003,11 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -6940,7 +7066,11 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, expb ); num_flag = 0; @@ -7064,9 +7194,11 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7081,10 +7213,10 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1796_replace_shl_o - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ +#ifdef ISSUE_1836_replace_overflow_libcom + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7114,7 +7246,19 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat + FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) + { + L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ + L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat + L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat + L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ + bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat + move16(); + } +#else gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7125,6 +7269,7 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } +#endif } ELSE { @@ -7138,10 +7283,17 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat + + tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat +#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7150,9 +7302,14 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat +#else + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7160,9 +7317,15 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ + tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat + bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat +#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ +#endif move16(); } } @@ -7198,7 +7361,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7229,8 +7392,8 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1796_replace_shl_o - formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); +#ifdef ISSUE_1836_replace_overflow_libcom + formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index e0315bbcb..8b044f2f7 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -9,13 +9,24 @@ #include "prot_fx.h" #include "stl.h" +#ifndef ISSUE_1836_FILEACTIVE_syn_filt_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); +#else + L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); //??sat + return L_msu_sat( L_tmp, y[-2], a[2] ); //??sat +#endif } static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] ) @@ -341,9 +352,11 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif if ( EQ_16( m, 6 ) ) @@ -377,8 +390,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); /* Filtering from Input + Mix of Memory & Output Signal Past */ @@ -388,15 +406,24 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Process Output Signal Past */ FOR( j = 1; j <= i; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_msu_sat( L_tmp, a[j], y[-j] ); //??sat +#else L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow ); +#endif } /* Process Memory */ FOR( ; j <= m; j++ ) { L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat + *y++ = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); } @@ -404,8 +431,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W FOR( ; i < lg; i++ ) { L_tmp = syn_kern( L_mult( a0, *x++ ), a, y ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); + *y++ = round_fx_sat( L_tmp ); +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); *y++ = round_fx_o( L_tmp, &Overflow ); +#endif move16(); } @@ -452,8 +484,10 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; move32(); +#endif if ( EQ_16( m, 6 ) ) { @@ -480,8 +514,8 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ mem += m; /*move32();*/ -#ifdef ISSUE_1799_replace_L_shr_o - a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ +#ifdef ISSUE_1836_replace_overflow_libcom + a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ //??sat #else a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ #endif @@ -491,7 +525,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); @@ -509,7 +547,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] ); } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); } @@ -518,7 +560,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] FOR( ; i < lg; i++ ) { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( L_tmp, q ); //??sat +#else L_tmp = L_shl_o( L_tmp, q, &Overflow ); +#endif *y++ = L_tmp; move32(); } -- GitLab From b458974c611f1363bbb6b26271293af0ffee24a3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 14:11:24 +0200 Subject: [PATCH 080/103] use swb files from main --- lib_com/swb_bwe_com_fx.c | 15 --- lib_com/swb_bwe_com_lr_fx.c | 194 +++++++++++---------------- lib_com/swb_tbe_com_fx.c | 261 +++++++----------------------------- 3 files changed, 131 insertions(+), 339 deletions(-) diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index ab3efa10d..138fbd705 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -36,12 +36,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*==========================================================================*/ /* FUNCTION : Word16 WB_BWE_gain_pred_fx () */ @@ -619,21 +613,12 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } -#ifdef ISSUE_1836_replace_overflow_libcom - L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat -#else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); -#endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat - tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat -#else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); -#endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 4dba49139..78422a292 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,12 +38,6 @@ #include -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -933,11 +927,9 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *Qss = 10; @@ -994,11 +986,7 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat -#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ -#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1020,119 +1008,109 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( L_inBuf_pss[j] >= 0 ){ - outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat - move16(); - } -#else - IF( L_inBuf_pss[j] >= 0 ){ + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) + { + IF( L_inBuf_pss[j] >= 0 ) + { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } + } + ELSE + { + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; + move16(); + if ( L_inBuf_pss[j] < 0x0L ) + { + outBuf_pss_fx[j] = -0x2800; + move16(); + } + } + j++; } -#endif } - ELSE + + k = 0; + move16(); + m = 0; + move16(); + n = 0; + move16(); + reset_flag = 0; + move16(); + n_list[0] = 0; + move16(); + FOR( j = 0; j < num_subband_smooth_fx; j++ ) { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; + cnt_zero_cont = 0; move16(); - if ( L_inBuf_pss[j] < 0x0L ) + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[j] = -0x2800; - move16(); + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) + { + cnt_zero_cont = 0; + move16(); + } + k = add( k, 1 ); } - } - j++; -} -} -k = 0; -move16(); -m = 0; -move16(); -n = 0; -move16(); -reset_flag = 0; -move16(); -n_list[0] = 0; -move16(); -FOR( j = 0; j < num_subband_smooth_fx; j++ ) -{ - cnt_zero_cont = 0; - move16(); - FOR( i = 0; i < L_SB; i++ ) - { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) + IF( cnt_zero_cont != 0 ) { - cnt_zero_cont = 0; + test(); + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + { + n = 0; + move16(); + reset_flag = 1; + move16(); + } + n_list[n] = j; move16(); + n = add( n, 1 ); } - k = add( k, 1 ); - } - IF( cnt_zero_cont != 0 ) - { test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) { - n = 0; - move16(); - reset_flag = 1; + m = 0; move16(); } - n_list[n] = j; - move16(); - n = add( n, 1 ); - } - test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) - { - m = 0; - move16(); - } - - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ - { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ { - if ( outBuf_pss_fx[pk + i] == 0 ) + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); + if ( outBuf_pss_fx[pk + i] == 0 ) + { + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); + } } + m = add( m, 1 ); } - m = add( m, 1 ); } -} -FOR( i = 0; i < fLen; i++ ) -{ - outBuf_fx[i] = 0x0; - move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + FOR( i = 0; i < fLen; i++ ) { - outBuf_fx[i] = outBuf_pss_fx[i]; + outBuf_fx[i] = 0x0; move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + { + outBuf_fx[i] = outBuf_pss_fx[i]; + move16(); + } } -} -return; + return; } /*-------------------------------------------------------------------* @@ -2247,11 +2225,9 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *QbeL = 3; @@ -2362,7 +2338,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat +#ifdef ISSUE_1796_replace_shl_o E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2404,19 +2380,13 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat -#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) -#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } -#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); -#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3243,7 +3213,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3282,8 +3252,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3356,8 +3326,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e8a74d834..beaef4614 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,12 +12,6 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 @@ -1002,10 +996,11 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; - move32(); #endif + move32(); + IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1045,8 +1040,8 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); #else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); #endif @@ -1456,11 +1451,9 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1550,8 +1543,8 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible +#ifdef ISSUE_1796_replace_shl_o + excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1 #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif @@ -1560,28 +1553,16 @@ void GenShapedWBExcitation_ivas_fx( n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 - pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 - } -#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } -#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat -#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1611,11 +1592,7 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1623,13 +1600,8 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ - pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ -#endif + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } } @@ -1638,19 +1610,11 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ -#endif + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat -#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ -#endif move16(); } } @@ -1666,8 +1630,8 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1679,20 +1643,6 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat - move16(); - k++; - } -#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1705,7 +1655,6 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } -#endif } } } @@ -1760,11 +1709,9 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif move16(); move16(); @@ -1856,8 +1803,8 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excTmp2_frac[i] = shl( excTmp2[i], n1 ); +#ifdef ISSUE_1796_replace_shl_o + excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); #endif @@ -1868,23 +1815,14 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ - pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat -#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat -#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1915,11 +1853,7 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1927,13 +1861,8 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat - pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ } } @@ -1942,23 +1871,13 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ - sc = sub( add( n2, Q_bwe_exc ), 14 ); - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat - move16(); - } -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } -#endif } ELSE { @@ -1973,8 +1892,8 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat +#ifdef ISSUE_1796_replace_shl_o + tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1986,20 +1905,6 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat - L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat - exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat - move16(); - k = add( k, 1 ); - } -#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -2012,7 +1917,6 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } -#endif } } } @@ -5787,12 +5691,10 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5891,19 +5793,15 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + scale_step = shl_sat( tmp, exp ); /* Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5927,12 +5825,8 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif } ELSE { @@ -5981,19 +5875,15 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom +#ifdef ISSUE_1796_replace_shl_o scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6061,12 +5951,10 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6165,19 +6053,15 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + scale_step = shl_sat( tmp, exp ); /* Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6201,12 +6085,8 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat -#else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ } ELSE { @@ -6255,19 +6135,15 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom - scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -7003,11 +6879,9 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -7066,11 +6940,7 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat -#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, expb ); num_flag = 0; @@ -7194,11 +7064,9 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7213,10 +7081,10 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat +#ifdef ISSUE_1796_replace_shl_o + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7246,19 +7114,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ -#ifdef ISSUE_1836_replace_overflow_libcom - gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat - FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) - { - L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ - L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat - L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat - L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ - bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat - move16(); - } -#else + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7269,7 +7125,6 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } -#endif } ELSE { @@ -7283,17 +7138,10 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat - - tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat -#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ -#endif + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ move16(); } } @@ -7302,14 +7150,9 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat - tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat -#else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ -#endif + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ move16(); } } @@ -7317,15 +7160,9 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ - tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat - bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat -#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ -#endif move16(); } } @@ -7361,7 +7198,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7392,8 +7229,8 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); +#ifdef ISSUE_1796_replace_shl_o + formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif -- GitLab From 33901be53c06f51d9439537e49e8e50ea6ad1a55 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 14:26:08 +0200 Subject: [PATCH 081/103] remove FILEACTIVE macros in lib_com/files a-i --- lib_com/arith_coder_fx.c | 6 ----- lib_com/basop_util.c | 7 ----- lib_com/bitalloc_fx.c | 6 ----- lib_com/cldfb_evs_fx.c | 6 ----- lib_com/cldfb_fx.c | 6 ----- lib_com/cng_exc_fx.c | 6 ----- lib_com/codec_tcx_common_fx.c | 6 ----- lib_com/deemph_fx.c | 6 ----- lib_com/edct_fx.c | 6 ----- lib_com/env_stab_fx.c | 5 ---- lib_com/fd_cng_com_fx.c | 5 ---- lib_com/fft_fx_evs.c | 6 ----- lib_com/frame_ener_fx.c | 6 ----- lib_com/get_gain_fx.c | 6 ----- lib_com/gs_bitallocation_fx.c | 6 ----- lib_com/gs_bitallocation_ivas_fx.c | 6 ----- lib_com/gs_gains_fx.c | 6 ----- lib_com/gs_noisefill_fx.c | 6 ----- lib_com/hp50_fx.c | 6 ----- lib_com/hq2_bit_alloc_fx.c | 7 ----- lib_com/hq2_core_com_fx.c | 7 ----- lib_com/hq2_noise_inject_fx.c | 6 ----- lib_com/ifft_rel_fx.c | 6 ----- lib_com/interpol_fx.c | 6 ----- lib_com/options.h | 41 ------------------------------ 25 files changed, 186 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index ff272b8c8..55d7a3ec5 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -10,12 +10,6 @@ #include "basop_proto_func.h" #include "cnst.h" -#ifndef ISSUE_1836_FILEACTIVE_arith_coder_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /* Fixed point implementation of exp(negate()) */ Word32 expfp( /* o: Q31 */ const Word16 x, /* i: mantissa Q-e */ diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index dd3310a7f..1d9c2f2d9 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -45,13 +45,6 @@ #include "basop_settings.h" #include "cnst.h" -#ifndef ISSUE_1836_FILEACTIVE_basop_util_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - extern const Word32 SqrtTable[32]; // Q31 extern const Word16 SqrtDiffTable[32]; /* Q15 */ diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index c3bcd3c8a..2b630cf21 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_bitalloc_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif void bitalloc_fx( Word16 *y, /* i : reordered norm of sub-vectors Q0 */ Word16 *idx, /* i : reordered sub-vector indices Q0 */ diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 77437a485..153f95cf9 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -48,12 +48,6 @@ #define N40 ( 20 ) #define N60 ( 30 ) -#ifndef ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs ); diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 877e2f48f..00cb884d4 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -51,12 +51,6 @@ #define restrict #endif -#ifndef ISSUE_1836_FILEACTIVE_cldfb_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-------------------------------------------------------------------* * Local prototypes *--------------------------------------------------------------------*/ diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 1f4ee4da4..6296b406c 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" #include "ivas_rom_com_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_cng_exc_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index a3c8cb258..010590ad1 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -11,12 +11,6 @@ #include "rom_basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif #define inv_int InvIntTable Word16 tcxGetNoiseFillingTilt( diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index e0720a44f..27d823a74 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -39,12 +39,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_deemph_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif void deemph_fx_32( Word32 *signal, /* i/o: signal Qx*/ const Word16 mu, /* i : deemphasis factor Q15*/ diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 3c3f6fafb..244d69381 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -13,12 +13,6 @@ #include "math_32.h" -#ifndef ISSUE_1836_FILEACTIVE_edct_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */ { Word16 factor; /*Q15*/ diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index 839d39c4f..50a15c5fe 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -44,11 +44,6 @@ #include "wmc_auto.h" #include "stl.h" -#ifndef ISSUE_1836_FILEACTIVE_env_stab_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*--------------------------------------------------------------------------* * Local constants *--------------------------------------------------------------------------*/ diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 8ff5eb489..6666f9091 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -21,12 +21,7 @@ #define CNG_HS 4 /* 4 bit headroom for dot product */ #define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */ -#ifndef ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*------------------------------------------------------------------- * Local function prototypes *-------------------------------------------------------------------*/ diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index ce1bd52ea..6572b57d7 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -32,12 +32,6 @@ static void fft64_16fx( Word16 *x, Word16 *y, const Word16 *Idx ); static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx ); static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w ); -#ifndef ISSUE_1836_FILEACTIVE_fft_fx_evs_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #include "math_32.h" /*-----------------------------------------------------------------* diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index ed46494ee..c641bef51 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -41,12 +41,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_frame_ener_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*----------------------------------------------------------------------------------* * fer_energy() * diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index ab7024371..8d10f3c4d 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -39,12 +39,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_get_gain_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*----------------------------------------------------------------------------------* * get_gain() * diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index beb402b5d..5e3870a7e 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -9,12 +9,6 @@ #include "assert.h" /* Debug prototypes */ #include "stl.h" -#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*==================================================================================*/ /* FUNCTION : void bands_and_bit_alloc_fx(); */ /*----------------------------------------------------------------------------------*/ diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 601eb92d7..52e5fef7f 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -34,12 +34,6 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ -#ifndef ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index a00fbd829..30501ff89 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -43,12 +43,6 @@ #include "stl.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_gs_gains_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index bc350e165..df8813844 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -6,12 +6,6 @@ #include "rom_com.h" #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * gs_noisf() * diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index f3eb49db6..76ca278e6 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -40,12 +40,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_hp50_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define HP20_COEFF_SCALE ( 2 ) /* * hp20 diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 02d3590c0..452481334 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -35,13 +35,6 @@ #include "prot_fx.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - #define MIN_BITS_FIX 0 /* QRk=18 */ #define HQ_16k40_BIT ( HQ_16k40 / 50 ) /* 16400/50=328 */ #define Qbf 14 /* Q value for bits_fact */ diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index f071689d4..5c1a63f28 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -37,13 +37,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 04bd5af34..7f61e9a91 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -36,12 +36,6 @@ #include "oper_32b.h" #include "move.h" -#ifndef ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*--------------------------------------------------------------------------* * hq2_noise_inject() * diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index f0add9252..dd711ed3d 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -40,12 +40,6 @@ #include "rom_com.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_ifft_rel_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index 38fc55792..7773e8d1a 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -41,12 +41,6 @@ #include "rom_com.h" #include "prot_fx_enc.h" -#ifndef ISSUE_1836_FILEACTIVE_interpol_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif Word32 Interpol_lc_fx( /* o : interpolated value Q15 */ const Word16 *x, /* i : input vector Q0 */ const Word16 *win, /* i : interpolation window Q14 */ diff --git a/lib_com/options.h b/lib_com/options.h index 736cbae2d..b7bb91a6f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -118,47 +118,6 @@ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ -#define ISSUE_1836_FILEACTIVE_arith_coder_fx_c -#define ISSUE_1836_FILEACTIVE_basop32_c -#define ISSUE_1836_FILEACTIVE_basop32_h -#define ISSUE_1836_FILEACTIVE_basop_lsf_tools_c -#define ISSUE_1836_FILEACTIVE_basop_util_c -#define ISSUE_1836_FILEACTIVE_bitalloc_fx_c -#define ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c -#define ISSUE_1836_FILEACTIVE_cldfb_fx_c -#define ISSUE_1836_FILEACTIVE_cng_exc_fx_c -#define ISSUE_1836_FILEACTIVE_codec_tcx_common_fx_c -#define ISSUE_1836_FILEACTIVE_deemph_fx_c -#define ISSUE_1836_FILEACTIVE_edct_fx_c -#define ISSUE_1836_FILEACTIVE_enh1632_c -#define ISSUE_1836_FILEACTIVE_enh1632_h -#define ISSUE_1836_FILEACTIVE_enh32_c -#define ISSUE_1836_FILEACTIVE_enh40_c -#define ISSUE_1836_FILEACTIVE_enh40_h -#define ISSUE_1836_FILEACTIVE_enh64_c -#define ISSUE_1836_FILEACTIVE_enh64_h -#define ISSUE_1836_FILEACTIVE_enhUL32_c -#define ISSUE_1836_FILEACTIVE_enr_1_az_fx_c -#define ISSUE_1836_FILEACTIVE_edct_fx_c -#define ISSUE_1836_FILEACTIVE_env_stab_fx_c -#define ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c -#define ISSUE_1836_FILEACTIVE_fft_fx_evs_c -#define ISSUE_1836_FILEACTIVE_fft_rel_fx_c -#define ISSUE_1836_FILEACTIVE_frame_ener_fx_c -#define ISSUE_1836_FILEACTIVE_get_gain_fx_c -#define ISSUE_1836_FILEACTIVE_gs_bitallocation_fx_c -#define ISSUE_1836_FILEACTIVE_gs_bitallocation_ivas_fx_c -#define ISSUE_1836_FILEACTIVE_gs_gains_fx_c -#define ISSUE_1836_FILEACTIVE_gs_noisefill_fx_c -#define ISSUE_1836_FILEACTIVE_hp50_fx_c -#define ISSUE_1836_FILEACTIVE_hq2_bit_alloc_fx_c -#define ISSUE_1836_FILEACTIVE_hq2_core_com_fx_c -#define ISSUE_1836_FILEACTIVE_hq2_noise_inject_fx_c -#define ISSUE_1836_FILEACTIVE_ifft_rel_fx_c -#define ISSUE_1836_FILEACTIVE_igf_base_fx_c -#define ISSUE_1836_FILEACTIVE_interpol_fx_c -// #define ISSUE_1836_FILEACTIVE_log2_c //nothing done - #define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c #define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -- GitLab From b752ac4b4f38626511f1130f0455734516bed735 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 14:33:14 +0200 Subject: [PATCH 082/103] take lmnopqrs from ce60069 but swb_bwe_com_fx --- lib_com/swb_bwe_com_lr_fx.c | 194 ++++++++++++++++----------- lib_com/swb_tbe_com_fx.c | 261 +++++++++++++++++++++++++++++------- 2 files changed, 324 insertions(+), 131 deletions(-) diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 78422a292..4dba49139 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,6 +38,12 @@ #include +#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -927,9 +933,11 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *Qss = 10; @@ -986,7 +994,11 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); +#ifdef ISSUE_1836_replace_overflow_libcom + max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat +#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ +#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1008,109 +1020,119 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) - { - IF( L_inBuf_pss[j] >= 0 ) - { + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ +#ifdef ISSUE_1836_replace_overflow_libcom + IF( L_inBuf_pss[j] >= 0 ){ + outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat + move16(); + } +#else + IF( L_inBuf_pss[j] >= 0 ){ outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); - } - } - ELSE - { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; - move16(); - if ( L_inBuf_pss[j] < 0x0L ) - { - outBuf_pss_fx[j] = -0x2800; - move16(); - } - } - j++; + move32(); } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } +#endif } - - k = 0; - move16(); - m = 0; - move16(); - n = 0; - move16(); - reset_flag = 0; - move16(); - n_list[0] = 0; - move16(); - FOR( j = 0; j < num_subband_smooth_fx; j++ ) + ELSE { - cnt_zero_cont = 0; + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; move16(); - FOR( i = 0; i < L_SB; i++ ) + if ( L_inBuf_pss[j] < 0x0L ) { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) - { - cnt_zero_cont = 0; - move16(); - } - k = add( k, 1 ); + outBuf_pss_fx[j] = -0x2800; + move16(); } + } + j++; +} +} - IF( cnt_zero_cont != 0 ) +k = 0; +move16(); +m = 0; +move16(); +n = 0; +move16(); +reset_flag = 0; +move16(); +n_list[0] = 0; +move16(); +FOR( j = 0; j < num_subband_smooth_fx; j++ ) +{ + cnt_zero_cont = 0; + move16(); + FOR( i = 0; i < L_SB; i++ ) + { + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) { - test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) - { - n = 0; - move16(); - reset_flag = 1; - move16(); - } - n_list[n] = j; + cnt_zero_cont = 0; move16(); - n = add( n, 1 ); } + k = add( k, 1 ); + } + IF( cnt_zero_cont != 0 ) + { test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) { - m = 0; + n = 0; + move16(); + reset_flag = 1; move16(); } + n_list[n] = j; + move16(); + n = add( n, 1 ); + } - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + test(); + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) + { + m = 0; + move16(); + } + + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ + { + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + if ( outBuf_pss_fx[pk + i] == 0 ) { - if ( outBuf_pss_fx[pk + i] == 0 ) - { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); - } + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); } - m = add( m, 1 ); } + m = add( m, 1 ); } +} - FOR( i = 0; i < fLen; i++ ) +FOR( i = 0; i < fLen; i++ ) +{ + outBuf_fx[i] = 0x0; + move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) { - outBuf_fx[i] = 0x0; + outBuf_fx[i] = outBuf_pss_fx[i]; move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) - { - outBuf_fx[i] = outBuf_pss_fx[i]; - move16(); - } } +} - return; +return; } /*-------------------------------------------------------------------* @@ -2225,9 +2247,11 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif *QbeL = 3; @@ -2338,7 +2362,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom //??sat E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2380,13 +2404,19 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat +#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) +#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } +#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); +#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3213,7 +3243,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3252,8 +3282,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ +#ifdef ISSUE_1836_replace_overflow_libcom + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3326,8 +3356,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index beaef4614..e8a74d834 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,6 +12,12 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" +#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 @@ -996,11 +1002,10 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; -#endif move32(); - +#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1040,8 +1045,8 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1796_replace_shl_o - sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); //??sat #else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); #endif @@ -1451,9 +1456,11 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ @@ -1543,8 +1550,8 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1 +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 #endif @@ -1553,16 +1560,28 @@ void GenShapedWBExcitation_ivas_fx( n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 + pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 + } +#else FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ } +#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1592,7 +1611,11 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else + exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1600,8 +1623,13 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ + pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ +#else + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ +#endif } } @@ -1610,11 +1638,19 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat +#else + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat +#else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ +#endif move16(); } } @@ -1630,8 +1666,8 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_vfac = shl_sat( voice_factors[i], 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1643,6 +1679,20 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k++; + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1655,6 +1705,7 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } +#endif } } } @@ -1709,9 +1760,11 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); move16(); @@ -1803,8 +1856,8 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + excTmp2_frac[i] = shl( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); #endif @@ -1815,14 +1868,23 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ + pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat +#else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); //??sat +#else excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); +#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1853,7 +1915,11 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ +#else exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ +#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1861,8 +1927,13 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat + pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ +#else + L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ + pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ +#endif } } @@ -1871,13 +1942,23 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ + sc = sub( add( n2, Q_bwe_exc ), 14 ); + FOR( i = 0; i < L_FRAME16k / 4; i++ ) + { + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + move16(); + } +#else + scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } +#endif } ELSE { @@ -1892,8 +1973,8 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o - tmp_vfac = shl_sat( voice_factors[i], 1 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp_vfac = shl_sat( voice_factors[i], 1 ); //??sat #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif @@ -1905,6 +1986,20 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ //??sat //??sat + L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ + Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); + temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */ //??sat //??sat + FOR( j = 0; j < L_FRAME16k / 16; j++ ) + { + L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat + exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat + move16(); + k = add( k, 1 ); + } +#else temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -1917,6 +2012,7 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } +#endif } } } @@ -5691,10 +5787,12 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -5793,15 +5891,19 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /* Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -5825,8 +5927,12 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -5875,15 +5981,19 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -5951,10 +6061,12 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -6053,15 +6165,19 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /* Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /* Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ #endif } } @@ -6085,8 +6201,12 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ //??sat +#else + scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ +#endif } ELSE { @@ -6135,15 +6255,19 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat +#else + L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ +#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1796_replace_shl_o - scale_step = shl_sat( tmp, exp ); /*Q14 */ +#ifdef ISSUE_1836_replace_overflow_libcom + scale_step = shl_sat( tmp, exp ); /*Q14 */ //??sat #else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ + scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ #endif } } @@ -6879,9 +7003,11 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy( shb_res, shb_res_local, L_FRAME16k ); @@ -6940,7 +7066,11 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, expb ); num_flag = 0; @@ -7064,9 +7194,11 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; @@ -7081,10 +7213,10 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1796_replace_shl_o - pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ +#ifdef ISSUE_1836_replace_overflow_libcom + pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ //??sat //??sat #else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ + pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ #endif test(); @@ -7114,7 +7246,19 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ +#ifdef ISSUE_1836_replace_overflow_libcom + gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ //??sat //??sat + FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) + { + L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ + L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/ //??sat + L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */ //??sat + L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */ + bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ //??sat + move16(); + } +#else gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7125,6 +7269,7 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ move16(); } +#endif } ELSE { @@ -7138,10 +7283,17 @@ void prep_tbe_exc_fx( Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ //??sat + + tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ //??sat //??sat +#else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ + tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7150,9 +7302,14 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ //??sat + tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ //??sat +#else + Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ + tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ +#endif move16(); } } @@ -7160,9 +7317,15 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ + tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat + bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat +#else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ +#endif move16(); } } @@ -7198,7 +7361,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7229,8 +7392,8 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1796_replace_shl_o - formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); +#ifdef ISSUE_1836_replace_overflow_libcom + formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif -- GitLab From 5586f8526cd4bc90e2988f8a0abb6df68ce13f36 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 15:00:21 +0200 Subject: [PATCH 083/103] take also swb_bwe_com_lr_fx from main --- lib_com/swb_bwe_com_lr_fx.c | 194 +++++++++++++++--------------------- 1 file changed, 82 insertions(+), 112 deletions(-) diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 4dba49139..78422a292 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,12 +38,6 @@ #include -#ifndef ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-------------------------------------------------------------------* * GetPredictedSignal() * @@ -933,11 +927,9 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *Qss = 10; @@ -994,11 +986,7 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom - max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat -#else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ -#endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; @@ -1020,119 +1008,109 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = 0; move16(); } - ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ){ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( L_inBuf_pss[j] >= 0 ){ - outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat - move16(); - } -#else - IF( L_inBuf_pss[j] >= 0 ){ + ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) + { + IF( L_inBuf_pss[j] >= 0 ) + { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); - move32(); - } - ELSE - { - outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); - move16(); + move32(); + } + ELSE + { + outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); + move16(); + } + } + ELSE + { + /* CLIP, for avoiding computational difference */ + outBuf_pss_fx[j] = 0x2800; + move16(); + if ( L_inBuf_pss[j] < 0x0L ) + { + outBuf_pss_fx[j] = -0x2800; + move16(); + } + } + j++; } -#endif } - ELSE + + k = 0; + move16(); + m = 0; + move16(); + n = 0; + move16(); + reset_flag = 0; + move16(); + n_list[0] = 0; + move16(); + FOR( j = 0; j < num_subband_smooth_fx; j++ ) { - /* CLIP, for avoiding computational difference */ - outBuf_pss_fx[j] = 0x2800; + cnt_zero_cont = 0; move16(); - if ( L_inBuf_pss[j] < 0x0L ) + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[j] = -0x2800; - move16(); + cnt_zero_cont = add( cnt_zero_cont, 1 ); + if ( outBuf_pss_fx[k] != 0 ) + { + cnt_zero_cont = 0; + move16(); + } + k = add( k, 1 ); } - } - j++; -} -} -k = 0; -move16(); -m = 0; -move16(); -n = 0; -move16(); -reset_flag = 0; -move16(); -n_list[0] = 0; -move16(); -FOR( j = 0; j < num_subband_smooth_fx; j++ ) -{ - cnt_zero_cont = 0; - move16(); - FOR( i = 0; i < L_SB; i++ ) - { - cnt_zero_cont = add( cnt_zero_cont, 1 ); - if ( outBuf_pss_fx[k] != 0 ) + IF( cnt_zero_cont != 0 ) { - cnt_zero_cont = 0; + test(); + IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + { + n = 0; + move16(); + reset_flag = 1; + move16(); + } + n_list[n] = j; move16(); + n = add( n, 1 ); } - k = add( k, 1 ); - } - IF( cnt_zero_cont != 0 ) - { test(); - IF( GT_16( j, div_s_ss( subband_search_offsets[0], L_SB ) ) && reset_flag == 0 ) + if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) { - n = 0; - move16(); - reset_flag = 1; + m = 0; move16(); } - n_list[n] = j; - move16(); - n = add( n, 1 ); - } - test(); - if ( EQ_16( reset_flag, 1 ) && EQ_16( n, 1 ) ) - { - m = 0; - move16(); - } - - pk = sub( k, L_SB ); - IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ - { - pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); - FOR( i = 0; i < L_SB; i++ ) + pk = sub( k, L_SB ); + IF( GT_16( cnt_zero_cont, mult_r( L_SB, 24576 ) ) ) /* cnt_zero_cont > 3*L_SB/4 */ { - if ( outBuf_pss_fx[pk + i] == 0 ) + pp = round_fx( L_shl( L_mult( n_list[m], L_SB ), 15 ) ); + FOR( i = 0; i < L_SB; i++ ) { - outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); - move16(); + if ( outBuf_pss_fx[pk + i] == 0 ) + { + outBuf_pss_fx[pk + i] = shr( outBuf_pss_fx[pp + i], 1 ); + move16(); + } } + m = add( m, 1 ); } - m = add( m, 1 ); } -} -FOR( i = 0; i < fLen; i++ ) -{ - outBuf_fx[i] = 0x0; - move16(); - if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + FOR( i = 0; i < fLen; i++ ) { - outBuf_fx[i] = outBuf_pss_fx[i]; + outBuf_fx[i] = 0x0; move16(); + if ( GT_16( abs_s( outBuf_pss_fx[i] ), th_cut_fx ) ) + { + outBuf_fx[i] = outBuf_pss_fx[i]; + move16(); + } } -} -return; + return; } /*-------------------------------------------------------------------* @@ -2247,11 +2225,9 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif *QbeL = 3; @@ -2362,7 +2338,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1836_replace_overflow_libcom //??sat +#ifdef ISSUE_1796_replace_shl_o E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); @@ -2404,19 +2380,13 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat -#else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) -#endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } -#ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); -#endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ @@ -3243,7 +3213,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1836_replace_overflow_libcom +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3282,8 +3252,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat +#ifdef ISSUE_1796_replace_shl_o + *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif @@ -3356,8 +3326,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1836_replace_overflow_libcom - ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif -- GitLab From 2a2cb9f15750fd754308b1616e03acc604a14f43 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 16:01:15 +0200 Subject: [PATCH 084/103] fix swb_tbe_com_fx --- lib_com/swb_tbe_com_fx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e8a74d834..55debea76 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1564,7 +1564,7 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 - pow1 = L_add( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ // saturation not possible: ld(L_FRAME16k / 4) = ld(80) < 10 + pow1 = L_add_sat( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ } #else FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1624,7 +1624,7 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ #else L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ @@ -1647,7 +1647,7 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat //??sat #else exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ #endif @@ -1869,7 +1869,7 @@ void GenShapedWBExcitation_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ + L_tmp = L_mult_sat( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ //??sat pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat #else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ @@ -1943,11 +1943,11 @@ void GenShapedWBExcitation_fx( { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); #ifdef ISSUE_1836_replace_overflow_libcom - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat + exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ //??sat //??sat //??sat move16(); } #else @@ -1994,7 +1994,7 @@ void GenShapedWBExcitation_fx( FOR( j = 0; j < L_FRAME16k / 16; j++ ) { L_tmp = L_mult( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat + L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */ //??sat //??sat exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */ //??sat move16(); k = add( k, 1 ); @@ -5892,7 +5892,7 @@ void non_linearity_fx( /* (log2(scale / prev_scale))/length */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif @@ -7319,7 +7319,7 @@ void prep_tbe_exc_fx( { #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ - tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat + tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ //??sat //??sat bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ //??sat #else L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ -- GitLab From cd3addddba519bd0dec7dd5b96602cdba030ec3b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 Aug 2025 16:05:11 +0200 Subject: [PATCH 085/103] clang patch --- lib_com/swb_tbe_com_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 55debea76..b97d2c041 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1564,7 +1564,7 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 - pow1 = L_add_sat( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ + pow1 = L_add_sat( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ } #else FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1624,8 +1624,8 @@ void GenShapedWBExcitation_ivas_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat - pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ + L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ //??sat + pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ #else L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ @@ -1869,8 +1869,8 @@ void GenShapedWBExcitation_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ //??sat - pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat + L_tmp = L_mult_sat( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ //??sat + pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ //??sat #else L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ @@ -5892,7 +5892,7 @@ void non_linearity_fx( /* (log2(scale / prev_scale))/length */ #ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat + L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ //??sat #else L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ #endif -- GitLab From 853d1849ffcc46dafa9ec6e71918773943d49bca Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 07:36:39 +0200 Subject: [PATCH 086/103] deactivated macro ISSUE_1836_replace_overflow_libcom in lower half of swb_tbe_com_fx.c --- lib_com/swb_tbe_com_fx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index b97d2c041..4fe67fe63 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -5755,7 +5755,9 @@ static Word32 non_linearity_scaled_copy_ivas( /*--------------------------------------------------------------------------*/ /* CALLED FROM : */ /*==========================================================================*/ - +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif void non_linearity_fx( const Word16 input[], /* i : input signal Q_inp */ Word32 output[], /* o : output signal 2*Q_inp */ -- GitLab From 82cbbaa16470c5d736c41a2999541dafe0af5bf9 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 09:06:53 +0200 Subject: [PATCH 087/103] deactivated macro ISSUE_1836_replace_overflow_libcom in lower fourth of swb_tbe_com_fx.c --- lib_com/swb_tbe_com_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 4fe67fe63..483665507 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -5755,9 +5755,7 @@ static Word32 non_linearity_scaled_copy_ivas( /*--------------------------------------------------------------------------*/ /* CALLED FROM : */ /*==========================================================================*/ -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif + void non_linearity_fx( const Word16 input[], /* i : input signal Q_inp */ Word32 output[], /* o : output signal 2*Q_inp */ @@ -6983,6 +6981,9 @@ void synthesise_fb_high_band_fx( * * * Estimate mix factors for SHB excitation generation * *-------------------------------------------------------------------*/ +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif void Estimate_mix_factors_fx( const Word16 *shb_res, /* i : SHB LP residual in Q = Q_shb */ const Word16 Q_shb, -- GitLab From 00a1142613bf7b783229b6fde7566f45e9569d24 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 09:28:02 +0200 Subject: [PATCH 088/103] deactivated macro ISSUE_1836_replace_overflow_libcom in swb_formant_fac of swb_tbe_com_fx.c --- lib_com/swb_tbe_com_fx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 483665507..48d70f028 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -7355,7 +7355,9 @@ void prep_tbe_exc_fx( /*------------------------------------------------------------------------------*/ /* CALLED FROM : */ /*==============================================================================*/ - +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif /*! r: Formant filter strength [0,1] */ Word16 swb_formant_fac_fx( const Word16 lpc_shb2, /* Q12 i : 2nd HB LPC coefficient */ -- GitLab From 5701730a3a80913bc10769966625e5a3d1feb10b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 10:11:01 +0200 Subject: [PATCH 089/103] fix swb_formant_fac_fx in swb_tbe_com_fx --- lib_com/swb_tbe_com_fx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 48d70f028..3e77c3559 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -7355,9 +7355,7 @@ void prep_tbe_exc_fx( /*------------------------------------------------------------------------------*/ /* CALLED FROM : */ /*==============================================================================*/ -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif + /*! r: Formant filter strength [0,1] */ Word16 swb_formant_fac_fx( const Word16 lpc_shb2, /* Q12 i : 2nd HB LPC coefficient */ @@ -7398,7 +7396,7 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom - formant_fac = shl( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); + formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); //??sat #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif -- GitLab From 80e52d731fe9825692531130e8361a3bc503c024 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 10:30:35 +0200 Subject: [PATCH 090/103] clang patch --- lib_com/swb_tbe_com_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 3e77c3559..301323dfc 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -7396,7 +7396,7 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom - formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); //??sat + formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 ); //??sat #else formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); #endif -- GitLab From bedcd9fccbb45c1ae7520d7ef83dd2e51e6b5abf Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 10:50:39 +0200 Subject: [PATCH 091/103] take all lib_com files with t* and w* from ce30069 --- lib_com/tcx_ltp_fx.c | 15 ++ lib_com/tcx_mdct_fx.c | 26 ++- lib_com/tcx_utils_fx.c | 36 +++- lib_com/tns_base.c | 12 ++ lib_com/tools_fx.c | 196 +++++++++++++++++-- lib_com/weight_a_fx.c | 13 ++ lib_com/wi_fx.c | 424 +++++++++++++++++++++++++++++++++++++---- lib_com/window_fx.c | 18 +- 8 files changed, 671 insertions(+), 69 deletions(-) diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 322549a6f..0bf0fb1c9 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" +#ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ @@ -389,9 +395,11 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); @@ -408,10 +416,17 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat + s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat + excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat +#else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ +#endif move16(); x0++; diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index b2cee32e6..8ef395423 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -8,6 +8,12 @@ #include "prot_fx.h" #include "basop_util.h" +#ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ @@ -107,9 +113,11 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); @@ -126,7 +134,11 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat +#else + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } FOR( i = 0; i < m / 2; i++ ) @@ -136,7 +148,11 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ +#else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } @@ -163,9 +179,11 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); @@ -182,7 +200,11 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#ifdef ISSUE_1836_replace_overflow_libcom + y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat +#else + y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ +#endif move32(); } FOR( i = 0; i < m / 2; i++ ) diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index c5ff95e04..e86f48eed 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -12,6 +12,12 @@ #define inv_int InvIntTable +#ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*-------------------------------------------------------------------* * getInvFrameLen() * @@ -991,8 +997,10 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* FDNS_NPTS = 64 */ @@ -1044,7 +1052,11 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#ifdef ISSUE_1836_replace_overflow_libcom + *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ +#else + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#endif move32(); x++; } @@ -1063,7 +1075,11 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#ifdef ISSUE_1836_replace_overflow_libcom + *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ +#else + *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ +#endif move32(); x += k; gains++; @@ -1389,9 +1405,11 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif +#endif assert( lpcGains[0] >= 0x4000 ); @@ -1438,8 +1456,12 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ - fac = tmp; /* Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = round_fx_sat( L_tmp ); /* Q15 */ +#else + tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ +#endif + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ @@ -2081,8 +2103,10 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif maxX = L_deposit_l( 1 ); @@ -2129,7 +2153,11 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ +#else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ +#endif if ( corr < 0 ) tmp = negate( tmp ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index aaf262786..35394f8f9 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -22,6 +22,12 @@ #define MAX_SUBDIVISIONS 3 +#ifndef ISSUE_1836_FILEACTIVE_tns_base_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ @@ -439,9 +445,11 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); @@ -475,7 +483,11 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1836_replace_overflow_libcom + tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ +#else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ +#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 5e116a286..0e11980cd 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -52,6 +52,12 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_tools_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ @@ -308,18 +314,21 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ - L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ -#ifdef ISSUE_1796_replace_shl_o - idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat + idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat #else + L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ #endif @@ -327,9 +336,13 @@ Word16 usquant_fx( /* o: index of the winning codeword */ idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ +#ifdef ISSUE_1836_replace_overflow_libcom + *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ +#else + *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ +#endif return idx; } /*-------------------------------------------------------------------* @@ -395,14 +408,20 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ +#else + L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ +#endif } return L_tmp; @@ -456,15 +475,21 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); +#else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); +#endif } return L_tmp; @@ -684,7 +709,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -711,8 +736,8 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - y[i] = shl_sat( x[i], exp0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = shl_sat( x[i], exp0 ); //??sat #else y[i] = shl_o( x[i], exp0, &Overflow ); #endif @@ -733,7 +758,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -755,8 +780,8 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -772,8 +797,8 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( 1, exp0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = shl_sat( 1, exp0 ); //??sat #else tmp = shl_o( 1, exp0, &Overflow ); #endif @@ -793,10 +818,12 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( exp0 == 0 ) @@ -813,8 +840,8 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif @@ -822,7 +849,11 @@ void Copy_Scale_sig_16_32_no_sat( } return; } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat +#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); +#endif IF( L_tmp >= 0x7FFF ) { @@ -854,9 +885,11 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif tmp = add( 16, exp0 ); @@ -864,7 +897,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); +#else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); +#endif move16(); } } @@ -872,7 +909,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = round_fx_sat( x[i] ); //??sat +#else y[i] = round_fx_o( x[i], &Overflow ); +#endif move16(); } } @@ -890,9 +931,11 @@ void Scale_sig32( ) { Word16 i; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( 0 == exp0 ) { @@ -901,7 +944,11 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + x[i] = L_shl_sat( x[i], exp0 ); +#else x[i] = L_shl_o( x[i], exp0, &Overflow ); +#endif move32(); /* saturation can occur here */ } } @@ -1896,10 +1943,12 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif idx = 0; @@ -1916,6 +1965,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + if ( weights[3] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + if ( weights[2] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + if ( weights[1] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + if ( weights[0] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } +#else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { @@ -1936,6 +2007,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } +#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -1965,6 +2037,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat + if ( weights[0] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat + if ( weights[1] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat + if ( weights[2] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } + tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat + if ( weights[3] != 0 ) + { + dist = L_mac0_sat( dist, tmp, tmp ); //??sat + } +#else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { @@ -1985,6 +2079,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } +#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -2451,9 +2546,11 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) @@ -2464,15 +2561,23 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); +#ifdef ISSUE_1836_replace_overflow_libcom + num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat +#else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); +#endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); +#ifdef ISSUE_1836_replace_overflow_libcom + den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat +#else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); +#endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1836_replace_overflow_libcom //??sat num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); @@ -2632,9 +2737,11 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); @@ -2647,14 +2754,27 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mult_sat( buf_in[K + i], h[0] ); //??sat +#else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); +#endif FOR( j = 1; j <= K; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat +#else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); +#endif } +#ifdef ISSUE_1836_replace_overflow_libcom + s = L_shl_sat( s, shift ); //??sat + y[i] = round_fx_sat( s ); /*Qx */ //??sat +#else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ +#endif move16(); } } @@ -2790,8 +2910,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif idx = 0; @@ -2802,10 +2924,18 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); +#ifdef ISSUE_1836_replace_overflow_libcom + tmp = sub_sat( x, cb[c] ); +#else tmp = sub_o( x, cb[c], &Overflow ); +#endif /*dist += tmp*tmp; */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat +#else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); +#endif if ( LT_32( L_dist, L_mindist ) ) { @@ -2943,9 +3073,11 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( exp0 == 0 ) { @@ -2960,12 +3092,20 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = L_shl_sat( x[i], tmp ); //??sat +#else y[i] = L_shl_o( x[i], tmp, &Overflow ); +#endif move16(); } return; } +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat +#else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); +#endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); @@ -3142,9 +3282,11 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); @@ -3152,7 +3294,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat +#else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); +#endif move16(); } } @@ -3160,7 +3306,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat +#else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); +#endif move16(); } } @@ -3287,7 +3437,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ +#ifdef ISSUE_1836_replace_overflow_libcom + temp = mult_r( *signal++, 16384 ); +#else temp = mult_ro( *signal++, 16384, &Overflow ); +#endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ @@ -3297,7 +3451,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + temp = mult_r( *signal++, 16384 ); +#else temp = mult_ro( *signal++, 16384, &Overflow ); +#endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } #ifdef ISSUE_1799_replace_L_shr_o diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index 7bea66ea0..b2d44e1d4 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -7,6 +7,13 @@ #include "prot_fx.h" #include + +#ifndef ISSUE_1836_FILEACTIVE_weight_a_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*------------------------------------------------------------------ * weight_a_subfr() * @@ -100,10 +107,12 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); +#endif #endif fac = gamma; /* Q15 */ @@ -122,7 +131,11 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat +#else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ +#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 5a8ad35c5..6f6bcb066 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -22,6 +22,12 @@ #define WI_THRESHLD 0.8 #define WI_SAMPLE_THLD 20 +#ifndef ISSUE_1836_FILEACTIVE_wi_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif + +#endif /*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */ /*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */ /*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */ @@ -264,9 +270,11 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -320,10 +328,17 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat + ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat + move16(); + move16(); +#else ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ move16(); move16(); +#endif } start = sub( Eshift, Adiff_fx ); @@ -344,8 +359,13 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat + corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat +#else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); +#endif move32(); move32(); temp = add( temp, temp1 ); @@ -358,12 +378,20 @@ static Word16 DTFS_alignment_weight_fx( move16(); } - temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ -#ifdef ISSUE_1796_replace_shl_o - wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat + wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat + IF( GE_16( Qmaxcorr, Qcorr ) ) + { + diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ + } + ELSE + { + diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ + } #else - wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ -#endif + temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ + wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ @@ -372,6 +400,7 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ } +#endif IF( diff_corr > 0 ) { @@ -421,9 +450,11 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Calculating the expected alignment shift */ @@ -457,8 +488,13 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat + ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat +#else ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ +#endif } IF( FR_flag == 0 ) { @@ -488,9 +524,15 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat + temp = add_sat( temp, temp1 ); //??sat +#else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); temp = add_o( temp, temp1, &Overflow ); +#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -596,9 +638,11 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif temp2 = L_deposit_l( 0 ); @@ -610,9 +654,15 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat + X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat + temp2 = L_add_sat( temp2, (Word32) ph ); //??sat +#else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); +#endif move16(); move16(); } @@ -624,9 +674,15 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat + X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat + temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat +#else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); +#endif move16(); move16(); } @@ -730,9 +786,11 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( !FR_flag ) @@ -769,7 +827,16 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ + diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat + + exp = norm_s( diff_fx ); + tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ + L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat + nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat +#else L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -777,7 +844,8 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ +#endif + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -800,8 +868,13 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat + inv_lag = round_fx_sat( L_tmp ); //??sat +#else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); +#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -815,8 +888,13 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat + L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat +#else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ +#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -853,13 +931,22 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat + L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat +#else + L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); +#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { +#ifdef ISSUE_1836_replace_overflow_libcom + L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat +#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ +#endif } La[k] = L_shl( L_a, 7 ); @@ -884,6 +971,30 @@ void DTFS_to_fs_fx( move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + FOR( k = 1; k <= nH; k++ ) + { + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + move16(); + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ + X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + move16(); + X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ + } + + /* IF ( N%2 == 0 ) */ + IF( s_and( N, 1 ) == 0 ) + { + X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat + X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat + move16(); + move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ + X_fx->b_fx[k] = 0; + move16(); + } +#else FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ @@ -906,6 +1017,7 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } +#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1201,9 +1313,11 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qmin = 32767; move16(); @@ -1221,6 +1335,22 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat + temp2 = add( temp2, temp ); + } + + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + + /* Calculate the circular convolution */ + L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); + L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat + L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); + + L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat +#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); temp2 = add( temp2, temp ); @@ -1233,7 +1363,8 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ +#endif /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1253,8 +1384,13 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat + X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat +#else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ +#endif move32(); move32(); @@ -1270,14 +1406,14 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1796_replace_shl_o - X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat #else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ -#ifdef ISSUE_1796_replace_shl_o - X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat #else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif @@ -1525,9 +1661,11 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); @@ -1537,15 +1675,23 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); - +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); +#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); +#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1553,9 +1699,13 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); - +#ifdef ISSUE_1836_replace_overflow_libcom + en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat + en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat +#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); +#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1586,6 +1736,23 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); +#ifdef ISSUE_1836_replace_overflow_libcom + HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); + HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); + FOR( k = 1; k <= HalfLag_fx; k++ ) + { + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + } + en_fx = L_shr( en_fx, 1 ); + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat + /* IF (X_fx->lag_fx%2 == 0) */ + IF( s_and( X_fx->lag_fx, 1 ) == 0 ) + { + en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat + } +#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1605,7 +1772,7 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); } - +#endif return en_fx; /* 2*X1.Q */ } @@ -1732,17 +1899,23 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat +#else Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ +#endif + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -1849,10 +2022,12 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -1864,7 +2039,11 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat +#else + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ +#endif Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -1879,8 +2058,13 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat + Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat +#else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ +#endif count = add( count, 1 ); } } @@ -1893,7 +2077,11 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ +#ifdef ISSUE_1836_replace_overflow_libcom + en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat +#else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); +#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -1904,7 +2092,11 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat +#else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); +#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -1942,7 +2134,11 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat +#else + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ +#endif move16(); } @@ -2006,9 +2202,11 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif num_flag = 0; move16(); @@ -2077,8 +2275,11 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ - +#ifdef ISSUE_1836_replace_overflow_libcom + IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat +#else IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) +#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2091,7 +2292,11 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( Ltemp3, expa ) ); +#else fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); +#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2100,7 +2305,11 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = extract_h( L_shl( Ltemp2, expb ) ); //??sat +#else fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); +#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2117,8 +2326,8 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fraca = shl_sat( fraca, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = shl_sat( fraca, scale ); //??sat #else fraca = shl_o( fraca, scale, &Overflow ); #endif @@ -2137,8 +2346,13 @@ static void cubicPhase_fx( tmp = negate( tmp ); } +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat + Lacc = L_add_sat( Lacc, 0x08000 ); //??sat +#else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); +#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2264,7 +2478,11 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //??sat //?sat +#else Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ +#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2322,9 +2540,11 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; @@ -2390,7 +2610,11 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ +#ifdef ISSUE_1836_replace_overflow_libcom + out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat +#else + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ +#endif move16(); IF( GT_16( count[i], 1 ) ) { @@ -2462,9 +2686,11 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Word16 *erb_fx = NULL; /*move16(); */ @@ -2547,7 +2773,33 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ +#ifdef ISSUE_1836_replace_overflow_libcom + mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ //??sat //??sat + move16(); + IF( GT_16( out_fx[j], 1 ) ) + { + expb = norm_l( mf_fx[j] ); + fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) ); //??sat //??sat + expb = sub( 30, add( expb, 20 ) ); + + + expa = norm_l( out_fx[j] ); + fraca = extract_h( L_shl( out_fx[j], expa ) ); + expa = sub( 30, expa ); + + scale = shr( sub( fraca, fracb ), 15 ); + fracb = shl( fracb, scale ); + expb = sub( expb, scale ); + + tmp = div_s( fracb, fraca ); + exp = sub( expb, expa ); + L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat + + mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat + move16(); + } +#else + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -2571,6 +2823,7 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); move16(); } +#endif } return; } @@ -2620,9 +2873,11 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) @@ -2708,7 +2963,11 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } +#ifdef ISSUE_1836_replace_overflow_libcom + X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ //??sat //??sat +#else X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ +#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3450,9 +3709,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3497,18 +3758,28 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); + expa = sub( 30, add( expa, 1 ) ); + + + expb = norm_l( L_sum ); + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat +#else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); +#endif + expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fracb = shl_sat( fracb, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = shl_sat( fracb, scale ); //??sat #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -3535,18 +3806,27 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); +#ifdef ISSUE_1836_replace_overflow_libcom + fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat + expa = sub( Q29, expa ); // 30 - expa - 1; + + + expb = norm_l( L_sum ); + fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat +#else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); +#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o - fracb = shl_sat( fracb, scale ); +#ifdef ISSUE_1836_replace_overflow_libcom + fracb = shl_sat( fracb, scale ); //??sat #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -4029,9 +4309,11 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif retX_fx->lag_fx = X1_fx->lag_fx; @@ -4042,8 +4324,13 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat + Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat +#else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ + Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ +#endif exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4085,6 +4372,17 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat + sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ + move16(); + + Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); + Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat + cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat + retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ +#else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ @@ -4094,6 +4392,7 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ +#endif move16(); } k = sub( k, 1 ); @@ -4147,9 +4446,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif en = L_deposit_l( 0 ); @@ -4185,8 +4486,12 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ - n = add( n, k4 ); /* n=4*i*k */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat +#else + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ +#endif + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4196,13 +4501,21 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ - n = add( n, k4 ); /* n=4*i*k */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat +#else + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ +#endif + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ +#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat +#else + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ +#endif + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4228,7 +4541,11 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); +#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); //??sat +#else Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); +#endif } ELSE { @@ -4277,9 +4594,11 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Qmin = 32767; move16(); @@ -4294,21 +4613,37 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { +#ifdef ISSUE_1836_replace_overflow_libcom + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat +#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ +#endif temp2 = add( temp2, k ); } +#ifdef ISSUE_1836_replace_overflow_libcom + temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat + temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat + /* Calculate the circular convolution */ + sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ + L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); + L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat + L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); + L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat +#else + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ +#endif IF( sum ) { exp = norm_l( sum ); @@ -4407,9 +4742,11 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); @@ -4423,8 +4760,13 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { +#ifndef ISSUE_1836_replace_overflow_libcom sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ +#else + sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat + sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat +#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 84302ff08..71a986408 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -21,6 +21,12 @@ #include "prot_fx.h" +#ifndef ISSUE_1836_FILEACTIVE_window_fx_c +#ifdef ISSUE_1836_replace_overflow_libcom +#undef ISSUE_1836_replace_overflow_libcom +#endif +#endif + void ham_cos_window( Word16 *fh, /* o: 0Q15 */ const Word16 n1, /* i: */ @@ -29,10 +35,12 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; +#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif +#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -46,7 +54,11 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1836_replace_overflow_libcom + fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat +#else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -63,10 +75,10 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1796_replace_shl_o - fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ +#ifdef ISSUE_1836_replace_overflow_libcom + fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From 511fc8a14fdde90b3161d0c0fbc03933521128f9 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 11:21:26 +0200 Subject: [PATCH 092/103] take lib_com/w* files from main --- lib_com/weight_a_fx.c | 13 -- lib_com/wi_fx.c | 424 ++++-------------------------------------- lib_com/window_fx.c | 18 +- 3 files changed, 44 insertions(+), 411 deletions(-) diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index b2d44e1d4..7bea66ea0 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -7,13 +7,6 @@ #include "prot_fx.h" #include - -#ifndef ISSUE_1836_FILEACTIVE_weight_a_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------ * weight_a_subfr() * @@ -107,12 +100,10 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; move32(); -#endif #endif fac = gamma; /* Q15 */ @@ -131,11 +122,7 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ //??sat -#else ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ -#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 6f6bcb066..5a8ad35c5 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -22,12 +22,6 @@ #define WI_THRESHLD 0.8 #define WI_SAMPLE_THLD 20 -#ifndef ISSUE_1836_FILEACTIVE_wi_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */ /*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */ /*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */ @@ -270,11 +264,9 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -328,17 +320,10 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ //??sat - ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ //??sat - move16(); - move16(); -#else ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ move16(); move16(); -#endif } start = sub( Eshift, Adiff_fx ); @@ -359,13 +344,8 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); //??sat - corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); //??sat -#else corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); -#endif move32(); move32(); temp = add( temp, temp1 ); @@ -378,20 +358,12 @@ static Word16 DTFS_alignment_weight_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ //??sat //??sat - wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //??sat //!!sat - IF( GE_16( Qmaxcorr, Qcorr ) ) - { - diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ - } - ELSE - { - diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ - } -#else temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ - wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#ifdef ISSUE_1796_replace_shl_o + wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#else + wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#endif IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ @@ -400,7 +372,6 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ } -#endif IF( diff_corr > 0 ) { @@ -450,11 +421,9 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* Calculating the expected alignment shift */ @@ -488,13 +457,8 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat - ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ //??sat //??sat //??sat -#else ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ -#endif } IF( FR_flag == 0 ) { @@ -524,15 +488,9 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); //??sat - temp = add_sat( temp, temp1 ); //??sat -#else corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); temp = add_o( temp, temp1, &Overflow ); -#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -638,11 +596,9 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif temp2 = L_deposit_l( 0 ); @@ -654,15 +610,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat //??sat //??sat - X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat //??sat //??sat - temp2 = L_add_sat( temp2, (Word32) ph ); //??sat -#else X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); -#endif move16(); move16(); } @@ -674,15 +624,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ //??sat - X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); //??sat - temp2 = add_sat( (Word16) temp2, negate( ph ) ); //??sat -#else X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); -#endif move16(); move16(); } @@ -786,11 +730,9 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( !FR_flag ) @@ -827,16 +769,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ - diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat - - exp = norm_s( diff_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ - L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ //??sat - nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ //??sat -#else + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ @@ -844,8 +777,7 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ -#endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -868,13 +800,8 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); //??sat - inv_lag = round_fx_sat( L_tmp ); //??sat -#else L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); inv_lag = round_fx_o( L_tmp, &Overflow ); -#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -888,13 +815,8 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ //??sat - L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ //??sat -#else L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ -#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -931,22 +853,13 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat - L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); //??sat -#else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ + L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); -#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { -#ifdef ISSUE_1836_replace_overflow_libcom - L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ //??sat -#else L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ -#endif } La[k] = L_shl( L_a, 7 ); @@ -971,30 +884,6 @@ void DTFS_to_fs_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - FOR( k = 1; k <= nH; k++ ) - { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - move16(); - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ - X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - move16(); - X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag ); //??sat - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ - } - - /* IF ( N%2 == 0 ) */ - IF( s_and( N, 1 ) == 0 ) - { - X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ //??sat //??sat - X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag ); //??sat - move16(); - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ - X_fx->b_fx[k] = 0; - move16(); - } -#else FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ @@ -1017,7 +906,6 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } -#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1313,11 +1201,9 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qmin = 32767; move16(); @@ -1335,22 +1221,6 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); //??sat - temp2 = add( temp2, temp ); - } - - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat - - /* Calculate the circular convolution */ - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */ //??sat - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - - L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ //??sat -#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); temp2 = add( temp2, temp ); @@ -1363,8 +1233,7 @@ void DTFS_zeroFilter_fx( L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ -#endif + L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1384,13 +1253,8 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ //??sat - X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ //??sat -#else X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ -#endif move32(); move32(); @@ -1406,14 +1270,14 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); #else X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); //??sat +#ifdef ISSUE_1796_replace_shl_o + X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); #else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); #endif @@ -1661,11 +1525,9 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); @@ -1675,23 +1537,15 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat -#else + en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat -#else en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); -#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1699,13 +1553,9 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom - en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); //??sat - en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); //??sat -#else + en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1736,23 +1586,6 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom - HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); - HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); - FOR( k = 1; k <= HalfLag_fx; k++ ) - { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat - } - en_fx = L_shr( en_fx, 1 ); - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] ); //??sat - /* IF (X_fx->lag_fx%2 == 0) */ - IF( s_and( X_fx->lag_fx, 1 ) == 0 ) - { - en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); //??sat - } -#else #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1772,7 +1605,7 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); } -#endif + return en_fx; /* 2*X1.Q */ } @@ -1899,23 +1732,17 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ //??sat -#else + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ -#endif - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -2022,12 +1849,10 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif -#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -2039,11 +1864,7 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ //??sat -#else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ -#endif + Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -2058,13 +1879,8 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); //??sat - Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ //??sat -#else L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ -#endif count = add( count, 1 ); } } @@ -2077,11 +1893,7 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); //??sat -#else en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); -#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -2092,11 +1904,7 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = round_fx_sat( L_shl( en1_fx, expb ) ); //??sat -#else fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); -#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -2134,11 +1942,7 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ //??sat -#else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ -#endif + X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ move16(); } @@ -2202,11 +2006,9 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif num_flag = 0; move16(); @@ -2275,11 +2077,8 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ -#ifdef ISSUE_1836_replace_overflow_libcom - IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) //??sat -#else + IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) -#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2292,11 +2091,7 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( Ltemp3, expa ) ); -#else fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); -#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2305,11 +2100,7 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = extract_h( L_shl( Ltemp2, expb ) ); //??sat -#else fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); -#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2326,8 +2117,8 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = shl_sat( fraca, scale ); //??sat +#ifdef ISSUE_1796_replace_shl_o + fraca = shl_sat( fraca, scale ); #else fraca = shl_o( fraca, scale, &Overflow ); #endif @@ -2346,13 +2137,8 @@ static void cubicPhase_fx( tmp = negate( tmp ); } -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_shl_sat( tmp, add( exp, 34 ) ); //??sat - Lacc = L_add_sat( Lacc, 0x08000 ); //??sat -#else Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); Lacc = L_add_o( Lacc, 0x08000, &Overflow ); -#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2478,11 +2264,7 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //??sat //?sat -#else Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ -#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2540,11 +2322,9 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; @@ -2610,11 +2390,7 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat //??sat -#else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ -#endif + out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ move16(); IF( GT_16( count[i], 1 ) ) { @@ -2686,11 +2462,9 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif const Word16 *erb_fx = NULL; /*move16(); */ @@ -2773,33 +2547,7 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ //??sat //??sat - move16(); - IF( GT_16( out_fx[j], 1 ) ) - { - expb = norm_l( mf_fx[j] ); - fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) ); //??sat //??sat - expb = sub( 30, add( expb, 20 ) ); - - - expa = norm_l( out_fx[j] ); - fraca = extract_h( L_shl( out_fx[j], expa ) ); - expa = sub( 30, expa ); - - scale = shr( sub( fraca, fracb ), 15 ); - fracb = shl( fracb, scale ); - expb = sub( expb, scale ); - - tmp = div_s( fracb, fraca ); - exp = sub( expb, expa ); - L_tmp = L_shl_sat( tmp, add( exp, 16 ) ); //??sat - - mfreq_fx[j] = round_fx_sat( L_tmp ); //??sat - move16(); - } -#else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ + mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) { @@ -2823,7 +2571,6 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); move16(); } -#endif } return; } @@ -2873,11 +2620,9 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) @@ -2963,11 +2708,7 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom - X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ //??sat //??sat -#else X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ -#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3709,11 +3450,9 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3758,28 +3497,18 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); - expa = sub( 30, add( expa, 1 ) ); - - - expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat -#else fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif - expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -3806,27 +3535,18 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom - fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); //??sat - expa = sub( Q29, expa ); // 30 - expa - 1; - - - expb = norm_l( L_sum ); - fracb = round_fx_sat( L_shl( L_sum, expb ) ); //??sat -#else fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom - fracb = shl_sat( fracb, scale ); //??sat +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); #endif @@ -4309,11 +4029,9 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif retX_fx->lag_fx = X1_fx->lag_fx; @@ -4324,13 +4042,8 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); //??sat - Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ //??sat -#else Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ -#endif + Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4372,17 +4085,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ //??sat - sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->b_fx[k] = mult_r( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ - move16(); - - Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); - Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ //??sat - cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ //??sat //??sat - retX_fx->a_fx[k] = mult_r( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ -#else Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ @@ -4392,7 +4094,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ -#endif move16(); } k = sub( k, 1 ); @@ -4446,11 +4147,9 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif en = L_deposit_l( 0 ); @@ -4486,12 +4185,8 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ //??sat -#else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4501,21 +4196,13 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ //??sat -#else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ //??sat -#else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ -#endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ + Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4541,11 +4228,7 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); -#ifdef ISSUE_1836_replace_overflow_libcom - Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); //??sat -#else Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); -#endif } ELSE { @@ -4594,11 +4277,9 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif Qmin = 32767; move16(); @@ -4613,37 +4294,21 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ //??sat -#else sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ -#endif temp2 = add( temp2, k ); } -#ifdef ISSUE_1836_replace_overflow_libcom - temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ //??sat - temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ //??sat - /* Calculate the circular convolution */ - sum = L_mac_sat( L_mult( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */ - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ //??sat -#else - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ + temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ + temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ /* Calculate the circular convolution */ sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ -#endif + L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ IF( sum ) { exp = norm_l( sum ); @@ -4742,11 +4407,9 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); @@ -4760,13 +4423,8 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifndef ISSUE_1836_replace_overflow_libcom sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ -#else - sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat - sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ //??sat -#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 71a986408..84302ff08 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -21,12 +21,6 @@ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_window_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - void ham_cos_window( Word16 *fh, /* o: 0Q15 */ const Word16 n1, /* i: */ @@ -35,12 +29,10 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; -#ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif -#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -54,11 +46,7 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ //??sat //??sat //??sat -#else fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -75,10 +63,10 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1836_replace_overflow_libcom - fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ //??sat +#ifdef ISSUE_1796_replace_shl_o + fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ #else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ + fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ #endif move16(); cc = L_add( cc, cte ); -- GitLab From e912a77a0b25a8267e09ba3fa6c69b72c9312066 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 11:32:31 +0200 Subject: [PATCH 093/103] stop tracking vcxproj --- Workspace_msvc/decoder.vcxproj | 176 ------------ Workspace_msvc/encoder.vcxproj | 178 ------------ Workspace_msvc/isar_post_rend.vcxproj | 179 ------------- Workspace_msvc/lib_com.vcxproj | 346 ------------------------ Workspace_msvc/lib_debug.vcxproj | 121 --------- Workspace_msvc/lib_dec.vcxproj | 351 ------------------------ Workspace_msvc/lib_enc.vcxproj | 371 -------------------------- Workspace_msvc/lib_isar.vcxproj | 184 ------------- Workspace_msvc/lib_lc3plus.vcxproj | 195 -------------- Workspace_msvc/lib_rend.vcxproj | 210 --------------- Workspace_msvc/lib_util.vcxproj | 161 ----------- Workspace_msvc/renderer.vcxproj | 183 ------------- 12 files changed, 2655 deletions(-) delete mode 100644 Workspace_msvc/decoder.vcxproj delete mode 100644 Workspace_msvc/encoder.vcxproj delete mode 100644 Workspace_msvc/isar_post_rend.vcxproj delete mode 100644 Workspace_msvc/lib_com.vcxproj delete mode 100644 Workspace_msvc/lib_debug.vcxproj delete mode 100644 Workspace_msvc/lib_dec.vcxproj delete mode 100644 Workspace_msvc/lib_enc.vcxproj delete mode 100644 Workspace_msvc/lib_isar.vcxproj delete mode 100644 Workspace_msvc/lib_lc3plus.vcxproj delete mode 100644 Workspace_msvc/lib_rend.vcxproj delete mode 100644 Workspace_msvc/lib_util.vcxproj delete mode 100644 Workspace_msvc/renderer.vcxproj diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj deleted file mode 100644 index 3ab058c29..000000000 --- a/Workspace_msvc/decoder.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - decoder - {E3DCBC31-7FC9-D127-E000-529F8460D5FD} - decoder - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_dec - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_dec - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - - - {e822ddaf-0f5f-4cd0-a694-38ae69de74d3} - false - - - {869a305e-d99e-4c3a-bdb3-aa57abcce619} - - - {2fa8f384-0775-f3b7-f8c3-85209222fc70} - false - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj deleted file mode 100644 index 9578e488d..000000000 --- a/Workspace_msvc/encoder.vcxproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - encoder - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} - encoder - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_cod - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_cod - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - false - true - $(IntDir)$(ProjectName).pdb - Console - - false - - MachineX86 - - - - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - - - - {824da4cf-06f0-45c9-929a-8792f0e19c3e} - false - - - {2fa8f384-0775-f3b7-f8c3-85209222fc70} - false - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/isar_post_rend.vcxproj b/Workspace_msvc/isar_post_rend.vcxproj deleted file mode 100644 index 19cb1aff7..000000000 --- a/Workspace_msvc/isar_post_rend.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - isar_post_rend - {12374ADC-0E5C-4FDD-B903-71D572413831} - isar_post_rend - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - ISAR_post_rend - - - ..\ - .\Release_$(ProjectName)\ - false - false - ISAR_post_rend - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - false - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - false - - - {869a305e-d99e-4c3a-bdb3-aa57abcce619} - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - false - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj deleted file mode 100644 index 8e37844b9..000000000 --- a/Workspace_msvc/lib_com.vcxproj +++ /dev/null @@ -1,346 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {39EC200D-7795-4FF8-B214-B24EDA5526AE} - common - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivascom - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivascom - - - - - - - Disabled - ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions); - - EnableFastChecks - MultiThreadedDebug - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj deleted file mode 100644 index 929dd72a8..000000000 --- a/Workspace_msvc/lib_debug.vcxproj +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - debug - 10.0.17763.0 - - - - StaticLibrary - v141 - MultiByte - - - StaticLibrary - v141 - MultiByte - true - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasdebug - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivasdebug - - - - - - - Disabled - ..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;DBG_WAV_WRITER;$(Macros);%(PreprocessorDefinitions) - false - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - MaxSpeed - AnySuitable - false - false - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - $(IntDir)$(ProjectName).pdb - Level4 - - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj deleted file mode 100644 index e5998e672..000000000 --- a/Workspace_msvc/lib_dec.vcxproj +++ /dev/null @@ -1,351 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_dec - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} - evs_dec - 10.0.17763.0 - - - StaticLibrary - v141 - false - MultiByte - - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasdec - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasdec - - - - - - - .\Debug\$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - false - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - {718DE063-A18B-BB72-9150-62B892E6FFA6} - false - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj deleted file mode 100644 index 123754142..000000000 --- a/Workspace_msvc/lib_enc.vcxproj +++ /dev/null @@ -1,371 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_enc - {824DA4CF-06F0-45C9-929A-8792F0E19C3E} - evs_enc - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasenc - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasenc - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj deleted file mode 100644 index cdc0979a0..000000000 --- a/Workspace_msvc/lib_isar.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_isar - {869A305E-D99E-4C3A-BDB3-AA57ABCCE619} - isar - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libisar - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libisar - - - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions); - - EnableFastChecks - MultiThreadedDebug - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - {95030B82-70CD-4C6B-84D4-61096035BEA2} - false - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj deleted file mode 100644 index 22b5cddd3..000000000 --- a/Workspace_msvc/lib_lc3plus.vcxproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {95030B82-70CD-4C6B-84D4-61096035BEA2} - Win32Proj - LC3_FL - 10.0.17763.0 - - - - StaticLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - liblc3plus - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - - - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - - - - Level3 - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - Disabled - MultiThreadedDebug - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - 4305;4244;4996 - OldStyle - false - false - - - Console - true - - - - - Level3 - - - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - MaxSpeed - MultiThreaded - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - 4244;4305;4996 - false - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj deleted file mode 100644 index f93b5f26d..000000000 --- a/Workspace_msvc/lib_rend.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_rend - {718DE063-A18B-BB72-9150-62B892E6FFA6} - evs_dec - 10.0.17763.0 - - - StaticLibrary - v141 - false - MultiByte - - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasrend - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasrend - - - - - - - .\Debug\$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - {95030B82-70CD-4C6B-84D4-61096035BEA2} - false - - - - - - - - - - - diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj deleted file mode 100644 index ceb342b21..000000000 --- a/Workspace_msvc/lib_util.vcxproj +++ /dev/null @@ -1,161 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - utility - 10.0.17763.0 - - - - StaticLibrary - v141 - MultiByte - - - StaticLibrary - v141 - MultiByte - true - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - true - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasutil - - - false - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivasutil - - - - Disabled - ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - false - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - MaxSpeed - AnySuitable - false - false - ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - $(IntDir)$(ProjectName).pdb - Level4 - - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj deleted file mode 100644 index 1bc5b5568..000000000 --- a/Workspace_msvc/renderer.vcxproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - renderer - {12B4C8A5-1E06-4E30-B443-D1F916F52B47} - renderer - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_rend - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_rend - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - false - - - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} - false - - - {869a305e-d99e-4c3a-bdb3-aa57abcce619} - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - false - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {718DE063-A18B-BB72-9150-62B892E6FFA6} - false - - - - - - - - - - - \ No newline at end of file -- GitLab From 1438065b54bf2ee009518b8659c63683a429b654 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 11:33:08 +0200 Subject: [PATCH 094/103] stop tracking vcxproj.filters --- Workspace_msvc/lib_com.vcxproj.filters | 646 ------------------------ Workspace_msvc/lib_dec.vcxproj.filters | 566 --------------------- Workspace_msvc/lib_enc.vcxproj.filters | 638 ----------------------- Workspace_msvc/lib_rend.vcxproj.filters | 152 ------ 4 files changed, 2002 deletions(-) delete mode 100644 Workspace_msvc/lib_com.vcxproj.filters delete mode 100644 Workspace_msvc/lib_dec.vcxproj.filters delete mode 100644 Workspace_msvc/lib_enc.vcxproj.filters delete mode 100644 Workspace_msvc/lib_rend.vcxproj.filters diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters deleted file mode 100644 index f247d199e..000000000 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ /dev/null @@ -1,646 +0,0 @@ - - - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_evs_c - - - common_all_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_ivas_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_ivas_c - - - - common_ivas_c - - - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - - common_h - - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - - - {890c2f45-9385-4fce-859b-6a65469e8dc0} - - - {201ea764-9626-4dca-9cc4-5b4106f8b8b2} - - - {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c} - - - {b95b7bed-a666-4a00-9332-2b528638503e} - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters deleted file mode 100644 index 170eada9a..000000000 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_all_c - - - decoder_all_c - - - decoder_ivas_c - - - decoder_all_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - - - {6d564218-e0e5-4a7b-80b3-6b10661ad36c} - - - {33d78f8d-2d43-40f5-a9b1-711097bd6746} - - - {044baa49-b157-45ed-8bec-29b6d7172e82} - - - {adc81a29-2517-49f0-819f-e8cea3d49ae3} - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters deleted file mode 100644 index e8f429f49..000000000 --- a/Workspace_msvc/lib_enc.vcxproj.filters +++ /dev/null @@ -1,638 +0,0 @@ - - - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_evs_c - - - encoder_ivas_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_all_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_ivas_c - - - encoder_all_c - - - - encoder_all_c - - - - - - encoder_h - - - encoder_h - - - encoder_h - - - encoder_h - - - encoder_h - - - encoder_all_c - - - - - {34137975-e4fd-40f0-938f-02fd46da5e22} - - - {c24a3dcd-cde3-411b-aecf-747c29d87668} - - - {e78e5d72-8d6d-4b00-a6e0-64a62c9cf8f2} - - - {597ebb71-22ba-41e8-b4bf-e8691bda2e5b} - - - \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters deleted file mode 100644 index 820a5c044..000000000 --- a/Workspace_msvc/lib_rend.vcxproj.filters +++ /dev/null @@ -1,152 +0,0 @@ - - - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - - - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - - - {54449ece-ef29-44b5-9512-ed8f555851a8} - - - {672b0eb6-cce8-425c-8bf2-aba4b45639bb} - - - \ No newline at end of file -- GitLab From 498a9068bae63cb56a87a585048fe3f0d428102c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 11:34:26 +0200 Subject: [PATCH 095/103] delete fileactive-macros in options.h for files with l*, m*, o*p* r* s* and in the files itself --- lib_com/low_rate_band_att_fx.c | 5 ----- lib_com/lpc_tools_fx.c | 6 ------ lib_com/lsf_tools_fx.c | 6 ------ lib_com/lsp_conv_poly_fx.c | 7 ------- lib_com/math_op.c | 6 ------ lib_com/modif_fs_fx.c | 6 ------ lib_com/oper_32b.c | 6 ------ lib_com/options.h | 23 +---------------------- lib_com/phase_dispersion_fx.c | 4 ---- lib_com/ppp_fx.c | 5 ----- lib_com/pred_lt4_fx.c | 6 ------ lib_com/pvq_com_fx.c | 7 ------- lib_com/residu_fx.c | 6 ------ lib_com/stat_noise_uv_mod_fx.c | 6 ------ lib_com/swb_tbe_com_fx.c | 6 ------ lib_com/syn_filt_fx.c | 6 ------ 16 files changed, 1 insertion(+), 110 deletions(-) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 1a6e91a22..8f05f18a4 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -8,11 +8,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif /*--------------------------------------------------------------------------* * fine_gain_pred() diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index b8267b53a..db8fc6d84 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -42,12 +42,6 @@ #include "rom_com.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local constants diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c5d20ef21..e168cd0f8 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -40,12 +40,6 @@ #include "ivas_error.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index ddd8f88f6..46fd9571a 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -9,13 +9,6 @@ #include "prot_fx.h" #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif - /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/math_op.c b/lib_com/math_op.c index caa17b3ae..24eb88278 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -23,12 +23,6 @@ #include #include -#ifndef ISSUE_1836_FILEACTIVE_math_op_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*___________________________________________________________________________ | | | Function Name : Isqrt | diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 60a15c5d0..1ad07ff66 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -15,12 +15,6 @@ #include "wmc_auto.h" -#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index 91e22a9d6..de733005e 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -27,12 +27,6 @@ #define WMC_TOOL_SKIP -#ifndef ISSUE_1836_FILEACTIVE_oper_32b_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /***************************************************************************** * * * Function L_Extract() * diff --git a/lib_com/options.h b/lib_com/options.h index fccb88f18..32db4b481 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -118,28 +118,7 @@ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ -#define ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c -#define ISSUE_1836_FILEACTIVE_lpc_tools_fx_c -#define ISSUE_1836_FILEACTIVE_lsf_tools_fx_c -#define ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c -#define ISSUE_1836_FILEACTIVE_math_op_c -#define ISSUE_1836_FILEACTIVE_math_op_h -#define ISSUE_1836_FILEACTIVE_modif_fs_fx_c - -#define ISSUE_1836_FILEACTIVE_oper_32b_c -#define ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c -#define ISSUE_1836_FILEACTIVE_ppp_fx_c -#define ISSUE_1836_FILEACTIVE_pred_lt4_fx_c -#define ISSUE_1836_FILEACTIVE_preemph_fx_c -#define ISSUE_1836_FILEACTIVE_prot_fx_h -#define ISSUE_1836_FILEACTIVE_pvq_com_fx_c - -#define ISSUE_1836_FILEACTIVE_residu_fx_c -#define ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c -#define ISSUE_1836_FILEACTIVE_swb_bwe_com_fx_c -#define ISSUE_1836_FILEACTIVE_swb_bwe_com_lr_fx_c -#define ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c -#define ISSUE_1836_FILEACTIVE_syn_filt_fx_c + #if 1 #define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 3679ed372..085c1808a 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -8,10 +8,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_phase_dispersion_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif #endif /*-----------------------------------------------------------------------* diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index 0fceb9165..734351199 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,11 +35,6 @@ #include "cnst.h" #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_ppp_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - #endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index c54ee5f39..f457e676f 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_pred_lt4_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*-------------------------------------------------------------------* * Function pred_lt4: * * ~~~~~~~~~ * diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 63eb26877..d53004f03 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -7,13 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ -#ifndef ISSUE_1836_FILEACTIVE_pvq_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - - /*! r: Approximate integer division for positive input using lookup table */ UWord32 intLimCDivPos_fx( UWord32 NUM, /* Qx */ diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index b1426dcb2..1de4fac6c 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -8,12 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_residu_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*--------------------------------------------------------------------* * residu_ivas_fx() * diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index cf4b5edc3..7624375d3 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -16,12 +16,6 @@ #define P1 ( 32768 - ISP_SMOOTHING_QUANT_A1_FX - 1 ) #define P9 ( 32767 - P1 ) -#ifndef ISSUE_1836_FILEACTIVE_stat_noise_uv_mod_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - /*---------------------------------------------------------* * Local functions *---------------------------------------------------------*/ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 301323dfc..67310a7c7 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,12 +12,6 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" -#ifndef ISSUE_1836_FILEACTIVE_swb_tbe_com_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ #define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 #define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 8b044f2f7..6f4eb8763 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -9,12 +9,6 @@ #include "prot_fx.h" #include "stl.h" -#ifndef ISSUE_1836_FILEACTIVE_syn_filt_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { #ifndef ISSUE_1836_replace_overflow_libcom -- GitLab From bbdcb9d63d9a8a4f3c6bad3b88872a5e2579d059 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 11:51:47 +0200 Subject: [PATCH 096/103] remove all FILEACTIVE macros --- lib_com/options.h | 14 -------------- lib_com/tcx_ltp_fx.c | 6 ------ lib_com/tcx_mdct_fx.c | 6 ------ lib_com/tcx_utils_fx.c | 6 ------ lib_com/tns_base.c | 7 ------- lib_com/tools_fx.c | 6 ------ 6 files changed, 45 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 32db4b481..3fa3ebcff 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -117,20 +117,6 @@ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ - - -#if 1 -#define ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c - -#define ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c -#define ISSUE_1836_FILEACTIVE_tcx_utils_fx_c -#define ISSUE_1836_FILEACTIVE_tns_base_c -#define ISSUE_1836_FILEACTIVE_tools_fx_c -#define ISSUE_1836_FILEACTIVE_weight_a_fx_c -#define ISSUE_1836_FILEACTIVE_wi_fx_c -#define ISSUE_1836_FILEACTIVE_window_fx_c -#endif - #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 0bf0fb1c9..b3fe52dd6 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -8,12 +8,6 @@ #include "basop_util.h" #include "rom_com.h" -#ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 8ef395423..135e54af8 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -8,12 +8,6 @@ #include "prot_fx.h" #include "basop_util.h" -#ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index e86f48eed..fa0f7a9df 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -12,12 +12,6 @@ #define inv_int InvIntTable -#ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*-------------------------------------------------------------------* * getInvFrameLen() * diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 35394f8f9..ab5b41038 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -21,13 +21,6 @@ #define HLM_MIN_NRG_FX 32768 /*Q0*/ #define MAX_SUBDIVISIONS 3 - -#ifndef ISSUE_1836_FILEACTIVE_tns_base_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif - -#endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 0e11980cd..cae17e24d 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -52,12 +52,6 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#ifndef ISSUE_1836_FILEACTIVE_tools_fx_c -#ifdef ISSUE_1836_replace_overflow_libcom -#undef ISSUE_1836_replace_overflow_libcom -#endif -#endif - #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ -- GitLab From aa92c130dd178ba559f738bd236b9dbfe905c4f8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 12:13:50 +0200 Subject: [PATCH 097/103] fix builderrors --- lib_com/phase_dispersion_fx.c | 1 - lib_com/ppp_fx.c | 1 - 2 files changed, 2 deletions(-) diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 085c1808a..b937d0fcf 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -9,7 +9,6 @@ #include "rom_com.h" -#endif /*-----------------------------------------------------------------------* * phase_dispersion: * diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index 734351199..56cde5456 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "prot_fx.h" -#endif /*===================================================================*/ /* FUNCTION : Interpol_delay_fx () */ /*-------------------------------------------------------------------*/ -- GitLab From 8c27efb090a83e56b83a48214627bba88f619657 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 13:33:05 +0200 Subject: [PATCH 098/103] Revert "stop tracking vcxproj.filters" This reverts commit 1438065b54bf2ee009518b8659c63683a429b654. --- Workspace_msvc/lib_com.vcxproj.filters | 646 ++++++++++++++++++++++++ Workspace_msvc/lib_dec.vcxproj.filters | 566 +++++++++++++++++++++ Workspace_msvc/lib_enc.vcxproj.filters | 638 +++++++++++++++++++++++ Workspace_msvc/lib_rend.vcxproj.filters | 152 ++++++ 4 files changed, 2002 insertions(+) create mode 100644 Workspace_msvc/lib_com.vcxproj.filters create mode 100644 Workspace_msvc/lib_dec.vcxproj.filters create mode 100644 Workspace_msvc/lib_enc.vcxproj.filters create mode 100644 Workspace_msvc/lib_rend.vcxproj.filters diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters new file mode 100644 index 000000000..f247d199e --- /dev/null +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -0,0 +1,646 @@ + + + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_evs_c + + + common_all_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_ivas_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_ivas_c + + + + common_ivas_c + + + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + + common_h + + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + + + {890c2f45-9385-4fce-859b-6a65469e8dc0} + + + {201ea764-9626-4dca-9cc4-5b4106f8b8b2} + + + {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c} + + + {b95b7bed-a666-4a00-9332-2b528638503e} + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters new file mode 100644 index 000000000..170eada9a --- /dev/null +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -0,0 +1,566 @@ + + + + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_all_c + + + decoder_all_c + + + decoder_ivas_c + + + decoder_all_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + + + {6d564218-e0e5-4a7b-80b3-6b10661ad36c} + + + {33d78f8d-2d43-40f5-a9b1-711097bd6746} + + + {044baa49-b157-45ed-8bec-29b6d7172e82} + + + {adc81a29-2517-49f0-819f-e8cea3d49ae3} + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters new file mode 100644 index 000000000..e8f429f49 --- /dev/null +++ b/Workspace_msvc/lib_enc.vcxproj.filters @@ -0,0 +1,638 @@ + + + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_evs_c + + + encoder_ivas_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_all_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_ivas_c + + + encoder_all_c + + + + encoder_all_c + + + + + + encoder_h + + + encoder_h + + + encoder_h + + + encoder_h + + + encoder_h + + + encoder_all_c + + + + + {34137975-e4fd-40f0-938f-02fd46da5e22} + + + {c24a3dcd-cde3-411b-aecf-747c29d87668} + + + {e78e5d72-8d6d-4b00-a6e0-64a62c9cf8f2} + + + {597ebb71-22ba-41e8-b4bf-e8691bda2e5b} + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters new file mode 100644 index 000000000..820a5c044 --- /dev/null +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -0,0 +1,152 @@ + + + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + + + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + + + {54449ece-ef29-44b5-9512-ed8f555851a8} + + + {672b0eb6-cce8-425c-8bf2-aba4b45639bb} + + + \ No newline at end of file -- GitLab From 31efe98ae226351277871693dd747a4ba389801a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 13:39:50 +0200 Subject: [PATCH 099/103] add vcxproj files again --- Workspace_msvc/decoder.vcxproj | 176 ++++++++++++ Workspace_msvc/encoder.vcxproj | 178 ++++++++++++ Workspace_msvc/isar_post_rend.vcxproj | 179 +++++++++++++ Workspace_msvc/lib_com.vcxproj | 346 ++++++++++++++++++++++++ Workspace_msvc/lib_debug.vcxproj | 121 +++++++++ Workspace_msvc/lib_dec.vcxproj | 351 ++++++++++++++++++++++++ Workspace_msvc/lib_enc.vcxproj | 371 ++++++++++++++++++++++++++ Workspace_msvc/lib_isar.vcxproj | 184 +++++++++++++ Workspace_msvc/lib_lc3plus.vcxproj | 201 ++++++++++++++ Workspace_msvc/lib_rend.vcxproj | 210 +++++++++++++++ Workspace_msvc/lib_util.vcxproj | 161 +++++++++++ Workspace_msvc/renderer.vcxproj | 183 +++++++++++++ 12 files changed, 2661 insertions(+) create mode 100644 Workspace_msvc/decoder.vcxproj create mode 100644 Workspace_msvc/encoder.vcxproj create mode 100644 Workspace_msvc/isar_post_rend.vcxproj create mode 100644 Workspace_msvc/lib_com.vcxproj create mode 100644 Workspace_msvc/lib_debug.vcxproj create mode 100644 Workspace_msvc/lib_dec.vcxproj create mode 100644 Workspace_msvc/lib_enc.vcxproj create mode 100644 Workspace_msvc/lib_isar.vcxproj create mode 100644 Workspace_msvc/lib_lc3plus.vcxproj create mode 100644 Workspace_msvc/lib_rend.vcxproj create mode 100644 Workspace_msvc/lib_util.vcxproj create mode 100644 Workspace_msvc/renderer.vcxproj diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj new file mode 100644 index 000000000..cbfca4f1f --- /dev/null +++ b/Workspace_msvc/decoder.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + decoder + {E3DCBC31-7FC9-D127-E000-529F8460D5FD} + decoder + 10.0 + + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_dec + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_dec + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + + + {e822ddaf-0f5f-4cd0-a694-38ae69de74d3} + false + + + {869a305e-d99e-4c3a-bdb3-aa57abcce619} + + + {2fa8f384-0775-f3b7-f8c3-85209222fc70} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj new file mode 100644 index 000000000..4d7b18be4 --- /dev/null +++ b/Workspace_msvc/encoder.vcxproj @@ -0,0 +1,178 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + encoder + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} + encoder + 10.0 + + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_cod + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_cod + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + false + true + $(IntDir)$(ProjectName).pdb + Console + + false + + MachineX86 + + + + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + + + + {824da4cf-06f0-45c9-929a-8792f0e19c3e} + false + + + {2fa8f384-0775-f3b7-f8c3-85209222fc70} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/isar_post_rend.vcxproj b/Workspace_msvc/isar_post_rend.vcxproj new file mode 100644 index 000000000..f5bf055e2 --- /dev/null +++ b/Workspace_msvc/isar_post_rend.vcxproj @@ -0,0 +1,179 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + isar_post_rend + {12374ADC-0E5C-4FDD-B903-71D572413831} + isar_post_rend + 10.0 + + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + ISAR_post_rend + + + ..\ + .\Release_$(ProjectName)\ + false + false + ISAR_post_rend + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + false + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + false + + + {869a305e-d99e-4c3a-bdb3-aa57abcce619} + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + false + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj new file mode 100644 index 000000000..273c31c9d --- /dev/null +++ b/Workspace_msvc/lib_com.vcxproj @@ -0,0 +1,346 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {39EC200D-7795-4FF8-B214-B24EDA5526AE} + common + 10.0 + + + + StaticLibrary + v143 + false + MultiByte + + + StaticLibrary + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivascom + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivascom + + + + + + + Disabled + ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions); + + EnableFastChecks + MultiThreadedDebug + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj new file mode 100644 index 000000000..853de36c6 --- /dev/null +++ b/Workspace_msvc/lib_debug.vcxproj @@ -0,0 +1,121 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + debug + 10.0 + + + + StaticLibrary + v143 + MultiByte + + + StaticLibrary + v143 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivasdebug + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivasdebug + + + + + + + Disabled + ..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;DBG_WAV_WRITER;$(Macros);%(PreprocessorDefinitions) + false + + EnableFastChecks + MultiThreadedDebug + false + $(IntDir)$(ProjectName).pdb + Level4 + OldStyle + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + MaxSpeed + AnySuitable + false + false + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + $(IntDir)$(ProjectName).pdb + Level4 + + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj new file mode 100644 index 000000000..3b27d2c53 --- /dev/null +++ b/Workspace_msvc/lib_dec.vcxproj @@ -0,0 +1,351 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_dec + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} + evs_dec + 10.0 + + + StaticLibrary + v143 + false + MultiByte + + + + StaticLibrary + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasdec + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasdec + + + + + + + .\Debug\$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + false + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + {718DE063-A18B-BB72-9150-62B892E6FFA6} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj new file mode 100644 index 000000000..d2a8ca264 --- /dev/null +++ b/Workspace_msvc/lib_enc.vcxproj @@ -0,0 +1,371 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_enc + {824DA4CF-06F0-45C9-929A-8792F0E19C3E} + evs_enc + 10.0 + + + + StaticLibrary + v143 + false + MultiByte + + + StaticLibrary + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasenc + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasenc + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj new file mode 100644 index 000000000..bec9ea98a --- /dev/null +++ b/Workspace_msvc/lib_isar.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_isar + {869A305E-D99E-4C3A-BDB3-AA57ABCCE619} + isar + 10.0 + + + + StaticLibrary + v143 + false + MultiByte + + + StaticLibrary + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libisar + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libisar + + + + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions); + + EnableFastChecks + MultiThreadedDebug + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + {95030B82-70CD-4C6B-84D4-61096035BEA2} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj new file mode 100644 index 000000000..c28f2ad13 --- /dev/null +++ b/Workspace_msvc/lib_lc3plus.vcxproj @@ -0,0 +1,201 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {95030B82-70CD-4C6B-84D4-61096035BEA2} + Win32Proj + LC3_FL + 10.0 + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + v143 + + + v143 + + + + + + + + + + + + + + + liblc3plus + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + + + LC3plus + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + + + + + + Level3 + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + Disabled + MultiThreadedDebug + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4305;4244;4996 + OldStyle + false + false + + + Console + true + + + + + Level3 + + + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4244;4305;4996 + false + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj new file mode 100644 index 000000000..5bdebdb07 --- /dev/null +++ b/Workspace_msvc/lib_rend.vcxproj @@ -0,0 +1,210 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_rend + {718DE063-A18B-BB72-9150-62B892E6FFA6} + evs_dec + 10.0 + + + StaticLibrary + v143 + false + MultiByte + + + + StaticLibrary + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasrend + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasrend + + + + + + + .\Debug\$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + {95030B82-70CD-4C6B-84D4-61096035BEA2} + false + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj new file mode 100644 index 000000000..9c987255e --- /dev/null +++ b/Workspace_msvc/lib_util.vcxproj @@ -0,0 +1,161 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + utility + 10.0 + + + + StaticLibrary + v143 + MultiByte + + + StaticLibrary + v143 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + true + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivasutil + + + false + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivasutil + + + + Disabled + ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) + false + + EnableFastChecks + MultiThreadedDebug + false + $(IntDir)$(ProjectName).pdb + Level4 + OldStyle + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + MaxSpeed + AnySuitable + false + false + ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + $(IntDir)$(ProjectName).pdb + Level4 + + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj new file mode 100644 index 000000000..39bea5cfb --- /dev/null +++ b/Workspace_msvc/renderer.vcxproj @@ -0,0 +1,183 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + renderer + {12B4C8A5-1E06-4E30-B443-D1F916F52B47} + renderer + 10.0 + + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_rend + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_rend + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + false + + + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} + false + + + {869a305e-d99e-4c3a-bdb3-aa57abcce619} + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + false + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {718DE063-A18B-BB72-9150-62B892E6FFA6} + false + + + + + + + + + + + \ No newline at end of file -- GitLab From 31bc406e10f80166e36ce448f8bd08eba5794c42 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 11:43:50 +0000 Subject: [PATCH 100/103] revert vcxproj changes --- Workspace_msvc/decoder.vcxproj | 8 ++++---- Workspace_msvc/encoder.vcxproj | 6 +++--- Workspace_msvc/isar_post_rend.vcxproj | 6 +++--- Workspace_msvc/lib_com.vcxproj | 6 +++--- Workspace_msvc/lib_debug.vcxproj | 6 +++--- Workspace_msvc/lib_dec.vcxproj | 6 +++--- Workspace_msvc/lib_enc.vcxproj | 6 +++--- Workspace_msvc/lib_isar.vcxproj | 6 +++--- Workspace_msvc/lib_lc3plus.vcxproj | 12 +++--------- Workspace_msvc/lib_rend.vcxproj | 10 +++++----- Workspace_msvc/lib_util.vcxproj | 10 +++++----- Workspace_msvc/renderer.vcxproj | 8 ++++---- 12 files changed, 42 insertions(+), 48 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index cbfca4f1f..3ab058c29 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -14,18 +14,18 @@ decoder {E3DCBC31-7FC9-D127-E000-529F8460D5FD} decoder - 10.0 + 10.0.17763.0 Application - v143 + v141 false MultiByte Application - v143 + v141 false MultiByte @@ -159,7 +159,7 @@ {869a305e-d99e-4c3a-bdb3-aa57abcce619} - + {2fa8f384-0775-f3b7-f8c3-85209222fc70} false diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index 4d7b18be4..9578e488d 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -14,18 +14,18 @@ encoder {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} encoder - 10.0 + 10.0.17763.0 Application - v143 + v141 false MultiByte Application - v143 + v141 false MultiByte diff --git a/Workspace_msvc/isar_post_rend.vcxproj b/Workspace_msvc/isar_post_rend.vcxproj index f5bf055e2..19cb1aff7 100644 --- a/Workspace_msvc/isar_post_rend.vcxproj +++ b/Workspace_msvc/isar_post_rend.vcxproj @@ -14,18 +14,18 @@ isar_post_rend {12374ADC-0E5C-4FDD-B903-71D572413831} isar_post_rend - 10.0 + 10.0.17763.0 Application - v143 + v141 false MultiByte Application - v143 + v141 false MultiByte diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 273c31c9d..8e37844b9 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -13,18 +13,18 @@ {39EC200D-7795-4FF8-B214-B24EDA5526AE} common - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 false MultiByte StaticLibrary - v143 + v141 false MultiByte diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 853de36c6..929dd72a8 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -13,17 +13,17 @@ {54509728-928B-44D9-A118-A6F92F08B34F} debug - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 MultiByte StaticLibrary - v143 + v141 MultiByte true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 3b27d2c53..e5998e672 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -14,18 +14,18 @@ lib_dec {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} evs_dec - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 false MultiByte StaticLibrary - v143 + v141 false MultiByte diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index d2a8ca264..123754142 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -14,18 +14,18 @@ lib_enc {824DA4CF-06F0-45C9-929A-8792F0E19C3E} evs_enc - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 false MultiByte StaticLibrary - v143 + v141 false MultiByte diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj index bec9ea98a..cdc0979a0 100644 --- a/Workspace_msvc/lib_isar.vcxproj +++ b/Workspace_msvc/lib_isar.vcxproj @@ -14,18 +14,18 @@ lib_isar {869A305E-D99E-4C3A-BDB3-AA57ABCCE619} isar - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 false MultiByte StaticLibrary - v143 + v141 false MultiByte diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj index c28f2ad13..22b5cddd3 100644 --- a/Workspace_msvc/lib_lc3plus.vcxproj +++ b/Workspace_msvc/lib_lc3plus.vcxproj @@ -22,28 +22,22 @@ {95030B82-70CD-4C6B-84D4-61096035BEA2} Win32Proj LC3_FL - 10.0 + 10.0.17763.0 StaticLibrary true - v143 + v141 Unicode StaticLibrary false - v143 + v141 true Unicode - - v143 - - - v143 - diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 5bdebdb07..f93b5f26d 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -14,18 +14,18 @@ lib_rend {718DE063-A18B-BB72-9150-62B892E6FFA6} evs_dec - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 false MultiByte StaticLibrary - v143 + v141 false MultiByte @@ -197,7 +197,7 @@ {95030B82-70CD-4C6B-84D4-61096035BEA2} false - + @@ -207,4 +207,4 @@ - \ No newline at end of file + diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 9c987255e..ceb342b21 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -13,17 +13,17 @@ {2FA8F384-0775-F3B7-F8C3-85209222FC70} utility - 10.0 + 10.0.17763.0 StaticLibrary - v143 + v141 MultiByte StaticLibrary - v143 + v141 MultiByte true @@ -121,7 +121,7 @@ - + @@ -148,7 +148,7 @@ - + diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 39bea5cfb..1bc5b5568 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -14,18 +14,18 @@ renderer {12B4C8A5-1E06-4E30-B443-D1F916F52B47} renderer - 10.0 + 10.0.17763.0 Application - v143 + v141 false MultiByte Application - v143 + v141 false MultiByte @@ -158,7 +158,7 @@ {869a305e-d99e-4c3a-bdb3-aa57abcce619} - + {2FA8F384-0775-F3B7-F8C3-85209222FC70} false -- GitLab From cb29d449848e1549f58f4e949359a673587b92a5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 13:34:59 +0000 Subject: [PATCH 101/103] fix bild error --- lib_com/lpc_tools_fx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index db8fc6d84..afd98a889 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -609,7 +609,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -826,7 +826,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -903,7 +903,6 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -# #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; @@ -1045,7 +1044,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ -- GitLab From 3e1d4a77ffcd517b0cbfcba4eda0a25ea36bd84c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 12 Aug 2025 16:13:51 +0200 Subject: [PATCH 102/103] clang format patch --- lib_com/lpc_tools_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index afd98a889..26c663135 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -609,7 +609,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -826,7 +826,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ @@ -1044,7 +1044,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ + t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ -- GitLab From 658f222ec6e816be522dd8f7f310b2b3469b9168 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 13 Aug 2025 20:58:14 +0200 Subject: [PATCH 103/103] merge from main --- lib_com/options.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index a2a3dbab9..84ce4e93f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -84,7 +84,8 @@ #define FIX_1762_COMPILER_ISSUE_NEW /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ #define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/ #define ISSUE_1799_replace_L_shr_o /* FhG: replace by non-overflow-alternative - BE */ -#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ +#define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives - BE */ +#define ISSUE_1866_replace_overflow_libdec /* FhG: BE - Replace BASOPoverflow operators all over the lib_dec module if Overflow result is not used */ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ -- GitLab