From c85e4f67ed29384cc0fa3bb7f4b8fa4a7ed0ade4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 07:41:37 +0200 Subject: [PATCH 01/29] added macro ISSUE_xxxx_replace_shl_o and some changes in c files --- lib_com/arith_coder_fx.c | 4 ++++ lib_com/bitalloc_fx.c | 4 ++++ lib_com/codec_tcx_common_fx.c | 14 ++++++++++++++ lib_com/env_stab_fx.c | 4 ++++ lib_com/options.h | 1 + 5 files changed, 27 insertions(+) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 846b4dcea..7f0164038 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -271,7 +271,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_xxxx_replace_shl_o + 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; diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 30ae2d47b..099f13854 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -442,7 +442,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*/ +#ifdef ISSUE_xxxx_replace_shl_o + 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/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 52c7d0614..e86764294 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -139,7 +139,11 @@ void tcxFormantEnhancement( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_xxxx_replace_shl_o + 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 +231,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_xxxx_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ @@ -309,7 +315,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_xxxx_replace_shl_o + 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 +364,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_xxxx_replace_shl_o + 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/env_stab_fx.c b/lib_com/env_stab_fx.c index a3140b4e4..b6a66b38f 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -85,9 +85,13 @@ Word16 env_stability_fx( /* in Q15 */ mem_norm[i] = ynrm[i]; move16(); } +#ifndef ISSUE_xxxx_replace_shl_o Overflow = 0; move16(); env_delta = shl_o( *mem_env_delta, 1, &Overflow ); +#else + env_delta = shl_sat( *mem_env_delta, 1 ); +#endif } ELSE { diff --git a/lib_com/options.h b/lib_com/options.h index d1b3cb63e..4437d8953 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -110,5 +110,6 @@ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ +#define ISSUE_xxxx_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ #endif -- GitLab From 40d684c4f05c27df74ede9507ba1b9f58e18d02e Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 07:42:22 +0200 Subject: [PATCH 02/29] renamed macro ISSUE_xxxx_replace_shl_o to ISSUE_1796... --- lib_com/arith_coder_fx.c | 2 +- lib_com/bitalloc_fx.c | 2 +- lib_com/codec_tcx_common_fx.c | 8 ++++---- lib_com/env_stab_fx.c | 2 +- lib_com/options.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 7f0164038..7551bd41a 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -271,7 +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_xxxx_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o 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 */ diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 099f13854..c01b08fb6 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -442,7 +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_xxxx_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ #else m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index e86764294..399ae64c5 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -139,7 +139,7 @@ void tcxFormantEnhancement( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_xxxx_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o 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 ) ); @@ -231,7 +231,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_xxxx_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -315,7 +315,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_xxxx_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o 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 ) ); @@ -364,7 +364,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_xxxx_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o 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/env_stab_fx.c b/lib_com/env_stab_fx.c index b6a66b38f..2e71443ca 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -85,7 +85,7 @@ Word16 env_stability_fx( /* in Q15 */ mem_norm[i] = ynrm[i]; move16(); } -#ifndef ISSUE_xxxx_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o Overflow = 0; move16(); env_delta = shl_o( *mem_env_delta, 1, &Overflow ); diff --git a/lib_com/options.h b/lib_com/options.h index 4437d8953..62b4a4764 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -110,6 +110,6 @@ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ -#define ISSUE_xxxx_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ +#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ #endif -- GitLab From b8e2c483843b350f0d9ee6f3122d11a770b3461e Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 08:51:11 +0200 Subject: [PATCH 03/29] some replacements shl_o -> shl_sat --- lib_com/fd_cng_com_fx.c | 10 ++++++++-- lib_com/gs_gains_fx.c | 8 ++++++++ lib_com/gs_noisefill_fx.c | 18 ++++++++++++++++++ lib_com/hq2_core_com_fx.c | 8 ++++++++ lib_com/hq2_noise_inject_fx.c | 4 ++++ lib_com/ifft_rel_fx.c | 20 ++++++++++++++++++++ lib_com/lsf_tools_fx.c | 14 ++++++++++++++ lib_com/lsp_conv_poly_fx.c | 4 ++++ lib_com/math_op.c | 12 ++++++++++-- 9 files changed, 94 insertions(+), 4 deletions(-) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 7cc536822..b8de1fcf4 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2279,10 +2279,12 @@ static void getmidbands( ) { Word16 j, max_psize, shift; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif max_psize = psize[0]; @@ -2316,8 +2318,12 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { - psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) - move16(); +#ifdef ISSUE_1796_replace_shl_o + 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 */ assert( norm_s( -max_psize ) >= 9 ); diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index f28af742f..79fba1eac 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -126,7 +126,11 @@ 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 + 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 ) ); @@ -208,7 +212,11 @@ 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 + 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 ) ); diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 208f20569..38df4f160 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -528,9 +528,11 @@ static void envelop_modify_fx( Word16 weight_fx; Word32 L_exc_diffQ_fx[L_FRAME16k], exc_diffQ_max; Word16 Q_tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif start_band = i_mult( last_bin, 16 ); @@ -565,7 +567,11 @@ 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 */ +#else Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ +#endif FOR( j = 0; j < 16; j++ ) { @@ -591,7 +597,11 @@ 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 */ +#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++ ) @@ -708,7 +718,11 @@ 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 ); +#else tmp1 = shl_o( tmp, exp, &Overflow ); +#endif move16(); ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ } @@ -1086,7 +1100,11 @@ 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 ); +#else tmp1 = shl_o( tmp, exp, &Overflow ); +#endif move16(); ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ } diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index bf0af5e87..9017903c8 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -163,7 +163,11 @@ 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 */ +#else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ +#endif Overflow = 0; move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) @@ -335,7 +339,11 @@ 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 */ +#else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ +#endif Overflow = 0; move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index bc96fe0f8..8088a213c 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -608,7 +608,11 @@ 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) */ +#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 diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index 9e64a4e25..5d1c5c2ad 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -111,11 +111,23 @@ void ifft_rel_fx( 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(); IF( NE_16( n4, 1 ) ) @@ -127,9 +139,17 @@ 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(); } xi1 += id; diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index a41e10713..361f43abc 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -989,7 +989,17 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /*b = -2.0f * *plsp;*/ b = *plsp; move16(); +#ifdef ISSUE_1796_replace_shl_o + m2 = shl_sat( -2, sub( 15, Q_out ) ); + + /* There's only 1 integer x to solve -32768 = x * 2^y, if y is an integer : x= -1, y = 15 . + * y = 15 is possible if Q_out is 0, but x = -1 is impossible, because x is set to -2 . + * so we can assume a saturated overflow, if -2 * 2^y = -32768 . + */ + Overflow = ( m2 == MIN_16 ) ? 1 : 0; +#else m2 = shl_o( -2, sub( 15, Q_out ), &Overflow ); +#endif f[1] = L_mult_o( b, m2, &Overflow ); move32(); @@ -2314,7 +2324,11 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ +#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 */ +#endif tmp = s_max( tmp, 0 ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 4f493cacd..fe6ac4f7c 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -345,7 +345,11 @@ 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 ); +#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*/ diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 7014988b8..dab86844a 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -256,12 +256,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val } IF( expi > 0 ) { +#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++ ) { - tmp = shl_o( x[i], expi, &Overflow ); - L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); +#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 ); } } -- GitLab From d72585167aac52d9f6c5f36d4940f276f1a74a25 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 08:55:14 +0200 Subject: [PATCH 04/29] some replacements shl_o -> shl_sat --- lib_com/modif_fs_fx.c | 18 +++++++++++++----- lib_com/residu_fx.c | 4 ++++ lib_com/stat_noise_uv_mod_fx.c | 16 ++++++++++++++++ lib_com/swb_bwe_com_lr_fx.c | 12 ++++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index a9b6581ed..a50638eaf 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -277,9 +277,13 @@ 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 ) ) ) { - num_den = shl_o( num_den, 1, &Overflow ); - *Q_new_inp = add( *Q_new_inp, 1 ); - move16(); +#ifdef ISSUE_1796_replace_shl_o + num_den = shl_sat( num_den, 1 ); +#else + num_den = shl_o( num_den, 1, &Overflow ); +#endif + *Q_new_inp = add( *Q_new_inp, 1 ); + move16(); } FOR( i = 0; i < lg_out; i++ ) { @@ -557,9 +561,13 @@ 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 - num_den = shl_o( num_den, 1, &Overflow ); +#ifdef ISSUE_1796_replace_shl_o + num_den = shl_sat( num_den, 1 ); +#else + num_den = shl_o( num_den, 1, &Overflow ); +#endif #else - num_den = shl( num_den, 1 ); + num_den = shl( num_den, 1 ); #endif } FOR( i = 0; i < lg_out; i++ ) diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 32d18d1fe..dcfec0856 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -72,7 +72,11 @@ void Residu3_lc_fx( { q = add( q, shift ); } +#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++ ) diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index c259745f2..adaa988e2 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -161,7 +161,11 @@ 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 */ +#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 +190,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_1796_replace_shl_o + tmp_res = shl_sat( tmp_res, tmp_shift ); +#else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); +#endif alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); *act_count = 0; @@ -467,7 +475,11 @@ 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 */ +#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 +504,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_1796_replace_shl_o + tmp_res = shl_sat( tmp_res, tmp_shift ); +#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_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 8fd876f1c..00202f0cd 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -2338,7 +2338,11 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); +#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 ); +#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]); */ @@ -3246,7 +3250,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_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 move16(); } p_L_En++; @@ -3316,7 +3324,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_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 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) */ -- GitLab From 82a26d78d8ed7cd12f14fdd8cc5de81e5004faf8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 08:56:58 +0200 Subject: [PATCH 05/29] buildfix --- lib_com/gs_noisefill_fx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 38df4f160..8b89796d4 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -528,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_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); -#endif #endif start_band = i_mult( last_bin, 16 ); -- GitLab From 094d6979e1663ea7cb8c5c7d0517be5e6a75efc1 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 08:59:34 +0200 Subject: [PATCH 06/29] warnings --- lib_com/modif_fs_fx.c | 4 ++++ lib_com/swb_bwe_com_lr_fx.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index a50638eaf..ff8c8116a 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -75,9 +75,11 @@ 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 #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Resampling_cfg *cfg_ptr_fx; @@ -362,9 +364,11 @@ 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 #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif const Resampling_cfg *cfg_ptr_fx; diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 00202f0cd..78422a292 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -3213,9 +3213,11 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; +#ifndef ISSUE_1796_replace_shl_o #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 ); -- GitLab From ff2410fe181613d90c235f990266464d3e4c1a92 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 09:00:28 +0200 Subject: [PATCH 07/29] clang patch --- lib_com/bitalloc_fx.c | 4 ++-- lib_com/fd_cng_com_fx.c | 6 +++--- lib_com/gs_gains_fx.c | 16 ++++++++-------- lib_com/gs_noisefill_fx.c | 2 +- lib_com/hq2_noise_inject_fx.c | 2 +- lib_com/ifft_rel_fx.c | 8 ++++---- lib_com/lsf_tools_fx.c | 6 +++--- lib_com/math_op.c | 8 ++++---- lib_com/modif_fs_fx.c | 14 +++++++------- lib_com/stat_noise_uv_mod_fx.c | 4 ++-- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index c01b08fb6..7b768cbcb 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -443,9 +443,9 @@ Word16 BitAllocF_fx( 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 - m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ + m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ #else - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ + m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ #endif if ( L_tmp1 < 0 ) { diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index b8de1fcf4..7420a4457 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2319,11 +2319,11 @@ static void getmidbands( FOR( j = 0; j < npart; j++ ) { #ifdef ISSUE_1796_replace_shl_o - psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp) + 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) + psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) #endif - move16(); + move16(); } /* minimum_statistics needs fixed exponent of 6 */ assert( norm_s( -max_psize ) >= 9 ); diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 79fba1eac..d49a786f2 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -205,19 +205,19 @@ 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_1796_replace_shl_o 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 */ + move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 8b89796d4..53fb67601 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -598,7 +598,7 @@ static void envelop_modify_fx( #ifdef ISSUE_1796_replace_shl_o Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ #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]; diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 8088a213c..fdd0d6d71 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -613,7 +613,7 @@ void hq2_noise_inject_fx( #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 = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE { diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index 5d1c5c2ad..b372e15f3 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -114,19 +114,19 @@ void ifft_rel_fx( #ifdef ISSUE_1796_replace_shl_o *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ #else - *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ + *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*/ + *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*/ + *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ #endif move16(); @@ -148,7 +148,7 @@ void ifft_rel_fx( #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*/ + *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ #endif move16(); } diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 361f43abc..68ede5413 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -991,12 +991,12 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons move16(); #ifdef ISSUE_1796_replace_shl_o m2 = shl_sat( -2, sub( 15, Q_out ) ); - + /* There's only 1 integer x to solve -32768 = x * 2^y, if y is an integer : x= -1, y = 15 . * y = 15 is possible if Q_out is 0, but x = -1 is impossible, because x is set to -2 . * so we can assume a saturated overflow, if -2 * 2^y = -32768 . */ - Overflow = ( m2 == MIN_16 ) ? 1 : 0; + Overflow = ( m2 == MIN_16 ) ? 1 : 0; #else m2 = shl_o( -2, sub( 15, Q_out ), &Overflow ); #endif @@ -2323,7 +2323,7 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ e = sub( 30 - 21 - 1, e ); tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ - tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ + tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ #else diff --git a/lib_com/math_op.c b/lib_com/math_op.c index dab86844a..74143b8ed 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -257,7 +257,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val IF( expi > 0 ) { #ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( x[0], expi ); + tmp = shl_sat( x[0], expi ); #else tmp = shl_o( x[0], expi, &Overflow ); #endif @@ -265,11 +265,11 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( x[i], expi ); + tmp = shl_sat( x[i], expi ); #else - tmp = shl_o( x[i], expi, &Overflow ); + tmp = shl_o( x[i], expi, &Overflow ); #endif - L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); + L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } } diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index ff8c8116a..5e8f02e09 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -280,12 +280,12 @@ 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_1796_replace_shl_o - num_den = shl_sat( num_den, 1 ); + num_den = shl_sat( num_den, 1 ); #else - num_den = shl_o( num_den, 1, &Overflow ); + num_den = shl_o( num_den, 1, &Overflow ); #endif - *Q_new_inp = add( *Q_new_inp, 1 ); - move16(); + *Q_new_inp = add( *Q_new_inp, 1 ); + move16(); } FOR( i = 0; i < lg_out; i++ ) { @@ -566,12 +566,12 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ { #ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef ISSUE_1796_replace_shl_o - num_den = shl_sat( num_den, 1 ); + num_den = shl_sat( num_den, 1 ); #else - num_den = shl_o( num_den, 1, &Overflow ); + num_den = shl_o( num_den, 1, &Overflow ); #endif #else - num_den = shl( num_den, 1 ); + num_den = shl( num_den, 1 ); #endif } FOR( i = 0; i < lg_out; i++ ) diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index adaa988e2..8d1236b53 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -160,7 +160,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_1796_replace_shl_o exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #else @@ -474,7 +474,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_1796_replace_shl_o exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #else -- GitLab From 02578ff77366d2f49da0a533f9d6953eccd6237a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 09:13:58 +0200 Subject: [PATCH 08/29] warnings --- lib_com/bitalloc_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 7b768cbcb..3bb0cbd72 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -245,9 +245,11 @@ Word16 BitAllocF_fx( Word16 tmp, exp1, exp2; Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */ Word16 B_w16_fx; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif set32_fx( Rsubband_w32_fx, 0, NB_SFM ); -- GitLab From c99450143b6299c9fe0eb90713244e2c596d0207 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 10:25:42 +0200 Subject: [PATCH 09/29] some replacements shl_o -> shl_sat --- lib_com/codec_tcx_common_fx.c | 2 + lib_com/swb_tbe_com_fx.c | 68 +++++++++++++++++++++++++----- lib_com/tools_fx.c | 40 +++++++++++++++--- lib_com/wi_fx.c | 24 +++++++++++ lib_com/window_fx.c | 4 ++ lib_dec/FEC_HQ_core_fx.c | 26 ++++++++++++ lib_dec/FEC_fx.c | 23 ++++++++++ lib_dec/LD_music_post_filter_fx.c | 6 +++ 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/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 | 8 ++++ lib_enc/cod_tcx_fx.c | 22 ++++++++++ lib_enc/core_enc_ol_fx.c | 4 ++ lib_enc/enc_acelp_fx.c | 10 +++++ lib_enc/enc_higher_acelp_fx.c | 8 ++++ lib_enc/enc_pit_exc_fx.c | 8 ++++ lib_enc/hvq_enc_fx.c | 8 ++++ lib_enc/lp_exc_e_fx.c | 11 +++++ 28 files changed, 347 insertions(+), 17 deletions(-) diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 399ae64c5..683e1e8d4 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -61,9 +61,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_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 8ddfa3e5f..020685354 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -996,7 +996,9 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; +#endif move32(); @@ -1038,7 +1040,11 @@ 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 ); +#else sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); +#endif move16(); /*Q12 */ } @@ -1537,8 +1543,12 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 - move16(); /* Q14 */ +#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 + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1618,9 +1628,13 @@ void GenShapedWBExcitation_ivas_fx( test(); IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { - /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ - tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); + /*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 ); +#else + tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); +#endif } ELSE { @@ -1789,8 +1803,12 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { - excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); - move16(); /* Q14 */ +#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 + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1872,9 +1890,13 @@ void GenShapedWBExcitation_fx( test(); IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { - /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ - tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); + /*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 ); +#else + tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); +#endif } ELSE { @@ -5776,7 +5798,11 @@ 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 + scale_step = shl_sat( tmp, exp ); /* Q14 */ +#else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ +#endif } } @@ -5854,7 +5880,11 @@ 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 + scale_step = shl_sat( tmp, exp ); /*Q14 */ +#else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ +#endif } } @@ -6028,7 +6058,11 @@ void non_linearity_ivas_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 + scale_step = shl_sat( tmp, exp ); /* Q14 */ +#else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ +#endif } } @@ -6106,7 +6140,11 @@ void non_linearity_ivas_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 + scale_step = shl_sat( tmp, exp ); /*Q14 */ +#else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ +#endif } } @@ -7043,7 +7081,11 @@ 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 */ +#else pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ +#endif test(); test(); @@ -7156,8 +7198,10 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif /* Smoothen tilt value */ @@ -7185,7 +7229,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_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 return formant_fac; /*Q15 */ } diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index b2974696a..81dd03c29 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -337,7 +337,11 @@ Word16 usquant_fx( /* o: index of the winning codeword */ 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 */ +#else 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 ); @@ -700,9 +704,11 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif IF( exp0 == 0 ) { @@ -725,8 +731,12 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { - y[i] = shl_o( x[i], exp0, &Overflow ); - move16(); /* saturation can occur here */ +#ifdef ISSUE_1796_replace_shl_o + y[i] = shl_sat( x[i], exp0 ); +#else + y[i] = shl_o( x[i], exp0, &Overflow ); +#endif + move16(); /* saturation can occur here */ } } /*-------------------------------------------------------------------* @@ -743,10 +753,12 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif IF( exp0 == 0 ) @@ -763,8 +775,12 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { - y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); - move32(); +#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 + move32(); } return; } @@ -776,7 +792,11 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( 1, exp0 ); +#else tmp = shl_o( 1, exp0, &Overflow ); +#endif FOR( i = 0; i < lg; i++ ) { y[i] = L_mult0( x[i], tmp ); @@ -813,8 +833,12 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { - y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); - move32(); +#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 + move32(); } return; } @@ -2468,7 +2492,11 @@ Word32 root_a_over_b_fx( exp_den = sub( sub( 30, exp_den ), Q_a ); 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 exp_num = sub( exp_num, scale ); tmp = div_s( num, den ); diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 591645017..eb0a2d7d0 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -359,7 +359,11 @@ static Word16 DTFS_alignment_weight_fx( } 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) */ +#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 */ @@ -1266,9 +1270,17 @@ 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] ) ); +#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] ) ); +#else X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); +#endif move16(); /* Q(Q+Qmin) */ } @@ -2105,7 +2117,11 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); +#ifdef ISSUE_1796_replace_shl_o + fraca = shl_sat( fraca, scale ); +#else fraca = shl_o( fraca, scale, &Overflow ); +#endif expa = sub( expa, scale ); tmp = div_s( fraca, fracb ); /* 15-exp */ @@ -3491,7 +3507,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W 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 ); @@ -3525,7 +3545,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W 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 ); diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index a1ff625b0..7fbd0fd23 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -63,7 +63,11 @@ 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*/ +#else fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ +#endif move16(); cc = L_add( cc, cte ); } diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 40e26df9c..a7ed800d0 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,7 +530,11 @@ 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*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ @@ -807,7 +823,11 @@ 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*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ @@ -1003,9 +1023,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 @@ -1072,7 +1094,11 @@ static Word16 find_best_delay_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 } *false_flag = 0; diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 48d91a87a..5a244d0cb 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..e3323060b 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -901,8 +901,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 +925,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 */ } +#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..06b92316e 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..6fc4f94a5 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..a8d96549a 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 BASOP_NOGLOB_DECLARE_LOCAL 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..ec9120685 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 511d8a977..039736f90 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_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 69983cbf2..6590ede7b 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3344,10 +3344,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_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/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/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 06da2a83d..1cd698546 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -961,7 +961,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 ); @@ -1603,7 +1607,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..1ba2f03e6 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..5f19fa765 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..42a279223 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; +#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/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index c8fab11a9..50f858c6b 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 ) { @@ -2741,7 +2749,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; @@ -3245,7 +3257,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*/ ) ) @@ -4008,9 +4024,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_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 ) ); @@ -4664,7 +4682,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..bb27b83e5 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..b63c4210e 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +563,17 @@ 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 */ + + /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . + * y = 0 is possible, x = 32767 is possible . + * so we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: y == 0 or x == 32767 . + */ + Overflow = ( gain == MAX_16 && i != 0) ? 1 : 0; +#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 bf248bb5a..834c5bb54 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(); } set16_fx( x_tran + Nsv * WIDTH_BAND, 0, sub( L_SUBFR, i_mult2( WIDTH_BAND, Nsv ) ) ); @@ -640,7 +644,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(); } set16_fx( x_tran + Nsv * WIDTH_BAND, 0, sub( L_SUBFR, i_mult2( WIDTH_BAND, Nsv ) ) ); diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 548e3f904..d4a18e751 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( } } +#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( } } +#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/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index a0acd0bfd..ceda6a133 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -183,7 +183,11 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits 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 { @@ -360,7 +364,11 @@ Word16 hvq_enc_fx( /*o : Consumed bits 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/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 01005f641..d8623ce15 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -521,7 +521,18 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) xy = shr( xy, 1 ); /* be sure that xy < yy */ gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); +#ifdef ISSUE_1796_replace_shl_o + gain = shl_sat( gain, i ); /* saturation can occur here */ + + /* + Theres only to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 + y == 0 is possible, x == 32767 is impossible + So we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: x == 32767 or y == 0 + */ + Overflow = (gain == MAX_16 && i != 0) ? 1 : 0; +#else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ +#endif *Overflow_out |= Overflow; move16(); -- GitLab From 9ea744fbeb1b2bb384adb042ad77995d5c192995 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 10:48:42 +0200 Subject: [PATCH 10/29] some replacements shl_o -> shl_sat --- lib_enc/lsf_enc_fx.c | 52 +++++++++++++++++++++++++++++++ lib_enc/lsf_msvq_ma_enc_fx.c | 4 +++ lib_enc/nois_est_fx.c | 8 +++++ lib_enc/pre_proc_fx.c | 6 ++++ lib_enc/pvq_core_enc_fx.c | 23 ++++++++++++++ lib_enc/scale_enc_fx.c | 4 +++ lib_enc/set_impulse_fx.c | 8 +++-- lib_enc/speech_music_classif_fx.c | 6 ++++ lib_enc/swb_bwe_enc_fx.c | 12 +++++++ lib_enc/swb_tbe_enc_fx.c | 30 ++++++++++++++++++ lib_enc/tcx_ltp_enc_fx.c | 20 ++++++++++++ lib_enc/tcx_utils_enc_fx.c | 20 ++++++++++++ lib_enc/vad_fx.c | 4 +++ lib_enc/voiced_enc_fx.c | 36 +++++++++++++++++++++ 14 files changed, 231 insertions(+), 2 deletions(-) diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 23ed7d0c2..6d7c2945c 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(); } +#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(); } +#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 676696fd6..fa8a8c48a 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 ) @@ -2548,7 +2552,11 @@ void noise_est_ivas_fx( { /* 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 } if ( ncharX != NULL ) diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index dc3ec020a..2b843245f 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..46a01a386 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,6 +267,7 @@ 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(); @@ -331,7 +332,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 +396,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 +462,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 +942,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 +954,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 +1025,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 +1037,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/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 364d78f97..3968efd04 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,9 +201,13 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); -#ifdef ISSUE_1772_replace_shr_o +#if defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o ) krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ -#else +#elif defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o ) + krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ +#elif !defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o ) + krit_fx = shr_o( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ), &Overflow ); /* Q18 */ +#elif !defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o ) krit_fx = shr_o( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ), &Overflow ); /* Q18 */ #endif diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 59f3b35f6..e0cd9ac5e 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -3676,9 +3676,11 @@ static void spec_analysis_fx( Word16 peak_idx[65]; Word16 valey_idx[65]; Word16 p2v[65]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* find spectral peaks */ @@ -3762,7 +3764,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_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 6b65f9afa..9bc506b55 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4643,17 +4643,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 */ } } @@ -4832,17 +4844,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 */ } } @@ -6174,9 +6198,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++ ) @@ -6198,7 +6224,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 diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 84f83a311..564cdc976 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 9ca9eb82a..c45ba3120 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2146,12 +2146,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 ) ) @@ -2221,10 +2227,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 ); @@ -2320,7 +2328,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 @@ -2523,7 +2535,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 @@ -2679,7 +2695,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 1cf7a5de8..c8f64f771 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1079,7 +1079,11 @@ 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 IF( LT_16( i, 2 ) ) { tmp = add_o( tmp, delta1, &Overflow ); /*Q13 */ diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 8081b2909..91005359a 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 */ +#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 f9133c0c82fc4eb7d2cba686a732b1ea589b766d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 11:06:35 +0200 Subject: [PATCH 11/29] clang patch --- lib_com/swb_tbe_com_fx.c | 36 +++++++++++++++--------------- lib_com/tools_fx.c | 22 +++++++++--------- lib_com/wi_fx.c | 6 ++--- lib_com/window_fx.c | 2 +- lib_dec/FEC_HQ_core_fx.c | 8 +++---- lib_dec/FEC_fx.c | 2 +- lib_dec/acelp_core_switch_dec_fx.c | 2 +- lib_dec/dec_higher_acelp_fx.c | 2 +- lib_dec/dec_post_fx.c | 2 +- lib_dec/er_util_fx.c | 2 +- lib_dec/swb_tbe_dec_fx.c | 4 ++-- lib_dec/syn_outp_fx.c | 2 +- lib_enc/arith_coder_enc_fx.c | 2 +- lib_enc/bass_psfilter_enc_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 8 +++---- lib_enc/core_enc_ol_fx.c | 2 +- lib_enc/enc_acelp_fx.c | 6 ++--- lib_enc/enc_higher_acelp_fx.c | 4 ++-- lib_enc/enc_pit_exc_fx.c | 8 +++---- lib_enc/lp_exc_e_fx.c | 4 ++-- lib_enc/lsf_enc_fx.c | 12 +++++----- lib_enc/nois_est_fx.c | 4 ++-- lib_enc/pre_proc_fx.c | 2 +- lib_enc/pvq_core_enc_fx.c | 1 + lib_enc/speech_music_classif_fx.c | 4 +--- lib_enc/swb_tbe_enc_fx.c | 12 +++++----- lib_enc/tcx_ltp_enc_fx.c | 4 ++-- lib_enc/voiced_enc_fx.c | 4 ++-- 28 files changed, 84 insertions(+), 85 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 020685354..f3a1471cb 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1544,11 +1544,11 @@ void GenShapedWBExcitation_ivas_fx( 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 + 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 + 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; @@ -1628,12 +1628,12 @@ void GenShapedWBExcitation_ivas_fx( test(); IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { - /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ + /*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 ); + tmp_vfac = shl_sat( voice_factors[i], 1 ); #else - tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); + tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif } ELSE @@ -1804,11 +1804,11 @@ void GenShapedWBExcitation_fx( FOR( i = 0; i < L_FRAME16k / 4; i++ ) { #ifdef ISSUE_1796_replace_shl_o - excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); + excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); #else - excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); + excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); #endif - move16(); /* Q14 */ + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1890,12 +1890,12 @@ void GenShapedWBExcitation_fx( test(); IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { - /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ + /*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 ); + tmp_vfac = shl_sat( voice_factors[i], 1 ); #else - tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); + tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); #endif } ELSE @@ -5801,7 +5801,7 @@ void non_linearity_fx( #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 } } @@ -5883,7 +5883,7 @@ void non_linearity_fx( #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,7 +6061,7 @@ void non_linearity_ivas_fx( #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 } } @@ -6143,7 +6143,7 @@ void non_linearity_ivas_fx( #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 } } diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 81dd03c29..da9757db9 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -335,8 +335,8 @@ 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) */ - L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ + 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 @@ -732,11 +732,11 @@ void Copy_Scale_sig( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o - y[i] = shl_sat( x[i], exp0 ); + y[i] = shl_sat( x[i], exp0 ); #else - y[i] = shl_o( x[i], exp0, &Overflow ); + y[i] = shl_o( x[i], exp0, &Overflow ); #endif - move16(); /* saturation can occur here */ + move16(); /* saturation can occur here */ } } /*-------------------------------------------------------------------* @@ -776,11 +776,11 @@ void Copy_Scale_sig_16_32_DEPREC( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #else - y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); + y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif - move32(); + move32(); } return; } @@ -834,11 +834,11 @@ void Copy_Scale_sig_16_32_no_sat( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o - y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #else - y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); + y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif - move32(); + move32(); } return; } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index eb0a2d7d0..5a8ad35c5 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -360,9 +360,9 @@ static Word16 DTFS_alignment_weight_fx( 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) */ + 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) */ + 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 ) ) { @@ -1271,7 +1271,7 @@ void DTFS_zeroFilter_fx( 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] ) ); + 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 diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 7fbd0fd23..84302ff08 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -64,7 +64,7 @@ void ham_cos_window( { /* 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*/ + 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*/ #endif diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index a7ed800d0..b865c4783 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -391,7 +391,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 ); + 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 @@ -535,7 +535,7 @@ void ivas_HQ_FEC_Mem_update_fx( #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*/ } @@ -828,7 +828,7 @@ void HQ_FEC_Mem_update_fx( #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*/ } @@ -1093,7 +1093,7 @@ 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 = 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 diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 5a244d0cb..78594558b 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -783,7 +783,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 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 ); + tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); #else tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); #endif diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 06b92316e..f3e7a8594 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -969,7 +969,7 @@ static void decod_gen_voic_core_switch_fx( { /*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 */ + 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 diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index 6fc4f94a5..bc638b1a1 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -145,7 +145,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 ); + 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 diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index a8d96549a..558bf9ee5 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -503,7 +503,7 @@ static void modify_pst_param_fx( 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 */ + 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 diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index ec9120685..330cb5d44 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -56,7 +56,7 @@ void minimumStatistics_fx( BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o - IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) ) + 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 diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 1cd698546..5b74b1a1c 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -962,7 +962,7 @@ void ivas_wb_tbe_dec_fx( 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*/ + 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 @@ -1608,7 +1608,7 @@ void wb_tbe_dec_fx( 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*/ + 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 diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index 1ba2f03e6..95b98e854 100644 --- a/lib_dec/syn_outp_fx.c +++ b/lib_dec/syn_outp_fx.c @@ -85,7 +85,7 @@ void unscale_AGC( } BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o - tmp = shl_sat( 30000, Qx ); /* saturation can occur here */ + tmp = shl_sat( 30000, Qx ); /* saturation can occur here */ #else tmp = shl_o( 30000, Qx, &Overflow ); /* saturation can occur here */ #endif diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 5f19fa765..2e88b1f00 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -481,7 +481,7 @@ 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 */ + adjust = shl_sat( tmp, sub( s, 1 ) ); /* Q14 */ #else adjust = shl_o( tmp, sub( s, 1 ), &Overflow ); /* Q14 */ #endif diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index 42a279223..f417a0904 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -132,7 +132,7 @@ Word16 bass_pf_enc_fx( #ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, tmp16 ); /* Q15 */ #else - gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ + gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ #endif BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 50f858c6b..02c60ffa6 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1658,7 +1658,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 ); + 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 @@ -2750,7 +2750,7 @@ void QuantizeSpectrum_fx( FOR( i = 0; i < L_frame; i++ ) { #ifdef ISSUE_1796_replace_shl_o - xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); + 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 @@ -3258,7 +3258,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 ); + 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 @@ -4683,7 +4683,7 @@ void InternalTCXDecoder_fx( FOR( i = 0; i < L_frame; i++ ) { #ifdef ISSUE_1796_replace_shl_o - xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); + 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 diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index bb27b83e5..2f2682b8e 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -553,7 +553,7 @@ void core_encode_openloop_fx( 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 ); + 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 diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index b63c4210e..d9842b882 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -564,13 +564,13 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn 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 */ - + gain = shl_sat( gain, i ); /* saturation can occur here */ + /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . * y = 0 is possible, x = 32767 is possible . * so we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: y == 0 or x == 32767 . */ - Overflow = ( gain == MAX_16 && i != 0) ? 1 : 0; + Overflow = ( gain == MAX_16 && i != 0 ) ? 1 : 0; #else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ #endif diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 834c5bb54..45a407d27 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -288,7 +288,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 ); + 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 @@ -645,7 +645,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 ); + 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 diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index d4a18e751..5f173cd7f 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -518,9 +518,9 @@ void enc_pit_exc_fx( } #ifdef ISSUE_1796_replace_shl_o - cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ #else - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ #endif *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } @@ -994,9 +994,9 @@ void enc_pit_exc_ivas_fx( } #ifdef ISSUE_1796_replace_shl_o - cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ #else - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ + 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/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index d8623ce15..02cf09f35 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -523,13 +523,13 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) i = sub( exp_xy, exp_yy ); #ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ - + /* Theres only to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 y == 0 is possible, x == 32767 is impossible So we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: x == 32767 or y == 0 */ - Overflow = (gain == MAX_16 && i != 0) ? 1 : 0; + Overflow = ( gain == MAX_16 && i != 0 ) ? 1 : 0; #else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ #endif diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 6d7c2945c..8db83c2b9 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -2425,7 +2425,7 @@ static Word32 vq_lvq_lsf_enc( FOR( j = 0; j < M; j++ ) { #ifdef ISSUE_1796_replace_shl_o - diff[j] = shl_sat( diff[j], 4 ); + diff[j] = shl_sat( diff[j], 4 ); #else diff[j] = shl_o( diff[j], 4, &Overflow ); #endif @@ -2434,12 +2434,12 @@ static Word32 vq_lvq_lsf_enc( #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 */ + 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 */ + 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 @@ -2562,7 +2562,7 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( FOR( j = 0; j < M; j++ ) { #ifdef ISSUE_1796_replace_shl_o - diff[j] = shl_sat( diff[j], 4 ); + diff[j] = shl_sat( diff[j], 4 ); #else diff[j] = shl_o( diff[j], 4, &Overflow ); #endif @@ -2571,12 +2571,12 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( #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 */ + 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 */ + 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 diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index fa8a8c48a..ffd7c0cef 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -2551,9 +2551,9 @@ void noise_est_ivas_fx( ELSE { /* ftemp2 /= ftemp */ - num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp + 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 + 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 diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 2b843245f..8a3cf1a00 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -1049,7 +1049,7 @@ void pre_proc_fx( 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 ); + 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 diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index 46a01a386..a5e193461 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -271,6 +271,7 @@ void pvq_encode_frame_ivas_fx( #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index e0cd9ac5e..6334a6ef0 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -3676,11 +3676,9 @@ static void spec_analysis_fx( Word16 peak_idx[65]; Word16 valey_idx[65]; Word16 p2v[65]; -#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif /* find spectral peaks */ @@ -3765,7 +3763,7 @@ static void spec_analysis_fx( 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 ); + 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 diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 9bc506b55..44dc63857 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4644,7 +4644,7 @@ static void EstimateSHBFrameGain_fx( 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] ); + 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 @@ -4653,7 +4653,7 @@ static void EstimateSHBFrameGain_fx( FOR( ; i < l_frame; i++ ) { #ifdef ISSUE_1796_replace_shl_o - sig = shl_sat( oriSHB[i], scaling ); + sig = shl_sat( oriSHB[i], scaling ); #else sig = shl_o( oriSHB[i], scaling, &Overflow ); #endif @@ -4662,7 +4662,7 @@ static void EstimateSHBFrameGain_fx( 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] ); + 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 @@ -4845,7 +4845,7 @@ static void EstimateSHBFrameGain_ivas_fx( 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] ); + 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 @@ -4854,7 +4854,7 @@ static void EstimateSHBFrameGain_ivas_fx( FOR( ; i < l_frame; i++ ) { #ifdef ISSUE_1796_replace_shl_o - sig = shl_sat( oriSHB[i], scaling ); + sig = shl_sat( oriSHB[i], scaling ); #else sig = shl_o( oriSHB[i], scaling, &Overflow ); #endif @@ -4863,7 +4863,7 @@ static void EstimateSHBFrameGain_ivas_fx( 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] ); + 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 diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 564cdc976..a069f99b4 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -545,7 +545,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 ) ); + g = shl_sat( g, sub( s1, s2 ) ); #else g = shl_o( g, sub( s1, s2 ), &Overflow ); #endif @@ -600,7 +600,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*/ + g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ #else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ #endif diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 91005359a..0de0285d5 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -559,7 +559,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 */ + 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 @@ -592,7 +592,7 @@ ivas_error ppp_voiced_encoder_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 */ + IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ #endif { /* if (res_enratio < 0.025) */ -- GitLab From e78d3b30fb1313794f4c3a3bf916689357a58e3a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 11:53:50 +0200 Subject: [PATCH 12/29] deactivated ISSUE_1796 macro in all lib_com files for testing --- lib_com/arith_coder_fx.c | 2 +- lib_com/bitalloc_fx.c | 4 ++-- lib_com/codec_tcx_common_fx.c | 10 +++++----- lib_com/env_stab_fx.c | 2 +- lib_com/fd_cng_com_fx.c | 4 ++-- lib_com/gs_gains_fx.c | 4 ++-- lib_com/gs_noisefill_fx.c | 8 ++++---- lib_com/hq2_core_com_fx.c | 4 ++-- lib_com/hq2_noise_inject_fx.c | 2 +- lib_com/ifft_rel_fx.c | 10 +++++----- lib_com/lsf_tools_fx.c | 4 ++-- lib_com/lsp_conv_poly_fx.c | 2 +- lib_com/math_op.c | 4 ++-- lib_com/modif_fs_fx.c | 8 ++++---- lib_com/residu_fx.c | 2 +- lib_com/stat_noise_uv_mod_fx.c | 8 ++++---- lib_com/swb_bwe_com_lr_fx.c | 8 ++++---- lib_com/swb_tbe_com_fx.c | 26 +++++++++++++------------- lib_com/tools_fx.c | 16 ++++++++-------- lib_com/wi_fx.c | 12 ++++++------ lib_com/window_fx.c | 2 +- 21 files changed, 71 insertions(+), 71 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 7551bd41a..90a8a13d2 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -271,7 +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_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ 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 */ diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 3bb0cbd72..e2e644a55 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -245,7 +245,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_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -444,7 +444,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_1796_replace_shl_o_ m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ #else m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 683e1e8d4..139500891 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_1796_replace_shl_o_ #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_1796_replace_shl_o_ 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_1796_replace_shl_o_ #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_1796_replace_shl_o_ 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_1796_replace_shl_o_ 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/env_stab_fx.c b/lib_com/env_stab_fx.c index 2e71443ca..c58abb1f0 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -85,7 +85,7 @@ Word16 env_stability_fx( /* in Q15 */ mem_norm[i] = ynrm[i]; move16(); } -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ Overflow = 0; move16(); env_delta = shl_o( *mem_env_delta, 1, &Overflow ); diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 7420a4457..57cdbd6e5 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2279,7 +2279,7 @@ static void getmidbands( ) { Word16 j, max_psize, shift; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -2318,7 +2318,7 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ 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) diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index d49a786f2..bf4921c7a 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -126,7 +126,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_1796_replace_shl_o_ 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 ); @@ -212,7 +212,7 @@ 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_1796_replace_shl_o_ 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*/ diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 53fb67601..7fa36443e 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -565,7 +565,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ Ener1_fx = mult_ro( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ #else Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ @@ -595,7 +595,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ #else Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ @@ -716,7 +716,7 @@ void highband_exc_dct_in_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp1 = shl_sat( tmp, exp ); #else tmp1 = shl_o( tmp, exp, &Overflow ); @@ -1098,7 +1098,7 @@ 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 +#ifdef ISSUE_1796_replace_shl_o_ tmp1 = shl_sat( tmp, exp ); #else tmp1 = shl_o( tmp, exp, &Overflow ); diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index 9017903c8..eb21aee8b 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -163,7 +163,7 @@ 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 +#ifdef ISSUE_1796_replace_shl_o_ cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ @@ -339,7 +339,7 @@ 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 +#ifdef ISSUE_1796_replace_shl_o_ cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index fdd0d6d71..9cc11e9b1 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -608,7 +608,7 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ #else tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index b372e15f3..485b21895 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -111,19 +111,19 @@ void ifft_rel_fx( t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); -#ifdef ISSUE_1796_replace_shl_o +#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 +#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 +#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*/ @@ -139,13 +139,13 @@ void ifft_rel_fx( move16(); *( xi2 + n8 ) = sub_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ); /*Qx*/ move16(); -#ifdef ISSUE_1796_replace_shl_o +#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 +#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*/ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 68ede5413..b1fc80f36 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -989,7 +989,7 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /*b = -2.0f * *plsp;*/ b = *plsp; move16(); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ m2 = shl_sat( -2, sub( 15, Q_out ) ); /* There's only 1 integer x to solve -32768 = x * 2^y, if y is an integer : x= -1, y = 15 . @@ -2324,7 +2324,7 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1796_replace_shl_o +#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 */ diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index fe6ac4f7c..5e3667fb9 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -345,7 +345,7 @@ 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 +#ifdef ISSUE_1796_replace_shl_o_ exp_den = shl_sat( exp_den, 1 ); #else exp_den = shl_o( exp_den, 1, &Overflow ); diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 74143b8ed..658d7f5ed 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -256,7 +256,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val } IF( expi > 0 ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp = shl_sat( x[0], expi ); #else tmp = shl_o( x[0], expi, &Overflow ); @@ -264,7 +264,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp = shl_sat( x[i], expi ); #else tmp = shl_o( x[i], expi, &Overflow ); diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 5e8f02e09..8daf3b72e 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_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -279,7 +279,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_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ num_den = shl_sat( num_den, 1 ); #else num_den = shl_o( num_den, 1, &Overflow ); @@ -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_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -565,7 +565,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_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ num_den = shl_sat( num_den, 1 ); #else num_den = shl_o( num_den, 1, &Overflow ); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index dcfec0856..2d1fb6af3 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -72,7 +72,7 @@ void Residu3_lc_fx( { q = add( q, shift ); } -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ *y++ = shl_sat( x[0], shift ); #else *y++ = shl_o( x[0], shift, &Overflow ); diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index 8d1236b53..b0eaea936 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -161,7 +161,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 */ -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -190,7 +190,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_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); @@ -475,7 +475,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 */ -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -504,7 +504,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_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 78422a292..025038357 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -2338,7 +2338,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_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 ); @@ -3213,7 +3213,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3252,7 +3252,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_1796_replace_shl_o +#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 */ @@ -3326,7 +3326,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_1796_replace_shl_o +#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 ); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index f3a1471cb..18a2defbb 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -996,7 +996,7 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ Flag Overflow = 0; #endif move32(); @@ -1040,7 +1040,7 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -1543,7 +1543,7 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 @@ -1630,7 +1630,7 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); @@ -1803,7 +1803,7 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); @@ -1892,7 +1892,7 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); @@ -5798,7 +5798,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_1796_replace_shl_o_ scale_step = shl_sat( tmp, exp ); /* Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ @@ -5880,7 +5880,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_1796_replace_shl_o_ scale_step = shl_sat( tmp, exp ); /*Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ @@ -6058,7 +6058,7 @@ void non_linearity_ivas_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_1796_replace_shl_o_ scale_step = shl_sat( tmp, exp ); /* Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ @@ -6140,7 +6140,7 @@ void non_linearity_ivas_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_1796_replace_shl_o_ scale_step = shl_sat( tmp, exp ); /*Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ @@ -7081,7 +7081,7 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -7198,7 +7198,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7229,7 +7229,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_1796_replace_shl_o +#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 ); diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index da9757db9..5ab79ead0 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -337,7 +337,7 @@ Word16 usquant_fx( /* o: index of the winning codeword */ 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 +#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 idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ @@ -704,7 +704,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -731,7 +731,7 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ y[i] = shl_sat( x[i], exp0 ); #else y[i] = shl_o( x[i], exp0, &Overflow ); @@ -753,7 +753,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -775,7 +775,7 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ) ); @@ -792,7 +792,7 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp = shl_sat( 1, exp0 ); #else tmp = shl_o( 1, exp0, &Overflow ); @@ -833,7 +833,7 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ) ); @@ -2492,7 +2492,7 @@ Word32 root_a_over_b_fx( exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 5a8ad35c5..08608a9d5 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -359,7 +359,7 @@ static Word16 DTFS_alignment_weight_fx( } temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ -#ifdef ISSUE_1796_replace_shl_o +#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) */ @@ -1270,13 +1270,13 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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_1796_replace_shl_o +#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 ); @@ -2117,7 +2117,7 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ fraca = shl_sat( fraca, scale ); #else fraca = shl_o( fraca, scale, &Overflow ); @@ -3507,7 +3507,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); @@ -3545,7 +3545,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 84302ff08..6cc1f493a 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -63,7 +63,7 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1796_replace_shl_o +#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*/ -- GitLab From 237b3fb3652548d03b1c161ed0573952684cd7f1 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 13:01:25 +0200 Subject: [PATCH 13/29] deactivated ISSUE_1796 macro in enc_acelp_fx and lp_exc_e_fx for testing --- lib_enc/enc_acelp_fx.c | 2 +- lib_enc/lp_exc_e_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index d9842b882..97c301fd8 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +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 +#ifdef ISSUE_1796_replace_shl_o_ gain = shl_sat( gain, i ); /* saturation can occur here */ /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 02cf09f35..85696d89f 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -521,7 +521,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) xy = shr( xy, 1 ); /* be sure that xy < yy */ gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ gain = shl_sat( gain, i ); /* saturation can occur here */ /* -- GitLab From 694a9ae06d2a2706a55a741053b0ce690c4ae961 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 13:42:27 +0200 Subject: [PATCH 14/29] deactivate macro for all the files --- lib_dec/FEC_HQ_core_fx.c | 16 ++++++++-------- lib_dec/FEC_fx.c | 10 +++++----- lib_dec/LD_music_post_filter_fx.c | 4 ++-- lib_dec/acelp_core_switch_dec_fx.c | 4 ++-- lib_dec/dec_higher_acelp_fx.c | 4 ++-- lib_dec/dec_pit_exc_fx.c | 4 ++-- lib_dec/dec_post_fx.c | 2 +- lib_dec/er_util_fx.c | 4 ++-- lib_dec/igf_dec_fx.c | 8 ++++---- lib_dec/ivas_dirac_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_dft_plc_fx.c | 4 ++-- lib_dec/pvq_core_dec_fx.c | 4 ++-- lib_dec/swb_tbe_dec_fx.c | 4 ++-- lib_dec/syn_outp_fx.c | 4 ++-- lib_enc/arith_coder_enc_fx.c | 10 +++++----- lib_enc/bass_psfilter_enc_fx.c | 4 ++-- lib_enc/cod_tcx_fx.c | 12 ++++++------ lib_enc/core_enc_ol_fx.c | 2 +- lib_enc/enc_higher_acelp_fx.c | 4 ++-- lib_enc/enc_pit_exc_fx.c | 4 ++-- lib_enc/hvq_enc_fx.c | 4 ++-- lib_enc/lsf_enc_fx.c | 28 ++++++++++++++-------------- lib_enc/lsf_msvq_ma_enc_fx.c | 2 +- lib_enc/nois_est_fx.c | 4 ++-- lib_enc/pre_proc_fx.c | 4 ++-- lib_enc/pvq_core_enc_fx.c | 16 ++++++++-------- lib_enc/scale_enc_fx.c | 2 +- lib_enc/set_impulse_fx.c | 8 ++++---- lib_enc/speech_music_classif_fx.c | 2 +- lib_enc/swb_bwe_enc_fx.c | 6 +++--- lib_enc/swb_tbe_enc_fx.c | 16 ++++++++-------- lib_enc/tcx_ltp_enc_fx.c | 12 ++++++------ lib_enc/tcx_utils_enc_fx.c | 12 ++++++------ lib_enc/vad_fx.c | 2 +- lib_enc/voiced_enc_fx.c | 18 +++++++++--------- 35 files changed, 124 insertions(+), 124 deletions(-) diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index b865c4783..197308446 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,7 +43,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -80,7 +80,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 +#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 */ @@ -168,7 +168,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -390,7 +390,7 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -530,7 +530,7 @@ 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 +#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*/ @@ -823,7 +823,7 @@ 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 +#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*/ @@ -1023,7 +1023,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1094,7 +1094,7 @@ static Word16 find_best_delay_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 +#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 */ diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 78594558b..9327e1cde 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -126,7 +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 +#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 ); @@ -191,7 +191,7 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -210,7 +210,7 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -768,7 +768,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -782,7 +782,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 +#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 ); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index e3323060b..d9ec7e2b0 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -901,7 +901,7 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -925,7 +925,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 +#ifdef ISSUE_1796_replace_shl_o_ tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ #else tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index f3e7a8594..a04814cff 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -872,7 +872,7 @@ static void decod_gen_voic_core_switch_fx( Word16 *pt1; GSC_DEC_HANDLE hGSCDec; hGSCDec = st_fx->hGSCDec; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -968,7 +968,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 +#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 */ diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index bc638b1a1..ba550e166 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -30,7 +30,7 @@ void transf_cdbk_dec_fx( Word32 L_tmp; Word32 dct_code32[L_SUBFR]; Word16 qdct; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -144,7 +144,7 @@ void transf_cdbk_dec_fx( } FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ); diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index e82394fbb..17c3359fd 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -73,7 +73,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -250,7 +250,7 @@ void dec_pit_exc_fx( gain_pit_fx = st_fx->lp_gainp_fx; move16(); } -#ifdef ISSUE_1796_replace_shl_o +#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*/ diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index 558bf9ee5..a337ec0a5 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -502,7 +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 +#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 */ diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index 330cb5d44..ae0b914da 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -44,7 +44,7 @@ void minimumStatistics_fx( Word16 f, p, i; Word16 tmp, tmp2, tmp_e; Word32 tmp32; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -55,7 +55,7 @@ void minimumStatistics_fx( BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o +#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 ) ) diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 039736f90..e6c6b8c3f 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2975,7 +2975,7 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in Word16 sfb; Word16 tmp; Word16 delta; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -2994,7 +2994,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 +#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 ) ); @@ -3029,7 +3029,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -3048,7 +3048,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 +#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 ) ); diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 6590ede7b..033e0bbfd 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3344,12 +3344,12 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac; -#ifndef ISSUE_1796_replace_shl_o +#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 +#ifdef ISSUE_1796_replace_shl_o_ fac = shl_sat( fac, exp ); #else fac = shl_o( fac, exp, &flag ); diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index fa4e914c5..ee75a4574 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -655,7 +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 +#ifndef ISSUE_1796_replace_shl_o_ Flag flg_ov; #endif IF( k == 0 ) @@ -709,7 +709,7 @@ void stereo_dft_res_subst_spec_fx( move32(); } -#ifdef ISSUE_1796_replace_shl_o +#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 ); diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c index f9c2db757..50a31e682 100644 --- a/lib_dec/pvq_core_dec_fx.c +++ b/lib_dec/pvq_core_dec_fx.c @@ -477,7 +477,7 @@ static void densitySymbolIndexDecode_fx( Word32 acc; Word16 alpha = 0; move16(); -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -494,7 +494,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 +#ifdef ISSUE_1796_replace_shl_o_ angle = shl_sat( angle, 1 ); #else angle = shl_o( angle, 1, &Overflow ); diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 5b74b1a1c..492a8aa0e 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -961,7 +961,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 +#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*/ @@ -1607,7 +1607,7 @@ void wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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*/ diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index 95b98e854..beb0bc36f 100644 --- a/lib_dec/syn_outp_fx.c +++ b/lib_dec/syn_outp_fx.c @@ -67,7 +67,7 @@ void unscale_AGC( { Word16 i, fac, tmp, frame_fac, max_val; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -84,7 +84,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 +#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 */ diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 2e88b1f00..44adf0da8 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -367,7 +367,7 @@ static Word16 tcx_arith_rateloop( Word32 L_tmp; Word16 tmp, tmp3; Word32 tmp2; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o__ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -381,7 +381,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 +#ifdef ISSUE_1796_replace_shl_o_ scale = shl_sat( scale, sub( tmp, *scale_e ) ); #else scale = shl_o( scale, sub( tmp, *scale_e ), &Overflow ); @@ -446,7 +446,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 +#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 ); @@ -480,12 +480,12 @@ 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 +#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 +#ifdef ISSUE_1796_replace_shl_o_ scale = shl_sat( mult_r( scale, adjust ), 1 ); #else scale = shl_o( mult_r( scale, adjust ), 1, &Overflow ); diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index f417a0904..df02ea4b2 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -129,7 +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 +#ifdef ISSUE_1796_replace_shl_o_ gain = shl_sat( gain, tmp16 ); /* Q15 */ #else gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ @@ -214,7 +214,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 +#ifdef ISSUE_1796_replace_shl_o_ tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */ #else tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 02c60ffa6..de1332dc9 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,7 +1657,7 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -1781,7 +1781,7 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ -#ifdef ISSUE_1796_replace_shl_o +#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*/ ); @@ -2749,7 +2749,7 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -3257,7 +3257,7 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -4024,7 +4024,7 @@ 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 ) +#if !defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o_ ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -4682,7 +4682,7 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ); diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 2f2682b8e..7812ad4f7 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -552,7 +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 +#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 ); diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 45a407d27..4b93ef4f9 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -287,7 +287,7 @@ void transf_cdbk_enc_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -644,7 +644,7 @@ void transf_cdbk_enc_ivas_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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 ); diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 5f173cd7f..d9995dc6f 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -517,7 +517,7 @@ void enc_pit_exc_fx( } } -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ #else cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ @@ -993,7 +993,7 @@ void enc_pit_exc_ivas_fx( } } -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ #else cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index ceda6a133..c6c224246 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -183,7 +183,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -364,7 +364,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o +#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 */ diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 8db83c2b9..227407589 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -784,7 +784,7 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -2369,7 +2369,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -2424,21 +2424,21 @@ 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 +#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 +#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 +#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 */ @@ -2489,7 +2489,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -2561,21 +2561,21 @@ 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 +#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 +#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 +#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 */ @@ -3428,7 +3428,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -3636,13 +3636,13 @@ 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 +#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 +#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 ); @@ -3830,13 +3830,13 @@ 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 +#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 +#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 ); diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 981c7e51c..b5d85627d 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -1630,7 +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 +#ifdef ISSUE_1796_replace_shl_o_ tmp = shl_sat( tmp, 4 ); #else tmp = shl_o( tmp, 4, &Overflow ); diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index ffd7c0cef..e737c0225 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -1211,7 +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 +#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 ); @@ -2552,7 +2552,7 @@ void noise_est_ivas_fx( { /* ftemp2 /= ftemp */ num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp -#ifdef ISSUE_1796_replace_shl_o +#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 diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 8a3cf1a00..b2712ce7f 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -126,7 +126,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -1048,7 +1048,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 +#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 ); diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index a5e193461..0fc18c120 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,7 +267,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -333,7 +333,7 @@ void pvq_encode_frame_ivas_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -397,7 +397,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -463,7 +463,7 @@ void pvq_encode_frame_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o +#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 ); @@ -943,7 +943,7 @@ static void densityIndexSymbolEncode_ivas_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -955,7 +955,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 +#ifdef ISSUE_1796_replace_shl_o_ angle = shl_sat( angle, 1 ); #else angle = shl_o( angle, 1, &Overflow ); @@ -1026,7 +1026,7 @@ static void densityIndexSymbolEncode_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -1038,7 +1038,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 +#ifdef ISSUE_1796_replace_shl_o_ angle = shl_sat( angle, 1 ); #else angle = shl_o( angle, 1, &Overflow ); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index 32633c89d..6ee6f98b8 100644 --- a/lib_enc/scale_enc_fx.c +++ b/lib_enc/scale_enc_fx.c @@ -98,7 +98,7 @@ void Preemph_scaled( BASOP_SATURATE_WARNING_OFF_EVS Overflow = 0; -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ QVal = shl_sat( 1, sub( 15, bits ) ); #else QVal = shl_o( 1, sub( 15, bits ), &Overflow ); diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index 3968efd04..b33fb1439 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,13 +201,13 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); -#if defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o ) +#if defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o_ ) krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ -#elif defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o ) +#elif defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o_ ) krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ -#elif !defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o ) +#elif !defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o_ ) krit_fx = shr_o( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ), &Overflow ); /* Q18 */ -#elif !defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o ) +#elif !defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o_ ) krit_fx = shr_o( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ), &Overflow ); /* Q18 */ #endif diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 6334a6ef0..e39eda8b9 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -3762,7 +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 +#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 ); diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 40fefd684..9635f0760 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -1059,7 +1059,7 @@ 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 +#ifdef ISSUE_1796_replace_shl_o_ num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); @@ -1068,7 +1068,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class tmp = div_s( num, den ); expn = sub( expn, expd ); -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -1172,7 +1172,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class } test(); -#ifdef ISSUE_1796_replace_shl_o +#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 ) ) ) diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 44dc63857..aa8d1336c 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4643,7 +4643,7 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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] ); @@ -4652,7 +4652,7 @@ static void EstimateSHBFrameGain_fx( } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ sig = shl_sat( oriSHB[i], scaling ); #else sig = shl_o( oriSHB[i], scaling, &Overflow ); @@ -4661,7 +4661,7 @@ static void EstimateSHBFrameGain_fx( } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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] ); @@ -4844,7 +4844,7 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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] ); @@ -4853,7 +4853,7 @@ static void EstimateSHBFrameGain_ivas_fx( } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ sig = shl_sat( oriSHB[i], scaling ); #else sig = shl_o( oriSHB[i], scaling, &Overflow ); @@ -4862,7 +4862,7 @@ static void EstimateSHBFrameGain_ivas_fx( } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o +#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] ); @@ -6198,7 +6198,7 @@ static void determine_gain_weights_fx( Word16 j; Word16 exp, exp1, frac, tmp, exp2; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -6224,7 +6224,7 @@ static void determine_gain_weights_fx( { exp2 = sub( exp, 2 ); } -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ weights[j] = shl_sat( tmp, exp2 ); #else weights[j] = shl_o( tmp, exp2, &Overflow ); diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index a069f99b4..61618bbad 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -86,7 +86,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -183,7 +183,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 +#ifdef ISSUE_1796_replace_shl_o_ *norm_corr = shl_sat( temp_m, temp_e ); #else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); @@ -301,7 +301,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -393,7 +393,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 +#ifdef ISSUE_1796_replace_shl_o_ *norm_corr = shl_sat( temp_m, temp_e ); #else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); @@ -544,7 +544,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 +#ifdef ISSUE_1796_replace_shl_o_ g = shl_sat( g, sub( s1, s2 ) ); #else g = shl_o( g, sub( s1, s2 ), &Overflow ); @@ -599,7 +599,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 +#ifdef ISSUE_1796_replace_shl_o_ g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ #else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index c45ba3120..5292d7260 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2146,14 +2146,14 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif -#ifdef ISSUE_1796_replace_shl_o +#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*/ ); @@ -2227,7 +2227,7 @@ 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 +#ifndef ISSUE_1796_replace_shl_o_ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -2328,7 +2328,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 +#ifdef ISSUE_1796_replace_shl_o_ att = shl_sat( att, s ); #else att = shl_o( att, s, &Overflow ); @@ -2535,7 +2535,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 +#ifdef ISSUE_1796_replace_shl_o_ tmp1 = shl_sat( tmp1, s ); #else tmp1 = shl_o( tmp1, s, &Overflow ); @@ -2695,7 +2695,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 +#ifdef ISSUE_1796_replace_shl_o_ att = shl_sat( att, s ); #else att = shl_o( att, s, &Overflow ); diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index c8f64f771..3094a7411 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1079,7 +1079,7 @@ Word16 wb_vad_fx( snr_sumt = add( snr_sumt, shr( snr, 4 ) ); /*Q4 */ -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ #else tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 0de0285d5..a8d509c91 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -558,7 +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 +#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 */ @@ -589,7 +589,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 +#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 */ @@ -621,7 +621,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 +#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 ) ) ) @@ -633,7 +633,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 +#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 */ @@ -756,7 +756,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 +#ifdef ISSUE_1796_replace_shl_o_ fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); @@ -793,7 +793,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 +#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 */ @@ -917,7 +917,7 @@ ivas_error ppp_voiced_encoder_fx( test(); test(); test(); -#ifdef ISSUE_1796_replace_shl_o +#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 ) ) ) ) @@ -1098,7 +1098,7 @@ ivas_error ppp_voiced_encoder_fx( move16(); } -#ifdef ISSUE_1796_replace_shl_o +#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 */ @@ -1437,7 +1437,7 @@ static Word32 DTFS_freq_corr_fx( scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); -- GitLab From 7623027c85b1fce26205903d3f4c1d91bc86a220 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 13:51:57 +0200 Subject: [PATCH 15/29] buildildfix --- lib_dec/dec_post_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index a337ec0a5..487a20d95 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 BASOP_NOGLOB_DECLARE_LOCAL +#ifndef ISSUE_1796_replace_shl_o_ Flag Overflow = 0; move16(); #endif diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index de1332dc9..da0976a2d 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -4024,7 +4024,7 @@ 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_ ) +#if !defined( ISSUE_1772_replace_shr_o ) || !defined( ISSUE_1796_replace_shl_o_ ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -- GitLab From 5fa9997508f39cd358f1033de251e93e307f0e88 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 14:24:48 +0200 Subject: [PATCH 16/29] rename all macros to correct name, deactivate macro --- lib_com/arith_coder_fx.c | 2 +- lib_com/bitalloc_fx.c | 4 ++-- lib_com/codec_tcx_common_fx.c | 10 +++++----- lib_com/env_stab_fx.c | 2 +- lib_com/fd_cng_com_fx.c | 4 ++-- lib_com/gs_gains_fx.c | 4 ++-- lib_com/gs_noisefill_fx.c | 8 ++++---- lib_com/hq2_core_com_fx.c | 4 ++-- lib_com/hq2_noise_inject_fx.c | 2 +- lib_com/ifft_rel_fx.c | 10 +++++----- lib_com/lsf_tools_fx.c | 4 ++-- lib_com/lsp_conv_poly_fx.c | 2 +- lib_com/math_op.c | 4 ++-- lib_com/modif_fs_fx.c | 8 ++++---- lib_com/options.h | 2 +- lib_com/residu_fx.c | 2 +- lib_com/stat_noise_uv_mod_fx.c | 8 ++++---- lib_com/swb_bwe_com_lr_fx.c | 8 ++++---- lib_com/swb_tbe_com_fx.c | 26 +++++++++++++------------- lib_com/tools_fx.c | 16 ++++++++-------- lib_com/wi_fx.c | 12 ++++++------ lib_com/window_fx.c | 2 +- lib_dec/FEC_HQ_core_fx.c | 16 ++++++++-------- lib_dec/FEC_fx.c | 10 +++++----- lib_dec/LD_music_post_filter_fx.c | 4 ++-- lib_dec/acelp_core_switch_dec_fx.c | 4 ++-- lib_dec/dec_higher_acelp_fx.c | 4 ++-- lib_dec/dec_pit_exc_fx.c | 4 ++-- lib_dec/dec_post_fx.c | 4 ++-- lib_dec/er_util_fx.c | 4 ++-- lib_dec/igf_dec_fx.c | 8 ++++---- lib_dec/ivas_dirac_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_dft_plc_fx.c | 4 ++-- lib_dec/pvq_core_dec_fx.c | 4 ++-- lib_dec/swb_tbe_dec_fx.c | 4 ++-- lib_dec/syn_outp_fx.c | 4 ++-- lib_enc/arith_coder_enc_fx.c | 8 ++++---- lib_enc/bass_psfilter_enc_fx.c | 4 ++-- lib_enc/cod_tcx_fx.c | 12 ++++++------ lib_enc/core_enc_ol_fx.c | 2 +- lib_enc/enc_acelp_fx.c | 2 +- lib_enc/enc_higher_acelp_fx.c | 4 ++-- lib_enc/enc_pit_exc_fx.c | 4 ++-- lib_enc/hvq_enc_fx.c | 4 ++-- lib_enc/lp_exc_e_fx.c | 2 +- lib_enc/lsf_enc_fx.c | 28 ++++++++++++++-------------- lib_enc/lsf_msvq_ma_enc_fx.c | 2 +- lib_enc/nois_est_fx.c | 4 ++-- lib_enc/pre_proc_fx.c | 4 ++-- lib_enc/pvq_core_enc_fx.c | 16 ++++++++-------- lib_enc/scale_enc_fx.c | 2 +- lib_enc/set_impulse_fx.c | 8 ++++---- lib_enc/speech_music_classif_fx.c | 2 +- lib_enc/swb_bwe_enc_fx.c | 6 +++--- lib_enc/swb_tbe_enc_fx.c | 16 ++++++++-------- lib_enc/tcx_ltp_enc_fx.c | 12 ++++++------ lib_enc/tcx_utils_enc_fx.c | 12 ++++++------ lib_enc/vad_fx.c | 2 +- lib_enc/voiced_enc_fx.c | 18 +++++++++--------- 59 files changed, 198 insertions(+), 198 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 90a8a13d2..7551bd41a 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -271,7 +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_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o 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 */ diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index e2e644a55..3bb0cbd72 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -245,7 +245,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_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -444,7 +444,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_1796_replace_shl_o m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ #else m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 139500891..683e1e8d4 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_1796_replace_shl_o #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_1796_replace_shl_o 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_1796_replace_shl_o #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_1796_replace_shl_o 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_1796_replace_shl_o 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/env_stab_fx.c b/lib_com/env_stab_fx.c index c58abb1f0..2e71443ca 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -85,7 +85,7 @@ Word16 env_stability_fx( /* in Q15 */ mem_norm[i] = ynrm[i]; move16(); } -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o Overflow = 0; move16(); env_delta = shl_o( *mem_env_delta, 1, &Overflow ); diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 57cdbd6e5..7420a4457 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2279,7 +2279,7 @@ static void getmidbands( ) { Word16 j, max_psize, shift; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -2318,7 +2318,7 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o 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) diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index bf4921c7a..d49a786f2 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -126,7 +126,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_1796_replace_shl_o 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 ); @@ -212,7 +212,7 @@ 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_1796_replace_shl_o 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*/ diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 7fa36443e..53fb67601 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -565,7 +565,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o Ener1_fx = mult_ro( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */ #else Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ @@ -595,7 +595,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ #else Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ @@ -716,7 +716,7 @@ void highband_exc_dct_in_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp1 = shl_sat( tmp, exp ); #else tmp1 = shl_o( tmp, exp, &Overflow ); @@ -1098,7 +1098,7 @@ 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_ +#ifdef ISSUE_1796_replace_shl_o tmp1 = shl_sat( tmp, exp ); #else tmp1 = shl_o( tmp, exp, &Overflow ); diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index eb21aee8b..9017903c8 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -163,7 +163,7 @@ 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_ +#ifdef ISSUE_1796_replace_shl_o cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ @@ -339,7 +339,7 @@ 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_ +#ifdef ISSUE_1796_replace_shl_o cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ #else cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 9cc11e9b1..fdd0d6d71 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -608,7 +608,7 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ #else tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index 485b21895..b372e15f3 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -111,19 +111,19 @@ void ifft_rel_fx( t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#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_ +#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_ +#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*/ @@ -139,13 +139,13 @@ void ifft_rel_fx( move16(); *( xi2 + n8 ) = sub_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ); /*Qx*/ move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#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_ +#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*/ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index b1fc80f36..68ede5413 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -989,7 +989,7 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /*b = -2.0f * *plsp;*/ b = *plsp; move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o m2 = shl_sat( -2, sub( 15, Q_out ) ); /* There's only 1 integer x to solve -32768 = x * 2^y, if y is an integer : x= -1, y = 15 . @@ -2324,7 +2324,7 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 5e3667fb9..fe6ac4f7c 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -345,7 +345,7 @@ 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_ +#ifdef ISSUE_1796_replace_shl_o exp_den = shl_sat( exp_den, 1 ); #else exp_den = shl_o( exp_den, 1, &Overflow ); diff --git a/lib_com/math_op.c b/lib_com/math_op.c index 658d7f5ed..74143b8ed 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -256,7 +256,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val } IF( expi > 0 ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( x[0], expi ); #else tmp = shl_o( x[0], expi, &Overflow ); @@ -264,7 +264,7 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( x[i], expi ); #else tmp = shl_o( x[i], expi, &Overflow ); diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 8daf3b72e..5e8f02e09 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_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -279,7 +279,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_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o num_den = shl_sat( num_den, 1 ); #else num_den = shl_o( num_den, 1, &Overflow ); @@ -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_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -565,7 +565,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_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o num_den = shl_sat( num_den, 1 ); #else num_den = shl_o( num_den, 1, &Overflow ); diff --git a/lib_com/options.h b/lib_com/options.h index 731516fbb..d7cb9646d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,6 +114,6 @@ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ -#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ +//#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ #endif diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 2d1fb6af3..dcfec0856 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -72,7 +72,7 @@ void Residu3_lc_fx( { q = add( q, shift ); } -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o *y++ = shl_sat( x[0], shift ); #else *y++ = shl_o( x[0], shift, &Overflow ); diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index b0eaea936..8d1236b53 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -161,7 +161,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 */ -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -190,7 +190,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_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); @@ -475,7 +475,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 */ -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -504,7 +504,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_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 025038357..78422a292 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -2338,7 +2338,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_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 ); @@ -3213,7 +3213,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -3252,7 +3252,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_1796_replace_shl_o_ +#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 */ @@ -3326,7 +3326,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_1796_replace_shl_o_ +#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 ); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 18a2defbb..f3a1471cb 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -996,7 +996,7 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; #endif move32(); @@ -1040,7 +1040,7 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -1543,7 +1543,7 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 @@ -1630,7 +1630,7 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); @@ -1803,7 +1803,7 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); #else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); @@ -1892,7 +1892,7 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp_vfac = shl_sat( voice_factors[i], 1 ); #else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); @@ -5798,7 +5798,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_1796_replace_shl_o scale_step = shl_sat( tmp, exp ); /* Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ @@ -5880,7 +5880,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_1796_replace_shl_o scale_step = shl_sat( tmp, exp ); /*Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ @@ -6058,7 +6058,7 @@ void non_linearity_ivas_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_1796_replace_shl_o scale_step = shl_sat( tmp, exp ); /* Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ @@ -6140,7 +6140,7 @@ void non_linearity_ivas_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_1796_replace_shl_o scale_step = shl_sat( tmp, exp ); /*Q14 */ #else scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ @@ -7081,7 +7081,7 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -7198,7 +7198,7 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -7229,7 +7229,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_1796_replace_shl_o_ +#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 ); diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 5ab79ead0..da9757db9 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -337,7 +337,7 @@ Word16 usquant_fx( /* o: index of the winning codeword */ 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_ +#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 idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ @@ -704,7 +704,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -731,7 +731,7 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o y[i] = shl_sat( x[i], exp0 ); #else y[i] = shl_o( x[i], exp0, &Overflow ); @@ -753,7 +753,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -775,7 +775,7 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ) ); @@ -792,7 +792,7 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( 1, exp0 ); #else tmp = shl_o( 1, exp0, &Overflow ); @@ -833,7 +833,7 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ) ); @@ -2492,7 +2492,7 @@ Word32 root_a_over_b_fx( exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 08608a9d5..5a8ad35c5 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -359,7 +359,7 @@ static Word16 DTFS_alignment_weight_fx( } temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ -#ifdef ISSUE_1796_replace_shl_o_ +#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) */ @@ -1270,13 +1270,13 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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_1796_replace_shl_o_ +#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 ); @@ -2117,7 +2117,7 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o fraca = shl_sat( fraca, scale ); #else fraca = shl_o( fraca, scale, &Overflow ); @@ -3507,7 +3507,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); @@ -3545,7 +3545,7 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 6cc1f493a..84302ff08 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -63,7 +63,7 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1796_replace_shl_o_ +#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*/ diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 197308446..b865c4783 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,7 +43,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -80,7 +80,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_ +#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 */ @@ -168,7 +168,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -390,7 +390,7 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -530,7 +530,7 @@ 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_ +#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*/ @@ -823,7 +823,7 @@ 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_ +#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*/ @@ -1023,7 +1023,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -1094,7 +1094,7 @@ static Word16 find_best_delay_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_ +#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 */ diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 9327e1cde..78594558b 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -126,7 +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_ +#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 ); @@ -191,7 +191,7 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -210,7 +210,7 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -768,7 +768,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -782,7 +782,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_ +#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 ); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index d9ec7e2b0..e3323060b 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -901,7 +901,7 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -925,7 +925,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_ +#ifdef ISSUE_1796_replace_shl_o tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ #else tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index a04814cff..f3e7a8594 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -872,7 +872,7 @@ static void decod_gen_voic_core_switch_fx( Word16 *pt1; GSC_DEC_HANDLE hGSCDec; hGSCDec = st_fx->hGSCDec; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -968,7 +968,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_ +#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 */ diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index ba550e166..bc638b1a1 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -30,7 +30,7 @@ void transf_cdbk_dec_fx( Word32 L_tmp; Word32 dct_code32[L_SUBFR]; Word16 qdct; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -144,7 +144,7 @@ void transf_cdbk_dec_fx( } FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index 17c3359fd..e82394fbb 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -73,7 +73,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -250,7 +250,7 @@ void dec_pit_exc_fx( gain_pit_fx = st_fx->lp_gainp_fx; move16(); } -#ifdef ISSUE_1796_replace_shl_o_ +#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*/ diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index 487a20d95..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; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; move16(); #endif @@ -502,7 +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_ +#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 */ diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index ae0b914da..330cb5d44 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -44,7 +44,7 @@ void minimumStatistics_fx( Word16 f, p, i; Word16 tmp, tmp2, tmp_e; Word32 tmp32; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -55,7 +55,7 @@ void minimumStatistics_fx( BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o_ +#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 ) ) diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index e6c6b8c3f..039736f90 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2975,7 +2975,7 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in Word16 sfb; Word16 tmp; Word16 delta; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -2994,7 +2994,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_ +#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 ) ); @@ -3029,7 +3029,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -3048,7 +3048,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_ +#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 ) ); diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 033e0bbfd..6590ede7b 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3344,12 +3344,12 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac; -#ifndef ISSUE_1796_replace_shl_o_ +#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_ +#ifdef ISSUE_1796_replace_shl_o fac = shl_sat( fac, exp ); #else fac = shl_o( fac, exp, &flag ); diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index ee75a4574..fa4e914c5 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -655,7 +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_ +#ifndef ISSUE_1796_replace_shl_o Flag flg_ov; #endif IF( k == 0 ) @@ -709,7 +709,7 @@ void stereo_dft_res_subst_spec_fx( move32(); } -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c index 50a31e682..f9c2db757 100644 --- a/lib_dec/pvq_core_dec_fx.c +++ b/lib_dec/pvq_core_dec_fx.c @@ -477,7 +477,7 @@ static void densitySymbolIndexDecode_fx( Word32 acc; Word16 alpha = 0; move16(); -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -494,7 +494,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_ +#ifdef ISSUE_1796_replace_shl_o angle = shl_sat( angle, 1 ); #else angle = shl_o( angle, 1, &Overflow ); diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 492a8aa0e..5b74b1a1c 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -961,7 +961,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_ +#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*/ @@ -1607,7 +1607,7 @@ void wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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*/ diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index beb0bc36f..95b98e854 100644 --- a/lib_dec/syn_outp_fx.c +++ b/lib_dec/syn_outp_fx.c @@ -67,7 +67,7 @@ void unscale_AGC( { Word16 i, fac, tmp, frame_fac, max_val; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -84,7 +84,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_ +#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 */ diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 44adf0da8..6c0adb6d2 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -381,7 +381,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_ +#ifdef ISSUE_1796_replace_shl_o scale = shl_sat( scale, sub( tmp, *scale_e ) ); #else scale = shl_o( scale, sub( tmp, *scale_e ), &Overflow ); @@ -446,7 +446,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_ +#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 ); @@ -480,12 +480,12 @@ 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_ +#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_ +#ifdef ISSUE_1796_replace_shl_o scale = shl_sat( mult_r( scale, adjust ), 1 ); #else scale = shl_o( mult_r( scale, adjust ), 1, &Overflow ); diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index df02ea4b2..f417a0904 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -129,7 +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_ +#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, tmp16 ); /* Q15 */ #else gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ @@ -214,7 +214,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_ +#ifdef ISSUE_1796_replace_shl_o tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */ #else tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index da0976a2d..c26bb22be 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,7 +1657,7 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -1781,7 +1781,7 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ -#ifdef ISSUE_1796_replace_shl_o_ +#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*/ ); @@ -2749,7 +2749,7 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -3257,7 +3257,7 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -4024,7 +4024,7 @@ 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_ ) +#if !defined( ISSUE_1772_replace_shr_o ) || !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -4682,7 +4682,7 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 7812ad4f7..2f2682b8e 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -552,7 +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_ +#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 ); diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 97c301fd8..d9842b882 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +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_ +#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 4b93ef4f9..45a407d27 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -287,7 +287,7 @@ void transf_cdbk_enc_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -644,7 +644,7 @@ void transf_cdbk_enc_ivas_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index d9995dc6f..5f173cd7f 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -517,7 +517,7 @@ void enc_pit_exc_fx( } } -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ #else cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ @@ -993,7 +993,7 @@ void enc_pit_exc_ivas_fx( } } -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ #else cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index c6c224246..ceda6a133 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -183,7 +183,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -364,7 +364,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 85696d89f..02cf09f35 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -521,7 +521,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) xy = shr( xy, 1 ); /* be sure that xy < yy */ gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ /* diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 227407589..8db83c2b9 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -784,7 +784,7 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -2369,7 +2369,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -2424,21 +2424,21 @@ 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_ +#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_ +#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_ +#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 */ @@ -2489,7 +2489,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -2561,21 +2561,21 @@ 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_ +#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_ +#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_ +#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 */ @@ -3428,7 +3428,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -3636,13 +3636,13 @@ 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_ +#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_ +#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 ); @@ -3830,13 +3830,13 @@ 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_ +#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_ +#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 ); diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index b5d85627d..981c7e51c 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -1630,7 +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_ +#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, 4 ); #else tmp = shl_o( tmp, 4, &Overflow ); diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index e737c0225..ffd7c0cef 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -1211,7 +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_ +#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 ); @@ -2552,7 +2552,7 @@ void noise_est_ivas_fx( { /* ftemp2 /= ftemp */ num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp -#ifdef ISSUE_1796_replace_shl_o_ +#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 diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index b2712ce7f..8a3cf1a00 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -126,7 +126,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -1048,7 +1048,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_ +#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 ); diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index 0fc18c120..a5e193461 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,7 +267,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -333,7 +333,7 @@ void pvq_encode_frame_ivas_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -397,7 +397,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -463,7 +463,7 @@ void pvq_encode_frame_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o_ +#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 ); @@ -943,7 +943,7 @@ static void densityIndexSymbolEncode_ivas_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -955,7 +955,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_ +#ifdef ISSUE_1796_replace_shl_o angle = shl_sat( angle, 1 ); #else angle = shl_o( angle, 1, &Overflow ); @@ -1026,7 +1026,7 @@ static void densityIndexSymbolEncode_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -1038,7 +1038,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_ +#ifdef ISSUE_1796_replace_shl_o angle = shl_sat( angle, 1 ); #else angle = shl_o( angle, 1, &Overflow ); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index 6ee6f98b8..32633c89d 100644 --- a/lib_enc/scale_enc_fx.c +++ b/lib_enc/scale_enc_fx.c @@ -98,7 +98,7 @@ void Preemph_scaled( BASOP_SATURATE_WARNING_OFF_EVS Overflow = 0; -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o QVal = shl_sat( 1, sub( 15, bits ) ); #else QVal = shl_o( 1, sub( 15, bits ), &Overflow ); diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index b33fb1439..3968efd04 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,13 +201,13 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); -#if defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o_ ) +#if defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o ) krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ -#elif defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o_ ) +#elif defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o ) krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ -#elif !defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o_ ) +#elif !defined( ISSUE_1772_replace_shr_o ) && defined( ISSUE_1796_replace_shl_o ) krit_fx = shr_o( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ), &Overflow ); /* Q18 */ -#elif !defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o_ ) +#elif !defined( ISSUE_1772_replace_shr_o ) && !defined( ISSUE_1796_replace_shl_o ) krit_fx = shr_o( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ), &Overflow ); /* Q18 */ #endif diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index e39eda8b9..6334a6ef0 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -3762,7 +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_ +#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 ); diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 9635f0760..40fefd684 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -1059,7 +1059,7 @@ 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_ +#ifdef ISSUE_1796_replace_shl_o num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); @@ -1068,7 +1068,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class tmp = div_s( num, den ); expn = sub( expn, expd ); -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -1172,7 +1172,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class } test(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 ) ) ) diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index aa8d1336c..44dc63857 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4643,7 +4643,7 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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] ); @@ -4652,7 +4652,7 @@ static void EstimateSHBFrameGain_fx( } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o sig = shl_sat( oriSHB[i], scaling ); #else sig = shl_o( oriSHB[i], scaling, &Overflow ); @@ -4661,7 +4661,7 @@ static void EstimateSHBFrameGain_fx( } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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] ); @@ -4844,7 +4844,7 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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] ); @@ -4853,7 +4853,7 @@ static void EstimateSHBFrameGain_ivas_fx( } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o sig = shl_sat( oriSHB[i], scaling ); #else sig = shl_o( oriSHB[i], scaling, &Overflow ); @@ -4862,7 +4862,7 @@ static void EstimateSHBFrameGain_ivas_fx( } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o_ +#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] ); @@ -6198,7 +6198,7 @@ static void determine_gain_weights_fx( Word16 j; Word16 exp, exp1, frac, tmp, exp2; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); @@ -6224,7 +6224,7 @@ static void determine_gain_weights_fx( { exp2 = sub( exp, 2 ); } -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o weights[j] = shl_sat( tmp, exp2 ); #else weights[j] = shl_o( tmp, exp2, &Overflow ); diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 61618bbad..a069f99b4 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -86,7 +86,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -183,7 +183,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_ +#ifdef ISSUE_1796_replace_shl_o *norm_corr = shl_sat( temp_m, temp_e ); #else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); @@ -301,7 +301,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -393,7 +393,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_ +#ifdef ISSUE_1796_replace_shl_o *norm_corr = shl_sat( temp_m, temp_e ); #else *norm_corr = shl_o( temp_m, temp_e, &Overflow ); @@ -544,7 +544,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_ +#ifdef ISSUE_1796_replace_shl_o g = shl_sat( g, sub( s1, s2 ) ); #else g = shl_o( g, sub( s1, s2 ), &Overflow ); @@ -599,7 +599,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_ +#ifdef ISSUE_1796_replace_shl_o g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ #else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 5292d7260..c45ba3120 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2146,14 +2146,14 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif -#ifdef ISSUE_1796_replace_shl_o_ +#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*/ ); @@ -2227,7 +2227,7 @@ 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_ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -2328,7 +2328,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_ +#ifdef ISSUE_1796_replace_shl_o att = shl_sat( att, s ); #else att = shl_o( att, s, &Overflow ); @@ -2535,7 +2535,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_ +#ifdef ISSUE_1796_replace_shl_o tmp1 = shl_sat( tmp1, s ); #else tmp1 = shl_o( tmp1, s, &Overflow ); @@ -2695,7 +2695,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_ +#ifdef ISSUE_1796_replace_shl_o att = shl_sat( att, s ); #else att = shl_o( att, s, &Overflow ); diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 3094a7411..c8f64f771 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1079,7 +1079,7 @@ Word16 wb_vad_fx( snr_sumt = add( snr_sumt, shr( snr, 4 ) ); /*Q4 */ -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ #else tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index a8d509c91..0de0285d5 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -558,7 +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_ +#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 */ @@ -589,7 +589,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_ +#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 */ @@ -621,7 +621,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_ +#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 ) ) ) @@ -633,7 +633,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_ +#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 */ @@ -756,7 +756,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_ +#ifdef ISSUE_1796_replace_shl_o fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); @@ -793,7 +793,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_ +#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 */ @@ -917,7 +917,7 @@ ivas_error ppp_voiced_encoder_fx( test(); test(); test(); -#ifdef ISSUE_1796_replace_shl_o_ +#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 ) ) ) ) @@ -1098,7 +1098,7 @@ ivas_error ppp_voiced_encoder_fx( move16(); } -#ifdef ISSUE_1796_replace_shl_o_ +#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 */ @@ -1437,7 +1437,7 @@ static Word32 DTFS_freq_corr_fx( scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o fracb = shl_sat( fracb, scale ); #else fracb = shl_o( fracb, scale, &Overflow ); -- GitLab From 3fa268c89b56698d904c1d52f02992ac0354d550 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 14:48:06 +0200 Subject: [PATCH 17/29] activated macro and deactivated macro triggered code in critical files lsf_tools_fx, enc_acelp_fx and lp_exc_e_fx --- lib_com/lsf_tools_fx.c | 9 ++++----- lib_com/options.h | 2 +- lib_enc/enc_acelp_fx.c | 2 +- lib_enc/lp_exc_e_fx.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 68ede5413..8fafd2159 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -989,14 +989,13 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /*b = -2.0f * *plsp;*/ b = *plsp; move16(); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ m2 = shl_sat( -2, sub( 15, Q_out ) ); - /* There's only 1 integer x to solve -32768 = x * 2^y, if y is an integer : x= -1, y = 15 . - * y = 15 is possible if Q_out is 0, but x = -1 is impossible, because x is set to -2 . - * so we can assume a saturated overflow, if -2 * 2^y = -32768 . + /* There's only 1 integer to solve -32768 = -2 * 2^y, y = 14 . + * so we can assume a saturated overflow, if -2 * 2^y = -32768 and y is not 14. */ - Overflow = ( m2 == MIN_16 ) ? 1 : 0; + Overflow = ( m2 == MIN_16 && Q_out != 1) ? 1 : 0; #else m2 = shl_o( -2, sub( 15, Q_out ), &Overflow ); #endif diff --git a/lib_com/options.h b/lib_com/options.h index d7cb9646d..731516fbb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,6 +114,6 @@ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ -//#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ +#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ #endif diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index d9842b882..97c301fd8 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +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 +#ifdef ISSUE_1796_replace_shl_o_ gain = shl_sat( gain, i ); /* saturation can occur here */ /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 02cf09f35..85696d89f 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -521,7 +521,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) xy = shr( xy, 1 ); /* be sure that xy < yy */ gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); -#ifdef ISSUE_1796_replace_shl_o +#ifdef ISSUE_1796_replace_shl_o_ gain = shl_sat( gain, i ); /* saturation can occur here */ /* -- GitLab From 0a0ccf7a7bdcd66eef640debcaea6b17a2a9b040 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 14:52:51 +0200 Subject: [PATCH 18/29] just cosmethics --- lib_enc/lp_exc_e_fx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 85696d89f..7d289b36a 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -525,8 +525,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) gain = shl_sat( gain, i ); /* saturation can occur here */ /* - Theres only to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 - y == 0 is possible, x == 32767 is impossible + Theres only one x, to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 . So we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: x == 32767 or y == 0 */ Overflow = ( gain == MAX_16 && i != 0 ) ? 1 : 0; -- GitLab From 110ce57c6f9154e5bd3cebf8605dca2776ec9db5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 14:56:51 +0200 Subject: [PATCH 19/29] Renamed all macros to correct name and deactivated again --- lib_com/lsf_tools_fx.c | 2 +- lib_com/options.h | 2 +- lib_enc/enc_acelp_fx.c | 2 +- lib_enc/lp_exc_e_fx.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 8fafd2159..662ae46b1 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -989,7 +989,7 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /*b = -2.0f * *plsp;*/ b = *plsp; move16(); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o m2 = shl_sat( -2, sub( 15, Q_out ) ); /* There's only 1 integer to solve -32768 = -2 * 2^y, y = 14 . diff --git a/lib_com/options.h b/lib_com/options.h index 731516fbb..6941242d7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,6 +114,6 @@ #define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */ #define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ -#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ +//#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ #endif diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 97c301fd8..d9842b882 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +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_ +#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 7d289b36a..15ecabb90 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -521,7 +521,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) xy = shr( xy, 1 ); /* be sure that xy < yy */ gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); -#ifdef ISSUE_1796_replace_shl_o_ +#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ /* -- GitLab From 1cec6b77a602b6e091ce0154927f5a19b65ed5d0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 3 Jul 2025 15:41:24 +0200 Subject: [PATCH 20/29] clang format 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 662ae46b1..d0f676948 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -995,7 +995,7 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /* There's only 1 integer to solve -32768 = -2 * 2^y, y = 14 . * so we can assume a saturated overflow, if -2 * 2^y = -32768 and y is not 14. */ - Overflow = ( m2 == MIN_16 && Q_out != 1) ? 1 : 0; + Overflow = ( m2 == MIN_16 && Q_out != 1 ) ? 1 : 0; #else m2 = shl_o( -2, sub( 15, Q_out ), &Overflow ); #endif -- GitLab From 8b79f19e11f2bc50352e877f47ab9348c60d6a79 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 17 Jul 2025 08:58:11 +0200 Subject: [PATCH 21/29] activate 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 95ce3c230..03a4a7aa8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,6 +145,6 @@ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ #define FIX_1824 -//#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ +#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ #endif -- GitLab From 3e4b35fbaab7a66d011d8cd46c6cbd975b48b4de Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 17 Jul 2025 09:53:55 +0200 Subject: [PATCH 22/29] fix warning --- lib_enc/arith_coder_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 6c0adb6d2..2e88b1f00 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -367,7 +367,7 @@ static Word16 tcx_arith_rateloop( Word32 L_tmp; Word16 tmp, tmp3; Word32 tmp2; -#ifndef ISSUE_1796_replace_shl_o__ +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -- GitLab From 729b1b67da35cf043c4bba914babc87f9e623bac Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 17 Jul 2025 10:59:06 +0200 Subject: [PATCH 23/29] fix instrumentation --- lib_com/lsf_tools_fx.c | 6 +++++- lib_enc/enc_acelp_fx.c | 7 +++++-- lib_enc/lp_exc_e_fx.c | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index d0f676948..fd6e44b8f 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -995,7 +995,11 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /* There's only 1 integer to solve -32768 = -2 * 2^y, y = 14 . * so we can assume a saturated overflow, if -2 * 2^y = -32768 and y is not 14. */ - Overflow = ( m2 == MIN_16 && Q_out != 1 ) ? 1 : 0; + test(); + IF( m2 == MIN_16 && Q_out != 1 ) + { + Overflow = 1; + } #else m2 = shl_o( -2, sub( 15, Q_out ), &Overflow ); #endif diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index d9842b882..6cf6690ea 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -567,10 +567,13 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn gain = shl_sat( gain, i ); /* saturation can occur here */ /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . - * y = 0 is possible, x = 32767 is possible . * so we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: y == 0 or x == 32767 . */ - Overflow = ( gain == MAX_16 && i != 0 ) ? 1 : 0; + test(); + IF( gain == MAX_16 && i != 0 ) + { + Overflow = 1; + } #else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ #endif diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 15ecabb90..8fa408301 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -528,7 +528,11 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) Theres only one x, to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 . So we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: x == 32767 or y == 0 */ - Overflow = ( gain == MAX_16 && i != 0 ) ? 1 : 0; + test(); + IF( gain == MAX_16 && i != 0 ) + { + Overflow = 1; + } #else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ #endif -- GitLab From 1ac3a22a449a2343da8c5612e9220b771fe34e62 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 08:50:11 +0200 Subject: [PATCH 24/29] minor: comments --- 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 6744874f7..56855d73f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -124,7 +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_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives*/ +#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free 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 7ebc0b782a77c056d6ee025546104e89bc2083ec Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 11:09:56 +0200 Subject: [PATCH 25/29] lib_com/lsf_tools_fx.c : restore shl_o in E_LPC_f_lsp_pol_get() --- lib_com/lsf_tools_fx.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index fd6e44b8f..0ac838cc4 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -989,20 +989,7 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons /*b = -2.0f * *plsp;*/ b = *plsp; move16(); -#ifdef ISSUE_1796_replace_shl_o - m2 = shl_sat( -2, sub( 15, Q_out ) ); - - /* There's only 1 integer to solve -32768 = -2 * 2^y, y = 14 . - * so we can assume a saturated overflow, if -2 * 2^y = -32768 and y is not 14. - */ - test(); - IF( m2 == MIN_16 && Q_out != 1 ) - { - Overflow = 1; - } -#else m2 = shl_o( -2, sub( 15, Q_out ), &Overflow ); -#endif f[1] = L_mult_o( b, m2, &Overflow ); move32(); -- GitLab From 56fe575da2baafb50972dc7b5e79d9e5b898c1da Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 11:20:55 +0200 Subject: [PATCH 26/29] lib_enc/lp_exc_e_fx.c : restore shl_o in corr_xy1_fx() --- lib_enc/lp_exc_e_fx.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 8fa408301..01005f641 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -521,21 +521,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) xy = shr( xy, 1 ); /* be sure that xy < yy */ gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); -#ifdef ISSUE_1796_replace_shl_o - gain = shl_sat( gain, i ); /* saturation can occur here */ - - /* - Theres only one x, to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 . - So we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: x == 32767 or y == 0 - */ - test(); - IF( gain == MAX_16 && i != 0 ) - { - Overflow = 1; - } -#else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ -#endif *Overflow_out |= Overflow; move16(); -- GitLab From 6c5311a0dc198112862801c6c10f97db37ffc108 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 29 Jul 2025 11:22:30 +0200 Subject: [PATCH 27/29] lib_enc/enc_acelp_fx.c : delete manual a-posteriori overflow-detection in corr_xy1_fx() : overflow flag is not read afterwards --- lib_enc/enc_acelp_fx.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 6cf6690ea..f6a8e65b2 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -565,15 +565,6 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ - - /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 . - * so we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: y == 0 or x == 32767 . - */ - test(); - IF( gain == MAX_16 && i != 0 ) - { - Overflow = 1; - } #else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ #endif -- GitLab From 70da0c0b73be19886279de2822ef45cbe86f1b59 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 30 Jul 2025 08:06:02 +0200 Subject: [PATCH 28/29] restore lib_com/env_stab_fx.c --- lib_com/env_stab_fx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index 2e71443ca..a3140b4e4 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -85,13 +85,9 @@ Word16 env_stability_fx( /* in Q15 */ mem_norm[i] = ynrm[i]; move16(); } -#ifndef ISSUE_1796_replace_shl_o Overflow = 0; move16(); env_delta = shl_o( *mem_env_delta, 1, &Overflow ); -#else - env_delta = shl_sat( *mem_env_delta, 1 ); -#endif } ELSE { -- GitLab From 24d34621a14f512bbebf9f13f9529da5ec2cc6eb Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 6 Aug 2025 21:35:24 +0200 Subject: [PATCH 29/29] more conflicts --- lib_dec/FEC_HQ_core_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 2e46dba17..c598af538 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -4023,7 +4023,7 @@ 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 ) +#if !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -- GitLab