diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 846b4dceab0befaa6257563eda540e785fb7c1d9..7551bd41afff208bfcf26f1e5fc8787c63a736e4 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_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 */ +#endif /* iscale = 1.0f / scale; */ iscale_e = 0; diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 30ae2d47b028021152ead282c240af1a18c6f46b..3bb0cbd7294ce06710644dca1137a6b614730abe 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 ); @@ -442,7 +444,11 @@ Word16 BitAllocF_fx( exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ +#ifdef ISSUE_1796_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 52c7d0614ec4d935e71187ad9967a14eea1b6017..683e1e8d4ce0eac9b7dac17d6706afcda75c25bf 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 */ @@ -139,7 +141,11 @@ 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 + 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 +233,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_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ @@ -309,7 +317,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_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 ) ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -354,7 +366,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_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 ) ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 7cc536822c4a22bee728319810e48db7dc5dea76..7420a4457750209c4fca63cd8fcab712dcc819f7 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,7 +2318,11 @@ static void getmidbands( move16(); 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) +#else psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) +#endif move16(); } /* minimum_statistics needs fixed exponent of 6 */ diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index f28af742fe673950c979fde8de6c8835711ebe89..d49a786f253e10c6f3e235d8bdc712d7bb96e78d 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 ) ); @@ -201,15 +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*/ - move16(); /*Q1 */ +#endif + 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 208f205693ce9d67d04e96870bfcf4a15ea12d12..53fb676016460d2c8dac74880b4f5da6eb608564 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -565,7 +565,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 +595,11 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); - Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */ +#ifdef ISSUE_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 +716,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 +1098,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 bf0af5e87d969e7f2f4a226b008982dc83a97ac9..9017903c831ba270f320458e50d37c1056a91bd7 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 bc96fe0f8fd62525c23e6b49845f01cdcd68d515..fdd0d6d7183761b85034098b8c32a9ccca1d3d9b 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -608,8 +608,12 @@ 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) */ - tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-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 9e64a4e254f17bd36d456d3d45bf35d36612720d..b372e15f3afc5251577a044e3b8fc8f532fd1dd0 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(); - *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ +#ifdef ISSUE_1796_replace_shl_o + *xi2 = shl_sat( *xi2, 1 ); /*Qx*/ +#else + *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ +#endif move16(); - *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ +#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(); - *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ +#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(); - *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ +#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 4b3e200a4560e8568d04886fa6f6a97f7cc97798..b4838e0c13dad83770c707f56da1f34bc835367b 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -2313,8 +2313,12 @@ 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 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 4f493cacde1c222cba29c4859e08beb17776da29..fe6ac4f7ccaa0657f9b093934977a88c2d514f36 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 7014988b887944d6c9417a15c0d07363e7245c79..74143b8ed40d03dd8eff19bf7ca2c39cff1b3d54 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -256,11 +256,19 @@ 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++ ) { +#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 ); } } diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 46e24e31af8d899d10a3cd489e1ab217bcd3d7b1..fae2a43c2f5c1330d63dc06c1e3e21886d58fb7d 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; @@ -277,7 +279,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { +#ifdef ISSUE_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(); } @@ -358,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; @@ -557,7 +565,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifdef ISSUE_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 ); #endif diff --git a/lib_com/options.h b/lib_com/options.h index 1178c1878a16ffff4d28d4e952bf403371f57ca5..b2bb8e4050b90cc73afc38bdc8f652dd061940ed 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -82,6 +82,7 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ #define FIX_1762_COMPILER_ISSUE_NEW /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ +#define ISSUE_1796_replace_shl_o /*FhG: replace shl_ro by overflow-free alternatives - BE*/ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 91d0ee30a04a5f639a529a20a93d77453acd8e49..0ed9c9ac844e12d16ec61679379fbf4fd3577b95 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 c259745f2a7266bffbe33207cac60e540cfbc577..8d1236b534091f8569a9a047f2a207a7573456d0 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -160,8 +160,12 @@ void stat_noise_uv_mod_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ +#ifdef ISSUE_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; @@ -466,8 +474,12 @@ void stat_noise_uv_mod_ivas_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ +#ifdef ISSUE_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 8fd876f1cb9d6dd008231fd5bc074ec58e0612da..78422a2927e8ce284dd110ac32c7a51b0d98b656 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]); */ @@ -3209,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 ); @@ -3246,7 +3252,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 +3326,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) */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 2ca52b8e4f673b1f486b85d3b052a3793736131a..beaef461407840ade891b3580064e51b4709f5db 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++ ) { +#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 - move16(); /* Q14 */ +#endif + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; @@ -1620,7 +1630,11 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ +#ifdef ISSUE_1796_replace_shl_o + tmp_vfac = shl_sat( voice_factors[i], 1 ); +#else tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); +#endif } ELSE { @@ -1789,7 +1803,11 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); +#else excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); +#endif move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); @@ -1873,8 +1891,12 @@ void GenShapedWBExcitation_fx( IF( igf_flag != 0 && EQ_16( coder_type, VOICED ) ) { /*tmp_vfac = 2*voice_factors[i]; - tmp_vfac = min(1, tmp_vfac);*/ + tmp_vfac = min(1, tmp_vfac);*/ +#ifdef ISSUE_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 ) ); - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ +#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 ) ); - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ +#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 ) ); - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ +#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 ) ); - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ +#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 2f5c3c8d33640dd6fe6c126caf455d54167451fd..6771c144c0619a63a5b99112c8dc87871b4ff74f 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -315,9 +315,13 @@ 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 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 ); @@ -680,9 +684,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 ) { @@ -705,7 +711,11 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { +#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 */ } } @@ -723,10 +733,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 ) @@ -743,7 +755,11 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); +#else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); +#endif move32(); } return; @@ -756,7 +772,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 ); @@ -793,7 +813,11 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); +#else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); +#endif move32(); } return; @@ -2448,7 +2472,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 591645017b05fddc498af77d499f50e1433571a5..5a8ad35c5bb311292fe2612b0b860dd4941c4016 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) */ - wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#ifdef ISSUE_1796_replace_shl_o + wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#else + wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ +#endif IF( GE_16( Qmaxcorr, Qcorr ) ) { diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ @@ -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 a1ff625b08f2328fac98ec8066afed188f7e453d..84302ff087347fa61f2ec06027406f5fea5cc556 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 a69584a32e1891c76c2ea70fa726d47a15619958..1be7453ab9492386fa762903658b5ff6c66921bc 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,9 +43,11 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif /* Initialize */ @@ -78,7 +80,11 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); +#ifdef ISSUE_1796_replace_shl_o + b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ +#else b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ +#endif move32(); } @@ -162,9 +168,11 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; @@ -382,7 +390,11 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); +#else hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); +#endif move16(); k = add( k, 1 ); } @@ -518,8 +530,12 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } +#ifdef ISSUE_1796_replace_shl_o + tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ +#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ +#endif + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -803,8 +819,12 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } +#ifdef ISSUE_1796_replace_shl_o + tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ +#else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ +#endif + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -995,9 +1015,11 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif move16(); // d1m @@ -1063,8 +1085,12 @@ static Word16 find_best_delay_fx( exp2 = norm_l( min_corr_fx ); L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); - tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ - tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ + tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ +#else + tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ +#endif } *false_flag = 0; diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 48d91a87a1956594ba84a662e33c8cc73d52d89f..78594558b78dae073e4c787fe15fec99d45478cd 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 12a13a4ec141ed145ab1cc55be02b3d825875768..e3323060b67f3739402e8def26f25461c6ae08e5 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 109f360cb63a30f8544bb6b14b33c2db62f14380..f3e7a8594b006eb87d230f5e9ae1ac1266a6e98d 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 6144765a8707dec75df9f6ffd037cb64681ddb17..bc638b1a13e6c264bb17bb2eeb6fa32a74ad7a40 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 ca6660fabe33908ad18c9f466f60afa9a3c88848..e82394fbbca1343d2f561f6f14b2ac09d1e11c21 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 37d088a8f98d7049e8ed7d130e26f5e2deab8e22..f11f851cbb6eb333caabc2d00fa28b3ddf127001 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -493,7 +493,7 @@ static void modify_pst_param_fx( Word16 tmp; Word16 lp_noiseQ12; Word32 L_tmp; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL +#ifndef ISSUE_1796_replace_shl_o Flag Overflow = 0; move16(); #endif @@ -502,7 +502,11 @@ static void modify_pst_param_fx( test(); IF( NE_16( coder_type, INACTIVE ) && LT_16( lp_noise, LP_NOISE_THR_FX ) ) { +#ifdef ISSUE_1796_replace_shl_o + lp_noiseQ12 = shl_sat( lp_noise, 4 ); /* to go from Q8 to Q12 */ +#else lp_noiseQ12 = shl_o( lp_noise, 4, &Overflow ); /* to go from Q8 to Q12 */ +#endif /* ftmp = lp_noise*BG1_FX + CG1_FX */ tmp = mac_r( CG1_FX * 65536L, lp_noiseQ12, BG1_FX * 8 ); /* x8 to go from Q12 to Q15 */ diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index cecbad2943bb83dc1528388e365cec92fa40c75e..330cb5d4452ce4f80eda4d441ca7e3f0a4a931ce 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 79953aacaf2dd5ee9c9258bfb583d0589fe3d92c..40b02c82315c383281a2b69656305999573e1ab0 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 370254a4eddb8775e5cee3cfa022f1349d36ec58..9de2904b8f65f8c3ac020444860a8de1577b7cfa 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3244,10 +3244,16 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac; +#ifndef ISSUE_1796_replace_shl_o Flag flag = 0; move32(); +#endif fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); +#ifdef ISSUE_1796_replace_shl_o + fac = shl_sat( fac, exp ); +#else fac = shl_o( fac, exp, &flag ); +#endif IF( LT_16( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) ) { diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 3fed308b21c3368cd93ec8880bc612d2a9bfde60..fa4e914c5c72ec2507258e7519fb36721ca57b4e 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 93da9c77a8a0ec9dc80d47a98cd2b5910c1b67e4..f9c2db757dffc1b7be48fdc5fb69d973b68c41d8 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 174f67f646d804ac6ac94bbbdd12c8eef17f3f01..09f5eda03dd1dc8c9749aed10a34c460acd378b1 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -962,7 +962,11 @@ void ivas_wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ +#else shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ +#endif move16(); } n = sub( 14, n ); @@ -1605,7 +1609,11 @@ void wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ +#else shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ +#endif move16(); } n = sub( 14, n ); diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index 133ff17b44e2f40ac846c88353ebfb4d97092a56..95b98e8548b69d2c5f854bf40c1215f6bb2257ce 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 98a5173f592f6f5c41fd26316bd5ec30b4d72ede..2e88b1f00e95a70547bf733cd212fb8184e110a8 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 a241101ba1f9b869a6b22df58d3b7aea1461e7c5..f417a09048b6d84974166cece0c39ac3eb9ca33d 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -129,7 +129,11 @@ Word16 bass_pf_enc_fx( /* gain = tmp/nrg; */ gain = BASOP_Util_Divide3232_Scale( tmp, nrg, &tmp16 ); BASOP_SATURATE_WARNING_OFF_EVS; - gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ +#ifdef ISSUE_1796_replace_shl_o + gain = shl_sat( gain, tmp16 ); /* Q15 */ +#else + gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ +#endif BASOP_SATURATE_WARNING_ON_EVS; if ( gain < 0 ) @@ -210,7 +214,11 @@ Word16 bass_pf_enc_fx( tmp32 = L_deposit_l( 1 ); tmp16 = BASOP_Util_Divide3232_Scale( tmp, tmp32, &st ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1796_replace_shl_o + tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */ +#else tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */ +#endif if ( GT_16( tmp16, 16384 /*0.5f Q15*/ ) ) { diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 640a5ba3c340dfc02edf9485098ecb1a97c62f89..c598af5385fc6fe8ea6816d91b00d636fa1520e3 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,7 +1657,11 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); +#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); +#endif move16(); BASOP_SATURATE_WARNING_ON_EVS @@ -1777,7 +1781,11 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ +#ifdef ISSUE_1796_replace_shl_o + tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#else tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#endif s = 15 - 5 - 7; IF( L_spec >= 1024 ) { @@ -2737,7 +2745,11 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); +#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); +#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; @@ -3244,7 +3256,11 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); +#else hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS if ( GT_16( hTcxEnc->tcx_target_bits_fac, 20480 /*1.25 in Q14*/ ) ) @@ -4007,9 +4023,11 @@ void InternalTCXDecoder_fx( Word16 Aq_old_fx[M + 1]; Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1]; Word16 *xn_buf16 = (Word16 *) xn_buf32; +#if !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); +#endif #endif Copy32( x_quant_fx, spectrum_fx, s_max( L_frame, L_spec ) ); @@ -4659,7 +4677,11 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); +#else xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); +#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 18f48e904671c41127b9f6d0c7d3bf801dcd555e..2f2682b8ee0ed035ee3a9c9d00879c99b3d122cd 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 4317bdbb339419e21de8d9d597255c2083a32b4c..f6a8e65b26ca963080b429dcf85e0661e0902f0c 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,7 +563,11 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn i = add( exp_xy, 1 - 1 ); /* -1 -> gain in Q14 */ i = sub( i, exp_yy ); BASOP_SATURATE_WARNING_OFF_EVS +#ifdef ISSUE_1796_replace_shl_o + gain = shl_sat( gain, i ); /* saturation can occur here */ +#else gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ +#endif BASOP_SATURATE_WARNING_ON_EVS /* gain = s_max(0, gain); */ /* see above xy < 0. */ diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 5edc6229ff9c80372ec10db06f94a2805c2e5504..00b18f79d21242c3b6a4392a3baf3520dda5eea3 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -287,7 +287,11 @@ void transf_cdbk_enc_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); +#else x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); +#endif move16(); } @@ -639,7 +643,11 @@ void transf_cdbk_enc_ivas_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); +#else x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); +#endif move16(); } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 548e3f904125711e63a0fdd5b428049e7cafbb72..5f173cd7f5e6a9869e3597cef881f91201418885 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -517,7 +517,11 @@ void enc_pit_exc_fx( } } - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#ifdef ISSUE_1796_replace_shl_o + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ +#else + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#endif *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } @@ -989,6 +993,10 @@ void enc_pit_exc_ivas_fx( } } - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#ifdef ISSUE_1796_replace_shl_o + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ +#else + cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ +#endif *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index a0acd0bfd63e5b6c69141b353503c9ee3a8f162f..ceda6a1333624469c77cb633de881c69ac327e46 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/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 23ed7d0c2489486806792721a6538f2ce3d37f2f..8db83c2b9c6cff417d8bdb6e4d298278c7d5fc4a 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -784,7 +784,11 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); +#ifdef ISSUE_1796_replace_shl_o + En = L_mac_o( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ +#else En = L_mac_o( En, mult( pred_pow2[i], shl_o( w[i], 2, &Overflow ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ +#endif } cs = shl( cs, 1 ); @@ -2365,8 +2369,10 @@ static Word32 vq_lvq_lsf_enc( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif stagesVQ = sub( stages, 1 ); @@ -2418,13 +2424,25 @@ static Word32 vq_lvq_lsf_enc( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + diff[j] = shl_sat( diff[j], 4 ); +#else diff[j] = shl_o( diff[j], 4, &Overflow ); +#endif move16(); } - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else + L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif FOR( j = 1; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif } e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ move32(); @@ -2471,8 +2489,10 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; +#endif #endif stagesVQ = sub( stages, 1 ); @@ -2541,13 +2561,25 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + diff[j] = shl_sat( diff[j], 4 ); +#else diff[j] = shl_o( diff[j], 4, &Overflow ); +#endif move16(); } - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else + L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif FOR( j = 1; j < M; j++ ) { +#ifdef ISSUE_1796_replace_shl_o + L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif } e[i] = L_tmp; move32(); @@ -3396,7 +3428,11 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); +#ifdef ISSUE_1796_replace_shl_o + temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow ); +#else temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_o( w_fx[i], 2, &Overflow ) ), yy_fx[i], &Overflow ); +#endif } cs = shl( cs, 1 ); temp_l = L_shr( temp_l, cs ); @@ -3600,9 +3636,17 @@ static void lsf_mid_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, 4 ); +#else tmp = shl_o( tmp, 4, &Overflow ); +#endif tmp = mult_ro( tmp, tmp, &Overflow ); +#ifdef ISSUE_1796_replace_shl_o + err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); +#else err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); +#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); @@ -3786,9 +3830,17 @@ static void lsf_mid_enc_ivas_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ +#ifdef ISSUE_1796_replace_shl_o + tmp = shl_sat( tmp, 4 ); +#else tmp = shl_o( tmp, 4, &Overflow ); +#endif tmp = mult_ro( tmp, tmp, &Overflow ); +#ifdef ISSUE_1796_replace_shl_o + err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); +#else err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); +#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 6056c0c4690b7ad2c518aed8c761b5db0cce0ff5..981c7e51c06cac2b4b196761e84ada582f34549d 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 7fb58941b3542e8673c35cf80aeea8fbee452620..1ed2d8d043abb4c9db0c7704eb6abab2bd1e7454 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,8 +2552,12 @@ 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 +#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 dc3ec020ab1959c1ecaefabc9bea1dcbbb366f43..8a3cf1a00a7e52dc4847517e176f0fdeba6d5495 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 e2d5fb264df53fc69c0fed15ffac3d9a28f98984..a5e19346144be671c53723d302b35236f0508aa7 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,9 +267,11 @@ void pvq_encode_frame_ivas_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -331,7 +333,11 @@ void pvq_encode_frame_ivas_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); +#ifdef ISSUE_1796_replace_shl_o + gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); +#else gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); +#endif move16(); if ( gopt[is] == 0 ) @@ -391,9 +397,11 @@ void pvq_encode_frame_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -455,7 +463,11 @@ void pvq_encode_frame_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); +#ifdef ISSUE_1796_replace_shl_o + gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); +#else gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); +#endif move16(); if ( gopt[is] == 0 ) { @@ -931,9 +943,11 @@ static void densityIndexSymbolEncode_ivas_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif sym_freq = L_deposit_l( 1 ); @@ -941,7 +955,11 @@ static void densityIndexSymbolEncode_ivas_fx( IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); +#ifdef ISSUE_1796_replace_shl_o + angle = shl_sat( angle, 1 ); +#else angle = shl_o( angle, 1, &Overflow ); +#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); @@ -1008,9 +1026,11 @@ static void densityIndexSymbolEncode_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif sym_freq = L_deposit_l( 1 ); @@ -1018,7 +1038,11 @@ static void densityIndexSymbolEncode_fx( IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); +#ifdef ISSUE_1796_replace_shl_o + angle = shl_sat( angle, 1 ); +#else angle = shl_o( angle, 1, &Overflow ); +#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index 76eae22b7b1f21cc40f7593b1cf4e5fcff81da16..32633c89d559d81ddf07d1db91f106c8f9150d31 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 e48ed476d9eb4313bbebc096a6312e87e9fa66ea..7a2224611b34c82fe57cc7930e7e061825376608 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -201,7 +201,12 @@ void set_impulse_fx( den = extract_h( L_shl( rr_fx[i], exp_den ) ); num = div_s( num, den ); + +#ifdef ISSUE_1796_replace_shl_o + krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ +#else krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ +#endif IF( GT_16( krit_fx, krit_max_fx ) ) { diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 59f3b35f6da8972a9c05df7cdef5895dee91accc..6334a6ef0b8b78ed44c5cac29e9c16c1b55a2b36 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -3762,7 +3762,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 6b309c3345bb12892421926486682ef51660e8a9..40fefd684dd6c4877ba872b508441f717f9479b4 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 ec11d283706ac760eaa8d4cbc8043eece9a67956..dd28a9ab32599168719bb8b7c0a3f0ed92d27676 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4683,17 +4683,29 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = shl_sat( oriSHB[i], scaling ); +#else sig = shl_o( oriSHB[i], scaling, &Overflow ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -4872,17 +4884,29 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = shl_sat( oriSHB[i], scaling ); +#else sig = shl_o( oriSHB[i], scaling, &Overflow ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { +#ifdef ISSUE_1796_replace_shl_o + sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#else sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); +#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -6214,9 +6238,11 @@ static void determine_gain_weights_fx( Word16 j; Word16 exp, exp1, frac, tmp, exp2; Word32 L_tmp; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); +#endif #endif FOR( j = 0; j < dims; j++ ) @@ -6238,7 +6264,11 @@ static void determine_gain_weights_fx( { exp2 = sub( exp, 2 ); } +#ifdef ISSUE_1796_replace_shl_o + weights[j] = shl_sat( tmp, exp2 ); +#else weights[j] = shl_o( tmp, exp2, &Overflow ); +#endif move16(); /* Q12 */ } ELSE diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 84f83a3119ec01dd953676844b2cf9c70dc19ef7..a069f99b435d805ee3380619c30a5b94cc24ed8b 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 0b94e74fa5c4399a52994c5bb588cddc342867a5..bdf473aab1c98c0d74af51d4ddfb0fe925d413b9 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2072,12 +2072,18 @@ void QuantizeGain( Word16 n, Word16 *pGain, Word16 *pGain_e, Word16 *pQuantizedG Word16 ener, ener_e, enerInv, enerInv_e, gain, gain_e; Word16 quantizedGain; Word32 tmp32; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif +#ifdef ISSUE_1796_replace_shl_o + ener = mult_r( shl_sat( n, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#else ener = mult_r( shl_o( n, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); +#endif ener_e = 15 - 5 - 7; move16(); IF( GE_16( n, 1024 ) ) @@ -2147,10 +2153,12 @@ void tcx_noise_factor_fx( Word16 c1, c2; Word16 att; /* noise level attenuation factor for transient windows */ Word32 xMax; +#ifndef ISSUE_1796_replace_shl_o #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif +#endif assert( nTransWidth <= 16 ); @@ -2246,7 +2254,11 @@ void tcx_noise_factor_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ +#ifdef ISSUE_1796_replace_shl_o + att = shl_sat( att, s ); +#else att = shl_o( att, s, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2449,7 +2461,11 @@ void tcx_noise_factor_fx( tmp1 = BASOP_Util_Divide3232_Scale( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); s = add( add( add( s, x_orig_e ), inv_gain2_e ), 7 - 15 ); BASOP_SATURATE_WARNING_OFF_EVS; +#ifdef ISSUE_1796_replace_shl_o + tmp1 = shl_sat( tmp1, s ); +#else tmp1 = shl_o( tmp1, s, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2605,7 +2621,11 @@ void tcx_noise_factor_ivas_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ +#ifdef ISSUE_1796_replace_shl_o + att = shl_sat( att, s ); +#else att = shl_o( att, s, &Overflow ); +#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 8f1fb6985dc38871880b73479201df4fdaf9fcbb..23099510b9b710beaa6d02928892ef2f4b5e3e71 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 8081b29097d39ced20004f5a95a6403c7e39e297..0de0285d54b4417ee11c1f4d57bcec549b10dc0a 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -558,7 +558,11 @@ ivas_error ppp_voiced_encoder_fx( } /* Bump up if big change between the previous and the current CWs */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { /*if ( res_enratio > 5.0 && tmp < 0.65 ) */ /* 5 in Q11, 0.65 in Q15 // L_shl(tmp_fx,sub(31,Qtmp)) makes tmp_fx FIXED Q31 */ @@ -585,7 +589,11 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampdown frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else + IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { /* if (res_enratio < 0.025) */ IF( LT_32( L_shl_o( res_enratio_fx, 4, &Overflow ), 819 ) ) /*0x0333 = 0.025 in Q15, res_enratio_fx in Q15 after shl 4 */ @@ -613,7 +621,11 @@ ivas_error ppp_voiced_encoder_fx( /* if (min(res_enratio, sp_enratio) < 0.075 && tmp < -0.5f)) : 2458 = 0.075 in Q15 */ test(); +#ifdef ISSUE_1796_replace_shl_o + if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_sat( -1, sub( Qtmp, 1 ) ) ) ) +#else if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_o( -1, sub( Qtmp, 1 ), &Overflow ) ) ) +#endif { hSC_VBR->bump_up = 1; move16(); @@ -621,7 +633,11 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampup frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { IF( GT_32( res_enratio_fx, 29696 ) ) /*14.5 in Q11 */ { @@ -740,7 +756,11 @@ ivas_error ppp_voiced_encoder_fx( expb = sub( 30, add( expb, Qadj ) ); scale = shr( sub( fraca, fracb ), 15 ); +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); +#else fracb = shl_o( fracb, scale, &Overflow ); +#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -773,7 +793,11 @@ ivas_error ppp_voiced_encoder_fx( /* Ltmp1_32 = 0.8f * st->prev_cw_en */ Ltmp1_32 = Mult_32_16( hSC_VBR->prev_cw_en_fx, 26214 ); /* Q = (Q_prev_cw_en_fx + Q15+1)-Q16 = Q_prev_cw_en_fx */ +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ +#endif { /* if ( DTFS_getEngy(*CURRP_NQ) > 0.8f * st->prev_cw_en && max(pos_nq, neg_nq) > 3.0f && st->rate_control ) */ /* pos_nq_fx and neg_nq_fx in Q28 ???? */ @@ -893,7 +917,11 @@ ivas_error ppp_voiced_encoder_fx( test(); test(); test(); +#ifdef ISSUE_1796_replace_shl_o + IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_sat( 1, sub( Qtmpres, 1 ) ) ) ) ) +#else IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_o( 1, sub( Qtmpres, 1 ), &Overflow ) ) ) ) +#endif { /* if ((pos_q > neg_q) && ((pos_q>3.0*pos_nq0) || ((pos_q > 1.5*pos_nq0) && (neg_q < 1.5*neg_nq0)))) */ test(); @@ -1070,7 +1098,11 @@ ivas_error ppp_voiced_encoder_fx( move16(); } +#ifdef ISSUE_1796_replace_shl_o + IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ +#else IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ +#endif { /* if ((( tmp < 3.05 && max(res_enratio,sp_enratio) > 0.8 ) && (st->rate_control))|| (( tmp < 2.8 && max(res_enratio,sp_enratio) > 0.65 ) && (!st->rate_control))) */ @@ -1405,7 +1437,11 @@ static Word32 DTFS_freq_corr_fx( scale = shr( sub( fraca, fracb ), 15 ); +#ifdef ISSUE_1796_replace_shl_o + fracb = shl_sat( fracb, scale ); +#else fracb = shl_o( fracb, scale, &Overflow ); +#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca );