From cbc8753f0ceba1c44104bd8a756c8e972490c529 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 15 Oct 2025 08:20:06 +0200 Subject: [PATCH 1/4] Create FIXES section in options.h and move two fixes there --- lib_com/options.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ee7d3b168..03e3ca8b6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,8 +71,8 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif +/* ################### Start FIXES switches ########################### */ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ - #define FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 2166 */ #define ISSUE_1836_replace_overflow_libcom /* FhG: BE - replace overflow operators by non-overflow-alternatives in lib_com */ #define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */ @@ -114,6 +114,12 @@ #define FIX_2083_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in makeCustomLsSetup()*/ #define FIX_2085_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in ivas_dirac_config_fx() */ +#define FIX_1984_SAT_IN_PSYCHAD /* VA: Issue 1984: proposal to fix an assert */ +#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/ + +/* #################### End FIXES switches ############################ */ + + /* #################### Start BASOP porting switches ############################ */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ @@ -122,7 +128,6 @@ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ #define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */ -#define FIX_1984_SAT_IN_PSYCHAD /* VA: Issue 1984: proposal to fix an assert */ #define NONBE_FIX_1261_MASA_EXT_META_JBM /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */ #define NONBE_FIX_1143_MASA_BRSW /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */ #define NONBE_FIX_1220_OMASA_JBM_EXT_USAN /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */ @@ -130,7 +135,6 @@ #define FIX_989_TD_REND_ROM /* Eri: Clean-up for TD renderer and completion of ROM generation tool */ #define FIX_CREND_SIMPLIFY_CODE #ifdef FIX_CREND_SIMPLIFY_CODE -#define FIX_989_TD_REND_ROM /* Eri: Clean-up for TD renderer and completion of ROM generation tool */ #define USE_REVERB_16BIT_ROM /* if desactivated old rom hrtf tables is used */ #define USE_TDREND_16BIT_ROM /* if desactivated old rom hrtf tables is used. when active some tests case with 4 ISM fail due to owerflow in round_fixed function */ #define USE_FASTCONV_PARAMBIN_16BIT_ROM /* if desactivated old rom hrtf tables is used */ @@ -138,7 +142,6 @@ #endif #define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ -#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/ #define FIX_1053_REVERB_RECONFIGURATION #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1113_EXTREND_ISAR /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */ -- GitLab From 5853a806ee03ef61b7c3fdd1ad8e4d5975af1caa Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 15 Oct 2025 16:01:33 +0200 Subject: [PATCH 2/4] accept ISSUE_1836_replace_overflow_libcom --- lib_com/arith_coder_fx.c | 29 +- lib_com/basop_util.c | 116 +------- lib_com/bitalloc_fx.c | 22 +- lib_com/cldfb_evs_fx.c | 14 - lib_com/cldfb_fx.c | 14 - lib_com/cng_exc_fx.c | 90 +----- lib_com/codec_tcx_common_fx.c | 24 -- lib_com/deemph_fx.c | 66 +---- lib_com/edct_fx.c | 46 +-- lib_com/env_stab_fx.c | 11 +- lib_com/fd_cng_com_fx.c | 49 ---- lib_com/fft_fx_evs.c | 446 +---------------------------- lib_com/frame_ener_fx.c | 34 +-- lib_com/get_gain_fx.c | 24 -- lib_com/gs_bitallocation_fx.c | 12 +- lib_com/gs_bitallocation_ivas_fx.c | 11 +- lib_com/gs_gains_fx.c | 48 +--- lib_com/gs_noisefill_fx.c | 86 +----- lib_com/hp50_fx.c | 61 ---- lib_com/hq2_bit_alloc_fx.c | 12 - lib_com/hq2_core_com_fx.c | 36 +-- lib_com/hq2_noise_inject_fx.c | 56 +--- lib_com/ifft_rel_fx.c | 80 ------ lib_com/igf_base_fx.c | 40 +-- lib_com/interpol_fx.c | 13 +- lib_com/low_rate_band_att_fx.c | 34 +-- lib_com/lpc_tools_fx.c | 138 +-------- lib_com/lsf_tools_fx.c | 144 ++-------- lib_com/lsp_conv_poly_fx.c | 90 +----- lib_com/math_op.c | 28 -- lib_com/modif_fs_fx.c | 190 ++---------- lib_com/oper_32b.c | 31 -- lib_com/options.h | 2 - lib_com/phase_dispersion_fx.c | 14 - lib_com/ppp_fx.c | 15 +- lib_com/pred_lt4_fx.c | 47 +-- lib_com/preemph_fx.c | 65 +---- lib_com/pvq_com_fx.c | 20 -- lib_com/residu_fx.c | 55 +--- lib_com/stat_noise_uv_mod_fx.c | 51 +--- lib_com/swb_tbe_com_fx.c | 271 +----------------- lib_com/syn_filt_fx.c | 73 ++--- lib_com/tcx_ltp_fx.c | 18 +- lib_com/tcx_mdct_fx.c | 27 +- lib_com/tcx_utils_fx.c | 39 +-- lib_com/tns_base.c | 13 +- lib_com/tools_fx.c | 256 +---------------- 47 files changed, 189 insertions(+), 2872 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 55d7a3ec5..09e2b7f4f 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -194,13 +194,6 @@ void tcx_arith_scale_envelope( Word16 statesi, bits; Word32 mean, a, s, L_tmp; Word16 mean_e, tmp, tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - lob_bits = 0; move16(); @@ -225,12 +218,8 @@ void tcx_arith_scale_envelope( tmp = norm_l( env[k] ); tmp2 = sub( 15, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = Inv16( round_fx_sat( L_shl( env[k], tmp ) ), &tmp2 ); /* exp(tmp2) */ -#else - tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */ -#endif - ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ + ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ move32(); mean = L_add( mean, ienv[k] ); /* Q16 */ } @@ -262,11 +251,7 @@ void tcx_arith_scale_envelope( b_e = add( b_e, mean_e ); /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ -#ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ) ); -#else - tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow ); -#endif IF( tmp <= 0 ) { @@ -281,11 +266,7 @@ void tcx_arith_scale_envelope( tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); /* exp(scale) */ scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom scale = shl_sat( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */ -#else - scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */ -#endif /* iscale = 1.0f / scale; */ iscale_e = 0; @@ -334,11 +315,7 @@ void tcx_arith_scale_envelope( L_tmp = L_add( L_tmp, L_shl( Mpy_32_16_1( env[k], mult_r( 1147 /*0.035f Q15*/, iscale ) ), iscale_e ) ); /* Q16 */ tmp = norm_l( L_tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom statesi = mult_r( statesi, round_fx_sat( L_shl( L_tmp, tmp ) ) ); -#else - statesi = mult_r( statesi, round_fx_o( L_shl_o( L_tmp, tmp, &Overflow ), &Overflow ) ); -#endif bits = add( bits, sub( 15, tmp ) ); tmp = norm_s( statesi ); @@ -425,11 +402,7 @@ void tcx_arith_scale_envelope( *s_env_e = sub( add( 15, iscale_e ), tmp ); move16(); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom a = L_shl_sat( 1265000, sub( 15, *s_env_e ) ); -#else - a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; FOR( k = 0; k < L_frame; k++ ) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index fe2b7e871..134cc7c84 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -267,12 +267,6 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a Word16 preShift, postShift; Word16 m; Word32 m32; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - assert( b_m != 0 ); @@ -305,11 +299,7 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a /* normalize result */ postShift = norm_l( m32 ); -#ifdef ISSUE_1836_replace_overflow_libcom m = round_fx_sat( L_shl( m32, postShift ) ); -#else - m = round_fx_o( L_shl( m32, postShift ), &Overflow ); -#endif /* exponent */ *ptrResult_e = sub( add( add( a_e, sub( 1, b_e ) ), preShift ), postShift ); @@ -325,10 +315,6 @@ static Word16 Sqrt16_common( Word16 m, Word16 e ) { Word16 index, frac; -#ifndef ISSUE_1836_replace_overflow_libcom - Flag Overflow; -#endif - assert( ( m >= 0x4000 ) || ( m == 0 ) ); @@ -342,13 +328,7 @@ static Word16 Sqrt16_common( Word16 m, /* interpolate */ if ( m != 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom m = mac_r_sat( SqrtTable[index], SqrtDiffTable[index], frac ); -#else - BASOP_SATURATE_WARNING_OFF_EVS; - m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow ); - BASOP_SATURATE_WARNING_ON_EVS; -#endif } /* handle odd exponents */ @@ -364,19 +344,10 @@ static Word32 Sqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif assert( ( m >= 0x40000000 ) || ( m == 0 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom m16 = round_fx_sat( m ); -#else - m16 = round_fx_o( m, &Overflow ); -#endif /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 9) - 32; */ @@ -432,23 +403,9 @@ static Word32 ISqrt32_common( Word32 m, Word16 e ) { Word16 m16, index, frac; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif assert( m >= 0x40000000 ); -#ifdef ISSUE_1836_replace_overflow_libcom m16 = round_fx_sat( m ); -#else -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - m16 = round_fx_o( m, &Overflow ); -#else - m16 = round_fx( m ); -#endif -#endif - /* get table index (upper 6 bits minus 32) */ /* index = (m16 >> 25) - 32; */ @@ -915,12 +872,6 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) { Word16 z; Word32 sign; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - sign = L_and( L_xor( L_num, L_denom ), (Word32) 0x80000000 ); @@ -933,17 +884,12 @@ Word16 divide3232( Word32 L_num, Word32 L_denom ) L_denom = L_shl( L_denom, z ); /* round_fx instead of extract_h improves spectral distortion in E_UTIL_lev_dur (schur version). */ -#ifdef ISSUE_1836_replace_overflow_libcom z = div_l( L_num, round_fx_sat( L_denom ) ); -#else - z = div_l( L_num, round_fx_o( L_denom, &Overflow ) ); -#endif if ( 0 != sign ) { z = negate( z ); } - return z; } @@ -2072,66 +2018,6 @@ Word16 idiv1616_1( Word16 x, Word16 y ) } } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW -Word32 norm_llQ31( /* o : normalized result Q31 */ - Word32 L_c, /* i : upper bits of accu Q-1 */ - Word32 L_sum, /* i : lower bits of accu, unsigned Q31 */ - Word16 *exp /* o : exponent of result in [-32,31] Q0 */ -) -{ -#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - move32(); /* compensate missing instrumentation */ - move32(); /* compensate missing instrumentation */ - return w_norm_llQ31( ( (Word64) L_c << 32 ) | (UWord32) L_sum, exp ); -#else - Word16 i; - Word32 L_tmp; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef ISSUE_1836_replace_overflow_libcom - Flag Overflow = 0; -#endif - Flag Carry = 0; -#endif /* BASOP_NOGLOB */ - - /* Move MSBit of L_sum into L_c */ -#ifdef ISSUE_1836_replace_overflow_libcom - Carry = 0; - L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1 */ - L_c = L_add_c( L_c, L_c, &Carry ); -#else - L_tmp = L_add_co( L_sum, L_sum, &Carry, &Overflow ); /* L_tmp = L_sum << 1 */ - L_c = L_add_co( L_c, L_c, &Carry, &Overflow ); -#endif - L_add( 0, 0 ); - test(); - IF( ( L_c != (Word32) 0L ) && ( L_c != (Word32) 0xFFFFFFFFL ) ) - { - i = norm_l( L_c ); - L_c = L_shl( L_c, i ); - i = sub( 31, i ); /* positive exponent */ - L_sum = L_lshr( L_tmp, 1 ); /* L_sum with MSBit=0 */ - L_sum = L_lshr( L_sum, i ); - L_sum = L_add( L_c, L_sum ); - } - ELSE - { - i = -32; - move16(); /* default exponent, if total sum=0 */ - IF( L_sum ) - { - i = norm_l( L_sum ); - L_sum = L_shl( L_sum, i ); - i = negate( i ); /* negative or zero exponent */ - } - } - *exp = i; - move16(); - return L_sum; -#endif /* #ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW */ -} -#endif /* #ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW */ - - Word32 Dot_product16HQ( /* o : normalized result Q31 */ const Word32 L_off, /* i : initial sum value Qn */ const Word16 x[], /* i : x vector Qn */ @@ -3013,7 +2899,7 @@ Word16 BASOP_util_atan( /* o: atan(x) [-pi/2;pi/2] 1Q14 * /*BASOP_util_atan_16(0.0444059968): max error 0.0000567511, mean 0.000017, abs mean 0.000017*/ } ELSE - IF( LT_32( x, ( L_shl( 1, Q_ATANINP ) - 8482560l /*0.00395 Q31*/ ) ) ) + IF( LT_32( x, ( L_shl( 1, Q_ATANINP ) - 8482560l /*0.00395 Q31*/ ) ) ) { xx = round_fx( L_shl( x, 6 ) ); tmp = mult_r( xx, xx ); /* q15 * q15 - (16-1) = q15*/ diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 2b630cf21..f993b5501 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -23,12 +23,6 @@ void bitalloc_fx( Word16 diff, temp; Word16 fac; Word16 ii; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 SFM_thr = SFM_G1G2; move16(); @@ -56,11 +50,7 @@ void bitalloc_fx( move16(); FOR( m = 1; m < im; m++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom v = sub_sat( temp, y[m] ); /* Q0 */ -#else - v = sub_o( temp, y[m], &Overflow ); /* Q0 */ -#endif temp = s_max( temp, y[m] ); if ( v < 0 ) { @@ -251,12 +241,6 @@ Word16 BitAllocF_fx( Word16 tmp, exp1, exp2; Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */ Word16 B_w16_fx; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif set32_fx( Rsubband_w32_fx, 0, NB_SFM ); @@ -450,11 +434,7 @@ Word16 BitAllocF_fx( exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ -#ifdef ISSUE_1836_replace_overflow_libcom - m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ -#else - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ -#endif + m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/ if ( L_tmp1 < 0 ) { m_fx = negate( m_fx ); diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 153f95cf9..368ce7923 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -1240,12 +1240,6 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif FOR( k = 0; k < numberCols; k++ ) { @@ -1331,11 +1325,7 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else - nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } @@ -1358,11 +1348,7 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else - nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 8c3331a31..e22205261 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -1499,12 +1499,6 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; // Word16 freqTable[2] = {20, 40}; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif FOR( k = 0; k < numberCols; k++ ) { @@ -1590,11 +1584,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else - nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } @@ -1617,11 +1607,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e { FOR( j = 20; j < numberBandsM; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); -#else - nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow ); -#endif } } diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 56701bf61..63aa77686 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -621,12 +621,6 @@ void cng_params_postupd_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); IF( ptr < 0 ) @@ -652,16 +646,10 @@ void cng_params_postupd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -739,12 +727,6 @@ void cng_params_postupd_ivas_fx( Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); IF( ptr < 0 ) @@ -770,16 +752,10 @@ void cng_params_postupd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); // To do : Saturation to be re-validated. sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); @@ -883,13 +859,6 @@ void cng_params_upd_fx( Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* update the pointer to circular buffer of old LSP vectors */ *ho_circ_ptr = add( *ho_circ_ptr, 1 ); @@ -926,15 +895,9 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#else - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); - pt_exc2++; - L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#endif } } ELSE /* L_FRAME16k */ @@ -945,22 +908,12 @@ void cng_params_upd_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#else - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); - pt_exc2++; - L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#endif } } -#ifdef ISSUE_1836_replace_overflow_libcom L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#else - L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#endif /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; @@ -994,16 +947,10 @@ void cng_params_upd_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ @@ -1086,12 +1033,6 @@ void cng_params_upd_ivas_fx( move16(); Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* update the pointer to circular buffer of old LSP vectors */ *ho_circ_ptr = add( *ho_circ_ptr, 1 ); @@ -1128,15 +1069,9 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#else - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); - pt_exc2++; - L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ -#endif } } ELSE /* L_FRAME16k */ @@ -1147,22 +1082,12 @@ void cng_params_upd_ivas_fx( L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#else - L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); - pt_exc2++; - L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ -#endif } } -#ifdef ISSUE_1836_replace_overflow_libcom L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#else - L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ -#endif /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; @@ -1196,21 +1121,12 @@ void cng_params_upd_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) ); -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ - tmp = add( add( Q_exc, Q_exc ), 1 ); - sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); -#endif move32(); /* Q6 */ ptR++; ptI--; diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c index 010590ad1..515a1a43e 100644 --- a/lib_com/codec_tcx_common_fx.c +++ b/lib_com/codec_tcx_common_fx.c @@ -61,12 +61,6 @@ void tcxFormantEnhancement( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ l = 0; @@ -141,11 +135,7 @@ void tcxFormantEnhancement( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); -#else - xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -233,12 +223,6 @@ void tcxFormantEnhancement_with_shift( Word16 i, j, k, l, n; Word16 fac, fac0, fac1, fac_e, d, tmp; Word16 xn_buf_e, xn_one, m, e; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */ l = 0; @@ -317,11 +301,7 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); -#else - xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -366,11 +346,7 @@ void tcxFormantEnhancement_with_shift( { fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); -#else - xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS; } diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c index 230dcec6a..829b4045b 100644 --- a/lib_com/deemph_fx.c +++ b/lib_com/deemph_fx.c @@ -92,34 +92,16 @@ void deemph_fx( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow; - Overflow = 0; - move32(); -#endif - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ - L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/ - signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ -#else - L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ - L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ - signal[0] = round_fx_sat( L_tmp ); /*Qx*/ -#endif - - + L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/ + L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/ + signal[0] = round_fx_sat( L_tmp ); /*Qx*/ move16(); FOR( i = 1; i < L; i++ ) { - L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/ L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/ signal[i] = round_fx_sat( L_tmp ); /*Qx*/ -#else - L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/ - signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/ -#endif move16(); } @@ -142,13 +124,7 @@ void Deemph2( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow; - Overflow = 0; - move32(); -#endif -#endif + /* saturation can occur in L_mac() */ L_tmp = L_mult( x[0], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ @@ -158,16 +134,14 @@ void Deemph2( FOR( i = 1; i < L; i++ ) { L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/ -#ifdef ISSUE_1836_replace_overflow_libcom - x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ -#else - x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/ -#endif + x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/ move16(); } *mem = x[L - 1]; /*Qx-1*/ move16(); + + return; } @@ -188,17 +162,15 @@ void Deemph2( * Returns: * void */ -void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, Word16 *mem ) +void E_UTIL_deemph2( + Word16 shift, + Word16 *x, + const Word16 mu, + const Word16 L, + Word16 *mem ) { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow; - Overflow = 0; - move32(); -#endif -#endif /* signal[0] = signal[0] + mu * (*mem); */ L_tmp = L_deposit_h( *mem ); /*Qx+16*/ @@ -207,13 +179,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W shift = shr( -32768, shift ); /*Q15 - shift*/ FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ -#else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ -#endif move16(); } } @@ -221,13 +188,8 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W { FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/ -#else - L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/ - x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/ -#endif move16(); } } diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 244d69381..fa6059628 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -395,13 +395,6 @@ void edct_16fx( const Word16 *px, *pt; Word16 *py; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow; - Overflow = 0; - move32(); -#endif -#endif /*COMPLETE: some eDCT sub function are missing */ IF( EQ_16( length, L_FRAME32k ) ) @@ -456,22 +449,13 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */ Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */ re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ move16(); L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */ im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */ -#else - Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow ); /*Q(Qx+16) */ - re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ - move16(); - L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */ - Lacc = L_msu_o( L_tmp, x[i2], *pt, &Overflow ); /*Q(Qx+16) */ - im2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ -#endif move16(); px -= 2; pt--; @@ -496,20 +480,12 @@ void edct_16fx( fact = round_fx( L_shl( L_tmp, 2 ) ); /*Q15 */ FOR( i = 0; i < shr( length, 1 ); i++ ) { - tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */ re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */ -#else - re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ -#endif move16(); - tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */ im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */ -#else - im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */ -#endif move16(); } @@ -520,8 +496,7 @@ void edct_16fx( { i2 = shl( i, 1 ); - L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */ y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ move16(); @@ -529,15 +504,6 @@ void edct_16fx( L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */ -#else - Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */ - y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ - move16(); - - L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */ - Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */ - *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */ -#endif move16(); py -= 2; @@ -916,8 +882,8 @@ void edxt_fx( #endif #ifdef IVAS_FLOAT_FIXED_TO_BE_DONE ELSE - /* TODO: below IF and ELSE blocks are unreachable, verified on code coverage report */ - IF( s_and( kernelType, 1 ) ) /* DST */ + /* TODO: below IF and ELSE blocks are unreachable, verified on code coverage report */ + IF( s_and( kernelType, 1 ) ) /* DST */ { const float offK = ( kernelType == MDST_II && synthesis ? 0.5f : 1.0f - 0.5f * ( kernelType >> 1 ) ); const float offM = ( kernelType == MDST_II && synthesis ? 1.0f : 0.5f ); diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c index c98807695..728cfddb9 100644 --- a/lib_com/env_stab_fx.c +++ b/lib_com/env_stab_fx.c @@ -188,12 +188,7 @@ Word16 env_stab_smo_fx( /* Q0 */ Word16 maxval, pp[NUM_ENV_STAB_PLC_STATES], pa[NUM_ENV_STAB_PLC_STATES]; Word16 i; Word16 tmp, sum, exp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /* get previous state */ prev_state = maximum_fx( env_stab_state_p, NUM_ENV_STAB_PLC_STATES, &maxval ); @@ -229,11 +224,7 @@ Word16 env_stab_smo_fx( /* Q0 */ /*tmp = shl(tmp, add(exp, 1));*/ /* Q15 */ FOR( i = 0; i < NUM_ENV_STAB_PLC_STATES; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom env_stab_state_p[i] = round_fx_sat( L_shl_sat( L_mult_sat( env_stab_state_p[i], tmp ), add( exp, 1 ) ) ); /* Q15 */ -#else - env_stab_state_p[i] = round_fx_o( L_shl_o( L_mult_o( env_stab_state_p[i], tmp, &Overflow ), add( exp, 1 ), &Overflow ), &Overflow ); /* Q15 */ -#endif move16(); } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 6666f9091..6796c7535 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -648,12 +648,6 @@ void minimum_statistics( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif len2 = i_mult( MSNUMSUBFR, len ); @@ -752,11 +746,7 @@ void minimum_statistics( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } -#ifdef ISSUE_1836_replace_overflow_libcom scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); -#else - scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); -#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -906,11 +896,7 @@ void minimum_statistics( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ -#ifdef ISSUE_1836_replace_overflow_libcom tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); -#else - tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); -#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -998,13 +984,8 @@ void minimum_statistics( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); move32(); -#else - msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); - move32(); -#endif BASOP_SATURATE_WARNING_ON_EVS; } } @@ -1261,13 +1242,6 @@ void minimum_statistics_fx( Word16 msAlphaCorAlpha2; Word16 msPeriodogSum16; Word16 msNoiseFloor16; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - len2 = i_mult( MSNUMSUBFR, len ); @@ -1366,11 +1340,7 @@ void minimum_statistics_fx( /* use absolute value to avoid -1.0 x -1.0 multiplications */ s2 = norm_l( scalar2 ); } -#ifdef ISSUE_1836_replace_overflow_libcom scalar216 = round_fx_sat( L_shl( scalar2, s2 ) ); -#else - scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow ); -#endif scalar2 = L_mult( scalar216, scalar216 ); /* find common exponent */ @@ -1527,11 +1497,7 @@ void minimum_statistics_fx( s2 = s_min( s2, WORD32_BITS - 1 ); /* beta: scaled by s2 */ -#ifdef ISSUE_1836_replace_overflow_libcom tmp16 = round_fx_sat( L_shl( tmp, s1 ) ); -#else - tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow ); -#endif beta = mult_r( tmp16, tmp16 ); /* scalar3: scaled by s3 */ @@ -1619,11 +1585,7 @@ void minimum_statistics_fx( move32(); /* exponent msCurrentMinSubWindow[j]: CNG_S */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 ); -#else - msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow ); -#endif move32(); BASOP_SATURATE_WARNING_ON_EVS; } @@ -2308,13 +2270,6 @@ static void getmidbands( ) { Word16 j, max_psize, shift; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - max_psize = psize[0]; move16(); @@ -2347,11 +2302,7 @@ static void getmidbands( move16(); FOR( j = 0; j < npart; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp) -#else - psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp) -#endif move16(); } /* minimum_statistics needs fixed exponent of 6 */ diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index 221bdc533..cf27583ae 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -1186,12 +1186,6 @@ static void fft5_32_16fx( Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7; Word16 i0, i1, i2, i3, i4; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif i0 = Idx[0]; move16(); i1 = Idx[32]; @@ -1218,15 +1212,9 @@ static void fft5_32_16fx( move16(); T6 = zRe[i3]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom T7 = add_sat( T5, T6 ); T8 = add_sat( T4, T7 ); Tt = sub_sat( T5, T6 ); -#else - T7 = add_o( T5, T6, &Overflow ); - T8 = add_o( T4, T7, &Overflow ); - Tt = sub_o( T5, T6, &Overflow ); -#endif /* T9 = KP559016994 * (T4 - T7); */ L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) T9 = round_fx_sat( L_tmp ); // Qx @@ -1248,17 +1236,10 @@ static void fft5_32_16fx( L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) Tn = round_fx_sat( L_tmp ); // Qx -#ifdef ISSUE_1836_replace_overflow_libcom zRe[i0] = add_sat( T1, T8 ); move16(); zIm[i0] = add_sat( To, Tp ); move32(); -#else - zRe[i0] = add_o( T1, T8, &Overflow ); - move16(); - zIm[i0] = add_o( To, Tp, &Overflow ); - move32(); -#endif /*T2 = KP951056516*Te + KP587785252*Th; */ L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x) @@ -1275,7 +1256,6 @@ static void fft5_32_16fx( T4 = add_sat( T9, T6 ); T5 = sub_sat( T6, T9 ); -#ifdef ISSUE_1836_replace_overflow_libcom zRe[i3] = sub_sat( T4, T2 ); move32(); zRe[i1] = add_sat( T5, T3 ); @@ -1284,16 +1264,6 @@ static void fft5_32_16fx( move32(); zRe[i4] = sub_sat( T5, T3 ); move32(); -#else - zRe[i3] = sub_o( T4, T2, &Overflow ); - move32(); - zRe[i1] = add_o( T5, T3, &Overflow ); - move32(); - zRe[i2] = add_o( T4, T2, &Overflow ); - move32(); - zRe[i4] = sub_o( T5, T3, &Overflow ); - move32(); -#endif /* T2 = KP951056516 * Ts + KP587785252 * Tt; */ L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x) @@ -1700,12 +1670,6 @@ static void cftfsub_16fx( { Word16 j, j1, j2, j3, l; Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif l = 2; move16(); @@ -1758,7 +1722,6 @@ static void cftfsub_16fx( { FOR( j = 0; j < l; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom j1 = add_sat( j, l ); x0r = sub_sat( a[j], a[j1] ); x0i = sub_sat( a[j + 1], a[j1 + 1] ); @@ -1766,15 +1729,6 @@ static void cftfsub_16fx( move16(); a[j + 1] = add_sat( a[j + 1], a[j1 + 1] ); move16(); -#else - j1 = add_o( j, l, &Overflow ); - x0r = sub_o( a[j], a[j1], &Overflow ); - x0i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); - a[j] = add_o( a[j], a[j1], &Overflow ); - move16(); - a[j + 1] = add_o( a[j + 1], a[j1 + 1], &Overflow ); - move16(); -#endif a[j1] = x0r; move16(); a[j1 + 1] = x0i; @@ -1799,14 +1753,7 @@ static void cft1st_16fx( Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; Word16 tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom x0r = add_sat( a[0], a[2] ); x0i = add_sat( a[1], a[3] ); x1r = sub_sat( a[0], a[2] ); @@ -1876,77 +1823,6 @@ static void cft1st_16fx( move16(); k1 = 0; move16(); -#else - x0r = add_o( a[0], a[2], &Overflow ); - x0i = add_o( a[1], a[3], &Overflow ); - x1r = sub_o( a[0], a[2], &Overflow ); - x1i = sub_o( a[1], a[3], &Overflow ); - x2r = add_o( a[4], a[6], &Overflow ); - x2i = add_o( a[5], a[7], &Overflow ); - x3r = sub_o( a[4], a[6], &Overflow ); - x3i = sub_o( a[5], a[7], &Overflow ); - a[0] = add_o( x0r, x2r, &Overflow ); - move16(); - a[1] = add_o( x0i, x2i, &Overflow ); - move16(); - a[4] = sub_o( x0r, x2r, &Overflow ); - move16(); - a[5] = sub_o( x0i, x2i, &Overflow ); - move16(); - a[2] = sub_o( x1r, x3i, &Overflow ); - move16(); - a[3] = add_o( x1i, x3r, &Overflow ); - move16(); - a[6] = add_o( x1r, x3i, &Overflow ); - move16(); - a[7] = sub_o( x1i, x3r, &Overflow ); - wk1r = w[2]; - move32(); - - x0r = add_o( a[8], a[10], &Overflow ); - x0i = add_o( a[9], a[11], &Overflow ); - x1r = sub_o( a[8], a[10], &Overflow ); - x1i = sub_o( a[9], a[11], &Overflow ); - x2r = add_o( a[12], a[14], &Overflow ); - x2i = add_o( a[13], a[15], &Overflow ); - x3r = sub_o( a[12], a[14], &Overflow ); - x3i = sub_o( a[13], a[15], &Overflow ); - a[8] = add_o( x0r, x2r, &Overflow ); - move16(); - a[9] = add_o( x0i, x2i, &Overflow ); - move16(); - a[12] = sub_o( x2i, x0i, &Overflow ); - move16(); - a[13] = sub_o( x0r, x2r, &Overflow ); - move16(); - - x0r = sub_o( x1r, x3i, &Overflow ); - x0i = add_o( x1i, x3r, &Overflow ); - tmp = sub_o( x0r, x0i, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - - a[10] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - tmp = add_o( x0r, x0i, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[11] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */ - move16(); - - x0r = add_o( x3i, x1r, &Overflow ); - x0i = sub_o( x3r, x1i, &Overflow ); - tmp = sub_o( x0i, x0r, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[14] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - tmp = add_o( x0i, x0r, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[15] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - k1 = 0; - move16(); -#endif FOR( j = 16; j < n; j += 16 ) { @@ -1967,7 +1843,7 @@ static void cft1st_16fx( L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ -#ifdef ISSUE_1836_replace_overflow_libcom + x0r = add_sat( a[j], a[j + 2] ); x0i = add_sat( a[j + 1], a[j + 3] ); x1r = sub_sat( a[j], a[j + 2] ); @@ -2078,118 +1954,6 @@ static void cft1st_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); -#else - x0r = add_o( a[j], a[j + 2], &Overflow ); - x0i = add_o( a[j + 1], a[j + 3], &Overflow ); - x1r = sub_o( a[j], a[j + 2], &Overflow ); - x1i = sub_o( a[j + 1], a[j + 3], &Overflow ); - x2r = add_o( a[j + 4], a[j + 6], &Overflow ); - x2i = add_o( a[j + 5], a[j + 7], &Overflow ); - x3r = sub_o( a[j + 4], a[j + 6], &Overflow ); - x3i = sub_o( a[j + 5], a[j + 7], &Overflow ); - a[j] = add_o( x0r, x2r, &Overflow ); - move16(); - a[j + 1] = add_o( x0i, x2i, &Overflow ); - move16(); - - x0r = sub_o( x0r, x2r, &Overflow ); - x0i = sub_o( x0i, x2i, &Overflow ); - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 4] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 5] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = sub_o( x1r, x3i, &Overflow ); - x0i = add_o( x1i, x3r, &Overflow ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 2] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 3] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = add_o( x1r, x3i, &Overflow ); - x0i = sub_o( x1i, x3r, &Overflow ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 6] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 7] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - wk1r = w[k2 + 2]; - move32(); - wk1i = w[k2 + 3]; - move32(); - L_tmp = L_shl( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ - wk3r = L_sub( wk1r, L_shl( L_tmp, 1 ) ); /*Q30 */ - - L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ - wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */ - - x0r = add_o( a[j + 8], a[j + 10], &Overflow ); - x0i = add_o( a[j + 9], a[j + 11], &Overflow ); - x1r = sub_o( a[j + 8], a[j + 10], &Overflow ); - x1i = sub_o( a[j + 9], a[j + 11], &Overflow ); - x2r = add_o( a[j + 12], a[j + 14], &Overflow ); - x2i = add_o( a[j + 13], a[j + 15], &Overflow ); - x3r = sub_o( a[j + 12], a[j + 14], &Overflow ); - x3i = sub_o( a[j + 13], a[j + 15], &Overflow ); - a[j + 8] = add_o( x0r, x2r, &Overflow ); - move16(); - a[j + 9] = add_o( x0i, x2i, &Overflow ); - move16(); - - x0r = sub_o( x0r, x2r, &Overflow ); - x0i = sub_o( x0i, x2i, &Overflow ); - tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 12] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 13] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = sub_o( x1r, x3i, &Overflow ); - x0i = add_o( x1i, x3r, &Overflow ); - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 10] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 11] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = add_o( x1r, x3i, &Overflow ); - x0i = sub_o( x1i, x3r, &Overflow ); - - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j + 14] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j + 15] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); -#endif } return; @@ -2212,16 +1976,10 @@ static void cftmdl_16fx( Word16 tmp, tmp2; Word32 L_tmp; Word32 L_x0r, L_x0i; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + m = shl( l, 2 ); FOR( j = 0; j < l; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom j1 = add_sat( j, l ); j2 = add_sat( j1, l ); j3 = add_sat( j2, l ); @@ -2249,35 +2007,6 @@ static void cftmdl_16fx( move16(); a[j3 + 1] = sub_sat( x1i, x3r ); move16(); -#else - j1 = add_o( j, l, &Overflow ); - j2 = add_o( j1, l, &Overflow ); - j3 = add_o( j2, l, &Overflow ); - x0r = add_o( a[j], a[j1], &Overflow ); - x0i = add_o( a[j + 1], a[j1 + 1], &Overflow ); - x1r = sub_o( a[j], a[j1], &Overflow ); - x1i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); - x2r = add_o( a[j2], a[j3], &Overflow ); - x2i = add_o( a[j2 + 1], a[j3 + 1], &Overflow ); - x3r = sub_o( a[j2], a[j3], &Overflow ); - x3i = sub_o( a[j2 + 1], a[j3 + 1], &Overflow ); - a[j] = add_o( x0r, x2r, &Overflow ); - move16(); - a[j + 1] = add_o( x0i, x2i, &Overflow ); - move16(); - a[j2] = sub_o( x0r, x2r, &Overflow ); - move16(); - a[j2 + 1] = sub_o( x0i, x2i, &Overflow ); - move16(); - a[j1] = sub_o( x1r, x3i, &Overflow ); - move16(); - a[j1 + 1] = add_o( x1i, x3r, &Overflow ); - move16(); - a[j3] = add_o( x1r, x3i, &Overflow ); - move16(); - a[j3 + 1] = sub_o( x1i, x3r, &Overflow ); - move16(); -#endif } wk1r = w[2]; @@ -2285,7 +2014,6 @@ static void cftmdl_16fx( tmp2 = add( l, m ); FOR( j = m; j < tmp2; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom j1 = add_sat( j, l ); j2 = add_sat( j1, l ); j3 = add_sat( j2, l ); @@ -2329,51 +2057,6 @@ static void cftmdl_16fx( L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); -#else - j1 = add_o( j, l, &Overflow ); - j2 = add_o( j1, l, &Overflow ); - j3 = add_o( j2, l, &Overflow ); - x0r = add_o( a[j], a[j1], &Overflow ); - x0i = add_o( a[j + 1], a[j1 + 1], &Overflow ); - x1r = sub_o( a[j], a[j1], &Overflow ); - x1i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); - x2r = add_o( a[j2], a[j3], &Overflow ); - x2i = add_o( a[j2 + 1], a[j3 + 1], &Overflow ); - x3r = sub_o( a[j2], a[j3], &Overflow ); - x3i = sub_o( a[j2 + 1], a[j3 + 1], &Overflow ); - a[j] = add_o( x0r, x2r, &Overflow ); - move16(); - a[j + 1] = add_o( x0i, x2i, &Overflow ); - move16(); - a[j2] = sub_o( x2i, x0i, &Overflow ); - move16(); - a[j2 + 1] = sub_o( x0r, x2r, &Overflow ); - move16(); - - x0r = sub_o( x1r, x3i, &Overflow ); - x0i = add_o( x1i, x3r, &Overflow ); - tmp = sub_o( x0r, x0i, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - tmp = add_o( x0r, x0i, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = add_o( x3i, x1r, &Overflow ); - x0i = sub_o( x3r, x1i, &Overflow ); - tmp = sub_o( x0i, x0r, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - tmp = add_o( x0i, x0r, &Overflow ); - L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); -#endif } k1 = 0; @@ -2400,7 +2083,6 @@ static void cftmdl_16fx( tmp2 = add( l, k ); FOR( j = k; j < tmp2; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom j1 = add_sat( j, l ); j2 = add_sat( j1, l ); j3 = add_sat( j2, l ); @@ -2456,87 +2138,21 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); -#else - j1 = add_o( j, l, &Overflow ); - j2 = add_o( j1, l, &Overflow ); - j3 = add_o( j2, l, &Overflow ); - x0r = add_o( a[j], a[j1], &Overflow ); - x0i = add_o( a[j + 1], a[j1 + 1], &Overflow ); - x1r = sub_o( a[j], a[j1], &Overflow ); - x1i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); - x2r = add_o( a[j2], a[j3], &Overflow ); - x2i = add_o( a[j2 + 1], a[j3 + 1], &Overflow ); - x3r = sub_o( a[j2], a[j3], &Overflow ); - x3i = sub_o( a[j2 + 1], a[j3 + 1], &Overflow ); - a[j] = add_o( x0r, x2r, &Overflow ); - move16(); - a[j + 1] = add_o( x0i, x2i, &Overflow ); - move16(); - - x0r = sub_o( x0r, x2r, &Overflow ); - x0i = sub_o( x0i, x2i, &Overflow ); - - L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = sub_o( x1r, x3i, &Overflow ); - x0i = add_o( x1i, x3r, &Overflow ); - - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_x0r = L_add( (Word32) x1r, (Word32) x3i ); - L_x0i = L_sub( (Word32) x1i, (Word32) x3r ); - x0r = extract_l( L_x0r ); - x0i = extract_l( L_x0i ); - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); -#endif } wk1r = w[k2 + 2]; move32(); wk1i = w[k2 + 3]; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */ wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */ L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */ wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */ tmp2 = add( l, add( k, m ) ); -#else - L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */ - wk3r = L_sub_o( wk1r, L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q30 */ - L_tmp = L_shl_o( Mult_32_32( wk2r, wk1r ), 1, &Overflow ); /*Q29 */ - wk3i = L_sub_o( L_shl_o( L_tmp, 1, &Overflow ), wk1i, &Overflow ); /*Q30 */ - tmp2 = add( l, add( k, m ) ); -#endif FOR( j = add( k, m ); j < tmp2; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom j1 = add_sat( j, l ); j2 = add_sat( j1, l ); j3 = add_sat( j2, l ); @@ -2593,64 +2209,6 @@ static void cftmdl_16fx( L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */ move16(); -#else - j1 = add_o( j, l, &Overflow ); - j2 = add_o( j1, l, &Overflow ); - j3 = add_o( j2, l, &Overflow ); - x0r = add_o( a[j], a[j1], &Overflow ); - x0i = add_o( a[j + 1], a[j1 + 1], &Overflow ); - x1r = sub_o( a[j], a[j1], &Overflow ); - x1i = sub_o( a[j + 1], a[j1 + 1], &Overflow ); - x2r = add_o( a[j2], a[j3], &Overflow ); - x2i = add_o( a[j2 + 1], a[j3 + 1], &Overflow ); - x3r = sub_o( a[j2], a[j3], &Overflow ); - x3i = sub_o( a[j2 + 1], a[j3 + 1], &Overflow ); - a[j] = add_o( x0r, x2r, &Overflow ); - move16(); - a[j + 1] = add_o( x0i, x2i, &Overflow ); - move16(); - - x0r = sub_o( x0r, x2r, &Overflow ); - x0i = sub_o( x0i, x2i, &Overflow ); - - tmp = negate( x0r ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */ - a[j2] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - tmp = negate( x0i ); - L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */ - a[j2 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = sub_o( x1r, x3i, &Overflow ); - x0i = add_o( x1i, x3r, &Overflow ); - - L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j1 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - x0r = add_o( x1r, x3i, &Overflow ); - x0i = sub_o( x1i, x3r, &Overflow ); - - L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */ - L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */ - a[j3] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); - - L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */ - L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */ - a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */ - move16(); -#endif } } diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index 1e58dafac..1ba05337c 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -240,20 +240,9 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 const Word16 *pt1; Word16 tmp16, exp1, exp2, tmp1, tmp2; Word16 len, enern; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* len = (0.5f * (pitch[2]/64.0 + pitch[3]/64.0) + 0.5f) */ -#ifdef ISSUE_1836_replace_overflow_libcom len = mult_r( add_sat( pitch[2], pitch[3] ), 256 ); -#else - len = mult_r( add_o( pitch[2], pitch[3], &Overflow ), 256 ); -#endif if ( LT_16( len, L_SUBFR ) ) { @@ -283,29 +272,16 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 exp1 = sub( 15 + exp1, tmp2 ); /*add ld(2^exp1)=exp1 but check format, first*/ - tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ -#ifdef ISSUE_1836_replace_overflow_libcom - Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ -#else - Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/ -#endif - exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/ + Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/ + exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/ Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/ -#else - Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/ -#endif /*make 10*log10 out of log2*/ - Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ -#ifdef ISSUE_1836_replace_overflow_libcom + Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/ *frame_ener = extract_h( L_shl_sat( Ltmp, add( tmp16, 1 ) ) ); /*Q8*/ move16(); enern = sub_sat( *frame_ener, lp_speech ); /*Q8*/ -#else - *frame_ener = extract_h( L_shl_o( Ltmp, add( tmp16, 1 ), &Overflow ) ); /*Q8*/ - move16(); - enern = sub_o( *frame_ener, lp_speech, &Overflow ); /*Q8*/ -#endif + return enern; } diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index 187339bf1..69d18b600 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -53,18 +53,10 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 exp_c, exp_e, exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - tcorr = L_deposit_l( 0 ); tener = L_deposit_l( 0 ); - /*----------------------------------------------------------------* * Find gain based on inter-correlation product *----------------------------------------------------------------*/ @@ -72,13 +64,8 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) tcorr = Dot_product16HQ( 0, x, y, n, &exp_c ); tener = Dot_productSq16HQ( 0, y, n, &exp_e ); -#ifdef ISSUE_1836_replace_overflow_libcom BASOP_Util_Divide_MantExp( round_fx_sat( tcorr ), exp_c, s_max( round_fx_sat( tener ), 1 ), exp_e, &tmp, &exp ); Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat -#else - BASOP_Util_Divide_MantExp( round_fx_o( tcorr, &Overflow ), exp_c, s_max( round_fx_o( tener, &Overflow ), 1 ), exp_e, &tmp, &exp ); - Lgain = L_shl_o( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ), &Overflow ) /*Q16*/; -#endif return Lgain; } @@ -91,12 +78,6 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) { Word32 tcorr, tener, Lgain; Word16 m_corr, m_ener, negative, Q_corr, Q_ener; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif negative = 0; move16(); @@ -139,17 +120,12 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) Q_corr = sub( Q_corr, Q_ener ); -#ifdef ISSUE_1836_replace_overflow_libcom Lgain = L_shl_sat( L_deposit_l( m_corr ), add( Q_corr, 1 ) ); /* Lgain in Q16 */ -#else - Lgain = L_shl_o( L_deposit_l( m_corr ), add( Q_corr, 1 ), &Overflow ); /* Lgain in Q16 */ -#endif if ( negative != 0 ) { Lgain = L_negate( Lgain ); /* Lgain in Q16 */ } - return Lgain; } diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 59917f42c..a4ebbe2d5 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -77,11 +77,7 @@ void bands_and_bit_alloc_fx( Word16 w_sum_bit; (void) GSC_IVAS_mode; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + nb_tot_bands = MBANDS_GN; move16(); if ( EQ_16( L_frame, L_FRAME16k ) ) @@ -95,12 +91,8 @@ void bands_and_bit_alloc_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ -#ifdef ISSUE_1836_replace_overflow_libcom ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ -#else - ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ -#endif - Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ + Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; move16(); IF( EQ_16( L_frame, L_FRAME16k ) ) diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 828d7933d..2223c0f8f 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -92,7 +92,6 @@ void bands_and_bit_alloc_ivas_fx( const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { - Word16 bandoffset, i, j, nb_bands_max, bit_new_bands, bit_tmp, st_band, nb_bands; Word16 ener_vec[MBANDS_GN_BITALLOC16k]; /*Q12 */ Word16 nb_tot_bands = 16; @@ -106,11 +105,7 @@ void bands_and_bit_alloc_ivas_fx( Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; /* Q18 */ Word16 w_sum_bit; Word16 fzero_val; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + nb_tot_bands = MBANDS_GN; move16(); if ( EQ_16( L_frame, L_FRAME16k ) ) @@ -123,11 +118,7 @@ void bands_and_bit_alloc_ivas_fx( set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* To adapt current energy band to PVQ freq band for sorting*/ -#ifdef ISSUE_1836_replace_overflow_libcom ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */ -#else - ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */ -#endif move16(); Copy( Ener_per_bd_iQ + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */ ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2]; diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 7f2cb7e63..860ed90b0 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -84,12 +84,6 @@ void Comp_and_apply_gain_fx( Word16 y_gain; Word16 L16, frac, exp1, tmp_exp; Word32 L32; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Recreate excitation for local synthesis and decoder */ StartBin = 0; @@ -110,15 +104,9 @@ void Comp_and_apply_gain_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */ exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */ move16(); -#else - L32 = L_shl_o( L_mult( exc_diffQ[i], y_gain ), tmp_exp, &Overflow ); /*Q_exc+16 */ - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc */ - move16(); -#endif } } ELSE @@ -134,22 +122,14 @@ void Comp_and_apply_gain_fx( y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ -#ifdef ISSUE_1836_replace_overflow_libcom Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); -#else - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); -#endif move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { - L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ -#ifdef ISSUE_1836_replace_overflow_libcom + L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */ -#else - exc_diffQ[i] = round_fx_o( L_shl_o( L32, tmp_exp, &Overflow ), &Overflow ); /*Q_exc */ -#endif move16(); } } @@ -173,12 +153,6 @@ void Comp_and_apply_gain_ivas_fx( Word16 L16, frac, exp1, tmp_exp; Word32 L32; Word16 Q_exc_diffQ[L_FRAME16k]; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Recreate excitation for local synthesis and decoder */ StartBin = 0; @@ -200,11 +174,7 @@ void Comp_and_apply_gain_ivas_fx( FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ -#else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ -#endif + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ move16(); IF( exc_diffQ[i] ) { @@ -230,22 +200,14 @@ 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_1836_replace_overflow_libcom - Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ -#else - Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ -#endif - move16(); /*Q1 */ + Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/ + move16(); /*Q1 */ tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) ); FOR( i = StartBin; i < NB_Qbins + StartBin; i++ ) { L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ -#else - exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */ -#endif + exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */ move16(); IF( exc_diffQ[i] ) { diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 5b8c54541..2617bd5ce 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -411,12 +411,6 @@ static void Decreas_freqPeak_fx( Word16 lsf_new_diff[M]; Word16 tmp, tmp1, exp; Word16 tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif move16(); /*ptr init*/ lsf_new_diff[0] = 0; /* prevent unitialized value */ move16(); @@ -474,13 +468,9 @@ static void Decreas_freqPeak_fx( exp = norm_s( max_val ); tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */ L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ -#else - tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */ -#endif - tmp = sub( 32767, tmp ); /*Q14 */ - L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ + tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */ + tmp = sub( 32767, tmp ); /*Q14 */ + L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */ tmp = round_fx( L_shl( L_tmp, 1 ) ); tmp1 = negate( tmp ); @@ -534,12 +524,6 @@ static void envelop_modify_fx( Word16 weight_fx; Word32 L_exc_diffQ_fx[L_FRAME16k], exc_diffQ_max; Word16 Q_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif start_band = i_mult( last_bin, 16 ); end_band = L_FRAME; @@ -573,11 +557,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ -#else - Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */ -#endif FOR( j = 0; j < 16; j++ ) { @@ -603,11 +583,7 @@ static void envelop_modify_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */ -#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++ ) @@ -706,12 +682,6 @@ void highband_exc_dct_in_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif FOR( j = 10; j < MBANDS_GN; j++ ) { @@ -726,15 +696,9 @@ void highband_exc_dct_in_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp1 = shl_sat( tmp, exp ); move16(); ener = add_sat( tmp1, ener ); /*Q0 */ -#else - tmp1 = shl_o( tmp, exp, &Overflow ); - move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ -#endif } test(); @@ -963,14 +927,10 @@ void highband_exc_dct_in_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ -#else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ -#endif } } @@ -1005,15 +965,9 @@ void highband_exc_dct_in_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; -#ifdef ISSUE_1836_replace_overflow_libcom *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ -#else - *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ - move16(); - tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ -#endif if ( tmp2 > 0 ) { *src = tmp; @@ -1102,12 +1056,6 @@ void highband_exc_dct_in_ivas_fx( Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif FOR( j = 10; j < MBANDS_GN; j++ ) { @@ -1122,15 +1070,9 @@ void highband_exc_dct_in_ivas_fx( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 14 ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp1 = shl_sat( tmp, exp ); move16(); ener = add_sat( tmp1, ener ); /*Q0 */ -#else - tmp1 = shl_o( tmp, exp, &Overflow ); - move16(); - ener = add_o( tmp1, ener, &Overflow ); /*Q0 */ -#endif } test(); @@ -1474,14 +1416,10 @@ void highband_exc_dct_in_ivas_fx( FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ ) { /*exc_dct_in[i] *= (0.067f*i-15.f); */ - tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ - tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ - L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */ + tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */ + L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */ exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */ -#else - exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */ -#endif } } @@ -1516,15 +1454,9 @@ void highband_exc_dct_in_ivas_fx( IF( GT_16( tmp, abs_s( *dst ) ) ) { tmp2 = *src; -#ifdef ISSUE_1836_replace_overflow_libcom *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */ move16(); tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */ -#else - *src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */ - move16(); - tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */ -#endif IF( tmp2 > 0 ) { *src = tmp; diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 9d6f10ed2..fedc06d23 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -86,12 +86,6 @@ static void filter_2nd_order( Word16 i; Word16 x2, x1; Word32 L_sum, L_y1, L_y2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - /* * Saturation: The states of the filter, namely L_y1 and L_y2 shall @@ -109,17 +103,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */ -#ifdef ISSUE_1836_replace_overflow_libcom L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); -#else - L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS @@ -131,17 +118,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */ L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */ -#ifdef ISSUE_1836_replace_overflow_libcom L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); -#else - L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS move16(); @@ -157,17 +137,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) ); -#else - L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS /* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */ BASOP_SATURATE_ERROR_ON_EVS @@ -178,17 +151,10 @@ static void filter_2nd_order( L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) ); L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE ); BASOP_SATURATE_ERROR_OFF_EVS BASOP_SATURATE_WARNING_OFF_EVS signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) ); -#else - L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow ); - BASOP_SATURATE_ERROR_OFF_EVS - BASOP_SATURATE_WARNING_OFF_EVS - signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS move16(); } @@ -221,12 +187,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { Word32 a1, b1, a2, b2; Word16 prescale, prescaleOld, diff; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - prescale = getScaleFactor16( signal, lg ); prescaleOld = extract_l( mem[4] ); @@ -235,11 +195,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * { prescale = s_min( prescale, diff ); } -#ifdef ISSUE_1836_replace_overflow_libcom diff = norm_l( L_shl_sat( mem[3], prescaleOld ) ); -#else - diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) ); -#endif if ( mem[3] != 0 ) { prescale = s_min( prescale, diff ); @@ -249,7 +205,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * IF( prescale != prescaleOld ) { diff = sub( prescale, prescaleOld ); -#ifdef ISSUE_1836_replace_overflow_libcom mem[0] = L_shr_sat( mem[0], diff ); move32(); mem[1] = L_shr_sat( mem[1], diff ); @@ -257,15 +212,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * mem[2] = L_shr_sat( mem[2], diff ); move32(); mem[3] = L_shr_sat( mem[3], diff ); //?sat -#else - mem[0] = L_shr_o( mem[0], diff, &Overflow ); - move32(); - mem[1] = L_shr_o( mem[1], diff, &Overflow ); - move32(); - mem[2] = L_shr_o( mem[2], diff, &Overflow ); - move32(); - mem[3] = L_shr_o( mem[3], diff, &Overflow ); -#endif move32(); mem[4] = L_deposit_l( prescale ); } @@ -378,17 +324,10 @@ void hp20_fx_32_opt( } diff = sub( prescale, prescaleOld ); -#ifdef ISSUE_1836_replace_overflow_libcom mem_fx[0] = L_shr_sat( mem_fx[0], diff ); mem_fx[1] = L_shr_sat( mem_fx[1], diff ); mem_fx[2] = L_shr_sat( mem_fx[2], diff ); mem_fx[3] = L_shr_sat( mem_fx[3], diff ); -#else - mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); - mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); - mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); - mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); -#endif move32(); move32(); move32(); diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c index 868617b84..0f097b669 100644 --- a/lib_com/hq2_bit_alloc_fx.c +++ b/lib_com/hq2_bit_alloc_fx.c @@ -312,12 +312,6 @@ void hq2_bit_alloc_har_fx( Word16 exp_shift; -#ifndef ISSUE_1836_replace_overflow_libcom - Flag Overflow; - Overflow = 0; - move32(); -#endif - L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk ); L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk ); L_THR3 = L_shl( L_deposit_l( THR3 ), SWB_BWE_LR_QRk ); @@ -572,13 +566,7 @@ void hq2_bit_alloc_har_fx( L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ -#ifdef ISSUE_1836_replace_overflow_libcom lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); -#else - lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); - Overflow = 0; /* reset BASOP Overflow */ - move32(); -#endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index d6606178d..a77513009 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -88,13 +88,6 @@ void mdct_spectrum_denorm_fx( Word16 cond_fx; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); /* allow overflow happen. */ -#endif -#endif - exp_safe = 4; /* safe bit for overflow */ move16(); @@ -165,13 +158,8 @@ void mdct_spectrum_denorm_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ -#else - cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ - Overflow = 0; -#endif - move16(); /* allow overflow happen. */ + move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { /*gain_tweak = (float) pow (2.0f, (ld_slope * log2_f (pd / pd_thresh))); */ @@ -202,11 +190,7 @@ void mdct_spectrum_denorm_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); -#else - gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); -#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } @@ -270,13 +254,6 @@ void mdct_spectrum_denorm_ivas_fx( Word16 cond_fx; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); /* allow overflow happen. */ -#endif -#endif - exp_safe = 4; /* safe bit for overflow */ move16(); @@ -347,13 +324,8 @@ void mdct_spectrum_denorm_ivas_fx( pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */ Qpd = add( sub( exp_normn, exp_normd ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */ -#else - cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */ - Overflow = 0; -#endif - move16(); /* allow overflow happen. */ + move16(); /* allow overflow happen. */ IF( cond_fx < 0 ) { /*gain_tweak = (float) pow (2.0f, (ld_slope * log2_f (pd / pd_thresh))); */ @@ -384,11 +356,7 @@ void mdct_spectrum_denorm_ivas_fx( /*gamma *= gain_tweak; */ L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */ exp_norm = norm_l( L_tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) ); -#else - gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow ); -#endif Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */ } diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 9f013a3b0..76efad10e 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -80,23 +80,13 @@ void hq2_noise_inject_fx( Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos; Word16 sb = bands; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif satur = 0; move16(); FOR( i = 0; i < bands; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */ -#else - Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */ -#endif move32(); } @@ -161,11 +151,7 @@ void hq2_noise_inject_fx( Q_env_fx[k] = sub( 31, exp2 ); move16(); tmp = sub( 17, Q_env_fx[k] ); -#ifdef ISSUE_1836_replace_overflow_libcom env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */ -#else - env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */ -#endif peak_fx[k] = 0; move16(); count[k] = 0; @@ -176,11 +162,7 @@ void hq2_noise_inject_fx( FOR( i = band_start[k]; i <= band_end[k]; i++ ) { L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */ -#ifdef ISSUE_1836_replace_overflow_libcom Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp ); -#else - Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow ); -#endif move32(); /* Q0 */ IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) ) { @@ -400,12 +382,8 @@ void hq2_noise_inject_fx( } ELSE IF( count[k - 1] == 0 && tmp4 > 0 ) { - L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */ fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */ -#else - fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */ -#endif } } @@ -485,11 +463,7 @@ void hq2_noise_inject_fx( } L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */ -#ifdef ISSUE_1836_replace_overflow_libcom ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) ); -#else - ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow ); -#endif move32(); /*Q17 */ } ELSE @@ -611,22 +585,14 @@ void hq2_noise_inject_fx( L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */ tmp = sub( Q_Ep_fx[k], Q_speech ); tmp = sub( 15, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ -#else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ -#endif } ELSE { tmp = 0x7fff; /*Q0 */ L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */ tmp = sub( 43, Q_Ep_fx[k] ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */ -#else - tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */ -#endif } fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */ @@ -638,11 +604,7 @@ void hq2_noise_inject_fx( IF( band_width[k] != 0 ) { Q_speech = norm_s( band_width[k] ); -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ -#else - tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */ -#endif + tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */ tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */ } ELSE @@ -652,16 +614,12 @@ void hq2_noise_inject_fx( move16(); move16(); } - tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ - L_tmp = L_mult( tmp1, j ); /*Q13 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */ + L_tmp = L_mult( tmp1, j ); /*Q13 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */ tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */ -#else - tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */ -#endif - tmp = sub( fac_fx, tmp ); /*Q12 */ - L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ + tmp = sub( fac_fx, tmp ); /*Q12 */ + L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */ L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) ); move32(); /*Q12 */ } diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index 2cc96b0c9..f404a10c8 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -78,13 +78,6 @@ void ifft_rel_fx( Word16 cc1, cc3, ss1, ss3; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif - /*-----------------------------------------------------------------* * ifft @@ -111,7 +104,6 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { -#ifdef ISSUE_1836_replace_overflow_libcom t1 = sub_sat( *xi1, *xi3 ); /*Qx*/ *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/ move16(); @@ -121,21 +113,9 @@ void ifft_rel_fx( move16(); *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/ move16(); -#else - t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/ - *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/ - move16(); - *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/ - move16(); - *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ - move16(); - *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/ - move16(); -#endif IF( NE_16( n4, 1 ) ) { -#ifdef ISSUE_1836_replace_overflow_libcom t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ @@ -147,19 +127,6 @@ void ifft_rel_fx( move16(); *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/ move16(); -#else - t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ - t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/ - - *( xi1 + n8 ) = add_o( *( xi1 + n8 ), *( xi2 + n8 ), &Overflow ); /*Qx*/ - move16(); - *( xi2 + n8 ) = sub_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ); /*Qx*/ - move16(); - *( xi3 + n8 ) = negate( shl_o( add_o( t2, t1, &Overflow ), 1, &Overflow ) ); /*Qx*/ - move16(); - *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/ - move16(); -#endif } xi1 += id; xi2 += id; @@ -207,7 +174,6 @@ void ifft_rel_fx( FOR( i = is; i < n; i += id ) { -#ifdef ISSUE_1836_replace_overflow_libcom t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/ *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/ move16(); @@ -245,45 +211,6 @@ void ifft_rel_fx( xdn8 += n4; *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/ move16(); -#else - t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/ - *xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ - move16(); - xup1 += n4; - xdn6 -= n4; - - t2 = sub_o( *xdn6, *xup1, &Overflow ); /*Qx*/ - *xdn6 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/ - move16(); - - xdn6 += n4; - t3 = add_o( *xdn8, *xup3, &Overflow ); /*Qx*/ - *xdn6 = sub_o( *xdn8, *xup3, &Overflow ); /*Qx*/ - move16(); - - xup3 += n4; - xdn8 -= n4; - - t4 = add_o( *xup3, *xdn8, &Overflow ); /*Qx*/ - *xup1 = sub_o( *xup3, *xdn8, &Overflow ); /*Qx*/ - move16(); - - t5 = sub_o( t1, t4, &Overflow ); /*Qx*/ - t1 = add_o( t1, t4, &Overflow ); /*Qx*/ - t4 = sub_o( t2, t3, &Overflow ); /*Qx*/ - t2 = add_o( t2, t3, &Overflow ); /*Qx*/ - *xup3 = sub_o( mult_r( t1, cc3 ), mult_r( t2, ss3 ), &Overflow ); /*Qx*/ - move16(); - xup3 -= n4; - *xup3 = add_o( mult_r( t5, cc1 ), mult_r( t4, ss1 ), &Overflow ); /*Qx*/ - move16(); - *xdn8 = sub_o( mult_r( t5, ss1 ), mult_r( t4, cc1 ), &Overflow ); /*Qx*/ - move16(); - - xdn8 += n4; - *xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/ - move16(); -#endif xup1 -= n4; xup1 += id; @@ -314,17 +241,10 @@ void ifft_rel_fx( { r1 = *xi0; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom *xi0 = add_sat( r1, *xi1 ); /*Qx*/ move16(); *xi1 = sub_sat( r1, *xi1 ); /*Qx*/ move16(); -#else - *xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/ - move16(); - *xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/ - move16(); -#endif xi0 += id; xi1 += id; } diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index 68853974c..ae2e9c51b 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1115,61 +1115,25 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in ) { Word16 /*Q0*/ sfb; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word16 /*Q0*/ line; - Word32 L_c; -#endif - -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; - move16(); - move16(); -#endif -#endif -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - FOR( sfb = startSfb; sfb < stopSfb; sfb++ ) - { - sfbEnergy[sfb] = L_deposit_l( 0 ); - move32(); - } -#endif IF( NULL == pPowerSpectrum ) { -#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW FOR( sfb = startSfb; sfb < stopSfb; sfb++ ) { sfbEnergy[sfb] = L_deposit_l( 0 ); move32(); } -#endif + return; } FOR( sfb = startSfb; sfb < stopSfb; sfb++ ) { -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_c = L_deposit_l( 0 ); - FOR( line = swb_offset[sfb]; line < swb_offset[sfb + 1]; line++ ) - { - Carry = 0; - move16(); - sfbEnergy[sfb] = L_add_co( sfbEnergy[sfb], pPowerSpectrum[line], &Carry, &Overflow ); - move32(); - Overflow = 0; - move16(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); - } - sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) ); - move32(); -#else sfbEnergy[sfb] = sum_array_norm( pPowerSpectrum + swb_offset[sfb], swb_offset[sfb + 1] - swb_offset[sfb], &( sfbEnergy_exp[sfb] ) ); move32(); -#endif + sfbEnergy_exp[sfb] = add( sfbEnergy_exp[sfb], *pPowerSpectrum_exp ); move16(); } diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c index f299c1d61..7d4c2208d 100644 --- a/lib_com/interpol_fx.c +++ b/lib_com/interpol_fx.c @@ -71,6 +71,7 @@ Word32 Interpol_lc_fx( /* o : interpolated value } L_sum = W_shl_sat_l( L_sum64, 1 ); /*Q15*/ } + return L_sum; } @@ -82,11 +83,6 @@ Word16 Interpol_4( /* Qx o : interpolated value */ { Word16 i; Word32 L_sum; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif x = x - L_INTERPOL1 + 1; @@ -103,13 +99,8 @@ Word16 Interpol_4( /* Qx o : interpolated value */ } BASOP_SATURATE_WARNING_OFF_EVS /* Here, saturation might occur by intention */ -#ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_shl_sat( L_sum, 1 ); /*Qx+14+2*/ BASOP_SATURATE_WARNING_ON_EVS + return round_fx_sat( L_sum ); /*Qx*/ -#else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/ - BASOP_SATURATE_WARNING_ON_EVS - return round_fx_o( L_sum, &Overflow ); /*Qx*/ -#endif } diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 8b323e96a..f0fbf9bd6 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -39,12 +39,6 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif FOR( band = 0; band < num_sfm; band++ ) { @@ -83,11 +77,7 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ -#else - gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -102,12 +92,8 @@ void ivas_fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ @@ -164,12 +150,6 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif FOR( band = 0; band < num_sfm; band++ ) { @@ -201,11 +181,7 @@ void fine_gain_pred_fx( exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom - gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ -#else - gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ -#endif + gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ @@ -220,12 +196,8 @@ void fine_gain_pred_fx( exp = add( exp, exp2 ); /*gp *= 1.0f - 0.05f / accuracy; */ - tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#else - tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ -#endif tmp = sub( 32767, tmp ); tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index c8cc09e73..9aea1fe4b 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -409,11 +409,6 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* First approximation: 1 / L_denom = 1/denom_hi */ @@ -429,11 +424,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); -#ifdef ISSUE_1836_replace_overflow_libcom L_32 = L_shl_sat( L_32, 2 ); -#else - L_32 = L_shl_o( L_32, 2, &Overflow ); -#endif return ( L_32 ); } @@ -469,12 +460,6 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - BASOP_SATURATE_WARNING_OFF_EVS if ( epsP != NULL ) @@ -534,21 +519,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else - t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); t0 = L_msu_sat( t0, Rh[i], -32768 ); -#else - t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); - t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -563,11 +539,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ -#else - t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -606,11 +578,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -646,11 +614,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom A[i] = round_fx_sat( L_shl_sat( t0, k ) ); -#else - A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -686,12 +650,6 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - BASOP_SATURATE_WARNING_OFF_EVS if ( epsP != NULL ) @@ -751,21 +709,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else - t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); t0 = L_msu_sat( t0, Rh[i], -32768 ); -#else - t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); - t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -780,11 +729,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ -#else - t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -823,11 +768,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -863,11 +804,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom A[i] = round_fx_sat( L_shl_sat( t0, k ) ); -#else - A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); -#endif move16(); } @@ -903,13 +840,6 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - BASOP_SATURATE_WARNING_OFF_EVS if ( epsP != NULL ) @@ -969,21 +899,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ -#else - t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ -#endif - /* No overflow possible */ + /* No overflow possible */ /* Compose and add R[i] in Q3 */ -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); t0 = L_msu_sat( t0, Rh[i], -32768 ); -#else - t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); - t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); -#endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); @@ -998,11 +919,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } -#ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ -#else - t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ -#endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { @@ -1041,11 +958,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ -#ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ -#else - t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ -#endif t0 = L_mac( t1, mult( Kh, Kl ), 2 ); t0 = L_abs( t0 ); /* Some case <0 !! */ t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ @@ -1081,11 +994,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); -#ifdef ISSUE_1836_replace_overflow_libcom A[i] = L_shl_sat( t0, k ); -#else - A[i] = L_shl_o( t0, k, &Overflow ); -#endif move16(); } @@ -1553,13 +1462,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* half length FFT */ scale = add( norm_s( lpcCoeffs[0] ), 1 ) + 5; move16(); @@ -1733,7 +1635,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); move16(); tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); @@ -1748,22 +1649,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); move16(); -#else - tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); - move16(); - tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); - move16(); - tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); - move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); @@ -1784,7 +1669,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); move16(); tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); @@ -1799,22 +1683,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); move16(); -#else - tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); - move16(); - tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); - move16(); - BASOP_SATURATE_WARNING_ON_EVS - RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); - move16(); - ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); - move16(); - BASOP_SATURATE_WARNING_OFF_EVS - tmpw15.v.re = msu_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); - move16(); - tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); - move16(); -#endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 80e597e1a..c93d4b77f 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -69,11 +69,6 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift Word16 cheb; Word32 t0, b1, b2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif cheb = norm_s( x ); if ( cheb ) @@ -110,26 +105,16 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 5 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom if ( !cheb ) t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ -#else - if ( !cheb ) - t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 6 */ t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom if ( !cheb ) t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ -#else - if ( !cheb ) - t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ + t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */ } /* IF (sub(n,8) == 0) */ IF( n == 8 ) @@ -137,15 +122,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */ /* i = 7 */ t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */ -#ifdef ISSUE_1836_replace_overflow_libcom if ( !cheb ) t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */ -#else - if ( !cheb ) - t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */ -#endif - t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ - /*b1 = L_add(b2,0);*/ + t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */ + /*b1 = L_add(b2,0);*/ } ELSE { @@ -163,13 +143,8 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom - t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ - cheb = round_fx_sat( t0 ); /* Result in Q14 */ -#else - t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */ - cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */ -#endif + t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */ + cheb = round_fx_sat( t0 ); /* Result in Q14 */ cheb = s_max( -32767, cheb ); /* to avoid saturation */ BASOP_SATURATE_WARNING_ON_EVS return ( cheb ); @@ -184,11 +159,6 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 t0, t1; Word16 scale = 1024; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*-------------------------------------------------------------* * find the sum and diff polynomials F1(z) and F2(z) @@ -310,11 +280,7 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow) *--------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom y = sub_sat( yhigh, ylow ); -#else - y = sub_o( yhigh, ylow, &Overflow ); -#endif IF( y != 0 ) { x = sub( xhigh, xlow ); @@ -1243,19 +1209,16 @@ void E_LPC_a_lsp_conversion( * Returns: * void */ -void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) +void E_LPC_f_lsp_a_conversion( + const Word16 *lsp, + Word16 *a, + const Word16 m ) { Word16 i, j, k; Word32 f1[NC_MAX + 1], f2[NC_MAX + 1]; Word16 nc; Word32 t0; Word16 Ovf, Ovf2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - /*-----------------------------------------------------* * Find the polynomials F1(z) and F2(z) * @@ -1285,11 +1248,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) { f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] ); move32(); -#ifdef ISSUE_1836_replace_overflow_libcom f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); -#else - f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow ); -#endif move32(); } @@ -1299,19 +1258,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) *-----------------------------------------------------*/ t0 = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom FOR( i = 1; i <= nc; i++ ) { t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) ); t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) ); } -#else - FOR( i = 1; i <= nc; i++ ) - { - t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) ); - t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) ); - } -#endif k = s_min( norm_l( t0 ), 6 ); a[0] = shl( 256, k ); move16(); @@ -1325,7 +1276,6 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) FOR( i = 1; i <= nc; i++ ) { /* a[i] = 0.5*(f1[i] + f2[i]) */ -#ifdef ISSUE_1836_replace_overflow_libcom t0 = L_add_sat( f1[i], f2[i] ); t0 = L_shl( t0, k ); a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ @@ -1334,16 +1284,6 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ) t0 = L_sub_sat( f1[i], f2[i] ); t0 = L_shl( t0, k ); a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */ -#else - t0 = L_add_o( f1[i], f2[i], &Overflow ); - t0 = L_shl( t0, k ); - a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ - - /* a[j] = 0.5*(f1[i] - f2[i]) */ - t0 = L_sub_o( f1[i], f2[i], &Overflow ); - t0 = L_shl( t0, k ); - a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */ -#endif j--; } @@ -1787,11 +1727,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ Word16 m, j, n; Word16 q, q_a, q_a2, One_Qx; Word32 One_Qx2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + q = add( norm_s( a[-1] ), 1 ); q_a = sub( 15, q ); q_a2 = add( shl( q_a, 1 ), 1 ); @@ -1851,8 +1787,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ FOR( j = 0; j < m / 2; j++ ) { n = sub( sub( m, (Word16) 1 ), j ); - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ @@ -1860,31 +1795,15 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */ f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */ -#else - L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ - L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ - L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ - f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ -#endif } IF( m & 1 ) { - L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */ f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */ move16(); -#else - L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ - L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ - f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ - move16(); -#endif } } @@ -2336,11 +2255,6 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*-------------------------------------------------------------------* * Check stability on lsf: distance between old lsf and current lsf @@ -2385,18 +2299,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/ -#else - tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ -#endif tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ -#ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */ -#else - tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ -#endif tmp = s_max( tmp, 0 ); @@ -2433,11 +2339,6 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability Word16 i, m; Word32 L_tmp; Word16 tmp, e; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*-------------------------------------------------------------------* * Check stability on lsf: distance between old lsf and current lsf @@ -2488,11 +2389,7 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability } e = sub( 30 - 21 - 1, e ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/ -#else - tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/ -#endif // tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */ tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */ @@ -3851,11 +3748,6 @@ Word16 root_search_fx( Word16 low, Word32 v_high, vh; Word32 Ltemp, L_tmp1, L_tmp, Ltmp; Word16 exp1, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */ @@ -3922,13 +3814,9 @@ Word16 root_search_fx( Word16 low, L_tmp1 = L_shl( L_tmp, exp1 ); tmp = extract_h( L_tmp1 ); exp1 = sub( 30 - 25, exp1 ); - tmp = div_s( 16384, tmp ); /* 15+exp1 */ - Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( 16384, tmp ); /* 15+exp1 */ + Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */ Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */ -#else - Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */ -#endif if ( LT_32( *v_low, vh ) ) { Ltemp = L_negate( Ltemp ); diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index e9d5413b3..e9b4a559b 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -335,28 +335,16 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif exp_den = norm_l( in32 ); m_den = extract_h( L_shl( in32, exp_den ) ); exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); -#ifdef ISSUE_1836_replace_overflow_libcom exp_den = shl( exp_den, 1 ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ -#else - exp_den = shl_o( exp_den, 1, &Overflow ); - - div_out = div_s( 8192, m_den ); - Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ -#endif return Ltmp; } @@ -372,11 +360,6 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif IF( re == 0 ) { @@ -388,11 +371,7 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); -#else - L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } @@ -407,11 +386,7 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); -#else - L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); -#endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } @@ -441,11 +416,7 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ -#else - L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ -#endif return ( L_tmp ); } @@ -523,11 +494,6 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*---------------------------------------------------------------------* * The mid point of the cosine table x of m entries assuming an odd m. @@ -549,11 +515,7 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom r[0] = L_add_sat( r[0], G[i] ); -#else - r[0] = L_add_o( r[0], G[i], &Overflow ); -#endif move32(); } @@ -587,27 +549,18 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom gp = L_add_sat( G[i], G[N - i - 1] ); -#else - gp = L_add_o( G[i], G[N - i - 1], &Overflow ); -#endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); -#ifdef ISSUE_1836_replace_overflow_libcom r[1] = L_add_sat( r[1], mh ); -#else - r[1] = L_add_o( r[1], mh, &Overflow ); -#endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); @@ -627,75 +580,34 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_sat( r[j + 1], mh ); move32(); -#else - c[j] = mult_r( c[j - 1], x[i - 1] ); - move16(); - c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); - move16(); - - /*r[j] = L_mac(r[j], c[j], gp);*/ - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_o( r[j], mh, &Overflow ); - move32(); - - c[j + 1] = mult_r( c[j], x[i - 1] ); - move16(); - c[j + 1] = add_o( c[j + 1], sub_o( c[j + 1], c[j - 1], &Overflow ), &Overflow ); - move16(); - - /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ - Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); - r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); - move32(); -#endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); move32(); -#else - c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); - move16(); - - Mpy_32_16_ss( gp, c[j], &mh, &ml ); - r[j] = L_add_o( r[j], mh, &Overflow ); - move32(); -#endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ -#ifdef ISSUE_1836_replace_overflow_libcom + gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_sat( r[0], gp ); -#else - gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); - gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); - - r[0] = L_add_o( r[0], gp, &Overflow ); -#endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); -#else - L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); - L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); -#endif } return; diff --git a/lib_com/math_op.c b/lib_com/math_op.c index ac92eec20..12d14ca6a 100644 --- a/lib_com/math_op.c +++ b/lib_com/math_op.c @@ -228,30 +228,16 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_mac_sat( 1, x[0], x[0] ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_sat( L_sum, x[i], x[i] ); } -#else - L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); - FOR( i = 1; i < lg; i++ ) - { - L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); - } -#endif } IF( expi < 0 ) { @@ -261,16 +247,11 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); -#ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_mac_sat( L_sum, tmp, tmp ); -#else - L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); -#endif } } IF( expi > 0 ) { -#ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( x[0], expi ); L_sum = L_mac_sat( 1, tmp, tmp ); FOR( i = 1; i < lg; i++ ) @@ -278,15 +259,6 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val tmp = shl_sat( x[i], expi ); L_sum = L_mac_sat( L_sum, tmp, tmp ); } -#else - tmp = shl_o( x[0], expi, &Overflow ); - 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 ); - } -#endif } /* Normalize acc in Q31 */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index b54efcea8..6bd1e7a69 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -75,12 +75,6 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif const Resampling_cfg *cfg_ptr_fx; /*-------------------------------------------------------------------* @@ -279,11 +273,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q test(); IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { -#ifdef ISSUE_1836_replace_overflow_libcom num_den = shl_sat( num_den, 1 ); -#else - num_den = shl_o( num_den, 1, &Overflow ); -#endif *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } @@ -364,12 +354,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word16 flag_low_order = 0; move16(); Word16 filt_len_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif const Resampling_cfg *cfg_ptr_fx; /*-------------------------------------------------------------------* @@ -565,11 +549,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifdef ISSUE_1836_replace_overflow_libcom num_den = shl_sat( num_den, 1 ); -#else - num_den = shl_o( num_den, 1, &Overflow ); -#endif #else num_den = shl( num_den, 1 ); #endif @@ -941,176 +921,95 @@ void Decimate_allpass_steep_fx( Word32 Lacc, Lacc1; Word16 temp1, temp2; Word16 sum = 0; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move16(); /*upper allpass filter chain */ - - FOR( k = 0; k < N / 2; k++ ) { - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */ -#else - Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */ - Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */ -#endif - mem[0] = extract_h( Lacc1 ); /* Qx */ + mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */ temp2 = extract_h( Lacc1 ); /* Qx */ Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */ -#else - Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */ - - temp2 = extract_h( Lacc1 ); /* Qx */ - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */ -#endif - mem[1] = extract_h( Lacc ); /* Qx */ + mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); move16(); - - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ move16(); -#else - out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ - move16(); -#endif } /* lower allpass filter chain */ - - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ -#else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */ - Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); temp[0] = temp1; move16(); Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); - Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ -#endif + Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ move16(); - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ move16(); Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ -#else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ - temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ - move16(); - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ move16(); - FOR( k = 1; k < N / 2; k++ ) { - - - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ temp1 = extract_h( Lacc ); /* Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ -#else - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */ - temp1 = extract_h( Lacc ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ -#endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ move16(); temp[0] = temp1; move16(); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom - Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ + Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */ + temp2 = extract_h( Lacc1 ); /* Qx */ temp[1] = temp2; move16(); Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ -#else - Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */ - temp2 = extract_h( Lacc1 ); /* Qx */ - temp[1] = temp2; - move16(); - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ - mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ - temp[2] = extract_h( Lacc ); /*temp[2] in Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ -#endif - mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ - + mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ sum = mult_r( out_fx[k], 16384 ); /* Qx */ out_fx[k] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); @@ -1225,20 +1124,13 @@ void Interpolate_allpass_steep_fx( Word16 k; Word32 Lacc = 0, Lacc1 = 0; Word16 temp1, temp2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ FOR( k = 0; k < N; k++ ) { - - Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_sat( Lacc ); /* Qx */ @@ -1261,37 +1153,13 @@ void Interpolate_allpass_steep_fx( move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ move16(); -#else - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ - - mem[0] = round_fx_o( Lacc1, &Overflow ); - move16(); - Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */ - Lacc1 = ( L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ) ); /* Q(16+x):temp[1] */ - Lacc = L_deposit_h( temp1 ); - - temp2 = round_fx_o( Lacc1, &Overflow ); /* Qx */ - Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ - mem[1] = round_fx_o( Lacc, &Overflow ); /* Qx */ - move16(); - - Lacc1 = L_deposit_h( temp2 ); - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - out_fx[2 * k + 1] = round_fx_o( L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ), &Overflow ); /* Qx format */ - move16(); - mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ - move16(); -#endif } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { - Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ -#ifdef ISSUE_1836_replace_overflow_libcom + Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */ Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ temp1 = round_fx_sat( Lacc ); /* Qx */ @@ -1312,28 +1180,6 @@ void Interpolate_allpass_steep_fx( move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ move16(); -#else - Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */ - Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */ - temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */ - Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ - - mem[ALLPASSSECTIONS_STEEP] = round_fx_o( Lacc1, &Overflow ); - Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */ - Lacc1 = L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x):temp[1] */ - - temp2 = round_fx_o( Lacc1, &Overflow ); /* Qx */ - Lacc = L_deposit_h( temp1 ); - Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ - mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_o( Lacc, &Overflow ); /* Qx */ - - Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ - Lacc1 = L_deposit_h( temp2 ); - out_fx[2 * k] = round_fx_o( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ), &Overflow ); /* Qx format */ - move16(); - mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ - move16(); -#endif } return; diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index d8966dbab..cb8c77300 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -124,20 +124,10 @@ Word32 L_Comp( Word16 hi, Word16 lo ) Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif L_32 = L_mult( hi1, hi2 ); -#ifdef ISSUE_1836_replace_overflow_libcom L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); -#else - L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); - L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); -#endif return ( L_32 ); } @@ -166,21 +156,10 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom L_32 = L_mac_sat( L_num, hi1, hi2 ); L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 ); L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 ); -#else - L_32 = L_mac_o( L_num, hi1, hi2, &Overflow ); - L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow ); - L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow ); -#endif return ( L_32 ); } @@ -208,19 +187,9 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 ) Word32 Sqr_32( Word16 hi, Word16 lo ) { Word32 L_32; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif -#ifdef ISSUE_1836_replace_overflow_libcom L_32 = L_mult_sat( hi, hi ); L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 ); -#else - L_32 = L_mult_o( hi, hi, &Overflow ); - L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow ); -#endif return ( L_32 ); } diff --git a/lib_com/options.h b/lib_com/options.h index 6c11918a2..6269be44a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -73,8 +73,6 @@ /* ################### Start FIXES switches ########################### */ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ -#define FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 2166 */ -#define ISSUE_1836_replace_overflow_libcom /* FhG: BE - replace overflow operators by non-overflow-alternatives in lib_com */ #define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */ #define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ #define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 055513dd1..ce4f70e5a 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -31,12 +31,6 @@ void phase_dispersion( Word32 x32[2 * L_SUBFR]; Word16 *code_real, *code_imag; const Word16 *h_real, *h_imag; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - move16(); state = 2; @@ -60,11 +54,7 @@ void phase_dispersion( move16(); prev_gain_pit[0] = gain_pit; -#ifdef ISSUE_1836_replace_overflow_libcom IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) ) -#else - IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) ) -#endif { IF( LT_16( state, 2 ) ) { @@ -172,11 +162,7 @@ void phase_dispersion( scale2 = getScaleFactor32( x32, L_subfr ); FOR( i = 0; i < L_subfr; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) ); -#else - code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); -#endif move16(); } j = sub( j, scale2 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index fd8b0acef..c08241249 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -97,12 +97,7 @@ void deemph_lpc_fx( Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + b_fx[0] = 4096; move16(); /* 1 in Q12 */ FOR( k = 0; k < M; k++ ) @@ -117,11 +112,7 @@ void deemph_lpc_fx( { /* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] ); -#else - LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); -#endif move16(); /* Q12 */ } @@ -143,11 +134,7 @@ void deemph_lpc_fx( { /* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */ temp = mult( a_fx[0], b_fx[k] ); /* Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] ); -#else - LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow ); -#endif move16(); /* Q12 */ } } diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 146ecc2ce..869edfd1b 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -34,12 +34,7 @@ void pred_lt4_ivas_fx( Word32 s; const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + x0 = &excI[-T0]; frac = negate( frac ); @@ -72,13 +67,10 @@ void pred_lt4_ivas_fx( s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } -#ifdef ISSUE_1836_replace_overflow_libcom excO[j] = round_fx_sat( s ); /* Q_exc */ -#else - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ -#endif move16(); } + return; } @@ -96,14 +88,8 @@ void pred_lt4( Word16 i, j; Word32 s; const Word16 *x0, *x1, *x2, *c1, *c2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - x0 = &excI[-T0]; + x0 = &excI[-T0]; frac = negate( frac ); @@ -134,22 +120,14 @@ void pred_lt4( } s = W_sat_l( s64 ); /* Q_exc + Q14 */ } -#ifdef ISSUE_1836_replace_overflow_libcom #if ( INTERP_EXP != -1 ) s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */ #endif excO[j] = round_fx_sat( s ); /* Q_exc */ move16(); -#else -#if ( INTERP_EXP != -1 ) - s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ -#endif - - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ - move16(); -#endif } + return; } @@ -193,12 +171,7 @@ void pred_lt4_tc_fx( Word16 excO[L_SUBFR + 1]; Word32 L_sum; Word16 excI[2 * L_SUBFR]; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ test(); @@ -230,25 +203,15 @@ void pred_lt4_tc_fx( k += UP_SAMP; L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } -#ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */ excO[j] = round_fx_sat( L_sum ); /* Q0 */ -#else - L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ - excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ -#endif - move16(); x0++; } FOR( i = T0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */ -#else - exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ -#endif move16(); } } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index db3949bca..0184a4aa3 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -22,15 +22,10 @@ void preemph_copy_fx( ) { Word16 i, temp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + temp = x[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) { y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */ @@ -38,19 +33,11 @@ void preemph_copy_fx( } y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */ move16(); -#else - FOR( i = lg - 1; i > 0; i-- ) - { - y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ - move16(); - } - y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ - move16(); -#endif - *mem = temp; /* Qx */ move16(); + + return; } void preemph_copy_32fx( @@ -62,15 +49,10 @@ void preemph_copy_32fx( ) { Word16 i, temp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + temp = x[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom + FOR( i = lg - 1; i > 0; i-- ) { y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */ @@ -78,18 +60,11 @@ void preemph_copy_32fx( } y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */ move16(); -#else - FOR( i = lg - 1; i > 0; i-- ) - { - y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */ - move16(); - } - y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */ - move16(); -#endif *mem = temp; /* Qx */ move16(); + + return; } /*-------------------------------------------------------------* @@ -150,16 +125,10 @@ void E_UTIL_f_preemph2( { Word16 i, temp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + temp = signal[lg - 1]; /* Qx */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom FOR( i = lg - 1; i > 0; i-- ) { L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ @@ -174,22 +143,6 @@ void E_UTIL_f_preemph2( L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */ signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */ move16(); -#else - FOR( i = lg - 1; i > 0; i-- ) - { - L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_o( L_tmp, signal[i - 1], mu, &Overflow ); /* Qx + 15 */ - L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ - signal[i] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ - move16(); - } - - L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ - L_tmp = L_msu0_o( L_tmp, *mem, mu, &Overflow ); /* Qx + 15 */ - L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ - signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ - move16(); -#endif *mem = temp; /* Qx */ move16(); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 9e2f58ed0..98ca8c4ab 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -427,12 +427,6 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); qboth = sub( qband, sub( qac, qzero ) ); /* Q0 */ @@ -458,11 +452,7 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); -#ifdef ISSUE_1836_replace_overflow_libcom QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ -#else - QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ -#endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ @@ -533,12 +523,6 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif FOR( band = 0; band < num_sfm; band++ ) { @@ -560,11 +544,7 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ -#ifdef ISSUE_1836_replace_overflow_libcom gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); -#else - gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); -#endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index d338e3163..ecfb672b0 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -62,19 +62,12 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif q = add( norm_s( a[0] ), 1 ); if ( shift > 0 ) { q = add( q, shift ); } -#ifdef ISSUE_1836_replace_overflow_libcom *y++ = shl_sat( x[0], shift ); move16(); @@ -103,36 +96,7 @@ void Residu3_lc_fx( *y++ = round_fx_sat( s ); } -#else - *y++ = shl_o( x[0], shift, &Overflow ); - move16(); - - FOR( i = 1; i < m; i++ ) - { - s = L_mult_o( x[i], a[0], &Overflow ); - /* Stop at i to Avoid Mults with Zeros */ - FOR( j = 1; j <= i; j++ ) - { - s = L_mac_o( s, x[i - j], a[j], &Overflow ); - } - - s = L_shl_o( s, q, &Overflow ); - *y++ = round_fx_o( s, &Overflow ); - } - - FOR( ; i < lg; i++ ) - { - s = L_mult_o( x[i], a[0], &Overflow ); - FOR( j = 1; j <= m; j++ ) - { - s = L_mac_o( s, x[i - j], a[j], &Overflow ); - } - - s = L_shl_o( s, q, &Overflow ); - *y++ = round_fx_o( s, &Overflow ); - } - -#endif + return; } /*--------------------------------------------------------------------* @@ -166,7 +130,10 @@ void Residu3_10_fx( s = W_shl_sat_l( s64, q ); y[i] = round_fx_sat( s ); } + + return; } + /*--------------------------------------------------------------------* * Residu3_fx: * @@ -185,12 +152,7 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) { @@ -206,14 +168,13 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( s32 ); -#else - y[i] = round_fx_o( s32, &Overflow ); -#endif move16(); } + + return; } + /*==========================================================================*/ /* FUNCTION : void calc_residu() */ /*--------------------------------------------------------------------------*/ diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index 9b0bae1e5..7a5519c04 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -74,12 +74,6 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*---------------------------------------------------------* * Init local variables @@ -111,11 +105,7 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); -#ifdef ISSUE_1836_replace_overflow_libcom min_alpha = add_sat( tmp_res, 16384 ); -#else - min_alpha = add_o( tmp_res, 16384, &Overflow ); -#endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ @@ -166,13 +156,8 @@ void stat_noise_uv_mod_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ 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 ); } } @@ -196,11 +181,7 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); -#else - tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); -#endif alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); *act_count = 0; @@ -264,13 +245,8 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ -#else - tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ -#endif - - Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ + tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ + Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ FOR( i = 0; i < L_FRAME; i++ ) { @@ -402,12 +378,6 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*---------------------------------------------------------* * Init local variables @@ -436,11 +406,7 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom min_alpha = add_sat( tmp_res, 16384 ); -#else - min_alpha = add_o( tmp_res, 16384, &Overflow ); -#endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); @@ -490,13 +456,8 @@ void stat_noise_uv_mod_ivas_fx( { FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom + exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ 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 ); } } @@ -520,11 +481,7 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); -#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_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 7aef5baa3..126f8ce25 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -999,10 +999,6 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifndef ISSUE_1836_replace_overflow_libcom - Flag Overflow = 0; - move32(); -#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) { @@ -1042,11 +1038,7 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add_sat( temp, *ptrs ); /*Q12 */ -#ifdef ISSUE_1836_replace_overflow_libcom sig_out[n] = shl_sat( mult_r( ga, temp ), 1 ); -#else - sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); -#endif move16(); /*Q12 */ } @@ -1453,12 +1445,6 @@ void GenShapedWBExcitation_ivas_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /*0.25f*sum_f(voice_factors, NB_SUBFR)*/ L_tmp = L_mult( voice_factors[0], 8192 /* 0.25 in Q15 */ ); @@ -1547,39 +1533,23 @@ void GenShapedWBExcitation_ivas_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible -#else - excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 -#endif - move16(); /* Q14 */ + move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); pow1 = 1; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom FOR( i = 0; i < L_FRAME16k / 4; i++ ) { L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16 pow1 = L_add_sat( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */ } -#else - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ - pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ - } -#endif } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0 -#else - excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif - move32(); /* Q_bwe_exc+16 */ + move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ } @@ -1608,11 +1578,7 @@ void GenShapedWBExcitation_ivas_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif move16(); } n2 = 30 - n2 - ( Q_bwe_exc + 6 ); @@ -1620,13 +1586,8 @@ void GenShapedWBExcitation_ivas_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */ -#endif } } @@ -1635,19 +1596,11 @@ void GenShapedWBExcitation_ivas_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ -#endif sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ -#else - exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ -#endif move16(); } } @@ -1663,11 +1616,7 @@ void GenShapedWBExcitation_ivas_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom tmp_vfac = shl_sat( voice_factors[i], 1 ); -#else - tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); -#endif } ELSE { @@ -1676,7 +1625,6 @@ void GenShapedWBExcitation_ivas_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); @@ -1689,20 +1637,6 @@ void GenShapedWBExcitation_ivas_fx( move16(); k++; } -#else - temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ - L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_o( L_shl_o( Ltemp2, exp, &Overflow ), &Overflow ); /* Q15 */ - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult_o( temp1, exc4kWhtnd[k], &Overflow ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_o( L_tmp, L_shl_o( L_mult_o( temp2, exc4k_frac[k], &Overflow ), sc, &Overflow ), &Overflow ); /* Q(16+Q_bwe_exc) */ - exc4kWhtnd[k] = round_fx_o( L_tmp, &Overflow ); /* Q_bwe_exc */ - move16(); - k++; - } -#endif } } } @@ -1757,12 +1691,6 @@ void GenShapedWBExcitation_fx( Word32 LepsP[LPC_WHTN_ORDER_WB + 1]; Word16 tmp_vfac; Word16 avg_voice_fac; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move16(); move16(); move16(); @@ -1853,11 +1781,7 @@ void GenShapedWBExcitation_fx( n1 = norm_s( max_val ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom excTmp2_frac[i] = shl( excTmp2[i], n1 ); -#else - excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); -#endif move16(); /* Q14 */ } n1 = sub( sub( 14, n1 ), Q_bwe_exc ); @@ -1865,23 +1789,14 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */ - pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif } } FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); -#else - excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow ); -#endif move32(); /* Q_bwe_exc+16 */ *mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] ); move32(); /* Q_bwe_exc+16 */ @@ -1912,11 +1827,7 @@ void GenShapedWBExcitation_fx( n2 = norm_l( Lmax ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */ -#else - exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */ -#endif move16(); } n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) ); @@ -1924,13 +1835,8 @@ void GenShapedWBExcitation_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */ pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */ -#else - L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */ - pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */ -#endif } } @@ -1939,7 +1845,6 @@ void GenShapedWBExcitation_fx( IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) ) { L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ sc = sub( add( n2, Q_bwe_exc ), 14 ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) @@ -1947,15 +1852,6 @@ void GenShapedWBExcitation_fx( exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ move16(); } -#else - scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ - sc = sub( add( n2, Q_bwe_exc ), 14 ); - FOR( i = 0; i < L_FRAME16k / 4; i++ ) - { - exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */ - move16(); - } -#endif } ELSE { @@ -1970,11 +1866,7 @@ void GenShapedWBExcitation_fx( { /*tmp_vfac = 2*voice_factors[i]; tmp_vfac = min(1, tmp_vfac);*/ -#ifdef ISSUE_1836_replace_overflow_libcom tmp_vfac = shl_sat( voice_factors[i], 1 ); -#else - tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); -#endif } ELSE { @@ -1983,7 +1875,6 @@ void GenShapedWBExcitation_fx( } Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp ); -#ifdef ISSUE_1836_replace_overflow_libcom temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); @@ -1996,30 +1887,16 @@ void GenShapedWBExcitation_fx( move16(); k = add( k, 1 ); } -#else - temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */ - L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/ - Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp ); - temp2 = round_fx_o( L_shl_o( Ltemp2, exp, &Overflow ), &Overflow ); /* Q15 */ - FOR( j = 0; j < L_FRAME16k / 16; j++ ) - { - L_tmp = L_mult_o( temp1, exc4kWhtnd[k], &Overflow ); /* Q(16+Q_bwe_exc) */ - L_tmp = L_add_o( L_tmp, L_shl_o( L_mult_o( temp2, exc4k_frac[k], &Overflow ), sc, &Overflow ), &Overflow ); /* Q(16+Q_bwe_exc) */ - exc4kWhtnd[k] = round_fx_o( L_tmp, &Overflow ); /* Q_bwe_exc */ - move16(); - k = add( k, 1 ); - } -#endif } } } Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER_WB, exc4kWhtnd, excSHB, L_FRAME16k / 4, state_lpc_syn, 1 ); - return; } + /*-------------------------------------------------------------------* * GenWBSynth() * @@ -5784,13 +5661,6 @@ void non_linearity_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - IF( EQ_16( L_frame, L_FRAME16k ) ) { @@ -5888,20 +5758,10 @@ void non_linearity_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif - - frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ - + frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ -#else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ -#endif } } @@ -5924,12 +5784,8 @@ void non_linearity_fx( IF( GT_16( max_val, shl( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ -#else - scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif } ELSE { @@ -5970,28 +5826,15 @@ void non_linearity_fx( L_tmp = L_sub( L_tmp, L_tmp1 ); /* Q16 */ /* Computing 1/(j - length/2) */ - tmp = sub( j, length_half ); exp = norm_s( tmp ); - - tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif - - frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ - + frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ -#else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ -#endif } } @@ -6058,12 +5901,6 @@ void non_linearity_ivas_fx( Word16 nframes; Word32 prev_scale; Word16 length_half; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif #ifdef NONBE_1328_FIX_NON_LINEARITY Word16 sc_factor; #endif @@ -6182,20 +6019,12 @@ void non_linearity_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /* Q14 */ -#else - scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ -#endif } } @@ -6218,12 +6047,8 @@ void non_linearity_ivas_fx( IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); - tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */ -#else - scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */ -#endif } ELSE { @@ -6283,28 +6108,15 @@ void non_linearity_ivas_fx( L_tmp = L_sub( L_tmp, L_tmp1 ); /* Q16 */ /* Computing 1/(j - length/2) */ - tmp = sub( j, length_half ); exp = norm_s( tmp ); - - tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */ /* (log2(scale / prev_scale))/length */ -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */ -#endif - - frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ - + frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ tmp = extract_l( Pow2( 14, frac ) ); -#ifdef ISSUE_1836_replace_overflow_libcom scale_step = shl_sat( tmp, exp ); /*Q14 */ -#else - scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ -#endif } } @@ -7039,12 +6851,6 @@ void Estimate_mix_factors_fx( Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag; Word16 tmp, tmp1, sc1, sc2; Word32 L_tmp1, L_tmp2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Copy( shb_res, shb_res_local, L_FRAME16k ); Copy( White_exc16k_frac, WN_exc_local, L_FRAME16k ); @@ -7102,11 +6908,7 @@ void Estimate_mix_factors_fx( expa = sub( 30, expa ); expb = norm_l( temp_p1_p2 ); -#ifdef ISSUE_1836_replace_overflow_libcom fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) ); -#else - fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, expb ); num_flag = 0; @@ -7233,12 +7035,6 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac; = VF_0th_PARAM + voice_fac * (VF_1st_PARAM + VF_2nd_PARAM * voice_fac ) @@ -7252,11 +7048,7 @@ void prep_tbe_exc_fx( tmp = MAX_16; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */ -#else - pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ -#endif test(); test(); @@ -7285,8 +7077,7 @@ void prep_tbe_exc_fx( IF( EQ_16( L_frame_fx, L_FRAME ) ) { - interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ -#ifdef ISSUE_1836_replace_overflow_libcom + interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) { @@ -7297,18 +7088,6 @@ void prep_tbe_exc_fx( bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */ move16(); } -#else - gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */ - FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) - { - L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/ - L_tmp = L_shl_o( L_tmp, 5, &Overflow ); /* Q9 + Q_exc + Q6*/ - L_tmp = L_mac_o( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC], &Overflow ); /*Q15+Q_exc */ - L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /*16+Q_exc */ /* saturation can occur here */ - bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */ - move16(); - } -#endif } ELSE { @@ -7337,20 +7116,13 @@ void prep_tbe_exc_fx( #ifdef FIX_2010_PREP_TBE_EXC Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q_code_preQ */ #else - Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ + Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ #endif -#ifdef ISSUE_1836_replace_overflow_libcom Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ -#else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */ - - tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */ -#endif move16(); } } @@ -7359,14 +7131,9 @@ void prep_tbe_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ -#ifdef ISSUE_1836_replace_overflow_libcom + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */ -#else - Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ - tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */ -#endif move16(); } } @@ -7374,15 +7141,9 @@ void prep_tbe_exc_fx( interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */ FOR( i = 0; i < shl( L_subfr, 1 ); i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */ tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */ bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */ -#else - L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */ - tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */ - bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */ -#endif move16(); } } @@ -7418,11 +7179,6 @@ Word16 swb_formant_fac_fx( { Word16 formant_fac; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* Smoothen tilt value */ /* tmp = 0.5f * (float)fabs(lpc_shb2) + 0.5f * *tilt_mem; */ @@ -7449,11 +7205,8 @@ Word16 swb_formant_fac_fx( /* formant_fac = 1.0f - 0.5f*formant_fac */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ -#ifdef ISSUE_1836_replace_overflow_libcom formant_fac = shl_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/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 891314fe2..cfa254042 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -11,16 +11,8 @@ static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] ) { -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif - L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow ); - return L_msu_o( L_tmp, y[-2], a[2], &Overflow ); -#else L_tmp = L_msu_sat( L_tmp, y[-1], a[1] ); return L_msu_sat( L_tmp, y[-2], a[2] ); -#endif } static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] ) @@ -340,18 +332,20 @@ void syn_filt_fx32( * Returns: * void */ -void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], Word16 y[], const Word16 lg, Word16 mem[], const Word16 update, const Word16 m ) +void E_UTIL_synthesis( + const Word16 shift, + const Word16 a[], + const Word16 x[], + Word16 y[], + const Word16 lg, + Word16 mem[], + const Word16 update, + const Word16 m ) { Word16 i, j, a0; Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif if ( EQ_16( m, 6 ) ) { @@ -384,13 +378,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); *y++ = round_fx_sat( L_tmp ); -#else - L_tmp = L_shl_o( L_tmp, q, &Overflow ); - *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); /* Filtering from Input + Mix of Memory & Output Signal Past */ @@ -400,24 +389,15 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W /* Process Output Signal Past */ FOR( j = 1; j <= i; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_msu_sat( L_tmp, a[j], y[-j] ); -#else - L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow ); -#endif } /* Process Memory */ FOR( ; j <= m; j++ ) { L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); *y++ = round_fx_sat( L_tmp ); -#else - L_tmp = L_shl_o( L_tmp, q, &Overflow ); - *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } @@ -425,13 +405,8 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W FOR( ; i < lg; i++ ) { L_tmp = syn_kern( L_mult( a0, *x++ ), a, y ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); *y++ = round_fx_sat( L_tmp ); -#else - L_tmp = L_shl_o( L_tmp, q, &Overflow ); - *y++ = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } @@ -471,17 +446,21 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W * Returns: * void */ -void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[], Word32 y[], const Word16 lg, Word32 mem[], const Word16 update, const Word16 m ) +void E_UTIL_synthesis_fx( + const Word16 shift, + const Word32 a[], + const Word32 x[], + Word32 y[], + const Word16 lg, + Word32 mem[], + const Word16 update, + const Word16 m ) { Word16 i, j; Word32 a0; Word32 L_tmp; Word16 q; Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL; -#ifndef ISSUE_1836_replace_overflow_libcom - Flag Overflow = 0; - move32(); -#endif if ( EQ_16( m, 6 ) ) { @@ -508,22 +487,14 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] *-----------------------------------------------------------------------*/ mem += m; /*move32();*/ -#ifdef ISSUE_1836_replace_overflow_libcom a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */ -#else - a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */ -#endif /*-----------------------------------------------------------------------* * Do the filtering *-----------------------------------------------------------------------*/ /* Filtering Only from Input + Memory */ L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); -#else - L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); @@ -541,11 +512,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] { L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] ); } -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); -#else - L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); } @@ -554,11 +521,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[] FOR( ; i < lg; i++ ) { L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y ); -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( L_tmp, q ); -#else - L_tmp = L_shl_o( L_tmp, q, &Overflow ); -#endif *y++ = L_tmp; move32(); } diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index d9112ffa0..3c54f64ea 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -375,6 +375,8 @@ static void tcx_ltp_get_zir_fx( move32(); alpha = sub( alpha, step ); } + + return; } void predict_signal( @@ -389,12 +391,7 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + x0 = &excI[-T0 - 1]; frac = negate( frac ); @@ -410,21 +407,16 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ -#else - s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ - s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ - s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ - excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ -#endif move16(); x0++; } + + return; } static void tcx_ltp_synth_filter( diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 29827b935..475a0079c 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -107,19 +107,13 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); move16(); neg_factor = negate( factor ); - /* Init */ FOR( i = 0; i < m / 2; i++ ) { @@ -128,11 +122,7 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ -#else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ -#endif move32(); } FOR( i = 0; i < m / 2; i++ ) @@ -142,11 +132,7 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ -#else - y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ -#endif move32(); } @@ -173,12 +159,7 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); move16(); @@ -194,11 +175,7 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ -#else - y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ -#endif move32(); } FOR( i = 0; i < m / 2; i++ ) diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index 326ec6221..20c698b84 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -991,11 +991,6 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* FDNS_NPTS = 64 */ k = shr( lg, 6 ); /*Q0*/ @@ -1046,11 +1041,7 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ -#else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ -#endif move32(); x++; } @@ -1069,11 +1060,7 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ -#else - *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ -#endif move32(); x += k; gains++; @@ -1399,12 +1386,6 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - assert( lpcGains[0] >= 0x4000 ); @@ -1449,17 +1430,13 @@ void PsychAdaptLowFreqDeemph( #ifdef FIX_1984_SAT_IN_PSYCHAD L_tmp = L_shl_sat( L_mult_sat( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */ #else - L_tmp = L_shl( L_mult( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */ + L_tmp = L_shl( L_mult( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */ #endif L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ -#ifdef ISSUE_1836_replace_overflow_libcom - tmp = round_fx_sat( L_tmp ); /* Q15 */ -#else - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ -#endif - fac = tmp; /* Q15 */ + tmp = round_fx_sat( L_tmp ); /* Q15 */ + fac = tmp; /* Q15 */ move16(); /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */ @@ -2101,11 +2078,6 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif maxX = L_deposit_l( 1 ); maxY = L_deposit_l( 1 ); @@ -2151,11 +2123,8 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ -#else - tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ -#endif + if ( corr < 0 ) tmp = negate( tmp ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 42c0db406..7c7f85991 100755 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -133,7 +133,7 @@ void InitTnsConfiguration( pTnsConfig->pTnsParameters = tnsParameters48kHz_grouped; } ELSE - IF( GT_32( nSampleRate, INT_FS_16k ) ) + IF( GT_32( nSampleRate, INT_FS_16k ) ) { { @@ -438,13 +438,6 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - move16(); move16(); move16(); @@ -476,11 +469,7 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1836_replace_overflow_libcom tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ -#else - tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ -#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 92ea099e0..32257b089 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -1185,35 +1185,21 @@ Word16 usquant_fx( Word16 idx; Word16 tmp, exp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); - tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ -#ifdef ISSUE_1836_replace_overflow_libcom + tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ -#else - L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ - idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ -#endif idx = s_min( idx, sub( cbsize, 1 ) ); idx = s_max( idx, 0 ); /* *xq = idx*delta + qlow; */ - L_tmp = L_deposit_l( qlow ); /*Qx */ - L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_deposit_l( qlow ); /*Qx */ + L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ -#else - *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ -#endif + return idx; } @@ -1287,20 +1273,11 @@ Word32 sum2_fx( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ -#else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ -#endif } return L_tmp; @@ -1357,21 +1334,11 @@ Word32 sum2_fx_mod( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); -#else - L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); -#endif } return L_tmp; @@ -1602,12 +1569,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + IF( exp0 == 0 ) { FOR( i = 0; i < lg; i++ ) @@ -1629,11 +1591,7 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = shl_sat( x[i], exp0 ); -#else - y[i] = shl_o( x[i], exp0, &Overflow ); -#endif move16(); /* saturation can occur here */ } @@ -1656,13 +1614,6 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - IF( exp0 == 0 ) { @@ -1678,11 +1629,7 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); -#else - y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); -#endif move32(); } return; @@ -1695,11 +1642,7 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif -#ifdef ISSUE_1836_replace_overflow_libcom 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 ); @@ -1735,13 +1678,6 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - IF( exp0 == 0 ) { @@ -1757,20 +1693,13 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); -#else - y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); -#endif move32(); } return; } -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); -#else - L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); -#endif IF( L_tmp >= 0x7FFF ) { @@ -1805,23 +1734,13 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif tmp = add( 16, exp0 ); IF( tmp != 0 ) { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); -#else - y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); -#endif move16(); } } @@ -1829,11 +1748,7 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( x[i] ); -#else - y[i] = round_fx_o( x[i], &Overflow ); -#endif move16(); } } @@ -1855,12 +1770,7 @@ void Scale_sig32( ) { Word16 i; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + IF( 0 == exp0 ) { return; @@ -1868,11 +1778,7 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom x[i] = L_shl_sat( x[i], exp0 ); -#else - x[i] = L_shl_o( x[i], exp0, &Overflow ); -#endif move32(); /* saturation can occur here */ } @@ -2955,13 +2861,6 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - idx = 0; move16(); @@ -2977,7 +2876,6 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); if ( weights[3] != 0 ) { @@ -2998,28 +2896,6 @@ Word16 w_vquant_fx( { dist = L_mac0_sat( dist, tmp, tmp ); } -#else - tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); - if ( weights[3] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } - tmp = sub_o( x[2], shr( cb[j++], Qx ), &Overflow ); - if ( weights[2] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } - tmp = sub_o( x[1], shr( cb[j++], Qx ), &Overflow ); - if ( weights[1] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } - tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); - if ( weights[0] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } -#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -3049,7 +2925,6 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); if ( weights[0] != 0 ) { @@ -3070,28 +2945,6 @@ Word16 w_vquant_fx( { dist = L_mac0_sat( dist, tmp, tmp ); } -#else - tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); - if ( weights[0] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } - tmp = sub_o( x[1], shr( cb[j++], Qx ), &Overflow ); - if ( weights[1] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } - tmp = sub_o( x[2], shr( cb[j++], Qx ), &Overflow ); - if ( weights[2] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } - tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); - if ( weights[3] != 0 ) - { - dist = L_mac0_o( dist, tmp, tmp, &Overflow ); - } -#endif if ( LT_32( dist, minDist ) ) { idx = c; @@ -3585,12 +3438,7 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + test(); IF( ( a <= 0 ) || ( b <= 0 ) ) { @@ -3600,27 +3448,15 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); -#ifdef ISSUE_1836_replace_overflow_libcom num = round_fx_sat( L_shl_sat( b, exp_num ) ); -#else - num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); -#endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); -#ifdef ISSUE_1836_replace_overflow_libcom den = round_fx_sat( L_shl_sat( a, exp_den ) ); -#else - den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); -#endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom num = shl_sat( num, scale ); -#else - num = shl_o( num, scale, &Overflow ); -#endif exp_num = sub( exp_num, scale ); tmp = div_s( num, den ); @@ -3779,12 +3615,7 @@ void fir_fx( Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); Copy( x, buf_in + K, L ); @@ -3796,27 +3627,15 @@ void fir_fx( /* do the filtering */ FOR( i = 0; i < L; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom s = L_mult_sat( buf_in[K + i], h[0] ); -#else - s = L_mult_o( buf_in[K + i], h[0], &Overflow ); -#endif FOR( j = 1; j <= K; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom s = L_mac_sat( s, h[j], buf_in[K + i - j] ); -#else - s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); -#endif } -#ifdef ISSUE_1836_replace_overflow_libcom + s = L_shl_sat( s, shift ); y[i] = round_fx_sat( s ); /*Qx */ -#else - s = L_shl_o( s, shift, &Overflow ); - y[i] = round_fx_o( s, &Overflow ); /*Qx */ -#endif move16(); } @@ -3957,11 +3776,6 @@ Word16 squant_fx( Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif idx = 0; move16(); @@ -3971,18 +3785,10 @@ Word16 squant_fx( FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); -#ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x, cb[c] ); -#else - tmp = sub_o( x, cb[c], &Overflow ); -#endif /*dist += tmp*tmp; */ -#ifdef ISSUE_1836_replace_overflow_libcom L_dist = L_mac_sat( L_dist, tmp, tmp ); -#else - L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); -#endif if ( LT_32( L_dist, L_mindist ) ) { @@ -4124,12 +3930,7 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + IF( exp0 == 0 ) { FOR( i = 0; i < lg; i++ ) @@ -4143,20 +3944,14 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_shl_sat( x[i], tmp ); -#else - y[i] = L_shl_o( x[i], tmp, &Overflow ); -#endif move16(); } return; } -#ifdef ISSUE_1836_replace_overflow_libcom + L_tmp = L_shl_sat( 1, exp0 - 1 ); -#else - L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); -#endif + FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); @@ -4346,23 +4141,14 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; -#ifndef ISSUE_1836_replace_overflow_libcom -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); IF( Qyx1 == 0 ) { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); -#else - y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#endif move16(); } } @@ -4370,11 +4156,7 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //!!sat //!!sat -#else - y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); -#endif move16(); } } @@ -4513,11 +4295,7 @@ Word32 Calc_Energy_Autoscaled( FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ -#ifdef ISSUE_1836_replace_overflow_libcom temp = mult_r( *signal++, 16384 ); -#else - temp = mult_ro( *signal++, 16384, &Overflow ); -#endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ @@ -4527,11 +4305,7 @@ Word32 Calc_Energy_Autoscaled( L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom temp = mult_r( *signal++, 16384 ); -#else - temp = mult_ro( *signal++, 16384, &Overflow ); -#endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } /*Overfloe will never happen because temp2 is always positive*/ -- GitLab From 39895d36067afc12ae79a13dd5b99a9ebea83369 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 15 Oct 2025 17:04:32 +0200 Subject: [PATCH 3/4] accept switches --- lib_com/ivas_spar_com_fx.c | 75 -------- lib_com/options.h | 9 - lib_com/tools_fx.c | 31 +--- lib_dec/arith_coder_dec_fx.c | 21 +-- lib_dec/er_dec_tcx_fx.c | 72 +------- lib_dec/igf_dec_fx.c | 48 ------ lib_dec/ivas_core_dec_fx.c | 5 - lib_dec/tonalMDCTconcealment_fx.c | 27 --- lib_enc/acelp_core_switch_enc_fx.c | 25 +-- lib_enc/acelp_enc_util_fx.c | 24 +-- lib_enc/analy_sp_fx.c | 35 +--- lib_enc/ari_hm_enc_fx.c | 10 -- lib_enc/arith_coder_enc_fx.c | 42 ----- lib_enc/avq_cod_fx.c | 11 +- lib_enc/bass_psfilter_enc_fx.c | 36 ---- lib_enc/bw_detect_fx.c | 20 +-- lib_enc/cng_enc_fx.c | 94 ++--------- lib_enc/cod2t32_fx.c | 32 +--- lib_enc/cod_ace_fx.c | 16 +- lib_enc/cod_tcx_fx.c | 37 +--- lib_enc/core_enc_ol_fx.c | 48 ------ lib_enc/corr_xh_fx.c | 45 ----- lib_enc/detect_transient_fx.c | 67 +------- lib_enc/dtx_fx.c | 53 +----- lib_enc/enc_acelp_fx.c | 215 ++--------------------- lib_enc/enc_acelpx_fx.c | 59 +------ lib_enc/enc_amr_wb_fx.c | 24 +-- lib_enc/enc_gen_voic_fx.c | 88 +--------- lib_enc/enc_gen_voic_rf_fx.c | 39 +---- lib_enc/enc_higher_acelp_fx.c | 20 +-- lib_enc/enc_pit_exc_fx.c | 52 +----- lib_enc/enc_tran_fx.c | 65 +------ lib_enc/find_tar_fx.c | 31 +--- lib_enc/find_tilt_fx.c | 64 ++----- lib_enc/find_uv_fx.c | 127 ++++---------- lib_enc/gain_enc_fx.c | 107 +----------- lib_enc/gaus_enc_fx.c | 29 +--- lib_enc/gp_clip_fx.c | 25 +-- lib_enc/gs_enc_fx.c | 14 -- lib_enc/guided_plc_enc_fx.c | 31 +--- lib_enc/hf_cod_amrwb_fx.c | 27 +-- lib_enc/hq_classifier_enc_fx.c | 22 +-- lib_enc/hq_lr_enc_fx.c | 178 +++---------------- lib_enc/hvq_enc_fx.c | 28 +-- lib_enc/igf_enc_fx.c | 75 -------- lib_enc/ivas_tcx_core_enc_fx.c | 7 - lib_enc/lsf_enc_fx.c | 76 +-------- lib_enc/lsf_msvq_ma_enc_fx.c | 13 -- lib_enc/mdct_classifier_fx.c | 31 +--- lib_enc/multi_harm_fx.c | 32 ---- lib_enc/nelp_enc_fx.c | 53 ------ lib_enc/nois_est_fx.c | 145 +++------------- lib_enc/normalizecoefs_fx.c | 11 +- lib_enc/pit_enc_fx.c | 34 ---- lib_enc/pitch_ol2_fx.c | 71 -------- lib_enc/pitch_ol_fx.c | 43 ----- lib_enc/ppp_enc_fx.c | 80 ++------- lib_enc/pvq_encode_fx.c | 43 +---- lib_enc/q_gain2p_fx.c | 41 +---- lib_enc/qlpc_stoch_fx.c | 14 -- lib_enc/scale_enc_fx.c | 42 +---- lib_enc/set_impulse_fx.c | 32 +--- lib_enc/speech_music_classif_fx.c | 89 ---------- lib_enc/stat_noise_uv_enc_fx.c | 38 +---- lib_enc/swb_bwe_enc_fx.c | 200 ++-------------------- lib_enc/swb_bwe_enc_hr_fx.c | 10 -- lib_enc/swb_bwe_enc_lr_fx.c | 14 +- lib_enc/swb_tbe_enc_fx.c | 263 ++--------------------------- lib_enc/tcx_ltp_enc_fx.c | 64 ------- lib_enc/tcx_utils_enc_fx.c | 25 --- lib_enc/tns_base_enc_fx.c | 20 --- lib_enc/transition_enc_fx.c | 33 ---- lib_enc/vad_fx.c | 74 +------- lib_enc/vad_param_updt_fx.c | 14 +- lib_enc/vbr_average_rate_fx.c | 12 +- lib_enc/vlpc_2st_cod_fx.c | 11 -- lib_enc/voiced_enc_fx.c | 161 ++---------------- lib_rend/ivas_reverb_fx.c | 34 ---- 78 files changed, 311 insertions(+), 3722 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 685d8de54..afb639ef0 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -2369,7 +2369,6 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( } ELSE IF( EQ_16( num_dmx, 3 ) ) { -#ifdef FIX_1970_SBA_CRASH Word64 re64[2]; Word32 re32[2], re32_2; Word16 qtmp2; @@ -2399,80 +2398,6 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( q_tmp = s_min( 63, qtmp2 ); recon_uu_re[0][0] = L_max( 0, re32_2 ); move32(); -#else - Word32 re1[2], re2; - Word16 q_re1[2]; - set32_fx( re1, 0, 2 ); - set16_fx( q_re1, 31, 2 ); - - FOR( j = 0; j < 2; j++ ) - { - FOR( k = 0; k < 2; k++ ) - { - Word32 re; - W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][k], cov_dd_re[k][j] ); // q_C_re+q_cov_dd_re - q_tmp = sub( W_norm( W_tmp ), 33 ); - re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_cov_dd_re+q_tmp - q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re ); - if ( W_tmp == 0 ) - { - q_tmp = 31; - move16(); - } - - IF( LT_16( q_tmp, q_re1[j] ) ) - { - re1[j] = L_shr( re1[j], sub( q_re1[j], q_tmp ) ); // q_tmp - move32(); - q_re1[j] = q_tmp; - move16(); - } - ELSE - { - re = L_shr( re, sub( q_tmp, q_re1[j] ) ); // q_re1[j] - } - re1[j] = L_add( re1[j], re ); // q_re1[j] - move32(); - } - } - - W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1[0] ); // q_C_re+q_re1[0] - q_tmp = sub( W_norm( W_tmp ), 33 ); - re2 = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_re1[0]+q_tmp - q_tmp = add( add( q_C_re, q_tmp ), q_re1[0] ); - if ( W_tmp == 0 ) - { - q_tmp = 31; - move16(); - } - recon_uu_re[0][0] = re2; // q_C_re+q_re1[0]+q_tmp-32 - move32(); - - W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][1], re1[1] ); // q_C_re+q_re1[1] - q_tmp1 = sub( W_norm( W_tmp ), 33 ); - re2 = W_shl_sat_l( W_tmp, q_tmp1 ); // q_C_re+q_re1[1]+q_tmp1 - q_tmp1 = add( add( q_C_re, q_tmp1 ), q_re1[1] ); - if ( W_tmp == 0 ) - { - q_tmp1 = 31; - move16(); - } - - IF( LT_16( q_tmp, q_tmp1 ) ) - { - re2 = L_shr( re2, sub( q_tmp1, q_tmp ) ); // q_tmp - } - ELSE - { - recon_uu_re[0][0] = L_shr( recon_uu_re[0][0], sub( q_tmp, q_tmp1 ) ); // q_tmp1 - move32(); - q_tmp = q_tmp1; - move16(); - } - - recon_uu_re[0][0] = L_add( recon_uu_re[0][0], re2 ); // q_tmp - move32(); -#endif IF( LT_16( q_cov_uu_re, q_tmp ) ) { diff --git a/lib_com/options.h b/lib_com/options.h index 6269be44a..593903f95 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -72,15 +72,6 @@ #endif /* ################### Start FIXES switches ########################### */ -/* Note: each compile switch (FIX_1101_...) is independent from the other ones */ -#define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */ -#define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ -#define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ -#define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */ - -#define FIX_1978_SAT_MISSING_IN_GAIN_ENC /* VA: Fix add saturation missing that lead to a crash in P800-10 */ -#define FIX_1981_MAXIMUM_EXP_FX /* FhG: Fix bug in function to find maximum value in vector */ -#define FIX_1981_MAXIMUM_EXP_FX_ZEROMANTISSA /* FhG: Fix bug in function to find maximum value in vector:zero-mantissa fix*/ #define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */ #define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 32257b089..dc8017d89 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -2083,7 +2083,6 @@ Word16 maximum_exp_fx( const Word16 *exp_vec, /* i : exponents of input vector */ const Word16 lvec_fx /* i : length of input vector */ ) -#ifdef FIX_1981_MAXIMUM_EXP_FX { Word16 j, ind; ind = 0; @@ -2092,49 +2091,23 @@ Word16 maximum_exp_fx( FOR( j = 1; j < lvec_fx; j++ ) { Word16 scale = sub( exp_vec[j], exp_vec[ind] ); -#ifdef FIX_1981_MAXIMUM_EXP_FX_ZEROMANTISSA + test(); if ( vec_fx[j] == 0 || vec_fx[ind] == 0 ) { scale = 0; move16(); } -#endif - if ( L_mac0_sat( L_shl_sat( L_deposit_l( vec_fx[j] ), scale ), vec_fx[ind], -0x0001 ) > 0 ) - { - ind = j; - move16(); - } - } - return ind; -} -#else -{ - Word16 j, ind; - Word16 tmp, exp; - ind = 0; - move16(); - tmp = vec_fx[0]; - move16(); - exp = exp_vec[0]; - move16(); - FOR( j = 1; j < lvec_fx; j++ ) - { - IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) ) + if ( L_mac0_sat( L_shl_sat( L_deposit_l( vec_fx[j] ), scale ), vec_fx[ind], -0x0001 ) > 0 ) { ind = j; move16(); - tmp = vec_fx[j]; - move16(); - exp = exp_vec[j]; - move16(); } } return ind; } -#endif /*---------------------------------------------------------------------* diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 77ae166b4..479d35a84 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -28,27 +28,16 @@ static Word16 tcx_arith_decode_fx( Word16 exp_k; Word16 tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_tmp, Q; - Flag Overflow = 0; - move32(); - Flag Carry = 0; -#else Word32 Q; Word64 W_tmp; -#endif move32(); #endif - bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as ); tmp = sub( envelope_e, 1 + 15 ); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_tmp = L_deposit_l( 0 ); -#else W_tmp = 0; -#endif + FOR( k = 0; k < L_frame; k++ ) { IF( envelope[k] == 0 ) /* safety check in case of bit errors */ @@ -72,11 +61,7 @@ static Word16 tcx_arith_decode_fx( { bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_tmp = L_macNs_co( L_tmp, q, k, &Carry, &Overflow ); -#else W_tmp = W_mac_16_16( W_tmp, q, k ); -#endif Q = L_mult( q, negate( shl( 1, sub( 30, SPEC_EXP_DEC ) ) ) ); IF( EQ_16( s, 0 ) ) @@ -101,11 +86,7 @@ static Word16 tcx_arith_decode_fx( set32_fx( q_spectrum + k, 0, sub( L_frame, k ) ); /* noise filling seed */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - *nf_seed = extract_l( L_tmp ); -#else *nf_seed = extract_l( W_extract_l( W_tmp ) ); -#endif move16(); return bp; diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 2b112c00e..4671ab1b2 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -16,35 +16,14 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, Word16 L_subfr /*Q0*/, Word32 lp_gainp /*Q16*/, Word32 *lp_gainc /*Q16*/ ) { Word16 tmp16, tmp16_2, tmp16_3, tmp_e, tmp2_e, tmp_loop, i; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_c; - Word32 L_acc, L_tmp; -#else Word64 W_acc; Word32 L_tmp; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; -#endif move32(); move32(); #endif - -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_acc = L_deposit_l( 0 ); - L_c = L_deposit_l( 0 ); -#else W_acc = 0; -#endif -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Overflow = 0; - move16(); - Carry = 0; - move16(); -#endif tmp16 = round_fx( old_fpitch ); /*Q0*/ tmp_loop = shl( L_subfr, 1 ); @@ -57,22 +36,9 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, /*st->lp_gainc += ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] ) * ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] );*/ tmp16_3 = sub_sat( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/ ); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_acc = L_macNs_co( L_acc, tmp16_3, tmp16_3, &Carry, &Overflow ); /*Q3*/ - Overflow = 0; - move16(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Accumulate Carrys Q-1*/ - Carry = 0; - move16(); -#else W_acc = W_mac_16_16( W_acc, tmp16_3, tmp16_3 ); /*Q3*/ -#endif } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/ -#else - L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/ -#endif + L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/ tmp_e = add( tmp_e, 31 - ( add( shl( Q_exc, 1 ), 1 ) ) ); /*L_tmp is Q31, now*/ tmp16 = BASOP_Util_Divide3216_Scale( L_tmp /*Q31,norm,tmp_e*/, shl( L_subfr, 1 ) /*Q15,15*/, &tmp2_e ) /*Q15,tmp2_e+tmp_e-15*/; tmp_e = sub( add( tmp2_e, tmp_e ), 15 ); @@ -88,56 +54,24 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, static void calcGainc2_fx( Word16 *exc, Word16 Q_exc, Word16 L_subfr /*Q0*/, Word32 *lp_gainc /*Q16*/ ) { Word16 i, cnt, tmp16, tmp_e, tmp2_e; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_c, L_acc, L_tmp; -#else Word64 W_acc; Word32 L_tmp; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; -#endif -#endif - move16(); move16(); - - -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Carry = 0; - move16(); - Overflow = 0; move16(); +#endif - L_c = L_deposit_l( 0 ); - L_acc = L_deposit_l( 0 ); -#else W_acc = 0; -#endif cnt = shl( L_subfr, 1 ); FOR( i = 0; i < cnt; i++ ) { /* *gainc += ( exc[i-2*L_subfr] ) * ( exc[i-2*L_subfr]); */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_acc = L_macNs_co( L_acc, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, &Carry, &Overflow ); /*Q3*/ - Overflow = 0; - move16(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /* Accumulate Carrys Q-1*/ - Carry = 0; - move16(); -#else W_acc = W_mac_16_16( W_acc, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, exc[( i - ( L_subfr * 2 ) )] /*Q1*/ ); /*Q3*/ -#endif } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/ -#else - L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/ -#endif + L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/ tmp_e = add( tmp_e, sub( 31, ( add( shl( Q_exc, 1 ), 1 ) ) ) ); /*L_tmp is Q31, now*/ tmp16 = BASOP_Util_Divide3216_Scale( L_tmp /*Q31,norm,tmp_e*/, shl( L_subfr, 1 ) /*Q15,15*/, &tmp2_e ) /*Q15,tmp2_e+tmp_e-15*/; tmp_e = sub( add( tmp2_e, tmp_e ), 15 ); diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index ee462d7c5..0df98484a 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -1482,15 +1482,8 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in Word16 dS[IGF_MAX_SFB]; Word16 dS_e[IGF_MAX_SFB]; Word32 energyTmp[24]; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_c; -#endif Word16 Hr; #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; -#endif move16(); move16(); #endif @@ -1569,22 +1562,7 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in &dE_e, negate( tmp ) ); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_c = 0; - move32(); - FOR( tb = 0; tb < 24; tb++ ) - { - Carry = 0; - move16(); - L_tmp = L_add_co( L_tmp, energyTmp[tb], &Carry, &Overflow ); // Q31 - dE_e - Overflow = 0; - move16(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); - } - L_tmp = norm_llQ31( L_c, L_tmp, &shift ); // Q31 -#else L_tmp = sum_array_norm( energyTmp, 24, &shift ); -#endif /* float: dE = (float)sqrt(dE / 24.f); basop: */ shift = add( sub( shift, 4 ), dE_e ); /* x/24 = (x >> 4) * 1/1.5 */ dE = Sqrt16norm( extract_h( L_tmp ), &shift ); @@ -2176,20 +2154,8 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in Word16 dS[IGF_MAX_SFB]; Word16 dS_e[IGF_MAX_SFB]; Word32 energyTmp[24]; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_c; -#endif Word16 spec_e_arr[N_MAX]; Word16 vspec_e_arr[N_MAX_TCX - IGF_START_MN]; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - move16(); - Flag Carry = 0; - move16(); -#endif -#endif - /* initialize variables */ w0 = 6586; // Q15 @@ -2266,21 +2232,7 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in &dE_e, negate( tmp ) ); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_c = 0; - move32(); - FOR( tb = 0; tb < 24; tb++ ) - { - Carry = 0; - move16(); - L_tmp = L_add_co( L_tmp, energyTmp[tb], &Carry, &Overflow ); // Q31 - dE_e - Overflow = 0; - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); - } - L_tmp = norm_llQ31( L_c, L_tmp, &shift ); // Q31 -#else L_tmp = sum_array_norm( energyTmp, 24, &shift ); -#endif /* float: dE = (float)sqrt(dE / 24.f); basop: */ shift = add( sub( shift, 4 ), dE_e ); /* x/24 = (x >> 4) * 1/1.5 */ dE = Sqrt16norm( extract_h( L_tmp ), &shift ); diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index de83e8a07..f3020662b 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -740,13 +740,8 @@ ivas_error ivas_core_dec_fx( move16(); sts[1]->hHQ_core->Q_old_wtda = sub( 15, sts[1]->hHQ_core->exp_old_out ); move16(); -#ifdef FIX_1944_CRASH_FOR_STEREO shift1 = getScaleFactor16( sts[0]->hHQ_core->old_out_fx, L_FRAME48k ); shift2 = getScaleFactor16( sts[1]->hHQ_core->old_out_fx, L_FRAME48k ); -#else - shift1 = norm_arr( sts[0]->hHQ_core->old_out_fx, L_FRAME48k ); - shift2 = norm_arr( sts[1]->hHQ_core->old_out_fx, L_FRAME48k ); -#endif scale_sig( sts[0]->hHQ_core->old_out_fx, L_FRAME48k, shift1 ); scale_sig( sts[1]->hHQ_core->old_out_fx, L_FRAME48k, shift2 ); sts[0]->hHQ_core->Q_old_wtda = add( sts[0]->hHQ_core->Q_old_wtda, shift1 ); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 82f741e56..d098eaa15 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -1306,11 +1306,7 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( { Word16 i, l, ld, fac; Word16 rnd; -#ifdef FIX_1944_CRASH_FOR_STEREO Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain, scaleFactor; -#else - Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain; -#endif Word32 L_tmp, L_tmp1, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; Word16 inv_exp, inv_samples, exp; Word32 last_block_nrg_correct; @@ -1488,10 +1484,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } mdctSpectrum[i] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp move32(); -#ifndef FIX_1944_CRASH_FOR_STEREO - hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[i], mdctSpectrum[i] ) ); // Q31- faded_signal_nrg_exp - move32(); -#endif } FOR( i = crossOverFreq; i < hTonalMDCTConc->lastBlockData.nSamples; i++ ) { @@ -1500,7 +1492,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } *mdctSpectrum_exp = sub( add( e_crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData_exp ), exp ); move16(); -#ifdef FIX_1944_CRASH_FOR_STEREO scaleFactor = getScaleFactor32( mdctSpectrum, crossOverFreq ); IF( scaleFactor > 8 ) { @@ -1519,9 +1510,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } move32(); hTonalMDCTConc->faded_signal_nrg_exp = shl( sub( *mdctSpectrum_exp, scaleFactor ), 1 ); -#else - hTonalMDCTConc->faded_signal_nrg_exp = shl( *mdctSpectrum_exp, 1 ); -#endif move16(); } } @@ -1685,10 +1673,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } mdctSpectrum[l] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp move32(); -#ifndef FIX_1944_CRASH_FOR_STEREO - hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[l], mdctSpectrum[l] ) ); // Q31 - 2*mdctSpectrum_exp - move32(); -#endif } FOR( i = 1; i < hTonalMDCTConc->pTCI->numIndexes; i++ ) @@ -1708,9 +1692,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } mdctSpectrum[l] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp move32(); -#ifndef FIX_1944_CRASH_FOR_STEREO - hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[l], mdctSpectrum[l] ) ); // Q31- 2*mdctSpectrum_exp -#endif } } @@ -1729,10 +1710,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } mdctSpectrum[l] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp move32(); -#ifndef FIX_1944_CRASH_FOR_STEREO - hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[l], mdctSpectrum[l] ) ); // Q31- 2*mdctSpectrum_exp - move32(); -#endif } FOR( l = crossOverFreq; l < hTonalMDCTConc->lastBlockData.nSamples; l++ ) @@ -1740,7 +1717,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( mdctSpectrum[l] = L_deposit_h( 0 ); move32(); } -#ifdef FIX_1944_CRASH_FOR_STEREO scaleFactor = getScaleFactor32( mdctSpectrum, crossOverFreq ); IF( scaleFactor > 8 ) { @@ -1759,9 +1735,6 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } move32(); hTonalMDCTConc->faded_signal_nrg_exp = shl( sub( *mdctSpectrum_exp, scaleFactor ), 1 ); -#else - hTonalMDCTConc->faded_signal_nrg_exp = shl( *mdctSpectrum_exp, 1 ); -#endif move16(); } } diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 12af87d7c..07e4320c8 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -726,12 +726,7 @@ static void bwe_switch_enc_fx( Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ Word16 n, L; BSTR_ENC_HANDLE hBstr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + hBstr = st_fx->hBstr; L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS ); @@ -847,17 +842,14 @@ static void bwe_switch_enc_fx( L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc - gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ -#else - gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ -#endif + gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); /* Q0 */ push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); return; } + static void bwe_switch_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_speech_fx /* i : original input signal Q0 */ @@ -878,12 +870,7 @@ static void bwe_switch_enc_ivas_fx( Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ Word16 n, L; BSTR_ENC_HANDLE hBstr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + hBstr = st_fx->hBstr; L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS ); @@ -996,11 +983,7 @@ static void bwe_switch_enc_ivas_fx( L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ -#else - gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ -#endif ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); diff --git a/lib_enc/acelp_enc_util_fx.c b/lib_enc/acelp_enc_util_fx.c index 8787c46c8..a9e567fa7 100644 --- a/lib_enc/acelp_enc_util_fx.c +++ b/lib_enc/acelp_enc_util_fx.c @@ -160,11 +160,7 @@ void E_ACELP_conv( { Word16 i, k; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + FOR( k = 0; k < L_SUBFR; k++ ) { /*cn2[k] = xn2[k]; */ @@ -175,12 +171,8 @@ void E_ACELP_conv( /*cn2[k]-=cn2[i]*h2[k-i];*/ L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*h2 4Q11*/ } - L_tmp = W_sat_l( L_tmp_64 ); /* 4Q11 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = W_sat_l( L_tmp_64 ); /* 4Q11 */ cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Q0 */ -#else - cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Q0 */ -#endif } } @@ -192,11 +184,7 @@ void E_ACELP_conv_ivas_fx( { Word16 i, k; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + FOR( k = 0; k < L_SUBFR; k++ ) { /*cn2[k] = xn2[k]; */ @@ -207,12 +195,8 @@ void E_ACELP_conv_ivas_fx( /*cn2[k]-=cn2[i]*h2[k-i];*/ L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*Qnew + 11*/ } - L_tmp = W_sat_l( L_tmp_64 ); /* Qnew + 11 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = W_sat_l( L_tmp_64 ); /* Qnew + 11 */ cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Qnew*/ -#else - cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Qnew*/ -#endif move16(); } } diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index 666d7865c..7a1f60e45 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -898,13 +898,6 @@ static void find_enr( Word32 etot; Word16 exp_etot; Word32 *tmpptr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - ptR = &data[1]; /* first real */ ptI = &data[L_FFT - 1]; /* first imaginary */ @@ -950,13 +943,9 @@ static void find_enr( /* *ptE *= 4.0 / (L_FFT*L_FFT) */ /* normalization - corresponds to FFT normalization by 2/L_FFT */ - BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ -#ifdef ISSUE_1867_replace_overflow_libenc + BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ *ptE = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE - 2 */ -#else - *ptE = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE - 2 */ -#endif - move32(); /* scaled by Q_new + QSCALE - 2 */ + move32(); /* scaled by Q_new + QSCALE - 2 */ BASOP_SATURATE_WARNING_ON_EVS; /*band[i] += *ptE++;*/ *Bin_E = *ptE; @@ -980,13 +969,9 @@ static void find_enr( exp_band = sub( exp_band, shift_to_norm ); exp_band = sub( diff_scaleP1, exp_band ); - BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ -#ifdef ISSUE_1867_replace_overflow_libenc + BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ band[i] = L_shl_sat( Ltmp1, exp_band ); /* Q15 + exp_band */ -#else - band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); /* Q15 + exp_band */ -#endif - move32(); /* band scaled by Q_new + QSCALE */ + move32(); /* band scaled by Q_new + QSCALE */ BASOP_SATURATE_WARNING_ON_EVS; test(); @@ -1035,13 +1020,9 @@ static void find_enr( /* *ptE *= 4.0 / (L_FFT*L_FFT) */ /* normalization - corresponds to FFT normalization by 2/L_FFT */ - BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ -#ifdef ISSUE_1867_replace_overflow_libenc + BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ *Bin_E = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE */ -#else - *Bin_E = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE */ -#endif - move32(); /* scaled by Q_new + QSCALE - 2 */ + move32(); /* scaled by Q_new + QSCALE - 2 */ BASOP_SATURATE_WARNING_ON_EVS; Bin_E++; Ltmp1 = L_add( Ltmp1, Ltmp ); @@ -1062,11 +1043,7 @@ static void find_enr( exp_band = sub( exp_band, shift_to_norm ); exp_band = sub( diff_scaleP1, exp_band ); BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ -#ifdef ISSUE_1867_replace_overflow_libenc band[i] = L_shl_sat( Ltmp1, exp_band ); -#else - band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); -#endif move32(); /* band scaled by Q_new + QSCALE */ BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/ari_hm_enc_fx.c b/lib_enc/ari_hm_enc_fx.c index 4beac647d..1917216ef 100644 --- a/lib_enc/ari_hm_enc_fx.c +++ b/lib_enc/ari_hm_enc_fx.c @@ -241,12 +241,6 @@ Word16 SearchPeriodicityIndex_fx( Word32 Lag; Word16 s, tmp, tmp2, tmp3; Word32 tmp32; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Debug init (not instrumented) */ C = -3000; @@ -459,11 +453,7 @@ Word16 SearchPeriodicityIndex_fx( tmp32 = L_mult0( Score, NumToConsider ); /* -> 16Q15 */ tmp = sub( norm_l( tmp32 ), 1 ); tmp2 = norm_l( AbsTotal ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp3 = div_s( round_fx_sat( L_shl( tmp32, tmp ) ), round_fx_sat( L_shl( AbsTotal, tmp2 ) ) ); -#else - tmp3 = div_s( round_fx_o( L_shl_o( tmp32, tmp, &Overflow ), &Overflow ), round_fx_o( L_shl_o( AbsTotal, tmp2, &Overflow ), &Overflow ) ); -#endif *RelativeScore = shr_sat( tmp3, add( sub( tmp, tmp2 ), 2 ) ); /* -> 2Q13 */ move16(); } diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 58125b81c..12f3368dc 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -48,13 +48,6 @@ static Word16 tcx_arith_estimate_scale( { Word16 scale, tmp, k, s, s1; Word32 L_tmp, accu; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* compute normalised standard deviation and determine approximate scale */ accu = L_deposit_l( 0 ); @@ -74,11 +67,7 @@ static Word16 tcx_arith_estimate_scale( s1 = norm_l( abs_spectrum[k] ); } -#ifdef ISSUE_1867_replace_overflow_libenc tmp = mult_r( round_fx_sat( L_shl( abs_spectrum[k], s1 ) ), envelope[k] ); -#else - tmp = mult_r( round_fx_o( L_shl( abs_spectrum[k], s1 ), &Overflow ), envelope[k] ); -#endif L_tmp = L_mult0( tmp, tmp ); tmp = sub( shl( s1, 1 ), 1 ); @@ -373,13 +362,6 @@ static Word16 tcx_arith_rateloop( Word32 L_tmp; Word16 tmp, tmp3; Word32 tmp2; -#ifndef ISSUE_1867_replace_overflow_libenc -#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 ); scale = mult_r( scale, *target_bits_fac ); @@ -688,22 +670,10 @@ void tcx_arith_encode_envelope_fx( const Word8 *deadzone_flags; Word16 gamma_w, gamma_uw; Word16 hm_bits; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_tmp, L_tmp2; -#else Word32 L_tmp; Word64 W_tmp2; -#endif Word16 tmp; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; - move32(); - move32(); -#endif -#endif assert( L_spec <= N_MAX_ARI ); @@ -787,18 +757,10 @@ void tcx_arith_encode_envelope_fx( move16(); /* Multiply back the signs */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_tmp2 = L_deposit_l( 0 ); -#else W_tmp2 = 0; -#endif FOR( k = 0; k <= kMax; k++ ) { -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_tmp2 = L_macNs_co( L_tmp2, q_spectrum[k], k, &Carry, &Overflow ); -#else W_tmp2 = W_mac_16_16( W_tmp2, q_spectrum[k], k ); -#endif if ( signs[k] != 0 ) L_tmp = L_mult( q_spectrum[k], -( 1 << ( 30 - SPEC_EXP_DEC ) ) ); @@ -812,11 +774,7 @@ void tcx_arith_encode_envelope_fx( set32_fx( spectrum + k, 0, sub( s_max( L_frame, L_spec ), k ) ); /* noise filling seed */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - *nf_seed = extract_l( L_tmp2 ); -#else *nf_seed = extract_l( W_extract_l( W_tmp2 ) ); -#endif move16(); } diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 8433e77ab..693a662b7 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -14,6 +14,7 @@ * Local prototypes *-------------------------------------------------------------------*/ static void wrte_cv( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits ); + /*-------------------------------------------------------------------* * Function AVQ_cod() * * * @@ -33,11 +34,7 @@ void AVQ_cod_fx( /* o: comfort noise gain factor Word16 ebits[NSV_MAX], e_ebits, f_ebits, e_tmp, f_tmp, tmp16, l_8; Word32 Lener, Ltmp, Lgain, x1[8]; Word16 tot_est_bits, Q_in; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + Q_in = sub( Q_in_ref, 1 ); move16(); @@ -53,11 +50,7 @@ void AVQ_cod_fx( /* o: comfort noise gain factor Lener = L_shl( 4, shl( Q_in, 1 ) ); /* to set ebits >= 0 */ FOR( i = 0; i < 8; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Lener = L_mac_sat( Lener, xri[l * 8 + i], xri[l * 8 + i] ); -#else - Lener = L_mac_o( Lener, xri[l * 8 + i], xri[l * 8 + i], &Overflow ); -#endif } /* estimated bit consumption when gain=1 */ /* ebits[l] = 5.0 * FAC_LOG2 * (Word16)log10(ener * 0.5) */ diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index 7a056dd13..c4aeab22d 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -36,13 +36,6 @@ Word16 bass_pf_enc_fx( Word32 cross_n_d, nrg_n; const Word16 *pFilt; Word32 ener2; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - IF( NE_16( l_frame, L_FRAME16k ) ) { @@ -155,7 +148,6 @@ Word16 bass_pf_enc_fx( FOR( i = 0; i < lg; i++ ) { tmp32 = L_msu0( 0, gain, syn[i + i_subfr - T] ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp32 = L_msu0_sat( tmp32, gain, syn[i + i_subfr + T] ); tmp16 = mac_r_sat( tmp32, gain, syn[i + i_subfr] ); /* Q0 */ @@ -164,16 +156,6 @@ Word16 bass_pf_enc_fx( tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) ); /* Q0+s1-3 */ ener2 = L_mac0_sat( ener2, tmp16, tmp16 ); /* Q0+(s1-3)*2 */ -#else - tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr + T], &Overflow ); - tmp16 = mac_ro( tmp32, gain, syn[i + i_subfr], &Overflow ); /* Q0 */ - - lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ ); - lp_error = L_mac_o( lp_error, tmp16, 0x1000, &Overflow ); /* Q13 */ - - tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */ - ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow ); /* Q0+(s1-3)*2 */ -#endif } } @@ -182,7 +164,6 @@ Word16 bass_pf_enc_fx( FOR( i = lg; i < l_subfr; i++ ) { tmp32 = L_mult0( gain, syn[i + i_subfr] ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp32 = L_msu0_sat( tmp32, gain, syn[i + i_subfr - T] ); /* Q0 */ tmp16 = round_fx_sat( tmp32 ); lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ ); @@ -190,15 +171,6 @@ Word16 bass_pf_enc_fx( tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) ); /* Q0+s1-3 */ ener2 = L_mac0_sat( ener2, tmp16, tmp16 ); /* Q0+(s1-3)*2 */ -#else - tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr - T], &Overflow ); /* Q0 */ - tmp16 = round_fx_o( tmp32, &Overflow ); - lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ ); - lp_error = L_mac_o( lp_error, tmp16, 0x1000, &Overflow ); /* Q13 */ - - tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */ - ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow ); /* Q0+(s1-3)*2 */ -#endif } } @@ -259,11 +231,7 @@ Word16 bass_pf_enc_fx( tmp32 = L_mac( tmp32, tmp16, syn[i + i_subfr] ); noise_in[i] = round_fx( L_shl( tmp32, s2 ) ); /* Q0+s2 */ -#ifdef ISSUE_1867_replace_overflow_libenc error_in[i] = sub_sat( orig[i + i_subfr], syn[i + i_subfr] ); /*Q0*/ -#else - error_in[i] = sub_o( orig[i + i_subfr], syn[i + i_subfr], &Overflow ); /*Q0*/ -#endif move16(); } } @@ -277,11 +245,7 @@ Word16 bass_pf_enc_fx( noise_in[i] = round_fx( L_shl( tmp32, s2 ) ); /* Q0+s2 */ move16(); -#ifdef ISSUE_1867_replace_overflow_libenc error_in[i] = sub_sat( orig[i + i_subfr], syn[i + i_subfr] ); /*Q0*/ -#else - error_in[i] = sub_o( orig[i + i_subfr], syn[i + i_subfr], &Overflow ); /*Q0*/ -#endif move16(); } } diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index 6ec7c626b..3f0def007 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -67,12 +67,6 @@ void bw_detect_fx( const Word32 *pt32; Word32 max_NB32, max_WB32, max_SWB32, max_FB32, mean_NB32, mean_WB32, mean_SWB32, mean_FB32; /* Q11*/ /* we need Word32 for the new cldfb energy vectors */ Word16 bwd_count_wider_bw; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 lp_noise_fx; bwd_count_wider_bw = BWD_COUNT_WIDER_BW; @@ -129,12 +123,8 @@ void bw_detect_fx( cldfb_bin[i] = L_deposit_l( 1 ); move32(); } - L_tmp = BASOP_Util_Log2( cldfb_bin[0] ); /*(log2(660423549*2^(-31))/64)*2^31*/ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = BASOP_Util_Log2( cldfb_bin[0] ); /*(log2(660423549*2^(-31))/64)*2^31*/ L_tmp = L_add_sat( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[0] ), 31 - LD_DATA_SCALE ) ); /* Q25 */ -#else - L_tmp = L_add_o( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[0] ), 31 - LD_DATA_SCALE ), &Overflow ); /* Q25 */ -#endif cldfb_bin[0] = Mpy_32_16_1( L_tmp, 9864 /*1.0f/3.3219280948873623478703194294894f Q15*/ ); move32(); /* 1/log2(10) */ /* Q25 */ @@ -303,11 +293,7 @@ void bw_detect_fx( FOR( i = 0; i < BWD_TOTAL_WIDTH; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc spect[i] = round_fx_sat( L_shr_sat( spect32[i], Q_dct ) ); -#else - spect[i] = round_fx_o( L_shr_o( spect32[i], Q_dct, &Overflow ), &Overflow ); -#endif move16(); } Q_dct = -2; @@ -345,11 +331,7 @@ void bw_detect_fx( pt1 = &spect[i_mult2( i, bin_width )]; FOR( j = 0; j < bin_width; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sum32 = L_mac0_sat( sum32, *pt1, *pt1 ); -#else - sum32 = L_mac0_o( sum32, *pt1, *pt1, &Overflow ); -#endif pt1++; } tmp_1 = BASOP_Util_Cmp_Mant32Exp( sum32, E_spect_bin, MAX_32, Q31 - 41 ); /* Any sum32 in Q_dct if it is less than MAX_32 in Q41 will be less than 0.001 */ diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 37770ce9e..b26fd281a 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -108,13 +108,6 @@ void CNG_enc_fx( st_lp_sp_enr = hTdCngEnc->lp_sp_enr_fx; move16(); Word16 lp_ener_thr_scale; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* Temp variables for floating point functions */ lp_ener_thr_scale = 8; /* 4.0f*/ /*IVAS_CODE Q2 */ move16(); @@ -637,11 +630,7 @@ void CNG_enc_fx( FOR( i = 0; i < M; i++ ) { dev = abs_s( sub( lsp_tmp[i], lsp_new[i] ) ); /*Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc - dist = add_sat( dist, dev ); /*Q15 */ -#else - dist = add_o( dist, dev, &Overflow ); /*Q15 */ -#endif + dist = add_sat( dist, dev ); /*Q15 */ if ( GT_16( dev, max_dev ) ) { max_dev = dev; @@ -771,16 +760,10 @@ void CNG_enc_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* env[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_new+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_new+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_new+1 */ -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_new+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_new+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_new+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */ tmp1 = add( add( Q_new, Q_new ), 1 ); env[i] = L_shr( L_tmp, sub( tmp1, 6 ) ); move32(); /* Q6 */ @@ -1056,13 +1039,9 @@ void CNG_enc_fx( /* d += (env[j] - CNG_details_codebook_fx[i][j]) * (env[j] - CNG_details_codebook_fx[i][j]);*/ L_tmp = L_sub( env[j], L_deposit_l( CNG_details_codebook_fx[i][j] ) ); /* Q6 */ exp = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/ - tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_mult_sat( tmp1, tmp1 ); /*Q(2*exp - 19)*/ -#else - L_tmp = L_mult_o( tmp1, tmp1, &Overflow ); /*Q(2*exp - 19)*/ -#endif + L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/ + tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/ + L_tmp = L_mult_sat( tmp1, tmp1 ); /*Q(2*exp - 19)*/ L_tmp = L_shr( L_tmp, sub( add( exp, exp ), 36 ) ); /* Q17 */ d = L_add( d, L_tmp ); } @@ -1249,12 +1228,7 @@ void CNG_enc_ivas_fx( Word64 w_temp; Word32 inv_frame_len; Word32 L_ener; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + step_inv = 0; move16(); maxl = 0; @@ -1957,16 +1931,10 @@ void CNG_enc_ivas_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* env[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_new+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_new+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_new+1 */ -#else - L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_new+1 */ - L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_new+1 */ - L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_new+1 */ -#endif - L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */ + L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */ tmp1 = add( add( Q_new, Q_new ), 1 ); env[i] = L_shr( L_tmp, sub( tmp1, 6 ) ); move32(); /* Q6 */ @@ -2266,13 +2234,9 @@ void CNG_enc_ivas_fx( /* d += (env[j] - CNG_details_codebook_fx[i][j]) * (env[j] - CNG_details_codebook_fx[i][j]);*/ L_tmp = L_sub( env[j], L_deposit_l( CNG_details_codebook_fx[i][j] ) ); /* Q6 */ exp = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/ - tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_mult_sat( tmp1, tmp1 ); /*Q(2*exp - 19)*/ -#else - L_tmp = L_mult_o( tmp1, tmp1, &Overflow ); /*Q(2*exp - 19)*/ -#endif + L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/ + tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/ + L_tmp = L_mult_sat( tmp1, tmp1 ); /*Q(2*exp - 19)*/ L_tmp = L_shr( L_tmp, sub( add( exp, exp ), 36 ) ); /* Q17 */ d = L_add( d, L_tmp ); /* Q17 */ } @@ -2539,12 +2503,7 @@ static Word16 shb_DTX_fx( DTX_ENC_HANDLE hDtxEnc = st_fx->hDtxEnc; TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + shb_new_speech_fx = shb_old_speech_fx + ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4; Copy( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4 ); Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k ); @@ -2561,11 +2520,7 @@ static Word16 shb_DTX_fx( wb_ener_fx = L_deposit_l( 0 ); FOR( i = 0; i < st_fx->L_frame; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc wb_ener_fx = L_mac_sat( wb_ener_fx, syn_12k8_16k[i], syn_12k8_16k[i] ); -#else - wb_ener_fx = L_mac_o( wb_ener_fx, syn_12k8_16k[i], syn_12k8_16k[i], &Overflow ); -#endif } wb_ener_fx = L_add( Mpy_32_16_1( wb_ener_fx, 128 ), 1 ); /* 128 in Q15, wb_ener_fx in Q1 */ @@ -2574,11 +2529,7 @@ static Word16 shb_DTX_fx( fra = Log2_norm_lc( L_shl( wb_ener_fx, exp ) ); exp = sub( 30 - 1, exp ); wb_ener_fx = Mpy_32_16( exp, fra, LG10 ); -#ifdef ISSUE_1867_replace_overflow_libenc log_wb_ener_fx = round_fx_sat( L_shl_sat( wb_ener_fx, 10 ) ); /* log_wb_ener_fx in Q8 */ -#else - log_wb_ener_fx = round_fx_o( L_shl_o( wb_ener_fx, 10, &Overflow ), &Overflow ); /* log_wb_ener_fx in Q8 */ -#endif exp = norm_l( shb_ener_fx ); fra = Log2_norm_lc( L_shl( shb_ener_fx, exp ) ); exp = sub( 30 - 1, exp ); @@ -2597,11 +2548,7 @@ static Word16 shb_DTX_fx( move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc log_shb_ener_fx = sub_sat( round_fx_sat( L_shl_sat( shb_ener_fx, 10 ) ), att ); /* log_shb_ener_fx in Q8 */ -#else - log_shb_ener_fx = sub_o( round_fx_o( L_shl_o( shb_ener_fx, 10, &Overflow ), &Overflow ), att, &Overflow ); /* log_shb_ener_fx in Q8 */ -#endif IF( hDtxEnc->first_CNG == 0 ) { hTdCngEnc->mov_wb_cng_ener_fx = log_wb_ener_fx; @@ -3010,13 +2957,6 @@ static Word16 shb_DTX_ivas_fx( TD_CNG_ENC_HANDLE hTdCngEnc = st->hTdCngEnc; TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif - shb_new_speech_fx = shb_old_speech_fx + ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4; Copy( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4 ); // old_speech_shb_fx -> Q0 Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k ); // Q0 @@ -3033,11 +2973,7 @@ static Word16 shb_DTX_ivas_fx( wb_ener_fx = L_deposit_l( 0 ); FOR( i = 0; i < st->L_frame; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc wb_ener_fx = L_mac_sat( wb_ener_fx, syn_12k8_16k_fx[i], syn_12k8_16k_fx[i] ); // ( Q0 + Q0 + Q1 ) --> Q1 due to left shift in L_mac -#else - wb_ener_fx = L_mac_o( wb_ener_fx, syn_12k8_16k_fx[i], syn_12k8_16k_fx[i], &Overflow ); // ( Q0 + Q0 + Q1 ) --> Q1 due to left shift in L_mac -#endif } wb_ener_fx = L_add( Mpy_32_16_1( wb_ener_fx, 128 ), 1 ); /* 128 in Q15, wb_ener_fx in Q1 */ @@ -3047,11 +2983,7 @@ static Word16 shb_DTX_ivas_fx( exp = sub( 30 - 1, exp ); wb_ener_fx = Mpy_32_16( exp, fra, LG10 ); -#ifdef ISSUE_1867_replace_overflow_libenc log_wb_ener_fx = round_fx_sat( L_shl_sat( wb_ener_fx, 10 ) ); /* log_wb_ener_fx in Q8 */ -#else - log_wb_ener_fx = round_fx_o( L_shl_o( wb_ener_fx, 10, &Overflow ), &Overflow ); /* log_wb_ener_fx in Q8 */ -#endif exp = norm_l( shb_ener_fx ); fra = Log2_norm_lc( L_shl( shb_ener_fx, exp ) ); exp = sub( 30 - 1, exp ); @@ -3075,11 +3007,7 @@ static Word16 shb_DTX_ivas_fx( move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc log_shb_ener_fx = sub_sat( round_fx_sat( L_shl_sat( shb_ener_fx, 10 ) ), att_fx ); /* log_shb_ener_fx in Q8 */ -#else - log_shb_ener_fx = sub_o( round_fx_o( L_shl_o( shb_ener_fx, 10, &Overflow ), &Overflow ), att_fx, &Overflow ); /* log_shb_ener_fx in Q8 */ -#endif IF( st->hDtxEnc->first_CNG == 0 ) { diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c index 156b38ce4..f77e8602b 100644 --- a/lib_enc/cod2t32_fx.c +++ b/lib_enc/cod2t32_fx.c @@ -47,12 +47,7 @@ void acelp_2t32_fx( Word32 L_tmp; Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T]; Word16 rrixiy[MSIZE]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /*----------------------------------------------------------------* * Compute rrixix[][] needed for the codebook search. *----------------------------------------------------------------*/ @@ -65,19 +60,11 @@ void acelp_2t32_fx( L_cor = L_deposit_h( 1 ); FOR( i = 0; i < NB_POS_FCB_2T; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 ); -#else - L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow ); -#endif ptr_h1++; *p1-- = extract_h( L_cor ); move16(); /*Q9 Q7*/ -#ifdef ISSUE_1867_replace_overflow_libenc L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 ); -#else - L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow ); -#endif ptr_h1++; *p0-- = extract_h( L_cor ); move16(); /*Q9 Q7*/ @@ -118,28 +105,17 @@ void acelp_2t32_fx( L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q(12+12+1) FOR( i = k; i < NB_POS_FCB_2T - 1; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc *p1 = round_fx_sat( L_cor ); // Q(25-16) L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ ); *p0 = round_fx_sat( L_cor ); // Q(9) L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ ); -#else - *p1 = round_fx_o( L_cor, &Overflow ); // Q(25-16) - L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow ); - *p0 = round_fx_o( L_cor, &Overflow ); // Q(9) - L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow ); -#endif move16(); move16(); p1 -= ( NB_POS_FCB_2T + 1 ); p0 -= ( NB_POS_FCB_2T + 1 ); } -#ifdef ISSUE_1867_replace_overflow_libenc *p1 = round_fx_sat( L_cor ); // Q9 -#else - *p1 = round_fx_o( L_cor, &Overflow ); // Q9 -#endif pos -= NB_POS_FCB_2T; move16(); pos2--; @@ -242,15 +218,9 @@ void acelp_2t32_fx( FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP ) { ps2 = add( ps1, dn_p[i1] ); -#ifdef ISSUE_1867_replace_overflow_libenc alp2 = add_sat( alp1, add_sat( *p1++, *p2++ ) ); sq = mult( ps2, ps2 ); s = L_msu_sat( L_mult( alpk, sq ), psk, alp2 ); -#else - alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow ); - sq = mult( ps2, ps2 ); - s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow ); -#endif IF( s > 0 ) { psk = sq; diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c index dc139873a..ca0142a44 100644 --- a/lib_enc/cod_ace_fx.c +++ b/lib_enc/cod_ace_fx.c @@ -75,12 +75,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * Word16 dummy = 0; move16(); ACELP_config *acelp_cfg; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif acelp_cfg = &( st->acelp_cfg ); LPD_state_HANDLE hLPDmem = st->hLPDmem; @@ -353,24 +347,16 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); Ltmp = L_shl( Ltmp, Q_new_p5 ); Ltmp = L_mac( Ltmp, gain_pit, exc[i + i_subfr] ); -#ifdef ISSUE_1867_replace_overflow_libenc exc2[i] = round_fx_sat( L_shl_sat( Ltmp, 1 ) ); -#else - exc2[i] = round_fx_sat( L_shl_o( Ltmp, 1, &Overflow ) ); -#endif move16(); Ltmp2 = Mpy_32_16_1( gain_code, code[i] ); Ltmp2 = L_shl_sat( Ltmp2, Q_new_p5 ); Ltmp = L_add_sat( Ltmp, Ltmp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here */ exc[i + i_subfr] = round_fx_sat( Ltmp ); -#else - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here */ - exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); -#endif move16(); } + /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index a08a81c4a..1e01d8c3c 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1272,12 +1272,6 @@ void QuantizeSpectrum_fx( Word16 nz; /* non-zero length in ALDO window*/ CONTEXT_HM_CONFIG *phm_cfg; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; -#endif -#endif /* Stack memory is split between encoder and internal decoder to reduce max stack memory usage. */ @@ -1841,29 +1835,19 @@ void QuantizeSpectrum_fx( /* Save quantized Values */ tmp32 = L_deposit_l( 0 ); move16(); -#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW Word64 seed = 0; move64(); -#endif FOR( i = 0; i < L_spec; i++ ) { spectrum[i] = L_mult( sqQ[i], 1 << ( 30 - SPEC_EXP_DEC ) ); move32(); /* noise filling seed */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - tmp32 = L_macNs_co( tmp32, abs_s( sqQ[i] ), i, &Carry, &Overflow ); -#else seed = W_mac_16_16( seed, abs_s( sqQ[i] ), i ); -#endif } *spectrum_e = SPEC_EXP_DEC; move16(); -#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW nf_seed = extract_l( W_extract_l( seed ) ); // Q0 -#else - nf_seed = extract_l( tmp32 ); -#endif } ELSE /* low rates: new arithmetic coder */ { @@ -2913,14 +2897,7 @@ void QuantizeTCXSpectrum_fx( CONTEXT_HM_CONFIG *phm_cfg; Word16 att_fx = 0; move16(); -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - move16(); - Flag Carry = 0; - move16(); -#endif -#endif + /*-----------------------------------------------------------* * Init * *-----------------------------------------------------------*/ @@ -3537,31 +3514,19 @@ void QuantizeTCXSpectrum_fx( move16(); } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - tmp32 = L_deposit_l( 0 ); -#else Word64 tmp64 = 0; -#endif FOR( i = 0; i < L_spec; i++ ) { spectrum_fx[i] = L_mult( sqQ[i], 1 << ( 30 - SPEC_EXP_DEC ) ); move32(); /* noise filling seed */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - tmp32 = L_macNs_co( tmp32, abs_s( sqQ[i] ), i, &Carry, &Overflow ); -#else tmp64 = W_mac_16_16( tmp64, abs_s( sqQ[i] ), i ); -#endif } *spectrum_e = SPEC_EXP_DEC; move16(); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - *nf_seed = extract_l( tmp32 ); -#else assert( W_extract_h( tmp64 ) == 0 ); *nf_seed = extract_l( W_extract_l( tmp64 ) ); -#endif } ELSE { diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 2483fe95d..c26905199 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -80,13 +80,6 @@ void core_encode_openloop_fx( Word16 lsp_old_q_rf[M + 1], lsf_old_q_rf[M + 1]; (void) vad_hover_flag; (void) vad_flag_dtx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; RF_ENC_HANDLE hRF = st->hRF; @@ -553,11 +546,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_1867_replace_overflow_libenc lsf_q_d_rf[i] = shl_sat( mult_r( sub_sat( lsf_uq_rf[i], lsf_q_1st_rf[i] ), 25600 ), 5 ); -#else - lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 ); -#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*/ @@ -758,12 +747,6 @@ static void closest_centroid_rf( Word16 tmp, tmpL; Word64 werr_64; Word32 L_tmp, best_werr, werr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif ind_vec[0] = 0; move16(); @@ -778,13 +761,8 @@ static void closest_centroid_rf( tmpL = i_mult2( i, length ); FOR( j = 0; j < length; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = sub_sat( data[j], quantizer[tmpL + j] ); L_tmp = L_mult_sat( tmp, tmp ); -#else - tmp = sub_o( data[j], quantizer[tmpL + j], &Overflow ); - L_tmp = L_mult_o( tmp, tmp, &Overflow ); -#endif werr_64 = W_mac_32_16( werr_64, L_tmp, weights[j] ); } werr = W_sat_m( werr_64 ); @@ -836,12 +814,6 @@ void core_acelp_tcx20_switching_fx( Word16 snr_tcx, snr_acelp, dsnr; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; SP_MUS_CLAS_HANDLE hSpMusClas = st->hSpMusClas; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Check minimum pitch for quantization */ FOR( i = 0; i < 3; i++ ) @@ -1117,11 +1089,7 @@ void core_acelp_tcx20_switching_fx( FOR( j = 0; j < L_SUBFR; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp32 = L_mac0_sat( tmp32, st->wspeech_enc[i + j], st->wspeech_enc[i + j] ); -#else - tmp32 = L_mac0_o( tmp32, st->wspeech_enc[i + j], st->wspeech_enc[i + j], &Overflow ); -#endif } tmp32 = L_shr( BASOP_Util_Log2( tmp32 ), 9 ); /* 15Q16 */ tmp32 = L_add( tmp32, L_sub( 0x1F0000, L_shl( L_deposit_h( add( Q_new, sub( shift, 1 ) ) ), 1 ) ) ); /* wspeech_enc scaling */ @@ -1139,11 +1107,7 @@ void core_acelp_tcx20_switching_fx( tcx_snr = L_shl( Mpy_32_16_1( tcx_snr, 0x6054 ), 2 ); /* 0x6054 -> 10/log2(10) (2Q13) */ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1867_replace_overflow_libenc snr_tcx = round_fx_sat( L_shl_sat( tcx_snr, 8 ) ); /* 7Q8 */ -#else - snr_tcx = round_fx_o( L_shl_o( tcx_snr, 8, &Overflow ), &Overflow ); /* 7Q8 */ -#endif BASOP_SATURATE_WARNING_ON_EVS /*--------------------------------------------------------------* @@ -1177,19 +1141,11 @@ void core_acelp_tcx20_switching_fx( FOR( j = 0; j < L_SUBFR; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc signal = L_mac0_sat( signal, st->wspeech_enc[i + j], st->wspeech_enc[i + j] ); tmp16 = round_fx_sat( L_shl_sat( Mpy_32_16_r( gain, st->wspeech_enc[i + j - T0] ), 15 ) ); tmp16 = sub_sat( st->wspeech_enc[i + j], tmp16 ); noise = L_mac0_sat( noise, tmp16, tmp16 ); -#else - signal = L_mac0_o( signal, st->wspeech_enc[i + j], st->wspeech_enc[i + j], &Overflow ); - - tmp16 = round_fx_o( L_shl_o( Mpy_32_16_r( gain, st->wspeech_enc[i + j - T0] ), 15, &Overflow ), &Overflow ); - tmp16 = sub_o( st->wspeech_enc[i + j], tmp16, &Overflow ); - noise = L_mac0_o( noise, tmp16, tmp16, &Overflow ); -#endif } /* Assume always 4 sub frames. */ /*assert( (st->L_frame / L_SUBFR) == 4);*/ @@ -1242,11 +1198,7 @@ void core_acelp_tcx20_switching_fx( test(); if ( ( GT_16( snr_acelp, snr_tcx ) ) && ( LT_16( snr_acelp, add( snr_tcx, 512 /*2.0f Q8*/ ) ) ) && -#ifdef ISSUE_1867_replace_overflow_libenc ( LT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 416 /*3.25f Q7*/ ) || EQ_16( stab_fac, 0x7fff /*1 Q15*/ ) || -#else - ( LT_16( add_o( st->prevTempFlatness_fx, currFlatness, &Overflow ), 416 /*3.25f Q7*/ ) || EQ_16( stab_fac, 0x7fff /*1 Q15*/ ) || -#endif ( EQ_32( st->sr_core, INT_FS_12k8 ) && EQ_16( st->sp_aud_decision0, 1 ) && LT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 2560 /*20.f Q7*/ ) ) ) && ( LE_16( st->acelpFramesCount, 6 ) ) ) { diff --git a/lib_enc/corr_xh_fx.c b/lib_enc/corr_xh_fx.c index 135d560d1..21af7bc0a 100644 --- a/lib_enc/corr_xh_fx.c +++ b/lib_enc/corr_xh_fx.c @@ -31,12 +31,6 @@ void corr_xh_fx( { Word16 i, j, k; Word32 L_tmp, y32[L_SUBFR], L_maxloc, L_tot; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /* first keep the result on 32 bits and find absolute maximum */ L_tot = L_deposit_l( 1 ); @@ -49,11 +43,7 @@ void corr_xh_fx( L_tmp = L_mac( 1L, x[i], h[0] ); /* 1 -> to avoid null dn[] Qx+15*/ FOR( j = i; j < L_SUBFR - 1; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, x[j + 1], h[j + 1 - i] ); /*Qx+15*/ -#else - L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); /*Qx+15*/ -#endif } y32[i] = L_tmp; /*Qx+15*/ @@ -63,13 +53,8 @@ void corr_xh_fx( } /* tot += 3*max / 8 */ L_maxloc = L_shr( L_maxloc, 2 ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tot = L_add_sat( L_tot, L_maxloc ); /* +max/4 */ L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */ -#else - L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */ - L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */ -#endif } /* Find the number of right shifts to do on y32[] so that */ @@ -93,12 +78,6 @@ void corr_hh_ivas_fx( { Word16 i, j, k; Word32 L_tmp, y32[L_SUBFR * 2], L_maxloc, L_tot; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /* first keep the result on 32 bits and find absolute maximum */ L_tot = L_deposit_l( 1 ); @@ -111,11 +90,7 @@ void corr_hh_ivas_fx( L_tmp = L_mac( 1L, shr( h[i], 3 ), shr( h[0], 3 ) ); /* 1 -> to avoid null dn[] */ // 2*(15 - norm_s(h[0]) -3) - 1 FOR( j = i; j < L_subfr - 1; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, shr( h[j + 1], 3 ), shr( h[j + 1 - i], 3 ) ); // 2*(15 - norm_s(h[0]) -3) - 1 //?sat -#else - L_tmp = L_mac_o( L_tmp, shr( h[j + 1], 3 ), shr( h[j + 1 - i], 3 ), &Overflow ); // 2*(15 - norm_s(h[0]) -3) - 1 -#endif } y32[i] = L_tmp; // 2*(15 - norm_s(h[0]) -3) - 1 @@ -125,13 +100,8 @@ void corr_hh_ivas_fx( } /* tot += 3*max / 8 */ L_maxloc = L_shr( L_maxloc, 2 ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tot = L_add_sat( L_tot, L_maxloc ); /* +max/4 */ L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */ -#else - L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */ - L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */ -#endif } /* Find the number of right shifts to do on y32[] so that */ @@ -161,12 +131,6 @@ void corr_xh_ivas_fx( { Word16 i, j, k; Word32 L_tmp, y32[L_SUBFR * 2], L_maxloc, L_tot; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /* first keep the result on 32 bits and find absolute maximum */ L_tot = L_deposit_l( 0 ); @@ -179,11 +143,7 @@ void corr_xh_ivas_fx( L_tmp = L_mac( 0, x[i], h[0] ); // Qx+(14 - norm_s(h[0])) + 1 FOR( j = i; j < L_subfr - 1; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, x[j + 1], h[j + 1 - i] ); // Qx+(14 - norm_s(h[0])) + 1 -#else - L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); // Qx+(14 - norm_s(h[0])) + 1 -#endif } y32[i] = L_tmp; // Qx+(14 - norm_s(h[0])) + 1 @@ -193,13 +153,8 @@ void corr_xh_ivas_fx( } /* tot += 3*max / 8 */ L_maxloc = L_shr( L_maxloc, 2 ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tot = L_add_sat( L_tot, L_maxloc ); /* +max/4 */ L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */ -#else - L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */ - L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */ -#endif } /* Find the number of right shifts to do on y32[] so that */ diff --git a/lib_enc/detect_transient_fx.c b/lib_enc/detect_transient_fx.c index 8a9562704..14a6d6c80 100644 --- a/lib_enc/detect_transient_fx.c +++ b/lib_enc/detect_transient_fx.c @@ -62,41 +62,28 @@ static void hp_filter_fx( { Word16 i; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /*y[0] = 0.4931f * *oldy + 0.7466f*(x[0] - *oldx); */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mult( sub_sat( x[0], *oldx ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */ -#else - L_tmp = L_mult( sub_o( x[0], *oldx, &Overflow ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */ -#endif - L_tmp = L_mac_sat( L_tmp, *oldy, 16158 /*0.4931f in Q15*/ ); /*Q_new+16 */ - y[0] = round_fx_sat( L_tmp ); /*Q_new */ + L_tmp = L_mac_sat( L_tmp, *oldy, 16158 /*0.4931f in Q15*/ ); /*Q_new+16 */ + y[0] = round_fx_sat( L_tmp ); /*Q_new */ FOR( i = 1; i < L; i++ ) { /*y[i] = 0.4931f*y[i-1] + 0.7466f*(x[i] - x[i-1]); */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mult( sub_sat( x[i], x[i - 1] ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */ L_tmp = L_mac_sat( L_tmp, y[i - 1], 16158 /*0.4931f in Q15*/ ); /*Q_new+16 */ y[i] = round_fx_sat( L_tmp ); /*Q_new */ -#else - L_tmp = L_mult( sub_o( x[i], x[i - 1], &Overflow ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */ - L_tmp = L_mac_o( L_tmp, y[i - 1], 16158 /*0.4931f in Q15*/, &Overflow ); /*Q_new+16 */ - y[i] = round_fx_o( L_tmp, &Overflow ); /*Q_new */ -#endif } *oldx = x[L - 1]; move16(); /*Q_new */ *oldy = y[L - 1]; move16(); /*Q_new */ + + return; } + + /*--------------------------------------------------------------------------*/ /* Function detect_transient */ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -129,11 +116,9 @@ Word16 detect_transient_fx( Word32 E_low_fx, E_high_fx; Word16 temp16, Thres_fx = 0; Word16 exp; -#ifdef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); -#endif #endif shift = 0; @@ -165,11 +150,7 @@ Word16 detect_transient_fx( FOR( i = 0; i < L / 4; i++ ) { /*EnergyLT += out_filt[i] * out_filt[i]; */ -#ifdef ISSUE_1867_replace_overflow_libenc EnergyLT = L_mac0_sat( EnergyLT, out_filt_fx[i], out_filt_fx[i] ); /*2Q_new */ -#else - EnergyLT = L_mac0_o( EnergyLT, out_filt_fx[i], out_filt_fx[i], &Overflow ); /*2Q_new */ -#endif } } ELSE @@ -188,27 +169,14 @@ Word16 detect_transient_fx( FOR( i = 0; i < L / 4; i++ ) { temp16 = extract_l( L_shr( out_filt_fx[i + blk * ( L / 4 )], 12 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc Energy_fx = L_add_sat( Energy_fx, L_mult0( temp16, temp16 ) ); -#else - Energy_fx = L_add_o( Energy_fx, L_mult0( temp16, temp16 ), &Overflow ); -#endif - temp16 = shr( in_fx[i + blk * ( L / 4 )], Q_new ); /*Q0*/ -#ifdef ISSUE_1867_replace_overflow_libenc + temp16 = shr( in_fx[i + blk * ( L / 4 )], Q_new ); /*Q0*/ Energy_in_fx[blk + 1] = L_add_sat( Energy_in_fx[blk + 1], L_mult0( temp16, temp16 ) ); /*Q0*/ -#else - Energy_in_fx[blk + 1] = L_add_o( Energy_in_fx[blk + 1], L_mult0( temp16, temp16 ), &Overflow ); /*Q0*/ -#endif move32(); } -#ifdef ISSUE_1867_replace_overflow_libenc E_in_fx = L_add_sat( E_in_fx, Energy_in_fx[blk + 1] ); /*Q0*/ E_out_fx = L_add_sat( E_out_fx, Energy_fx ); /*Q0*/ -#else - E_in_fx = L_add_o( E_in_fx, Energy_in_fx[blk + 1], &Overflow ); /*Q0*/ - E_out_fx = L_add_o( E_out_fx, Energy_fx, &Overflow ); /*Q0*/ -#endif Thres_fx = 2185; /*1 /15 Q15*/ move16(); @@ -232,21 +200,13 @@ Word16 detect_transient_fx( FOR( i = 0; i < L / 8; i++ ) { /*Energy += out_filt_fx[i + blk*(L/4)] * out_filt_fx[i + blk*(L/4)]; */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )] ); /*2Q_new */ -#else - L_tmp = L_mac0_o( L_tmp, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )], &Overflow ); /*2Q_new */ -#endif } L_tmp2 = L_deposit_l( 0 ); FOR( ; i < L / 4; i++ ) { /*Energy += out_filt_fx[i + blk*(L/4)] * out_filt_fx[i + blk*(L/4)]; */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp2 = L_mac0_sat( L_tmp2, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )] ); /*2Q_new */ -#else - L_tmp2 = L_mac0_o( L_tmp2, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )], &Overflow ); /*2Q_new */ -#endif } Overflow = 0; move16(); @@ -257,14 +217,7 @@ Word16 detect_transient_fx( shift = 1; move16(); } -#ifndef ISSUE_1867_replace_overflow_libenc - Overflow = 0; - move16(); - - Energy = L_add_o( L_shr( L_tmp, shift ), L_shr( L_tmp2, shift ), &Overflow ); /*2Q_new - shift*/ -#else - Energy = L_add_sat( L_shr( L_tmp, shift ), L_shr( L_tmp2, shift ) ); /*2Q_new - shift*/ -#endif + Energy = L_add_sat( L_shr( L_tmp, shift ), L_shr( L_tmp2, shift ) ); /*2Q_new - shift*/ test(); IF( EQ_16( st_fx->extl, SWB_BWE ) || EQ_16( st_fx->extl, FB_BWE ) ) { @@ -305,11 +258,7 @@ Word16 detect_transient_fx( } /*EnergyLT = 0.75f*EnergyLT + 0.25f*Energy; */ /*0.75f*EnergyLT in Q0 //0.25f*Energy in Q0 */ -#ifdef ISSUE_1867_replace_overflow_libenc EnergyLT = L_add_sat( Mult_32_16( EnergyLT, 24576 /*0.75f in Q15*/ ), Mult_32_16( Energy, shl( 8192 /*0.25 in Q15*/, shift ) ) ); /*2Q_new */ -#else - EnergyLT = L_add_o( Mult_32_16( EnergyLT, 24576 /*0.75f in Q15*/ ), Mult_32_16( Energy, shl( 8192 /*0.25 in Q15*/, shift ) ), &Overflow ); /*2Q_new */ -#endif } } st_fx->EnergyLT_fx = EnergyLT; diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 10ec0dd8b..fa9da7f42 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -78,12 +78,6 @@ void dtx_ivas_fx( TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; Word16 last_br_cng_flag, last_br_flag, br_dtx_flag; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word32 total_brate_ref; total_brate_ref = st_fx->total_brate; @@ -467,11 +461,7 @@ void dtx_ivas_fx( speech++; FOR( i = 1; i < L_FRAME / 16; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, *speech, *speech ); /*2*Q_speech*/ -#else - L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/ -#endif speech++; } hDtxEnc->frame_ener_fx = L_add( hDtxEnc->frame_ener_fx, L_shr( L_tmp, Q_speech2 ) ); /* Q(-7) */ @@ -641,12 +631,6 @@ void dtx_fx( TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; Word16 last_br_cng_flag, last_br_flag, br_dtx_flag; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif IF( st_fx->dtx_sce_sba != 0 ) { @@ -943,11 +927,7 @@ void dtx_fx( speech++; FOR( i = 1; i < L_FRAME / 16; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, *speech, *speech ); /*2*Q_speech*/ -#else - L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/ -#endif speech++; } hDtxEnc->frame_ener_fx = L_add( hDtxEnc->frame_ener_fx, L_shr( L_tmp, Q_speech2 ) ); /*Q(-7) */ @@ -1252,11 +1232,6 @@ void dtx_hangover_control_fx( VAD_HANDLE hVAD = st_fx->hVAD; DTX_ENC_HANDLE hDtxEnc = st_fx->hDtxEnc; TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* get current frame exc energy in log2 */ exp = norm_l( hTdCngEnc->ho_ener_circ_fx[hTdCngEnc->ho_circ_ptr] ); @@ -1425,11 +1400,7 @@ void dtx_hangover_control_fx( move16(); FOR( j = 0; j < m; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc lsp_est[i] = add_sat( lsp_est[i], tmp[j * M + i] ); /*Q15 */ -#else - lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */ -#endif } lsp_est[i] = sub( lsp_est[i], tmp[max_idx[0] * M + i] ); /*Q15 */ @@ -1445,20 +1416,12 @@ void dtx_hangover_control_fx( move16(); FOR( j = 0; j < m; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc lsp_est[i] = add_sat( lsp_est[i], tmp[j * M + i] ); /*Q15 */ -#else - lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */ -#endif } -#ifdef ISSUE_1867_replace_overflow_libenc lsp_est[i] = sub_sat( lsp_est[i], add_sat( tmp[max_idx[0] * M + i], tmp[max_idx[1] * M + i] ) ); /*Q15 */ -#else - lsp_est[i] = sub_o( lsp_est[i], add_o( tmp[max_idx[0] * M + i], tmp[max_idx[1] * M + i], &Overflow ), &Overflow ); /*Q15 */ -#endif - S_tmp = div_s( 1, sub( m, 2 ) ); /*Q15 */ - lsp_est[i] = mult_r( lsp_est[i], S_tmp ); /*Q15 */ + S_tmp = div_s( 1, sub( m, 2 ) ); /*Q15 */ + lsp_est[i] = mult_r( lsp_est[i], S_tmp ); /*Q15 */ } } @@ -1466,11 +1429,7 @@ void dtx_hangover_control_fx( move16(); FOR( i = 0; i < M; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc - Dlsp_n2e = add_sat( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ) ); /*Q15 */ -#else - Dlsp_n2e = add_o( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ), &Overflow ); /*Q15 */ -#endif + Dlsp_n2e = add_sat( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ) ); /*Q15 */ lsp_est[i] = add( mult_r( 26214, lsp_est[i] ), mult_r( 6554, lsp_new_fx[i] ) ); /*Q15 */ } @@ -1483,11 +1442,7 @@ void dtx_hangover_control_fx( FOR( i = 0; i < M; i++ ) { S_tmp = abs_s( sub( hDtxEnc->lspCNG_fx[i], lsp_est[i] ) ); /*Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Dlsp = add_sat( Dlsp, S_tmp ); /*Q15 */ -#else - Dlsp = add_o( Dlsp, S_tmp, &Overflow ); /*Q15 */ -#endif + Dlsp = add_sat( Dlsp, S_tmp ); /*Q15 */ IF( GT_16( S_tmp, S_max ) ) { S_max = S_tmp; /*Q15 */ diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 16d4bd260..af0ecd986 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -65,12 +65,6 @@ void E_ACELP_h_vec_corr1_fx( Word16 *dn2; Word16 *p0, *p1, *p2; Word32 L_sum; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif dn2 = &dn2_pos[( track * 8 )]; /*Q0*/ p0 = rrixix[track]; /*Q9*/ @@ -84,41 +78,26 @@ void E_ACELP_h_vec_corr1_fx( p2 = &vec[dn]; /*Qx*/ FOR( j = dn; j < L_SUBFR - 1; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_sum = L_mac_sat( L_sum, *p1++, *p2++ ); /*2*Qx+1*/ -#else - L_sum = L_mac_o( L_sum, *p1++, *p2++, &Overflow ); /*2*Qx+1*/ -#endif } -#ifdef ISSUE_1867_replace_overflow_libenc corr = mac_r_sat( L_sum, *p1++, *p2++ ); /*Q9*/ -#else - corr = mac_ro( L_sum, *p1++, *p2++, &Overflow ); /*Q9*/ -#endif /*cor[dn >> 2] = sign[dn] * s + p0[dn >> 2];*/ j = shr( dn, 2 ); if ( sign[dn] > 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc corr = add_sat( p0[j], corr ); /*Q9*/ -#else - corr = add_o( p0[j], corr, &Overflow ); /*Q9*/ -#endif } if ( sign[dn] < 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc corr = sub_sat( p0[j], corr ); /*Q9*/ -#else - corr = sub_o( p0[j], corr, &Overflow ); /*Q9*/ -#endif } cor[j] = corr; /*Q9*/ move16(); } + return; } @@ -134,12 +113,6 @@ void E_ACELP_h_vec_corr2_fx( Word16 i, j, pos, corr; Word16 *p0, *p1, *p2; Word32 L_sum; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif p0 = rrixix[track]; /*Q9*/ @@ -152,21 +125,12 @@ void E_ACELP_h_vec_corr2_fx( p2 = &vec[pos]; /*Qx*/ FOR( j = pos; j < L_SUBFR - 1; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_sum = L_mac_sat( L_sum, *p1++, *p2++ ); /* 2*Qx+1 */ -#else - L_sum = L_mac_o( L_sum, *p1++, *p2++, &Overflow ); /* 2*Qx+1 */ -#endif } -#ifdef ISSUE_1867_replace_overflow_libenc corr = mac_r_sat( L_sum, *p1++, *p2++ ); /*Q9*/ -#else - corr = mac_ro( L_sum, *p1++, *p2++, &Overflow ); /*Q9*/ -#endif /*cor[i] = s * sign[track] + p0[i];*/ -#ifdef ISSUE_1867_replace_overflow_libenc if ( sign[pos] > 0 ) { corr = add_sat( *p0++, corr ); /*Q9*/ @@ -175,21 +139,12 @@ void E_ACELP_h_vec_corr2_fx( { corr = sub_sat( *p0++, corr ); /*Q9*/ } -#else - if ( sign[pos] > 0 ) - { - corr = add_o( *p0++, corr, &Overflow ); /*Q9*/ - } - if ( sign[pos] < 0 ) - { - corr = sub_o( *p0++, corr, &Overflow ); /*Q9*/ - } -#endif cor[i] = corr; /*Q9*/ move16(); pos = add( pos, 4 ); } + return; } @@ -239,14 +194,6 @@ static void E_ACELP_2pulse_search( Word32 xy_save; Word16 check = 0; /* debug code not instrumented */ -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - - /* eight dn2 max positions per track */ /*pos_x = &dn2[track_x << 3]; SHIFT(1); PTR_INIT(1);*/ pos_x = &dn2[( track_x * 8 )]; /*Qdn*/ @@ -262,11 +209,7 @@ static void E_ACELP_2pulse_search( sqk[0] = -1; move16(); x2 = shr( pos_x[0], 2 ); /*Qdn*/ -#ifdef ISSUE_1867_replace_overflow_libenc if ( mac_r_sat( L_mac_sat( L_mac_sat( alp0, cor_x[x2], _1_ ), cor_y[0], _1_ ), rrixiy[track_x][( x2 * 16 )], _1_ ) < 0 ) -#else - if ( mac_ro( L_mac_o( L_mac_o( alp0, cor_x[x2], _1_, &Overflow ), cor_y[0], _1_, &Overflow ), rrixiy[track_x][( x2 * 16 )], _1_, &Overflow ) < 0 ) -#endif { sqk[0] = 1; move16(); @@ -286,11 +229,7 @@ static void E_ACELP_2pulse_search( ps1 = add( ps0, dn[x] ); /*Qdn*/ /*alp1 = alp0 + cor_x[x2];*/ -#ifdef ISSUE_1867_replace_overflow_libenc alp1 = L_mac_sat( alp0, cor_x[x2], _1_ ); /*Q22*/ -#else - alp1 = L_mac_o( alp0, cor_x[x2], _1_, &Overflow ); /*Q22*/ -#endif p1 = cor_y; /*Qx*/ p2 = &rrixiy[track_x][( x2 * 16 )]; /*Q9*/ @@ -302,14 +241,9 @@ static void E_ACELP_2pulse_search( move16(); /*alp2 = alp1 + (*p1++) + (*p2++);*/ -#ifdef ISSUE_1867_replace_overflow_libenc alp2 = L_mac_sat( alp1, *p1++, _1_ ); /*Qx+12+1*/ alp2_16 = mac_r_sat( alp2, *p2++, _1_ ); /*Q6*/ -#else - alp2 = L_mac_o( alp1, *p1++, _1_, &Overflow ); /*Qx+12+1*/ - alp2_16 = mac_ro( alp2, *p2++, _1_, &Overflow ); /*Q6*/ -#endif - alpk[1 - ik] = alp2_16; /*Q6*/ + alpk[1 - ik] = alp2_16; /*Q6*/ move16(); /*sq = ps2 * ps2;*/ @@ -348,6 +282,7 @@ static void E_ACELP_2pulse_search( *alp = alpk[ik]; /*Q6*/ move16(); + return; } @@ -458,6 +393,7 @@ static void E_ACELP_1pulse_search( move16(); *ix = x_save; /*Q0*/ move16(); + return; } @@ -618,29 +554,16 @@ Word16 E_ACELP_xy1_corr_fx( Word16 i, Q_xn; Word16 xy, yy, exp_xy, exp_yy, gain; Word32 L_off; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif L_off = L_shr( 10737418l /*0.01f/2.0f Q31*/, s_min( add( exp_xn, exp_xn ), 31 ) ); L_off = L_max( 1, L_off ); /* ensure at least a '1' */ /* Compute scalar product t1: */ -#ifdef ISSUE_1867_replace_overflow_libenc yy = round_fx_sat( Dot_product15_offs( y1, y1, L_subfr, &exp_yy, L_off ) ); /*Q15 - exp_yy*/ -#else - yy = round_fx_o( Dot_product15_offs( y1, y1, L_subfr, &exp_yy, L_off ), &Overflow ); /*Q15 - exp_yy*/ -#endif /* Compute scalar product t0: */ -#ifdef ISSUE_1867_replace_overflow_libenc xy = round_fx_sat( Dot_product12_offs( xn, y1, L_subfr, &exp_xy, L_off ) ); /*Q15 - exp_xy*/ -#else - xy = round_fx_o( Dot_product12_offs( xn, y1, L_subfr, &exp_xy, L_off ), &Overflow ); /*Q15 - exp_xy*/ -#endif + /* Compute doubled format out of the exponent */ Q_xn = shl( sub( 15, exp_xn ), 1 ); g_corr->y1y1 = yy; @@ -682,11 +605,7 @@ Word16 E_ACELP_xy1_corr_fx( Word16 tmp, exp_tmp, exp_div; /* Compute scalar product */ -#ifdef ISSUE_1867_replace_overflow_libenc tmp = round_fx_sat( Dot_product12_offs( xn, xn, L_subfr, &exp_tmp, 1 ) ); /*Q15 - exp_tmp*/ -#else - tmp = round_fx_o( Dot_product12_offs( xn, xn, L_subfr, &exp_tmp, 1 ), &Overflow ); /*Q15 - exp_tmp*/ -#endif /* gain_p_snr = sqrt(/) */ tmp = BASOP_Util_Divide1616_Scale( tmp, yy, &exp_div ); exp_tmp = add( sub( exp_tmp, exp_yy ), exp_div ); @@ -696,11 +615,7 @@ Word16 E_ACELP_xy1_corr_fx( /* Note: shl works as shl or shr. */ exp_tmp = sub( exp_tmp, 1 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1867_replace_overflow_libenc tmp = round_fx_sat( L_shl_sat( Mpy_32_16_1( 1717986944l /*ACELP_GAINS_CONST Q31*/, tmp ), exp_tmp ) ); /*Q14*/ -#else - tmp = round_fx_o( L_shl_o( Mpy_32_16_1( 1717986944l /*ACELP_GAINS_CONST Q31*/, tmp ), exp_tmp, &Overflow ), &Overflow ); /*Q14*/ -#endif BASOP_SATURATE_WARNING_ON_EVS gain = s_min( gain, tmp ); /*Q14*/ @@ -708,7 +623,6 @@ Word16 E_ACELP_xy1_corr_fx( bail: - return ( gain ); } @@ -808,12 +722,6 @@ void E_ACELP_codebook_target_update_fx( { Word16 i, Q15_flag; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif assert( gain >= 0 ); Q15_flag = 0; @@ -830,19 +738,13 @@ void E_ACELP_codebook_target_update_fx( L_tmp = L_deposit_h( x[i] ); /*Q_xn+16*/ if ( Q15_flag == 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, y[i], gain ); /*Q_xn+15*/ -#else - L_tmp = L_msu_o( L_tmp, y[i], gain, &Overflow ); /*Q_xn+15*/ -#endif } -#ifdef ISSUE_1867_replace_overflow_libenc x2[i] = msu_r_sat( L_tmp, y[i], gain ); /*Q_xn*/ -#else - x2[i] = msu_ro( L_tmp, y[i], gain, &Overflow ); /*Q_xn*/ -#endif move16(); } + + return; } @@ -882,13 +784,6 @@ void E_ACELP_pulsesign( Word16 signs[3]; Word16 *ptr16; Word16 val, index; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* calculate energy for normalization of cn[] and dn[] */ Lval = L_mac0( 1, cn[0], cn[0] ); /*2*Q_xn*/ @@ -896,12 +791,8 @@ void E_ACELP_pulsesign( FOR( i = 1; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Lval = L_mac0_sat( Lval, cn[i], cn[i] ); /*2*Q_xn*/ -#else - Lval = L_mac0_o( Lval, cn[i], cn[i], &Overflow ); /*2*Q_xn*/ -#endif - Lcor = L_mac0( Lcor, dn[i], dn[i] ); /*2*Qdn*/ + Lcor = L_mac0( Lcor, dn[i], dn[i] ); /*2*Qdn*/ } e_dn = 31; @@ -917,13 +808,8 @@ void E_ACELP_pulsesign( if ( i > 0 ) Lcor = L_shr( Lcor, i ); -#ifdef ISSUE_1867_replace_overflow_libenc k_dn = round_fx_sat( Lval ); /*Q15 - e_dn*/ k_cn = round_fx_sat( Lcor ); /*Q15 - e_cn*/ -#else - k_dn = round_fx_o( Lval, &Overflow ); /*Q15 - e_dn*/ - k_cn = round_fx_o( Lcor, &Overflow ); /*Q15 - e_cn*/ -#endif k_cn = mult_r( 0x2000, k_cn ); /* 1 in Q13 */ k_dn = mult_r( alp, k_dn ); /* alp in Q13 */ @@ -941,13 +827,9 @@ void E_ACELP_pulsesign( FOR( i = 0; i < L_subfr; i++ ) { /*cor = (s * cn[i]) + (alp * dn[i]); MULT(1);MAC(1);*/ - Lcor = L_mult( cn[i], k_cn ); /*Q_xn + Q15 - e_cn + 1*/ - Lcor = L_mac( Lcor, dn[i], k_dn ); /*Qdn + Q15 - e_dn + 1*/ -#ifdef ISSUE_1867_replace_overflow_libenc + Lcor = L_mult( cn[i], k_cn ); /*Q_xn + Q15 - e_cn + 1*/ + Lcor = L_mac( Lcor, dn[i], k_dn ); /*Qdn + Q15 - e_dn + 1*/ val = round_fx_sat( L_shl_sat( Lcor, 4 ) ); /*shifting by 4 may overflow but improves accuracy Qdn + 4 - e_dn*/ -#else - val = round_fx_o( L_shl_o( Lcor, 4, &Overflow ), &Overflow ); /*shifting by 4 may overflow but improves accuracy Qdn + 4 - e_dn*/ -#endif index = shr( val, 15 ); sign[i] = ptr16[index]; /*Q15*/ @@ -1268,12 +1150,6 @@ void E_ACELP_4tsearch_fx( Word32 s, L_tmp; Word16 nb_pulse, nb_pulse_m2; Word16 check = 0; /* debug code not instrumented */ -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif alp = config->alp; /* Q13 */ /* initial value for energy of all fixed pulses */ move16(); @@ -1311,11 +1187,7 @@ void E_ACELP_4tsearch_fx( BASOP_SATURATE_WARNING_OFF_EVS FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, H[i], H[i] ); /*Q25*/ -#else - L_tmp = L_mac_o( L_tmp, H[i], H[i], &Overflow ); /*Q25*/ -#endif } val = extract_h( L_tmp ); /*Q9*/ BASOP_SATURATE_WARNING_ON_EVS @@ -1463,13 +1335,8 @@ void E_ACELP_4tsearch_fx( L_tmp = L_mult( vec[0], vec[0] ); /*Q25+2*scale*/ FOR( i = 1; i < L_SUBFR; i++ ) -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q25+2*scale*/ -#else - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q25+2*scale*/ -#endif - - alp = round_fx( L_shr( L_tmp, 3 ) ); /*Q6+2*scale*/ + alp = round_fx( L_shr( L_tmp, 3 ) ); /*Q6+2*scale*/ /*alp *= 0.5F; */ } @@ -1524,11 +1391,7 @@ void E_ACELP_4tsearch_fx( FOR( i = 0; i < L_SUBFR; i++ ) { tmp = add( *p0++, *p1++ ); -#ifdef ISSUE_1867_replace_overflow_libenc vec[i] = add_sat( vec[i], tmp ); /* can saturate here. */ -#else - vec[i] = add_o( vec[i], tmp, &Overflow ); /* can saturate here. */ -#endif move16(); } } @@ -1578,16 +1441,14 @@ void E_ACELP_4tsearch_fx( } FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc y[i] = add_sat( y[i], *p0++ ); /*Q12+scale*/ -#else - y[i] = add_o( y[i], *p0++, &Overflow ); /*Q12+scale*/ -#endif move16(); } } return; } + + /* * E_ACELP_4t_fx * @@ -2149,19 +2010,7 @@ static void E_ACELP_codearithp_fx( { Word16 k, nb_pulse, i, t, pos[NPMAXPT], posno; Word16 sign, m; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - UWord32 s; -#else UWord64 W_s; -#endif -#ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; -#endif - move32(); - move32(); -#endif /* Collect different pulse positions to pos[], number of them to posno */ posno = 0; @@ -2184,11 +2033,7 @@ static void E_ACELP_codearithp_fx( } /* Iterate over the different pulse positions */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - s = L_deposit_l( 0 ); -#else W_s = 0; -#endif t = 0; move16(); nb_pulse = 0; @@ -2201,15 +2046,7 @@ static void E_ACELP_codearithp_fx( /* Code m-1 pulses */ FOR( i = 1; i < m; ++i ) { -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Carry = 0; -#endif - move32(); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - s = L_add_co( s, pulsestostates[pos[k]][t], &Carry, &Overflow ); -#else W_s = W_add( W_s, pulsestostates[pos[k]][t] ); -#endif t = add( t, 1 ); if ( sub( t, NPMAXPT ) > 0 ) { @@ -2220,42 +2057,18 @@ static void E_ACELP_codearithp_fx( /* Code sign */ /* We use L_add_c since we want to work with unsigned UWord32 */ /* Therefore, we have to clear carry */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Carry = 0; -#endif - move32(); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - s = L_lshl( s, 1 ); -#else W_s = W_lshl( W_s, 1 ); -#endif if ( sign < 0 ) { -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - s = L_add_co( s, 1, &Carry, &Overflow ); -#else W_s = W_add( W_s, 1 ); -#endif } /* Code last pulse */ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Carry = 0; -#endif - move32(); -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - s = L_add_co( s, pulsestostates[pos[k]][t], &Carry, &Overflow ); -#else W_s = W_add( W_s, pulsestostates[pos[k]][t] ); -#endif t = add( t, 1 ); } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - *ps = s; /*Q0*/ -#else *ps = (UWord32) W_s; /*Q0*/ -#endif move32(); *n = L_deposit_l( 0 ); if ( nb_pulse ) diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index cd06a4d15..12428bbb4 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -139,12 +139,6 @@ static void E_ACELP_2pulse_searchx_fx( Word32 alp0, alp1, alp2, s; Word16 *pR, sgnx; Word16 sqk[2], alpk[2], ik; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* eight dn2 max positions per track */ pos_x = &dn2[( track_x * 8 )]; /*Qdn*/ @@ -169,11 +163,7 @@ static void E_ACELP_2pulse_searchx_fx( { sgnx = negate( sgnx ); } -#ifdef ISSUE_1867_replace_overflow_libenc if ( mac_r_sat( L_mac_sat( L_mac_sat( alp0, cor[x], sign[x] ), cor[track_y], sign[track_y] ), R[track_y - x], sgnx ) < 0 ) -#else - if ( mac_ro( L_mac_o( L_mac_o( alp0, cor[x], sign[x], &Overflow ), cor[track_y], sign[track_y], &Overflow ), R[track_y - x], sgnx, &Overflow ) < 0 ) -#endif { sqk[0] = 1; move16(); @@ -192,14 +182,10 @@ static void E_ACELP_2pulse_searchx_fx( move16(); /* dn[x] has only nb_pos_ix positions saved */ /*ps1 = ps0 + dn[x]; INDIRECT(1);ADD(1);*/ - ps1 = add_sat( ps0, dn[x] ); /*Qdn*/ - /*alp1 = alp0 + 2*sgnx*cor[x]; INDIRECT(1);MULT(1); MAC(1);*/ -#ifdef ISSUE_1867_replace_overflow_libenc + ps1 = add_sat( ps0, dn[x] ); /*Qdn*/ + /*alp1 = alp0 + 2*sgnx*cor[x]; INDIRECT(1);MULT(1); MAC(1);*/ alp1 = L_mac_sat( alp0, cor[x], sgnx ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#else - alp1 = L_mac_o( alp0, cor[x], sgnx, &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#endif - pR = R - x; /*Q9+scale*/ + pR = R - x; /*Q9+scale*/ FOR( y = track_y; y < L_SUBFR; y += 4 ) { @@ -213,26 +199,14 @@ static void E_ACELP_2pulse_searchx_fx( assert( sgnx != 0 ); alp2_16 = 0; -#ifdef ISSUE_1867_replace_overflow_libenc alp2 = L_mac_sat( alp1, cor[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#else - alp2 = L_mac_o( alp1, cor[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#endif if ( sgnx > 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc alp2_16 = mac_r_sat( alp2, pR[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#else - alp2_16 = mac_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#endif } if ( sgnx < 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc alp2_16 = msu_r_sat( alp2, pR[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#else - alp2_16 = msu_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#endif } alpk[1 - ik] = alp2_16; /* Qalp */ move16(); @@ -242,13 +216,8 @@ static void E_ACELP_2pulse_searchx_fx( sqk[1 - ik] = sq; /* Q9 */ move16(); - /*s = (alpk * sq) - (sqk * alp2); MULT(1);MAC(1);*/ -#ifdef ISSUE_1867_replace_overflow_libenc s = L_msu_sat( L_mult( alpk[ik], sq ), sqk[ik], alp2_16 ); /* Q_sq = Q_sqk, Q_alpk = Q_alp */ -#else - s = L_msu_o( L_mult( alpk[ik], sq ), sqk[ik], alp2_16, &Overflow ); /* Q_sq = Q_sqk, Q_alpk = Q_alp */ -#endif if ( s > 0 ) { ik = sub( 1, ik ); @@ -306,12 +275,7 @@ static void E_ACELP_1pulse_searchx_fx( Word16 ntracks, t; Word16 sqk[2], alpk[2], ik; move16(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /* save these to limit memory searches */ /*alp0 = *alp + R[0]; INDIRECT(1);*/ ps0 = *ps; /* Qdn */ @@ -326,11 +290,7 @@ static void E_ACELP_1pulse_searchx_fx( sqk[0] = -1; ik = 0; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( mac_r_sat( alp0, cor[tracks[0]], sign[tracks[0]] ) < 0 ) -#else - if ( mac_ro( alp0, cor[tracks[0]], sign[tracks[0]], &Overflow ) < 0 ) -#endif { sqk[0] = 1; move16(); @@ -354,26 +314,17 @@ static void E_ACELP_1pulse_searchx_fx( ps1 = add( ps0, dn[x] ); /* alp1 = alp0 + 2*sign[x]*cor[x]; MAC(1); MULT(1);*/ assert( sign[x] == sign_val_1 << 1 || sign[x] == -( sign_val_1 << 1 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc alp1 = mac_r_sat( alp0, cor[x], sign[x] ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#else - alp1 = mac_ro( alp0, cor[x], sign[x], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#endif - alpk[1 - ik] = alp1; /* Qalp */ + alpk[1 - ik] = alp1; /* Qalp */ move16(); - /*sq = ps1 * ps1; MULT(1);*/ sq = mult_r( ps1, ps1 ); /* 6Q9 */ sqk[1 - ik] = sq; /* Q9 */ move16(); /*s = (alpk[ik] * sq) - (sqk[ik] * alp1); MULT(1);MAC(1);*/ -#ifdef ISSUE_1867_replace_overflow_libenc s = L_msu_sat( L_mult_sat( alpk[ik], sq ), sqk[ik], alp1 ); /* Q9+Qalp+1 */ -#else - s = L_msu_o( L_mult_o( alpk[ik], sq, &Overflow ), sqk[ik], alp1, &Overflow ); /* Q9+Qalp+1 */ -#endif if ( s > 0 ) { ik = sub( 1, ik ); diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c index 530eb4a40..2bbb7d154 100644 --- a/lib_enc/enc_amr_wb_fx.c +++ b/lib_enc/enc_amr_wb_fx.c @@ -65,12 +65,6 @@ void encod_amr_wb_fx( AMRWB_IO_ENC_HANDLE hAmrwb_IO = st->hAmrwb_IO; BSTR_ENC_HANDLE hBstr = st->hBstr; LPD_state_HANDLE hLPDmem = st->hLPDmem; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*------------------------------------------------------------------* * Initializations @@ -193,23 +187,14 @@ void encod_amr_wb_fx( &gain_inov, &norm_gain_code, g_corr, clip_gain, hAmrwb_IO->past_qua_en_fx ); gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); /*Q0*/ -#else - Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_o( Lgcode, &Overflow ); /*Q0*/ -#endif hLPDmem->tilt_code = Est_tilt2( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, shift ); /*Q15*/ FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc exc2[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult( gain_pit, exc[i + i_subfr] ), 1 ) ); /*Q_new*/ -#else - exc2[i + i_subfr] = round_fx_o( L_shl_o( L_mult( gain_pit, exc[i + i_subfr] ), 1, &Overflow ), &Overflow ); /*Q_new*/ -#endif move16(); } @@ -236,13 +221,8 @@ void encod_amr_wb_fx( L_tmp = L_mult( gcode16, code[i] ); /*Q10*/ L_tmp = L_shl_sat( L_tmp, 5 ); /*Q15*/ L_tmp = L_mac_sat( L_tmp, exc[i + i_subfr], gain_pit ); /* Q_new+15 */ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q_new+15*/ - exc[i + i_subfr] = round_fx_sat( L_tmp ); /*Q_new*/ -#else - L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q_new+15*/ - exc[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /*Q_new*/ -#endif + L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q_new+15*/ + exc[i + i_subfr] = round_fx_sat( L_tmp ); /*Q_new*/ move16(); } diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 01f80cacb..1324bd178 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -144,12 +144,6 @@ void encod_gen_voic_fx( Word16 shift_wsp; Word16 harm_flag_acelp; Word16 lp_select, lp_flag, L_frame; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas; @@ -283,11 +277,7 @@ void encod_gen_voic_fx( } /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ -#ifdef ISSUE_1867_replace_overflow_libenc hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ -#else - hSpMusClas->lowrate_pitchGain = round_fx_o( L_mac_o( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx, &Overflow ), &Overflow ); /*Q14*Q16(0.1) + Q15 -> Q15*/ -#endif /*-----------------------------------------------------------------* * Transform domain contribution encoding - active frames @@ -339,14 +329,8 @@ void encod_gen_voic_fx( } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc - Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_sat( Lgcode ); /*Q0*/ -#else - Lgcode = L_shl_o( gain_code_fx, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_o( Lgcode, &Overflow ); /*Q0*/ -#endif - + Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/ + gcode16 = round_fx_sat( Lgcode ); /*Q0*/ hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, Lgcode, &voice_fac_fx, shift ); /* Q15 */ move16(); @@ -381,35 +365,20 @@ void encod_gen_voic_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /* Contribution from AVQ layer */ -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp1 = L_mult_sat( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q6 -> Q9*/ Ltmp1 = L_shl_sat( Ltmp1, tmp1_fx ); /* Q16 + Q_exc */ -#else - Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow ); /* Q2 + Q6 -> Q9*/ - Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow ); /* Q16 + Q_exc */ -#endif /* Compute exc2 */ -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1 ); /* Q16 */ exc2_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); /* Q0 */ -#else - Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow ); /* Q16 */ - exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */ -#endif move16(); /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ - Ltmp = L_shl( Ltmp, 5 ); /* Q15 */ - Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ + Ltmp = L_shl( Ltmp, 5 ); /* Q15 */ + Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ exc_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); /* Q0 */ -#else - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */ -#endif } } ELSE @@ -422,18 +391,11 @@ void encod_gen_voic_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 */ Ltmp = L_mac_sat( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ exc_fx[i + i_subfr_fx] = round_fx_sat( Ltmp ); /* Q0 */ -#else - Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 */ - Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /* Q15 */ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow ); /* Q0 */ -#endif } } @@ -554,12 +516,6 @@ void encod_gen_voic_ivas_fx( Word16 harm_flag_acelp; Word16 lp_select, lp_flag, L_frame; Word16 q_h1; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; @@ -753,13 +709,8 @@ void encod_gen_voic_ivas_fx( } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); -#else - Lgcode = L_shl_o( gain_code_fx, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_o( Lgcode, &Overflow ); -#endif hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, Q_new, L_SUBFR, 0 ); /* Q15 */ move16(); @@ -810,35 +761,20 @@ void encod_gen_voic_ivas_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /* Contribution from AVQ layer */ -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp1 = L_mult_sat( gain_preQ_fx, code_preQ_fx[i] ); Ltmp1 = L_shl_sat( Ltmp1, tmp1_fx ); -#else - Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow ); - Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow ); -#endif /* Compute exc2 */ -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1 ); exc2_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); -#else - Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow ); - exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); -#endif move16(); /* code in Q9, gain_pit in Q14 */ Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */ Ltmp = L_shl( Ltmp, 5 ); /*Qnew + 9+ 1+5 */ Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /*Qnew + 14 + 1*/ -#ifdef ISSUE_1867_replace_overflow_libenc - Ltmp = L_shl_sat( Ltmp, 1 ); /*Qnew + 14 + 1 +1 */ /* saturation can occur here Q16*/ + Ltmp = L_shl_sat( Ltmp, 1 ); /*Qnew + 14 + 1 +1 */ /* saturation can occur here Q16*/ exc_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); -#else - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /*Qnew + 14 + 1 +1 */ /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); -#endif move16(); } } @@ -853,20 +789,14 @@ void encod_gen_voic_ivas_fx( { /* code in Q9, gain_pit in Q14 */ /*gcode16 in Qnew*/ - Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */ Ltmp = L_shl_sat( Ltmp, 5 ); /*Qnew + 9+ 1+5 */ Ltmp = L_mac_sat( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /*Qnew + 14 + 1*/ Ltmp = L_shl_sat( Ltmp, 1 ); /*Qnew + 14 + 1 +1 */ exc_fx[i + i_subfr_fx] = round_fx_sat( Ltmp ); -#else - Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /*Qnew + 9+ 1+5 */ - Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /*Qnew + 14 + 1*/ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /*Qnew + 14 + 1 +1 */ - exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow ); -#endif } } + /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ diff --git a/lib_enc/enc_gen_voic_rf_fx.c b/lib_enc/enc_gen_voic_rf_fx.c index 26a45bad9..a8ce8de56 100644 --- a/lib_enc/enc_gen_voic_rf_fx.c +++ b/lib_enc/enc_gen_voic_rf_fx.c @@ -164,13 +164,6 @@ void coder_acelp_rf_fx( Word16 prev_gain_pit; Word16 rf_coder_type; Word16 lp_select; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - RF_ENC_HANDLE hRF = st->hRF; /* to avoid compilation warnings */ @@ -433,16 +426,16 @@ void coder_acelp_rf_fx( /*----------------------------------------------------------* * - voice factor (for pitch enhancement) * *----------------------------------------------------------*/ + E_UTIL_voice_factor( exc_rf, i_subfr, code, gain_pit, gain_code, &voice_fac, &( hRF->rf_tilt_code ), L_SUBFR, acelp_cfg->voice_tilt, Q_new, shift ); - /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ + /* st_fx->_rf_mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ - Ltmp = Mpy_32_16_1( gain_code, y2[L_SUBFR - 1] ); /* Q10 */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = Mpy_32_16_1( gain_code, y2[L_SUBFR - 1] ); /* Q10 */ Ltmp = L_shl_sat( Ltmp, add( 5, Q_xn ) ); /* Q15 + Q_xn */ Ltmp = L_mac_sat( Ltmp, y1[L_SUBFR - 1], gain_pit ); /* Q15 + Q_xn */ /* Add Gaussian contribution*/ @@ -450,19 +443,9 @@ void coder_acelp_rf_fx( Ltmp2 = L_shl_sat( Ltmp2, add( 5, Q_xn ) ); /* Q15 + Q_xn */ Ltmp = L_add_sat( Ltmp, Ltmp2 ); /* Q15 + Q_xn */ hRF->rf_mem_w0 = sub_sat( xn[L_SUBFR - 1], round_fx_sat( L_shl_sat( Ltmp, 1 ) ) ); /* Q_xn */ -#else - Ltmp = L_shl_o( Ltmp, add( 5, Q_xn ), &Overflow ); /* Q15 + Q_xn */ - Ltmp = L_mac_o( Ltmp, y1[L_SUBFR - 1], gain_pit, &Overflow ); /* Q15 + Q_xn */ - /* Add Gaussian contribution*/ - Ltmp2 = Mpy_32_16_1( gain_code2, y22[L_SUBFR - 1] ); /* Q10 */ - Ltmp2 = L_shl_o( Ltmp2, add( 5, Q_xn ), &Overflow ); /* Q15 + Q_xn */ - Ltmp = L_add_o( Ltmp, Ltmp2, &Overflow ); /* Q15 + Q_xn */ - hRF->rf_mem_w0 = sub_o( xn[L_SUBFR - 1], round_fx_o( L_shl_o( Ltmp, 1, &Overflow ), &Overflow ), &Overflow ); /* Q_xn */ -#endif move16(); hRF->rf_mem_w0 = shr_sat( hRF->rf_mem_w0, shift ); /*Qnew-1*/ - /*-------------------------------------------------------* * - Find the total excitation. * *-------------------------------------------------------*/ @@ -473,8 +456,7 @@ void coder_acelp_rf_fx( FOR( i = sub( tmp2, shr( L_SUBFR, 1 ) ); i < tmp2; i++ ) { /* code in Q9, gain_pit in Q14; exc Q_new */ - Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); /* Q10 */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); /* Q10 */ Ltmp = L_shl_sat( Ltmp, Q_new_p5 ); /* Q15 + Q_new */ Ltmp = L_mac_sat( Ltmp, gain_pit, exc_rf[i + i_subfr] ); /* Q15 + Q_new */ exc2[i] = round_fx_sat( L_shl_sat( Ltmp, 1 ) ); /* Q_new */ @@ -484,27 +466,16 @@ void coder_acelp_rf_fx( Ltmp = L_add_sat( Ltmp, Ltmp2 ); /* Q15 + Q_new */ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16 + Q_new*/ exc_rf[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */ -#else - Ltmp = L_shl_o( Ltmp, Q_new_p5, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_mac_o( Ltmp, gain_pit, exc_rf[i + i_subfr], &Overflow ); /* Q15 + Q_new */ - exc2[i] = round_fx_o( L_shl_o( Ltmp, 1, &Overflow ), &Overflow ); /* Q_new */ - move16(); - Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code[i] ); /* Q10 */ - Ltmp2 = L_shl_o( Ltmp2, Q_new_p5, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_add_o( Ltmp, Ltmp2, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new*/ - exc_rf[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); /* Q_new */ -#endif move16(); } tmp2 = L_SUBFR; move16(); } - /*---------------------------------------------------------* * Enhance the excitation * *---------------------------------------------------------*/ + E_UTIL_enhancer( voice_fac, stab_fac, past_gcode, gain_inov, &hRF->rf_gc_threshold, code, exc2, gain_pit, &hRF->rf_dm_fx.prev_gain_code, hRF->rf_dm_fx.prev_gain_pit, &hRF->rf_dm_fx.prev_state, coder_type, diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index dcbe87a8d..b1b72ad9a 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -89,11 +89,7 @@ void transf_cdbk_enc_fx( *--------------------------------------------------------------*/ IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) ); -#else - gcode16 = round_fx_o( L_shl_o( gain_code, Q_new, &Overflow ), &Overflow ); -#endif FOR( i = 0; i < L_SUBFR; i++ ) { /*x_tran[i] = xn[i] - *gain_pit * y1[i] - gain_code * y2[i];*/ @@ -188,11 +184,7 @@ void transf_cdbk_enc_fx( m_corr = div_s( 16384, m_den ); e_corr = sub( 14 + 4, e_den ); Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/ -#ifdef ISSUE_1867_replace_overflow_libenc - stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */ -#else - stmp = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12 */ -#endif + stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */ } ELSE { @@ -447,11 +439,7 @@ void transf_cdbk_enc_ivas_fx( *--------------------------------------------------------------*/ IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) ); -#else - gcode16 = round_fx_o( L_shl_o( gain_code, Q_new, &Overflow ), &Overflow ); -#endif FOR( i = 0; i < L_SUBFR; i++ ) { /*x_tran[i] = xn[i] - *gain_pit * y1[i] - gain_code * y2[i];*/ @@ -545,11 +533,7 @@ void transf_cdbk_enc_ivas_fx( m_corr = div_s( 16384, m_den ); e_corr = sub( 14 + 4, e_den ); Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/ -#ifdef ISSUE_1867_replace_overflow_libenc - stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */ -#else - stmp = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12 */ -#endif + stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */ } ELSE { diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 532c03898..08a86f731 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -104,12 +104,6 @@ void enc_pit_exc_fx( BSTR_ENC_HANDLE hBstr = st_fx->hBstr; GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*------------------------------------------------------------------* * Initialization @@ -297,11 +291,7 @@ void enc_pit_exc_fx( } /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit;*/ -#ifdef ISSUE_1867_replace_overflow_libenc hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ -#else - hSpMusClas->lowrate_pitchGain = round_fx_o( L_mac_o( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit, &Overflow ), &Overflow ); /*Q14*Q16(0.1) + Q15 -> Q15*/ -#endif gpit_tmp = gain_pit; move16(); /*Q14*/ @@ -380,21 +370,12 @@ void enc_pit_exc_fx( IF( use_fcb != 0 ) { Ltmp = L_mult( gcode16, y2[L_subfr - 1] ); /* Q10 + Q_new */ -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( Ltmp, add( 5, shift ) ); /* Q15 + Q_new + shift */ Ltmp = L_negate( Ltmp ); Ltmp = L_mac_sat( Ltmp, xn[L_subfr - 1], 16384 ); /* Q_new + Q15 + shift */ Ltmp = L_msu_sat( Ltmp, y1[L_subfr - 1], gain_pit ); /* Q_new + Q15 + shift */ Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new + 15 */ hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ -#else - Ltmp = L_shl_o( Ltmp, add( 5, shift ), &Overflow ); /* Q15 + Q_new + shift */ - Ltmp = L_negate( Ltmp ); - Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); /* Q_new + Q15 + shift */ - Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); /* Q_new + Q15 + shift */ - Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); /* Q_new + 15 */ - hLPDmem->mem_w0 = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */ -#endif move16(); } ELSE @@ -416,18 +397,11 @@ void enc_pit_exc_fx( FOR( i = 0; i < L_subfr; i++ ) { /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 + Q_new */ Ltmp = L_mac_sat( Ltmp, exc[i + i_subfr], gain_pit ); /* Q15 + Q_new */ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q_new + Q16*/ exc[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */ -#else - Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_mac_o( Ltmp, exc[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q_new + Q16*/ - exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); /* Q_new */ -#endif move16(); } } @@ -613,12 +587,6 @@ void enc_pit_exc_ivas_fx( BSTR_ENC_HANDLE hBstr = st_fx->hBstr; GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*------------------------------------------------------------------* * Initialization @@ -884,21 +852,12 @@ void enc_pit_exc_ivas_fx( IF( use_fcb != 0 ) { Ltmp = L_mult0( gcode16, y2[L_subfr - 1] ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( Ltmp, add( 5, shift ) ); // Q_new+14+shift Ltmp = L_negate( Ltmp ); Ltmp = L_mac_sat( Ltmp, xn[L_subfr - 1], 16384 ); // Q_new-1+15+shift Ltmp = L_msu_sat( Ltmp, y1[L_subfr - 1], gain_pit ); // Q_new-1+15+shift Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); // Q_new+15 hGSCEnc->mem_w0_tmp_fx = round_fx_sat( Ltmp ); /*Q_new-1 */ -#else - Ltmp = L_shl_o( Ltmp, add( 5, shift ), &Overflow ); // Q_new+14+shift - Ltmp = L_negate( Ltmp ); - Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); // Q_new-1+15+shift - Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); // Q_new-1+15+shift - Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); // Q_new+15 - hGSCEnc->mem_w0_tmp_fx = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */ -#endif } ELSE { @@ -918,18 +877,11 @@ void enc_pit_exc_ivas_fx( FOR( i = 0; i < L_subfr; i++ ) { /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 + Q_new */ Ltmp = L_mac_sat( Ltmp, exc[i + i_subfr], gain_pit ); /* Q15 + Q_new */ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16 + Q_new */ exc[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */ -#else - Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_mac_o( Ltmp, exc[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new */ - exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); /* Q_new */ -#endif move16(); } } diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index c95f07e41..6f029849b 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -93,12 +93,6 @@ Word16 encod_tran_fx( Word16 L_frame_fx; Word16 shift_wsp; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif BSTR_ENC_HANDLE hBstr = st_fx->hBstr; SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; @@ -230,14 +224,10 @@ Word16 encod_tran_fx( } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); -#else - Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_o( Lgcode, &Overflow ); -#endif hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr], gain_pit, code, Lgcode, &voice_fac, shift ); /* Q15 */ + /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ @@ -284,18 +274,11 @@ Word16 encod_tran_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ - L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ L_tmp = L_shl_sat( L_tmp, 5 ); /* Q15 + Q_new */ L_tmp = L_mac_sat( L_tmp, exc_fx[i + i_subfr], gain_pit ); /* Q15 + Q_new */ L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q16 + Q_new */ exc_fx[i + i_subfr] = round_fx_sat( L_tmp ); /* Q_new */ -#else - L_tmp = L_shl_o( L_tmp, 5, &Overflow ); /* Q15 + Q_new */ - L_tmp = L_mac_o( L_tmp, exc_fx[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */ - L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new */ - exc_fx[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /* Q_new */ -#endif } /*-----------------------------------------------------------------* @@ -308,21 +291,12 @@ Word16 encod_tran_fx( FOR( i = 0; i < L_SUBFR; i++ ) { L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */ + L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */ tmp_fx = round_fx_sat( L_tmp ); exc2_fx[i + i_subfr] = add_sat( exc2_fx[i + i_subfr], tmp_fx ); /* Q_exc */ move16(); exc_fx[i + i_subfr] = add_sat( exc_fx[i + i_subfr], tmp_fx ); /* Q_exc */ move16(); -#else - L_tmp = L_shl_o( L_tmp, tmp1_fx, &Overflow ); /* Q16 + Q_exc */ - tmp_fx = round_fx_o( L_tmp, &Overflow ); - exc2_fx[i + i_subfr] = add_o( exc2_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */ - move16(); - exc_fx[i + i_subfr] = add_o( exc_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */ - move16(); -#endif } } @@ -494,12 +468,6 @@ Word16 encod_tran_ivas_fx( Word16 shift_wsp; Word32 L_tmp; Word16 q_h1; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif BSTR_ENC_HANDLE hBstr = st_fx->hBstr; SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; @@ -639,14 +607,10 @@ Word16 encod_tran_ivas_fx( } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); -#else - Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_o( Lgcode, &Overflow ); -#endif hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); // Q15 + /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ @@ -690,21 +654,15 @@ Word16 encod_tran_ivas_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ + FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ - L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ L_tmp = L_shl_sat( L_tmp, 5 ); /* Q15 + Q_new */ L_tmp = L_mac_sat( L_tmp, exc_fx[i + i_subfr], gain_pit ); /* Q15 + Q_new */ L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q16 + Q_new */ exc_fx[i + i_subfr] = round_fx_sat( L_tmp ); /* Q_new */ -#else - L_tmp = L_shl_o( L_tmp, 5, &Overflow ); /* Q15 + Q_new */ - L_tmp = L_mac_o( L_tmp, exc_fx[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */ - L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new */ - exc_fx[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /* Q_new */ -#endif } /*-----------------------------------------------------------------* @@ -717,21 +675,12 @@ Word16 encod_tran_ivas_fx( FOR( i = 0; i < L_SUBFR; i++ ) { L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */ + L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */ tmp_fx = round_fx_sat( L_tmp ); exc2_fx[i + i_subfr] = add_sat( exc2_fx[i + i_subfr], tmp_fx ); /* Q_exc */ move16(); exc_fx[i + i_subfr] = add_sat( exc_fx[i + i_subfr], tmp_fx ); /* Q_exc */ -#else - L_tmp = L_shl_o( L_tmp, tmp1_fx, &Overflow ); /* Q16 + Q_exc */ - tmp_fx = round_fx_o( L_tmp, &Overflow ); - - exc2_fx[i + i_subfr] = add_o( exc2_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */ - move16(); - exc_fx[i + i_subfr] = add_o( exc_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */ -#endif move16(); } } diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c index 0fec2c424..ca3f50f11 100644 --- a/lib_enc/find_tar_fx.c +++ b/lib_enc/find_tar_fx.c @@ -134,11 +134,7 @@ void find_targets_fx( { Ltmp = L_msu( Ltmp, Aqs[j], h1[i - j] ); /* Q27 */ } -#ifdef ISSUE_1867_replace_overflow_libenc h1[i] = round_fx( L_shl_sat( Ltmp, s ) ); /* Q11 + s */ -#else - h1[i] = round_fx( L_shl_o( Ltmp, s, &Overflow ) ); /* Q11 + s */ -#endif } Ltmp = L_mult( Ap[i], s2 ); /* Q27 */ FOR( j = 1; j <= M; j++ ) @@ -185,12 +181,7 @@ void find_targets_ivas_fx( Word32 h1_32[6 * L_SUBFR]; Word16 sf; Word64 Ltmp64; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + /*------------------------------------------------------------------------* * Find the target vector for excitation search: * @@ -256,20 +247,12 @@ void find_targets_ivas_fx( } set32_fx( h1_32, 0, L_subfr ); -#ifndef ISSUE_1867_replace_overflow_libenc - Overflow = 0; - move16(); -#endif FOR( i = 0; i < M; i++ ) { Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */ FOR( j = 1; j <= i; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_sat( h1_32[i - j], s ) ) ); /* Q27 */ -#else - Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */ -#endif } h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */ move32(); @@ -278,29 +261,17 @@ void find_targets_ivas_fx( Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */ FOR( j = 1; j <= M; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_sat( h1_32[i - j], s ) ) ); /* Q27 */ -#else - Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */ -#endif } h1_32[M] = W_extract_l( Ltmp64 ); /* Q27 */ move32(); FOR( i = M + 1; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp64 = W_msu_16_16( 0, Aqs[1], extract_h( L_shl_sat( h1_32[i - 1], s ) ) ); /* Q27 */ -#else - Ltmp64 = W_msu_16_16( 0, Aqs[1], extract_h( L_shl_o( h1_32[i - 1], s, &Overflow ) ) ); /* Q27 */ -#endif FOR( j = 2; j <= M; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_sat( h1_32[i - j], s ) ) ); /* Q27 */ -#else - Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */ -#endif } h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */ move32(); diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index 56078ec1e..5eaa1d4dd 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -44,12 +44,7 @@ void find_tilt_fx( Word16 scaling; move32(); move32(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /*-----------------------------------------------------------------* * Initializations *-----------------------------------------------------------------*/ @@ -110,13 +105,8 @@ void find_tilt_fx( /*mean_voi = 0.5f * (voicing[1] + voicing[2]) + corr_shift;*/ Ltmp = L_mult( voicing[1], 16384 /* 0.5 in Q15 */ ); /* Q31 */ Ltmp = L_mac( Ltmp, voicing[2], 16384 /* 0.5 in Q15 */ ); /* Q31 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Ltmp = L_mac_sat( Ltmp, corr_shift, 32767 ); /* Q31 */ - mean_voi = round_fx_sat( Ltmp ); /* Q15 */ -#else - Ltmp = L_mac_o( Ltmp, corr_shift, 32767, &Overflow ); /* Q31 */ - mean_voi = round_fx_o( Ltmp, &Overflow ); /* Q15 */ -#endif + Ltmp = L_mac_sat( Ltmp, corr_shift, 32767 ); /* Q31 */ + mean_voi = round_fx_sat( Ltmp ); /* Q15 */ /*f0 = INT_FS_FX / pitch[2];*/ e_tmp = norm_s( pitch[2] ); @@ -162,23 +152,15 @@ void find_tilt_fx( tmp = sub( freq, f2 ); IF( L_mac0( -(Word32) TH_D_FX * TH_D_FX, tmp, tmp ) < 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc lp_E = L_add_sat( *pt_E, lp_E ); /* Q_new + QSCALE - 2 */ -#else - lp_E = L_add_o( *pt_E, lp_E, &Overflow ); /* Q_new + QSCALE - 2 */ -#endif - m_cnt = add( m_cnt, 1 ); /* Q0 */ + m_cnt = add( m_cnt, 1 ); /* Q0 */ } pt_E++; } -#ifdef ISSUE_1867_replace_overflow_libenc f1 = add_sat( f1, f0 ); f2 = add_sat( f2, f0 ); -#else - f1 = add_o( f1, f0, &Overflow ); - f2 = add_o( f2, f0, &Overflow ); -#endif } + /*lp_E = lp_E / (float)cnt - lp_bckr;*/ e_tmp = sub( norm_l( lp_E ), 1 ); m_tmp = extract_h( L_shl( lp_E, e_tmp ) ); @@ -191,11 +173,7 @@ void find_tilt_fx( m_tmp = div_s( m_tmp, m_cnt ); /* exp(e_tmp + e_cnt) */ e_tmp = sub( e_tmp, e_cnt ); -#ifdef ISSUE_1867_replace_overflow_libenc lp_E = L_sub_sat( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr ); /* Q_new + QSCALE */ -#else - lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */ -#endif pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */ } @@ -236,11 +214,7 @@ void find_tilt_fx( IF( EQ_16( bwidth, NB ) ) /* For NB input, compensate for the missing bands */ { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( ee[i], 3 ); -#else - Ltmp = L_shl_o( ee[i], 3, &Overflow ); -#endif IF( EQ_32( Ltmp, MAX_32 ) ) /* if Overflow: Compute with less precision */ { Ltmp = Mult_32_16( ee[i], 24576 /* 0.75 in Q15 */ ); /* 6/8 Q6*/ @@ -295,14 +269,9 @@ void find_tilt_ivas_fx( Word64 sum; Word16 inv_bands, q_lp_E; Word32 Le_min_scaled, Ltmp2; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move32(); move32(); + /*-----------------------------------------------------------------* * Initializations *-----------------------------------------------------------------*/ @@ -370,15 +339,10 @@ void find_tilt_ivas_fx( hp_bckr = L_add_sat( L_shl_sat( hp_bckr, 1 ), hp_bckr ); /* Q_new */ } /*mean_voi = 0.5f * (voicing[1] + voicing[2]) + corr_shift;*/ - Ltmp = L_mult( voicing[1], 16384 /* 0.5 in Q15 */ ); // Q31 - Ltmp = L_mac( Ltmp, voicing[2], 16384 /* 0.5 in Q15 */ ); // Q31 -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_mult( voicing[1], 16384 /* 0.5 in Q15 */ ); // Q31 + Ltmp = L_mac( Ltmp, voicing[2], 16384 /* 0.5 in Q15 */ ); // Q31 Ltmp = L_mac_sat( Ltmp, corr_shift, 32767 /* 1.0f in Q15 */ ); // Q31 mean_voi = round_fx_sat( Ltmp ); // Q15 -#else - Ltmp = L_mac_o( Ltmp, corr_shift, 32767 /* 1.0f in Q15 */, &Overflow ); // Q31 - mean_voi = round_fx_o( Ltmp, &Overflow ); // Q15 -#endif /*f0 = INT_FS_FX / pitch[2];*/ e_tmp = norm_s( pitch[2] ); @@ -430,14 +394,10 @@ void find_tilt_ivas_fx( } pt_E++; } -#ifdef ISSUE_1867_replace_overflow_libenc f1 = add_sat( f1, f0 ); f2 = add_sat( f2, f0 ); -#else - f1 = add_o( f1, f0, &Overflow ); - f2 = add_o( f2, f0, &Overflow ); -#endif } + /*lp_E = lp_E / (float)cnt - lp_bckr;*/ e_tmp = sub( W_norm( sum ), 1 ); m_tmp = extract_h( W_extract_h( W_shl( sum, e_tmp ) ) ); // q_lf_E+1+e_tmp-32-16 @@ -504,12 +464,8 @@ void find_tilt_ivas_fx( IF( bwidth == NB ) /* For NB input, compensate for the missing bands */ { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_shl_sat( ee[i], 3 ); /* Q6 */ -#else - Ltmp = L_shl_o( ee[i], 3, &Overflow ); /* Q6 */ -#endif - IF( EQ_32( Ltmp, MAX_32 ) ) /* if Overflow: Compute with less precision */ + IF( EQ_32( Ltmp, MAX_32 ) ) /* if Overflow: Compute with less precision */ { Ltmp = Mult_32_16( ee[i], 24576 /* 0.75 in Q15 */ ); /* 6/8 Q6*/ ee[i] = L_shl_sat( Ltmp, 3 ); /* Q6 */ diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c index 401b64cb5..8554b03dd 100644 --- a/lib_enc/find_uv_fx.c +++ b/lib_enc/find_uv_fx.c @@ -115,13 +115,6 @@ Word16 find_uv_fx( /* o : coding type */ Word16 ee0_th, ee1_th, voi_th, nb_cond, flag_low_relE; NOISE_EST_HANDLE hNoiseEst = st_fx->hNoiseEst; SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - Word16 Last_Resort; Word16 vadnoise; @@ -199,13 +192,9 @@ Word16 find_uv_fx( /* o : coding type */ * Average voicing (normalized correlation) *-----------------------------------------------------------------*/ - /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */ -#ifdef ISSUE_1867_replace_overflow_libenc + /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */ mean_ee = L_add_sat( L_add_sat( st_fx->ee_old_fx, ee[0] ), ee[1] ); /* Q6 */ -#else - mean_ee = L_add_o( L_add_o( st_fx->ee_old_fx, ee[0], &Overflow ), ee[1], &Overflow ); /* Q6 */ -#endif - mean_ee = Mult_32_16( mean_ee, 10923 /* 1/3 in Q15 */ ); /*Q6*/ + mean_ee = Mult_32_16( mean_ee, 10923 /* 1/3 in Q15 */ ); /*Q6*/ /* mean_voi3 = 1.0f/3.0f * (voicing[0] + voicing[1] + voicing[2]);*/ Ltmp0 = L_mult( st_fx->voicing_fx[0], 10923 /* 1/3 in Q15 */ ); /* Q31 */ @@ -230,11 +219,7 @@ Word16 find_uv_fx( /* o : coding type */ { dE2_th = 21 << 10; move32(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( GE_16( add_sat( mean_voi3, corr_shift ), 22282 /* 0.68 in Q15 */ ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/ -#else - if ( GE_16( add_o( mean_voi3, corr_shift, &Overflow ), 22282 /* 0.68 in Q15 */ ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/ -#endif { nb_cond = 0; move16(); @@ -313,11 +298,7 @@ Word16 find_uv_fx( /* o : coding type */ test(); if ( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */ ( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], L_shl( E_MIN_FX, Q_new ) ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */ -#ifdef ISSUE_1867_replace_overflow_libenc - ( LT_16( add_sat( st_fx->voicing_fx[0], corr_shift ), voi_th ) ) ) ) /* normalized correlation is low */ -#else - ( LT_16( add_o( st_fx->voicing_fx[0], corr_shift, &Overflow ), voi_th ) ) ) ) /* normalized correlation is low */ -#endif + ( LT_16( add_sat( st_fx->voicing_fx[0], corr_shift ), voi_th ) ) ) ) /* normalized correlation is low */ { tmp_offset_flag = 0; move16(); @@ -393,21 +374,16 @@ Word16 find_uv_fx( /* o : coding type */ test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */ -#else - if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ - ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */ -#endif - ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ - ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ - ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ - /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */ - ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ - ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ - flag_low_relE ) /* low relative frame energy (only for SC-VBR) */ + ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ + ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ + ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ + /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */ + ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ + ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */ + ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ + flag_low_relE ) /* low relative frame energy (only for SC-VBR) */ { coder_type = UNVOICED; move16(); @@ -427,20 +403,16 @@ Word16 find_uv_fx( /* o : coding type */ test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ -#else - if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ -#endif - ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.8 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */ - ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ - ( LT_32( ee[1], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ - ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ - /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */ - ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ - ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ - || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */ + ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.8 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */ + ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ + ( LT_32( ee[1], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ + ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ + /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */ + ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ + ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */ + ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ + || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */ { coder_type = UNVOICED; move16(); @@ -633,12 +605,6 @@ Word16 find_uv_ivas_fx( /* o : coding typ Word16 ee0_th, ee1_th, voi_th, nb_cond, flag_low_relE; NOISE_EST_HANDLE hNoiseEst = st_fx->hNoiseEst; SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 Last_Resort; Word16 vadnoise; @@ -738,13 +704,9 @@ Word16 find_uv_ivas_fx( /* o : coding typ * Average voicing (normalized correlation) *-----------------------------------------------------------------*/ - /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */ -#ifdef ISSUE_1867_replace_overflow_libenc + /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */ mean_ee = L_add_sat( L_add_sat( st_fx->ee_old_fx, ee[0] ), ee[1] ); /* Q6 */ -#else - mean_ee = L_add_o( L_add_o( st_fx->ee_old_fx, ee[0], &Overflow ), ee[1], &Overflow ); /* Q6 */ -#endif - mean_ee = Mult_32_16( mean_ee, 10923 ); /*Q6*/ + mean_ee = Mult_32_16( mean_ee, 10923 ); /*Q6*/ /* mean_voi3 = 1.0f/3.0f * (voicing[0] + voicing[1] + voicing[2]);*/ Ltmp0 = L_mult( st_fx->voicing_fx[0], 10923 /* 1/3 in Q15 */ ); /* Q31 */ @@ -769,11 +731,7 @@ Word16 find_uv_ivas_fx( /* o : coding typ { dE2_th = 21 << 10; move32(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( GE_16( add_sat( mean_voi3, corr_shift ), 22282 ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/ -#else - if ( GE_16( add_o( mean_voi3, corr_shift, &Overflow ), 22282 ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/ -#endif { nb_cond = 0; move16(); @@ -852,16 +810,10 @@ Word16 find_uv_ivas_fx( /* o : coding typ test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */ ( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */ ( LT_16( add_sat( st_fx->voicing_fx[0], corr_shift ), voi_th ) ) ) ) /* normalized correlation is low */ -#else - IF( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */ - ( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */ - ( LT_16( add_o( st_fx->voicing_fx[0], corr_shift, &Overflow ), voi_th ) ) ) ) /* normalized correlation is low */ -#endif { tmp_offset_flag = 0; move16(); @@ -937,7 +889,6 @@ Word16 find_uv_ivas_fx( /* o : coding typ test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */ ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ @@ -948,18 +899,6 @@ Word16 find_uv_ivas_fx( /* o : coding typ ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */ ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ flag_low_relE ) -#else - IF( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ - ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */ - ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ - ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ - ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ - /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */ - ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ - ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ - flag_low_relE ) -#endif /* low relative frame energy (only for SC-VBR) */ { coder_type = UNVOICED; @@ -977,20 +916,16 @@ Word16 find_uv_ivas_fx( /* o : coding typ test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ -#else - if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */ -#endif - /*( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) && */ /* normalized correlation low on look-ahead - onset detection */ - ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ - ( LT_32( ee[1], 397 /* 6.2f in Q16 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ - ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ - /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */ - ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ - ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ - || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */ + /*( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) && */ /* normalized correlation low on look-ahead - onset detection */ + ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ + ( LT_32( ee[1], 397 /* 6.2f in Q16 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ + ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ + /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */ + ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */ + ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */ + ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ + || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */ { coder_type = UNVOICED; move16(); diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c index 1d3cecfc5..27b49c9d6 100644 --- a/lib_enc/gain_enc_fx.c +++ b/lib_enc/gain_enc_fx.c @@ -66,12 +66,6 @@ void Es_pred_enc_fx( Word16 s0, s1, ener_dB, mean_ener_code16; const Word16 *qua_table; Word32 ener_fx, Lmean_ener_code, Ltmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Lmean_ener_code = L_deposit_l( 0 ); Q_res = sub( shl( Q_new, 1 ), 3 ); @@ -99,11 +93,7 @@ void Es_pred_enc_fx( FOR( i = 1; i < L_SUBFR; i++ ) { tmp16 = mult_r( res[i_subfr + i], 8192 /* 1 in Q13 */ ); /* remove 2bits Q_new - 2*/ -#ifdef ISSUE_1867_replace_overflow_libenc ener_fx = L_mac_sat( ener_fx, tmp16, tmp16 ); -#else - ener_fx = L_mac_o( ener_fx, tmp16, tmp16, &Overflow ); -#endif } /* ener = 10 * (float)log10(ener / (float)L_SUBFR) */ @@ -185,11 +175,7 @@ void Es_pred_enc_fx( FOR( i = 1; i < size; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp16_2 = abs_s( sub_sat( mean_ener_code16, qua_table[i] ) ); -#else - tmp16_2 = abs_s( sub_o( mean_ener_code16, qua_table[i], &Overflow ) ); -#endif IF( LT_16( tmp16_2, tmp16 ) ) { tmp16 = tmp16_2; @@ -245,12 +231,6 @@ void gain_enc_mless_fx( Word16 exp1, exp2; Word16 exp_num, exp_den, exp_div, frac_den; Word32 L_frac_num, L_frac_den, L_div; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*-----------------------------------------------------------------* * calculate the rest of the correlation coefficients @@ -413,11 +393,7 @@ void gain_enc_mless_fx( L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ exp_div = sub( exp_num, exp_den ); -#ifdef ISSUE_1867_replace_overflow_libenc *gain_pit = round_fx_sat( L_shl_sat( L_div, add( exp, exp_div ) ) ); /*Q14*/ -#else - *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/ -#endif L_tmp1 = L_shr( L_mult( coeff[1], coeff[4] ), 2 ); /*Q31*/ exp1 = add( exp_coeff[1], exp_coeff[4] ); @@ -442,11 +418,7 @@ void gain_enc_mless_fx( L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ exp_div = sub( exp_num, exp_den ); -#ifdef ISSUE_1867_replace_overflow_libenc *gain_code = L_shl_sat( L_div, sub( add( exp, exp_div ), 14 ) ); -#else - *gain_code = L_shl_o( L_div, sub( add( exp, exp_div ), 14 ), &Overflow ); -#endif move32(); /*Q16*/ *gain_pit = s_max( G_PITCH_MIN_TC192_Q14, s_min( *gain_pit, G_PITCH_MAX_TC192_Q14 ) ); @@ -475,12 +447,8 @@ void gain_enc_mless_fx( index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_TC192_Q14, LG10_G_CODE_MAX_TC192_Q13, nBits2, &expg ); push_indice( hBstr, IND_GAIN_CODE, index, nBits2 ); - L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/ -#else - *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/ -#endif } ELSE { @@ -598,12 +566,6 @@ void gain_enc_SQ_fx( Word16 exp1, exp2; Word16 exp_num, exp_den, exp_div, frac_den; Word32 L_frac_num, L_frac_den, L_div; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*-----------------------------------------------------------------* * calculate the rest of the correlation coefficients @@ -707,11 +669,7 @@ void gain_enc_SQ_fx( L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/ exp1 = add( exp_coeff[0], exp_coeff[2] ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp2 = L_mult_sat( coeff[4], coeff[4] ); /*Q31*/ -#else - L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/ -#endif exp2 = add( exp_coeff[4], exp_coeff[4] ); IF( GT_16( exp1, exp2 ) ) @@ -753,33 +711,17 @@ void gain_enc_SQ_fx( exp_num = exp2; move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc L_frac_num = L_sub_sat( L_tmp2, L_tmp1 ); /*Q31*/ -#else - L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ -#endif L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ exp_div = sub( exp_num, exp_den ); -#ifdef ISSUE_1867_replace_overflow_libenc *gain_pit = round_fx_sat( L_shl_sat( L_div, add( exp, exp_div ) ) ); /*Q14*/ -#else - *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/ -#endif -#ifdef FIX_1978_SAT_MISSING_IN_GAIN_ENC L_tmp1 = L_mult_sat( coeff[1], coeff[4] ); /*Q31*/ -#else - L_tmp1 = L_mult( coeff[1], coeff[4] ); /*Q31*/ -#endif exp1 = add( exp_coeff[1], exp_coeff[4] ); -#ifdef FIX_1978_SAT_MISSING_IN_GAIN_ENC L_tmp2 = L_mult_sat( coeff[0], coeff[3] ); /*Q31*/ -#else - L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/ -#endif exp2 = add( exp_coeff[0], exp_coeff[3] ); IF( GT_16( exp1, exp2 ) ) @@ -794,11 +736,7 @@ void gain_enc_SQ_fx( exp_num = exp2; move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc L_frac_num = L_sub_sat( L_tmp2, L_tmp1 ); /*Q31*/ -#else - L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ -#endif L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ exp_div = sub( exp_num, exp_den ); @@ -885,12 +823,7 @@ Word16 gain_enc_gaus_fx( /* o : Return index of quant Word16 index, exp_gain, frac_gain, wtmp; Word16 enr_q, wenr; Word32 Ltmp, enr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /*enr = 20.0 * log10(*gain + 0.001) codebook gain in dB */ exp_gain = norm_l( *gain ); frac_gain = Log2_norm_lc( L_shl( *gain, exp_gain ) ); @@ -921,15 +854,13 @@ Word16 gain_enc_gaus_fx( /* o : Return index of quant Ltmp = Pow2( 14, frac_gain ); /* Put 14 as exponent */ exp_gain = sub( exp_gain, 14 ); /* Retreive exponent of wtmp */ -#ifdef ISSUE_1867_replace_overflow_libenc *gain = L_shl_sat( Ltmp, add( 16, exp_gain ) ); -#else - *gain = L_shl_o( Ltmp, add( 16, exp_gain ), &Overflow ); -#endif move32(); /*Q16*/ return index; } + + /*-----------------------------------------------------------------* * gain_enc_tc() * @@ -1144,13 +1075,6 @@ static Word16 Find_Opt_gainQ_fx( Word16 exp_max[5]; Word16 exp_code, e_max; Word32 L_tmp, L_tmp1; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /*----------------------------------------------------------------* * Find the best quantizer @@ -1244,11 +1168,7 @@ static Word16 Find_Opt_gainQ_fx( L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */ L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = L_sub_sat( L_tmp, dist_min ); -#else - L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow ); -#endif if ( L_tmp1 < 0 ) { index = i; @@ -1781,12 +1701,6 @@ void gain_enc_amr_wb_fx( Word16 exp_max[5], tmp, nBits; Word32 L_tmp, dist_min, L_inov, L_tmp1; const Word16 *t_qua_gain, *p; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*----------------------------------------------------------------* * Find the initial quantization pitch index @@ -2018,11 +1932,7 @@ void gain_enc_amr_wb_fx( L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */ L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = L_sub_sat( L_tmp, dist_min ); -#else - L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow ); -#endif /* splitting the if cost half the complexity of using IF macro */ if ( L_tmp1 < 0 ) { @@ -2044,14 +1954,9 @@ void gain_enc_amr_wb_fx( g_code = *p++; /* selected code gain in Q11 */ move16(); - L_tmp = L_mult( g_code, gcode0 ); /* Q11*Q0 -> Q12 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = L_mult( g_code, gcode0 ); /* Q11*Q0 -> Q12 */ L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 4 ) ); /* Q12 -> Q16 */ -#else - L_tmp = L_shl_o( L_tmp, add( exp_gcode0, 4 ), &Overflow ); /* Q12 -> Q16 */ -#endif - - *gain_code = L_tmp; /* gain of code in Q16 */ + *gain_code = L_tmp; /* gain of code in Q16 */ move16(); /*---------------------------------------------------* diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index 8b822b704..fb93a6743 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -63,12 +63,6 @@ Word16 gaus_encode_fx( Word32 Ltmp; Word16 dn[L_SUBFR], exp_code, gcode; /* Correlation between xn and h1 */ Word16 exp, tmp, tmp_idx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*----------------------------------------------------------------* * Encode gaussian excitation @@ -103,11 +97,9 @@ Word16 gaus_encode_fx( /*----------------------------------------------------------------* * Total excitation for Unvoiced coders *----------------------------------------------------------------*/ -#ifdef ISSUE_1867_replace_overflow_libenc + gcode = round_fx_sat( L_shl_sat( *gain_code, Q_new ) ); /* scaled gain_code with Qnew */ -#else - gcode = round_fx_o( L_shl_o( *gain_code, Q_new, &Overflow ), &Overflow ); /* scaled gain_code with Qnew */ -#endif + FOR( i = 0; i < L_SUBFR; i++ ) { exc[i + i_subfr] = round_fx( L_shl( L_mult( gcode, code[i] ), 15 - 9 ) ); /* Q_new */ @@ -200,12 +192,6 @@ void gauss2v_fx( Word16 gxx, gcc, index_delta, delta, m_sign, inv_delta; Word16 hg[190], Gaus_dico2[190]; Word16 shiftP3; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*----------------------------------------------------------------* * Encode the tilt of gaussian excitation @@ -435,13 +421,8 @@ void gauss2v_fx( cor2_norm = norm_l( cor2 ); eneri_norm = norm_l( eneri ); -#ifdef ISSUE_1867_replace_overflow_libenc cor2_mantissa = round_fx_sat( L_shl_sat( cor2, cor2_norm ) ); eneri_mantissa = round_fx_sat( L_shl_sat( eneri, eneri_norm ) ); -#else - cor2_mantissa = round_fx_o( L_shl_o( cor2, cor2_norm, &Overflow ), &Overflow ); - eneri_mantissa = round_fx_o( L_shl_o( eneri, eneri_norm, &Overflow ), &Overflow ); -#endif difference_norm = sub( add( cor2_norm, enerw_norm ), add( cor2w_norm, eneri_norm ) ); update_best = 0; @@ -610,15 +591,13 @@ void gauss2v_fx( /* Gain must be output in a 32-bit variable as a Q16 */ /* Compensate for Q_new */ -#ifdef ISSUE_1867_replace_overflow_libenc *gain = L_shl_sat( Portion, sub( 13, Q_new ) ); /* Q16 */ -#else - *gain = L_shl_o( Portion, sub( 13, Q_new ), &Overflow ); /* Q16 */ -#endif move32(); return; } + + /*---------------------------------------------------------------------* * Put selected codevector positions and signs into quantization index *---------------------------------------------------------------------*/ diff --git a/lib_enc/gp_clip_fx.c b/lib_enc/gp_clip_fx.c index 05d385fe7..07b88103b 100644 --- a/lib_enc/gp_clip_fx.c +++ b/lib_enc/gp_clip_fx.c @@ -114,12 +114,6 @@ Word16 gp_clip_fx( Word32 ener; Word32 L_tmp; Word16 thres; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif clip = 0; move16(); @@ -144,18 +138,10 @@ Word16 gp_clip_fx( } } -#ifdef ISSUE_1867_replace_overflow_libenc ener = L_mac_sat( 1L, xn[0], xn[0] ); -#else - ener = L_mac_o( 1L, xn[0], xn[0], &Overflow ); -#endif FOR( i = 1; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc ener = L_mac_sat( ener, xn[i], xn[i] ); -#else - ener = L_mac_o( ener, xn[i], xn[i], &Overflow ); -#endif } /* ener = 10.0f*(float)log10(ener) */ @@ -344,12 +330,7 @@ Word16 Mode2_gp_clip_fx( Word16 clip, tmp, exp_xn; Word16 i; Word32 wener, Ltmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + move16(); clip = 0; @@ -367,11 +348,7 @@ Word16 Mode2_gp_clip_fx( FOR( i = 0; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc wener = L_mac0_sat( wener, xn[i], xn[i] ); -#else - wener = L_mac0_o( wener, xn[i], xn[i], &Overflow ); -#endif } /*wener = 10.0f*(float)log10(wener);*/ diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index e26d5abbf..7a0d1a279 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -1332,12 +1332,6 @@ static Word16 edyn_fx( /* o : ratio of max to mean */ Word32 L_tmp, ener_max, ener_mean; Word16 tmp, exp2, tmp2, tmp1, exp1, exp3; Word16 scale; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif ener_mean = L_shl( 1, shl( Qnew, 1 ) ); /*2*Qnew*/ ener_max = L_shl( 1, shl( Qnew, 1 ) ); @@ -1346,11 +1340,7 @@ static Word16 edyn_fx( /* o : ratio of max to mean */ { L_tmp = L_mult0( vec[j], vec[j] ); /*2*Qnew*/ ener_max = L_max( ener_max, L_tmp ); -#ifdef ISSUE_1867_replace_overflow_libenc ener_mean = L_add_sat( ener_mean, L_tmp ); -#else - ener_mean = L_add_o( ener_mean, L_tmp, &Overflow ); -#endif } /*dyn = 10.0f * (ener_max / ener_mean);*/ ener_mean = Mult_32_16( ener_mean, div_s( 1, lvec ) ); /*2*Qnew*/ @@ -1358,11 +1348,7 @@ static Word16 edyn_fx( /* o : ratio of max to mean */ IF( ener_mean > 0 ) { exp1 = norm_l( ener_mean ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl( ener_mean, exp1 ) ); -#else - tmp1 = round_fx_o( L_shl( ener_mean, exp1 ), &Overflow ); -#endif exp1 = sub( 30, exp1 ); exp2 = norm_l( ener_max ); diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c index 50932734c..599fc57f2 100644 --- a/lib_enc/guided_plc_enc_fx.c +++ b/lib_enc/guided_plc_enc_fx.c @@ -43,13 +43,6 @@ static void coderLookAheadInnovation( move32(); move16(); move16(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* Debug init (not instrumented) */ T0_fx = -3000; @@ -167,14 +160,9 @@ static void coderLookAheadInnovation( ps_e = add( alp_e, ps_e ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1867_replace_overflow_libenc max_ps_tmp = L_shl_sat( max_ps, sub( max_ps_e, ps_e ) ); -#else - max_ps_tmp = L_shl_o( max_ps, sub( max_ps_e, ps_e ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS - IF( LT_32( max_ps_tmp, ps ) ) { max_ps = L_add( ps, 0 ); @@ -438,6 +426,8 @@ Word16 encSideSpecPowDiffuseDetector_fx( return idx; } + + /*-------------------------------------------------------------------* * updateSpecPowDiffuseIdx_fx() * @@ -448,13 +438,6 @@ void updateSpecPowDiffuseIdx_fx( { Word16 min_gp; Word16 k; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - move32(); move16(); @@ -463,26 +446,20 @@ void updateSpecPowDiffuseIdx_fx( FOR( k = 1; k < 4; k++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc st->mean_gc[1] = L_add_sat( st->mean_gc[1], st->gain_code[k] ); -#else - st->mean_gc[1] = L_add_o( st->mean_gc[1], st->gain_code[k], &Overflow ); -#endif move32(); min_gp = s_min( min_gp, st->bpf_gainT[k] ); } /* Suppress saturation warning in threshold comparison. */ test(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( LT_32( st->mean_gc[1], L_add_sat( st->mean_gc[0], Mpy_32_16_r( st->mean_gc[0], 3211 /*0.098 Q15*/ ) ) ) || GT_16( min_gp, 13435 /*0.82 Q14*/ ) ) -#else - if ( LT_32( st->mean_gc[1], L_add_o( st->mean_gc[0], Mpy_32_16_r( st->mean_gc[0], 3211 /*0.098 Q15*/ ), &Overflow ) ) || GT_16( min_gp, 13435 /*0.82 Q14*/ ) ) -#endif { move16(); st->glr_idx[0] = 0; } move16(); st->mean_gc[0] = st->mean_gc[1]; /* Q15 */ + + return; } diff --git a/lib_enc/hf_cod_amrwb_fx.c b/lib_enc/hf_cod_amrwb_fx.c index 860f5626b..e833201bc 100644 --- a/lib_enc/hf_cod_amrwb_fx.c +++ b/lib_enc/hf_cod_amrwb_fx.c @@ -87,11 +87,6 @@ void hf_cod_fx( Word32 L_tmp; Word16 *pt1; const Word16 *pt2; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* Original speech signal as reference for high band gain quantisation */ Copy( speech16k_fx, HF_SP_fx, L_SUBFR16k ); @@ -110,15 +105,10 @@ void hf_cod_fx( ener_exc_fx = dot_prod_satcontr( exc_fx, exc_fx, Q_exc, Q_exc, &q1, L_SUBFR ); ener_hf_fx = dot_prod_satcontr( HF_fx, HF_fx, -3, -3, &q2, L_SUBFR16k ); - scale_fx = div_s( shl( 1, 14 ), ener_exc_fx ); /*Q(29-q1) */ - L_tmp = L_mult( ener_hf_fx, scale_fx ); /*30-q1+q2 */ - q2 = sub( q1, q2 ); /*30-q2 */ -#ifdef ISSUE_1867_replace_overflow_libenc + scale_fx = div_s( shl( 1, 14 ), ener_exc_fx ); /*Q(29-q1) */ + L_tmp = L_mult( ener_hf_fx, scale_fx ); /*30-q1+q2 */ + q2 = sub( q1, q2 ); /*30-q2 */ scale_fx = round_fx( Isqrt( L_shl_sat( L_tmp, sub( q2, 26 ) ) ) ); /*Q13 */ -#else - scale_fx = round_fx( Isqrt( L_shl_o( L_tmp, sub( q2, 26 ), &Overflow ) ) ); /*Q13 */ -#endif - pt1 = HF_fx; FOR( i = 0; i < L_SUBFR16k; i++ ) @@ -190,15 +180,10 @@ void hf_cod_fx( ener_hf_fx = dot_prod_satcontr( HF_syn_fx, HF_syn_fx, 0, 0, &q2, L_SUBFR16k ); ener_input_fx = dot_prod_satcontr( HF_SP_fx, HF_SP_fx, 0, 0, &q1, L_SUBFR16k ); - HF_calc_gain_fx = div_s( shl( 1, 14 ), ener_input_fx ); /*Q(29-q1) */ - L_tmp = L_mult( ener_hf_fx, HF_calc_gain_fx ); /*30-q1+q2 */ - q2 = sub( q1, q2 ); /*30-q2 */ -#ifdef ISSUE_1867_replace_overflow_libenc + HF_calc_gain_fx = div_s( shl( 1, 14 ), ener_input_fx ); /*Q(29-q1) */ + L_tmp = L_mult( ener_hf_fx, HF_calc_gain_fx ); /*30-q1+q2 */ + q2 = sub( q1, q2 ); /*30-q2 */ HF_calc_gain_fx = round_fx_sat( Isqrt( L_shl_sat( L_tmp, sub( q2, 20 ) ) ) ); /*Q10 */ -#else - HF_calc_gain_fx = round_fx_o( Isqrt( L_shl_sat( L_tmp, sub( q2, 20 ) ) ), &Overflow ); /*Q10 */ -#endif - /* set energy of HF synthesis to energy of original HF: cross-fade between HF levels in active and inactive frame in hangover period */ diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 1f84c270a..1253d55fd 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -652,14 +652,9 @@ void hvq_classifier_ivas_fx( Word16 num_peak_cands, high, low; Word16 sharp[HVQ_NSUB_32k]; Word16 peak_cand_idx[HVQ_THRES_BIN_32k], avail_peaks[HVQ_NSUB_32k]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif Word16 temp_e = 0; move16(); + L_input_max = L_deposit_l( 0 ); set32_fx( L_thr, 0, L_FRAME16k ); @@ -810,11 +805,7 @@ void hvq_classifier_ivas_fx( sharp[i] = extract_h( L_shl( L_tmp, shift ) ); /* 30-s+s-8-16 -> Q6 */ move16(); /*sharp_dist += (sharp[i]-HVQ_SHARP_THRES); */ -#ifdef ISSUE_1867_replace_overflow_libenc sharp_dist = add_sat( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ) ); /* Q6 */ -#else - sharp_dist = add_o( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ), &Overflow ); /* Q6 */ -#endif if ( GT_16( sharp[i], HVQ_SHARP_THRES_FX ) ) { num_sharp_bands = add( num_sharp_bands, 1 ); @@ -1091,12 +1082,7 @@ void hvq_classifier_fx( Word16 num_peak_cands, high, low; Word16 sharp[HVQ_NSUB_32k]; Word16 peak_cand_idx[HVQ_THRES_BIN_32k], avail_peaks[HVQ_NSUB_32k]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + L_input_max = L_deposit_l( 0 ); set32_fx( L_thr, 0, L_FRAME16k ); @@ -1248,11 +1234,7 @@ void hvq_classifier_fx( move16(); /*sharp_dist += (sharp[i]-HVQ_SHARP_THRES); */ -#ifdef ISSUE_1867_replace_overflow_libenc sharp_dist = add_sat( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ) ); -#else - sharp_dist = add_o( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ), &Overflow ); -#endif IF( GT_16( sharp[i], HVQ_SHARP_THRES_FX ) ) { num_sharp_bands = add( num_sharp_bands, 1 ); diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c index 645c952e4..cce822cae 100644 --- a/lib_enc/hq_lr_enc_fx.c +++ b/lib_enc/hq_lr_enc_fx.c @@ -271,13 +271,6 @@ void hq_lr_enc_fx( Word16 beta_fx; /*Q14 1.05f; */ HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - set32_fx( L_y2, 0x0L, L_FRAME48k ); set16_fx( inp_vector_fx, 0, inner_frame_fx ); @@ -607,13 +600,9 @@ void hq_lr_enc_fx( exp = 0; move16(); } - L_tmp = Mult_32_16( Ep_vari_fx, 3277 ); /*13+15-15=13 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( Ep_vari_fx, 3277 ); /*13+15-15=13 */ L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( 12, exp ) ); /*Q(13+exp-15 +12-exp +4 = 14) */ -#else - L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( 12, exp ), &Overflow ); /*Q(13+exp-15 +12-exp +4 = 14) */ -#endif - tmp2 = extract_h( Ep_avrg_fx ); /*Q13-16=-3 */ + tmp2 = extract_h( Ep_avrg_fx ); /*Q13-16=-3 */ IF( tmp2 != 0 ) { exp = norm_s( tmp2 ); @@ -628,14 +617,10 @@ void hq_lr_enc_fx( exp = 0; move16(); } - L_tmp2 = Mult_32_16( Ep_vari_fx, 6554 ); /*13+15-15=13 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp2 = Mult_32_16( Ep_vari_fx, 6554 ); /*13+15-15=13 */ L_tmp2 = L_shl_sat( Mult_32_16( L_tmp2, tmp2 ), sub( 13, exp ) ); /*Q(13+exp-15 +13-exp +3 = 14) */ -#else - L_tmp2 = L_shl_o( Mult_32_16( L_tmp2, tmp2 ), sub( 13, exp ), &Overflow ); /*Q(13+exp-15 +13-exp +3 = 14) */ -#endif - L_tmp = L_min( L_tmp, L_tmp2 ); /*Q14 */ - tmp = extract_l( L_min( L_tmp, 13107 ) ); /*Q14 */ + L_tmp = L_min( L_tmp, L_tmp2 ); /*Q14 */ + tmp = extract_l( L_min( L_tmp, 13107 ) ); /*Q14 */ alpha_fx = add( 16384, tmp ); } IF( EQ_16( hHQ_core->last_bitalloc_max_band[j++], 1 ) ) @@ -656,14 +641,10 @@ void hq_lr_enc_fx( exp = 0; move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( Mult_32_16( Ep_avrg_fx, tmp ), sub( 14, exp ) ); /*Q(13+exp-15 +14-exp+2 = 14) */ -#else - L_tmp = L_shl_o( Mult_32_16( Ep_avrg_fx, tmp ), sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */ -#endif - L_tmp = L_max( L_tmp, 16384 ); /*Q14 */ - tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*Q14 */ - alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=Q14 */ + L_tmp = L_max( L_tmp, 16384 ); /*Q14 */ + tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*Q14 */ + alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=Q14 */ } ELSE { @@ -683,15 +664,11 @@ void hq_lr_enc_fx( exp = 0; move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( Mult_32_16( Ep_tmp_fx[i], tmp2 ), sub( 19, exp ) ); /*Q(13+exp-15 +19-exp +3 = 20) */ -#else - L_tmp = L_shl_o( Mult_32_16( Ep_tmp_fx[i], tmp2 ), sub( 19, exp ), &Overflow ); /*Q(13+exp-15 +19-exp +3 = 20) */ -#endif - L_tmp = Mult_32_16( L_tmp, shl( sub( bands_fx, lowband ), 9 ) ); /*20 +9 -15 =Q14 */ - L_tmp = L_max( L_tmp, 13926 ); /*Q14 */ - tmp2 = extract_l( L_min( L_tmp, 16384 ) ); /*Q14 */ - alpha_fx = shl( mult( alpha_fx, tmp2 ), 1 ); /*14+14-15+1 =Q14 */ + L_tmp = Mult_32_16( L_tmp, shl( sub( bands_fx, lowband ), 9 ) ); /*20 +9 -15 =Q14 */ + L_tmp = L_max( L_tmp, 13926 ); /*Q14 */ + tmp2 = extract_l( L_min( L_tmp, 16384 ) ); /*Q14 */ + alpha_fx = shl( mult( alpha_fx, tmp2 ), 1 ); /*14+14-15+1 =Q14 */ } L_band_energy_tmp[i] = L_shl( Mult_32_16( L_band_energy_tmp[i], alpha_fx ), 1 ); /*Q(Q_band_energy+14-15 +1= Q_band_energy) */ move32(); @@ -766,11 +743,7 @@ void hq_lr_enc_fx( bit_budget_fx = sub( bit_budget_fx, 2 ); /* bits in high bands to indicate the last 2 subbands is allocated bits or not Q0*/ FOR( i = 0; i < bands_fx; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_tmp_fx[i] = L_shl_sat( Ep_tmp_fx[i], 2 ); /* Q15 */ -#else - Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); /* Q15 */ -#endif move32(); } IF( EQ_32( st_fx->core_brate, ACELP_13k20 ) ) @@ -802,11 +775,7 @@ void hq_lr_enc_fx( IF( GE_16( i, lowband ) && add( sub( i, bands_fx ), p2a_bands_fx ) < 0 ) { Ep_vari_fx = L_add_sat( Ep_vari_fx, L_abs( L_sub_sat( Ep_tmp_fx[i], Ep_tmp_fx[( i - 1 )] ) ) ); /*Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif + Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ } IF( GE_16( i, highband ) ) @@ -874,12 +843,8 @@ void hq_lr_enc_fx( IF( EQ_16( hHQ_core->last_bitalloc_max_band[sub( i, add( tmp, 1 ) )], 1 ) ) { tmp = sub( tmp, lowband ); - L_tmp = Mult_32_16( Ep_tmp_fx[i], tmp ); /*Q(15+0-15 = 0) */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( Ep_tmp_fx[i], tmp ); /*Q(15+0-15 = 0) */ tmp = extract_h( L_shl_sat( L_tmp, 16 ) ); /*Q0 */ -#else - tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ -#endif IF( tmp != 0 ) { exp = norm_s( tmp ); @@ -940,19 +905,11 @@ void hq_lr_enc_fx( { IF( GE_16( i, lowband ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif IF( GT_32( Ep_tmp_fx[i], Ep_peak_fx ) ) { Ep_peak_fx = L_add( Ep_tmp_fx[i], 0 ); /*Q15 */ @@ -1216,15 +1173,9 @@ void hq_lr_enc_ivas_fx( Word32 L_band_energy_tmp[BANDS_MAX]; UWord16 lo; Word16 Q_band_energy; -#ifndef ISSUE_1867_replace_overflow_libenc - Flag Overflow; - move32(); -#endif - BSTR_ENC_HANDLE hBstr = st->hBstr; HQ_ENC_HANDLE hHQ_core = st->hHQ_core; - set32_fx( L_y2, 0x0L, L_FRAME48k ); set32_fx( inp_vector, 0, inner_frame ); flag_spt = 0; @@ -1487,11 +1438,7 @@ void hq_lr_enc_ivas_fx( } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { Ep_peak_fx = Ep_tmp_fx[i]; /*Q15 */ @@ -1615,11 +1562,7 @@ void hq_lr_enc_ivas_fx( move16(); } Mpy_32_16_ss( Ep_avrg_fx, tmp, &L_tmp, &lo ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( L_tmp, sub( 14, exp ) ); /*Q(13+exp-15 +14-exp+2 = 14) */ -#else - L_tmp = L_shl_o( L_tmp, sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */ -#endif L_tmp = L_max( L_tmp, 16384 ); /*14 */ tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */ alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */ @@ -1666,11 +1609,7 @@ void hq_lr_enc_ivas_fx( { IF( sub( i, lowband ) >= 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif } ELSE { @@ -1712,12 +1651,8 @@ void hq_lr_enc_ivas_fx( Mpy_32_16_ss( Ep_peak_fx, tmp, &L_tmp, &lo ); Mpy_32_16_ss( L_tmp, lowband, &L_tmp, &lo ); Mpy_32_16_ss( L_tmp, 18842, &L_tmp, &lo ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( L_tmp, sub( 27, exp ) ); /*Q14 0.5 */ -#else - L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ -#endif - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ + tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ Mpy_32_16_ss( L_band_energy_tmp[i], tmp2, &L_tmp, &lo ); L_band_energy_tmp[i] = L_shl( L_tmp, 1 ); /*Q_band_energy */ move32(); @@ -1740,11 +1675,7 @@ void hq_lr_enc_ivas_fx( bit_budget = sub( bit_budget, 2 ); /* bits in high bands to indicate the last 2 subbands is allocated bits or not */ FOR( i = 0; i < bands; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_tmp_fx[i] = L_shl_sat( Ep_tmp_fx[i], 2 ); /* Q15 */ -#else - Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); /* Q15 */ -#endif move32(); } IF( EQ_32( st->core_brate, ACELP_13k20 ) ) @@ -1780,11 +1711,7 @@ void hq_lr_enc_ivas_fx( IF( sub( i, lowband ) >= 0 && add( sub( i, bands ), p2a_bands ) < 0 ) { Ep_vari_fx = L_add( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ) ); /*Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif + Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ } IF( sub( i, highband ) >= 0 ) @@ -1817,11 +1744,7 @@ void hq_lr_enc_ivas_fx( tmp = sub( bands, p2a_bands ); tmp = sub( tmp, lowband ); /*Q0 */ -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = extract_h( L_shl_sat( Ep_avrg_fx, 1 ) ); /*Q0 */ -#else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ -#endif IF( tmp1 != 0 ) { exp = norm_s( tmp1 ); @@ -1860,11 +1783,7 @@ void hq_lr_enc_ivas_fx( { tmp = sub( tmp, lowband ); Mpy_32_16_ss( Ep_tmp_fx[i], tmp, &L_tmp, &lo ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp = extract_h( L_shl_sat( L_tmp, 16 ) ); /*Q0 */ -#else - tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ -#endif IF( tmp != 0 ) { exp = norm_s( tmp ); @@ -1888,12 +1807,7 @@ void hq_lr_enc_ivas_fx( ELSE { tmp = sub( tmp, lowband ); - -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = extract_h( L_shl_sat( Ep_avrg_fx, 1 ) ); /*Q0 */ -#else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ -#endif IF( tmp1 != 0 ) { exp = norm_s( tmp1 ); @@ -1932,19 +1846,11 @@ void hq_lr_enc_ivas_fx( { IF( sub( i, lowband ) >= 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else - Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { Ep_peak_fx = Ep_tmp_fx[i]; /* Q15 */ @@ -1969,11 +1875,7 @@ void hq_lr_enc_ivas_fx( move16(); FOR( i = 0; i < lowband; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = extract_h( L_shl_sat( Ep_avrgL_fx, 1 ) ); /*Q0 */ -#else - tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ -#endif IF( tmp != 0 ) { exp = norm_s( tmp ); @@ -3481,12 +3383,6 @@ static Word16 p2a_threshold_quant_fx( Word32 L_p2a; Word16 p2a_fx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif exp_safe = 4; /* never happen overflow. */ move16(); @@ -3553,11 +3449,7 @@ static Word16 p2a_threshold_quant_fx( /* 10/( log(10)/log(2) ) = 3.01029995663981195211 24660(Q13) */ L_p2a = Mpy_32_16_1( L_tmp, 24660 ); /* 16+13-15 -> Q14 */ -#ifdef ISSUE_1867_replace_overflow_libenc p2a_fx = round_fx_sat( L_shl_sat( L_p2a, 13 ) ); /* 27 -16 -> 11 */ -#else - p2a_fx = round_fx_o( L_shl_o( L_p2a, 13, &Overflow ), &Overflow ); /* 27 -16 -> 11 */ -#endif } IF( LE_16( p2a_fx, p2a_th_fx ) ) @@ -3607,12 +3499,6 @@ static Word16 p2a_threshold_quant_ivas_fx( Word32 L_p2a; Word16 p2a_fx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif exp_safe = 4; /* never happen overflow. */ move16(); @@ -3678,11 +3564,7 @@ static Word16 p2a_threshold_quant_ivas_fx( /* 10/( log(10)/log(2) ) = 3.01029995663981195211 24660(Q13) */ L_p2a = Mpy_32_16_1( L_tmp, 24660 ); /* 16+13-15 -> Q14 */ -#ifdef ISSUE_1867_replace_overflow_libenc p2a_fx = round_fx_sat( L_shl_sat( L_p2a, 13 ) ); /* 27 -16 -> 11 */ -#else - p2a_fx = round_fx_o( L_shl_o( L_p2a, 13, &Overflow ), &Overflow ); /* 27 -16 -> 11 */ -#endif } IF( LE_16( p2a_fx, p2a_th_fx ) ) @@ -3749,12 +3631,6 @@ static void mdct_spectrum_fine_gain_enc_fx( Word16 d_fx; Word16 dmin_fx; Word16 imin_fx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Fine gain quantization on only the most significant energy bands */ @@ -3824,13 +3700,9 @@ static void mdct_spectrum_fine_gain_enc_fx( exp_normn = norm_l( L_Exy ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_l( L_Eyy ); -#ifdef ISSUE_1867_replace_overflow_libenc gamma_fx = div_l( L_shl( L_Exy, exp_normn ), round_fx_sat( L_shl( L_Eyy, exp_normd ) ) ); /* Qgamma */ -#else - gamma_fx = div_l( L_shl_o( L_Exy, exp_normn, &Overflow ), round_fx_o( L_shl_o( L_Eyy, exp_normd, &Overflow ), &Overflow ) ); /* Qgamma */ -#endif - Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */ - gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */ + Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */ + gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */ dmin_fx = 32767; move16(); @@ -3917,12 +3789,6 @@ static void mdct_spectrum_fine_gain_enc_ivas_fx( Word16 d_fx; Word16 dmin_fx; Word16 imin_fx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Fine gain quantization on only the most significant energy bands */ @@ -3992,13 +3858,9 @@ static void mdct_spectrum_fine_gain_enc_ivas_fx( exp_normn = norm_l( L_Exy ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_l( L_Eyy ); -#ifdef ISSUE_1867_replace_overflow_libenc gamma_fx = div_l( L_shl( L_Exy, exp_normn ), round_fx_sat( L_shl( L_Eyy, exp_normd ) ) ); /* Qgamma */ -#else - gamma_fx = div_l( L_shl_o( L_Exy, exp_normn, &Overflow ), round_fx_o( L_shl_o( L_Eyy, exp_normd, &Overflow ), &Overflow ) ); /* Qgamma */ -#endif - Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */ - gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */ + Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */ + gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */ dmin_fx = 32767; move16(); diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index 60cf0159a..1119656fc 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -49,12 +49,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits Word16 expPeMean, expNfMean, expNfpe, expNfpe3, expo, expo3; Word16 manPeMean, manNfMean, manNfpe, man; Word16 tmp16, adjust; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + bits_used = 0; move16(); @@ -120,11 +115,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits nf_cnt = add( nf_cnt, 1 ); /* Q0 */ } -#ifdef ISSUE_1867_replace_overflow_libenc pe_mean = L_add_sat( pe_mean, pe ); /* in Q12 and always positive */ -#else - pe_mean = L_add_o( pe_mean, pe, &Overflow ); /* in Q12 and always positive */ -#endif } IF( pe_mean > 0 ) @@ -151,12 +142,8 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */ expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */ /* Number of bits required to adjust to Q15 */ - adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ -#ifdef ISSUE_1867_replace_overflow_libenc - noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#else + adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */ noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */ -#endif move16(); q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] ); move16(); @@ -236,12 +223,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits Word16 expPeMean, expNfMean, expNfpe, expNfpe3, expo, expo3; Word16 manPeMean, manNfMean, manNfpe, man; Word16 tmp16, adjust; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + bits_used = 0; move16(); @@ -307,11 +289,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits nf_cnt = add( nf_cnt, 1 ); /* Q0 */ } -#ifdef ISSUE_1867_replace_overflow_libenc pe_mean = L_add_sat( pe_mean, pe ); /* in Q12 and always positive */ -#else - pe_mean = L_add_o( pe_mean, pe, &Overflow ); /* in Q12 and always positive */ -#endif } IF( pe_mean > 0 ) diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index 4225570dd..25dfa2534 100755 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -105,12 +105,6 @@ static void IGF_CalculateEnvelope( Word16 tmp_exp; Word32 L_tmp; Word16 shift; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* initialize variables */ Copy32( pMDCTSpectrum + IGF_START_MN, hInstance->spec_be_igf, hInstance->infoStopLine - IGF_START_MN ); @@ -232,13 +226,8 @@ static void IGF_CalculateEnvelope( move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyTileR[sfb] ), sfbEnergyTileR_exp[sfb], width, 15, &gain, &gain_exp ); BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyC[sfb] ), sfbEnergyC_exp[sfb], round_fx_sat( sfbEnergyTileC[sfb] ), sfbEnergyTileC_exp[sfb], &tmp, &tmp_exp ); -#else - BASOP_Util_Divide_MantExp( round_fx_o( sfbEnergyTileR[sfb], &Overflow ), sfbEnergyTileR_exp[sfb], width, 15, &gain, &gain_exp ); - BASOP_Util_Divide_MantExp( round_fx_o( sfbEnergyC[sfb], &Overflow ), sfbEnergyC_exp[sfb], round_fx_o( sfbEnergyTileC[sfb], &Overflow ), sfbEnergyTileC_exp[sfb], &tmp, &tmp_exp ); -#endif L_tmp = L_mult( gain, tmp ); gain_exp = add( gain_exp, tmp_exp ); } @@ -266,11 +255,7 @@ static void IGF_CalculateEnvelope( L_tmp = BASOP_Util_Log2( L_tmp ); L_tmp = L_add( L_tmp, L_deposit_h( shl( gain_exp, 15 - 6 ) ) ); shift = norm_l( L_tmp ); -#ifdef ISSUE_1867_replace_overflow_libenc gain = round_fx_sat( L_shl( L_tmp, shift ) ); -#else - gain = round_fx_o( L_shl_o( L_tmp, shift, &Overflow ), &Overflow ); -#endif gain_exp = sub( 7, shift ); gain_exp = BASOP_Util_Add_MantExp( gain, gain_exp, 32767 /*16 Q11*/, 4, &gain ); gain_exp = BASOP_Util_Add_MantExp( gain, gain_exp, 0x4000, 0, &gain ); @@ -384,9 +369,6 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou Word32 highPassEner; /* Q31 */ Word32 lastLine; Word32 nextLine; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_c; -#endif Word32 highPassEner_Ovfl; Word16 s; Word16 tmploop; @@ -400,17 +382,6 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou Word16 tmp; Word32 L_tmp; -#if !defined( FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW ) && !defined( ISSUE_1867_replace_overflow_libenc ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Carry = 0; -#endif - move32(); - move32(); -#endif -#endif - hPrivateData = &hInstance->igfData; hGrid = &hPrivateData->igfInfo.grid[igfGridIdx]; igfBgn = hGrid->startLine; @@ -441,32 +412,14 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou IF( igfBgn > 0 ) { -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_c = 0; - move32(); -#else Word64 W_highPassEner = 0; move64(); -#endif FOR( i = 0; i < igfBgn; i++ ) { -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Carry = 0; - move32(); - highPassEner = L_add_co( highPassEner, Mpy_32_16_1( pPowerSpectrum[i], shl( i, 4 ) /*Q4*/ ) /*Q20, pPowerSpectrum_exp*/, &Carry, &Overflow ); - Overflow = 0; - move32(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); -#else W_highPassEner = W_add( W_highPassEner, W_deposit32_l( Mpy_32_16_1( pPowerSpectrum[i], shl( i, 4 ) /*Q4*/ ) ) /*Q20, pPowerSpectrum_exp*/ ); -#endif } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - highPassEner = norm_llQ31( L_c, highPassEner, highPassEner_exp ); /*Q20, highPassEner_exp*/ -#else highPassEner = w_norm_llQ31( W_highPassEner, highPassEner_exp ); /*Q20, highPassEner_exp*/ -#endif *highPassEner_exp = add( *highPassEner_exp, pPowerSpectrum_exp ); move16(); test(); @@ -487,13 +440,8 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou /* May overflow - just for threshold comparison */ /* negate because the negated may be 1 larger in abs, */ /* so whenever compared to the negation of a maximum possible pPowerspectrum, it is still larger */ -#ifdef ISSUE_1867_replace_overflow_libenc highPassEner_Ovfl = L_shl_sat( L_negate( highPassEner ), sub( *highPassEner_exp, pPowerSpectrum_exp ) ); L_tmp = L_add_sat( pPowerSpectrum[i - 1], highPassEner_Ovfl ); -#else - highPassEner_Ovfl = L_shl_o( L_negate( highPassEner ), sub( *highPassEner_exp, pPowerSpectrum_exp ), &Overflow ); - L_tmp = L_add_o( pPowerSpectrum[i - 1], highPassEner_Ovfl, &Overflow ); -#endif if ( L_tmp >= 0 ) { @@ -930,22 +878,12 @@ Word16 IGF_getSFM( /**< out: Q15| SFM value Word16 invDenom_exp, numf_exp; Word16 numf; Word32 SFM32; -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Word32 L_c; -#endif Word16 invDenom, SFM; #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Flag Overflow = 0; - Flag Carry = 0; -#endif move32(); move32(); #endif -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - L_c = 0; -#endif move32(); num = 0; move32(); @@ -976,23 +914,10 @@ Word16 IGF_getSFM( /**< out: Q15| SFM value n = s_max( 0, n ); num = L_add( num, L_deposit_l( n ) ); /*Q0*/ -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - Carry = 0; - move32(); - denom = L_add_co( energy[i], denom, &Carry, &Overflow ); - Overflow = 0; - move32(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); -#else W_denom = W_add( W_deposit32_l( energy[i] ), W_denom ); -#endif } -#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW - denom = norm_llQ31( L_c, denom, &denom_exp ); /*Q31*/ -#else denom = w_norm_llQ31( W_denom, &denom_exp ); /*Q31*/ -#endif denom_exp = add( denom_exp, *energy_exp ); /* calculate SFM only if signal is present */ diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 52cc9db83..c10705e5d 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -760,9 +760,6 @@ Word16 ivas_acelp_tcx20_switching_fx( Word32 offset_tcx, target; Word32 y_fx[N_MAX]; Word32 tcx_snr; -#ifndef ISSUE_1867_replace_overflow_libenc - Flag Overflow; -#endif Word32 gain, noise; Word16 noise_e = 0; move16(); @@ -1250,11 +1247,7 @@ Word16 ivas_acelp_tcx20_switching_fx( test(); if ( ( GT_32( snr_acelp, tcx_snr ) ) && ( LT_32( snr_acelp, L_add( tcx_snr, 131072 /*2.0f Q16*/ ) ) ) && -#ifdef ISSUE_1867_replace_overflow_libenc ( LT_32( L_add_sat( st->prevTempFlatness_32fx, currFlatness ), 6815744 /*3.25f Q21*/ ) || EQ_16( stab_fac, 0x7fff ) || -#else - ( LT_32( L_add_o( st->prevTempFlatness_32fx, currFlatness, &Overflow ), 6815744 /*3.25f Q21*/ ) || EQ_16( stab_fac, 0x7fff ) || -#endif ( !flag_16k_smc && ( st->sp_aud_decision0 > 0 ) && LT_32( L_add_sat( st->prevTempFlatness_32fx, currFlatness ), 41943040 /*20.f Q21*/ ) ) ) && ( LE_16( st->Nb_ACELP_frames, 6 ) ) ) { diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 469b3baa2..1f024b81d 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -766,11 +766,6 @@ static Word16 qlsf_Mode_Select_fx( Word32 temp32, En = 0; Word16 safety_net; Word16 i, cs, cl; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* calculate the prediction residual */ cl = 0; @@ -786,11 +781,7 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); -#ifdef ISSUE_1867_replace_overflow_libenc En = L_mac_sat( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i] ); /* 2.56*2.56 at Q-4 */ -#else - 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 */ -#endif } cs = shl( cs, 1 ); @@ -1970,11 +1961,6 @@ static void first_VQstages( Word16 *pTmp_short, idx_buf[2 * LSFMBEST * MAX_VQ_STAGES], parents[LSFMBEST], counter = 0, j, m, s, c, c2, p_max, *indices[2]; Word16 maxC = LSFMBEST; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*float dd[16];*/ const Word16 *cb_stage, *cbp; @@ -2000,13 +1986,9 @@ static void first_VQstages( L_tmp = L_deposit_l( 0 ); FOR( j = 0; j < N; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = L_shl_sat( L_mult0( u[j], w[j] ), 7 ); /*x2.56 + Q8 + Q7 */ -#else - L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */ -#endif - L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */ - L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */ + L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */ + L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */ } set32_fx( dist[1], L_tmp, maxC ); @@ -2166,11 +2148,6 @@ static void first_VQstages_ivas_fx( Word16 *pTmp_short, idx_buf[2 * LSFMBEST * MAX_VQ_STAGES], parents[LSFMBEST], counter = 0, j, m, s, c, c2, p_max, *indices[2]; Word16 maxC = LSFMBEST; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*float dd[16];*/ const Word16 *cb_stage, *cbp; @@ -2196,13 +2173,9 @@ static void first_VQstages_ivas_fx( L_tmp = L_deposit_l( 0 ); FOR( j = 0; j < N; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = L_shl_sat( L_mult0( u[j], w[j] ), 7 ); /*x2.56 + Q8 + Q7 */ -#else - L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */ -#endif - L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */ - L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */ + L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */ + L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */ } set32_fx( dist[1], L_shr( L_tmp, 1 ), maxC ); /*Q-1 + x2.56 +x2.56 */ @@ -2562,7 +2535,7 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( #ifdef FIX_1979_SAT_MISSING_IN_LSF_ENC L_tmp = L_mac_sat( 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_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 */ #endif } e[i] = L_tmp; @@ -3338,11 +3311,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( Word16 error_svq_fx[M], error_svq_q_fx[M]; Word16 cl, cs; Word32 temp_l; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif + IF( EQ_16( safety_net, 1 ) ) { indice[0] = 1; @@ -3414,11 +3383,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); -#ifdef ISSUE_1867_replace_overflow_libenc temp_l = L_mac_sat( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i] ); -#else - temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow ); -#endif } cs = shl( cs, 1 ); temp_l = L_shr( temp_l, cs ); @@ -3437,20 +3402,11 @@ static void FFT_Mid_Interpol_16k_fx( ) { Word16 i; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif FOR( i = 0; i < L_FFT / 2; i++ ) { /* Interpolation */ -#ifdef ISSUE_1867_replace_overflow_libenc Bin_Ener_mid[i] = L_shr( L_add_sat( Bin_Ener_old[i], Bin_Ener[i] ), 1 ); -#else - Bin_Ener_mid[i] = L_shr( L_add_o( Bin_Ener_old[i], Bin_Ener[i], &Overflow ), 1 ); -#endif /* Memory update */ Bin_Ener_old[i] = Bin_Ener[i]; @@ -3515,11 +3471,6 @@ static void lsf_mid_enc_fx( Word32 L_tmp; Word16 tmp, k1; const Word16 *ratio = NULL; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* convert LSPs to LSFs */ lsp2lsf_fx( lsp, lsf, M, int_fs ); @@ -3631,13 +3582,8 @@ static void lsf_mid_enc_fx( /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ tmp = shl_sat( tmp, 4 ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp = mult_r_sat( tmp, tmp ); err = L_mac_sat( err, tmp, shl_sat( wghts[j], 2 ) ); -#else - tmp = mult_ro( tmp, tmp, &Overflow ); - err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); -#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); @@ -3699,11 +3645,6 @@ static void lsf_mid_enc_ivas_fx( Word32 L_tmp; Word16 tmp, k1; const Word16 *ratio = NULL; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /* convert LSPs to LSFs */ lsp2lsf_fx( lsp, lsf, M, int_fs ); @@ -3824,13 +3765,8 @@ static void lsf_mid_enc_ivas_fx( /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ tmp = shl_sat( tmp, 4 ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp = mult_r_sat( tmp, tmp ); err = L_mac_sat( err, tmp, shl_sat( wghts[j], 2 ) ); -#else - tmp = mult_ro( tmp, tmp, &Overflow ); - err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &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 333ea97ff..c0e02d6c2 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -1576,11 +1576,6 @@ void midlsf_enc_fx( Word32 err, err_min, L_tmp; Word16 k, k1, j, tmp, size, qlsf[M], wghts[M]; const Word16 *ratio; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif IF( EQ_16( coder_type, UNVOICED ) ) { @@ -1631,18 +1626,10 @@ void midlsf_enc_fx( /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ tmp = shl_sat( tmp, 4 ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp = mult_r_sat( tmp, tmp ); -#else - tmp = mult_ro( tmp, tmp, &Overflow ); -#endif err = L_mac( err, tmp, wghts[j] ); } -#ifdef ISSUE_1867_replace_overflow_libenc err = L_shl_sat( err, 2 ); -#else - err = L_shl_o( err, 2, &Overflow ); -#endif /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); diff --git a/lib_enc/mdct_classifier_fx.c b/lib_enc/mdct_classifier_fx.c index 790ec7aa8..2b55889f5 100644 --- a/lib_enc/mdct_classifier_fx.c +++ b/lib_enc/mdct_classifier_fx.c @@ -118,16 +118,9 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision Word16 exp, exp1, exp2, exp3; Word32 L_tmp, L_tmp1; TCX_ENC_HANDLE hTcxEnc = st_fx->hTcxEnc; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif - test(); - { - dft_mag_square_fx( fft_buff, magSq, 256 ); - } + dft_mag_square_fx( fft_buff, magSq, 256 ); + nf = L_add( magSq[0], 0 ); pe = L_add( magSq[0], 0 ); np = 0; @@ -358,11 +351,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_sat( avrg_H1, 1 ) ) ) || ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( L_tmp, exp ), L_shl( avrg_l, exp1 ) ) ) || GT_32( Mult_32_32( L_shl( L_tmp1, exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) ) -#else - IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_o( avrg_H1, 1, &Overflow ) ) ) || ( LT_32( Mult_32_32( L_shl_o( peak_l, exp, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( L_tmp, exp, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) || GT_32( Mult_32_32( L_shl_o( L_tmp1, exp2, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( peak_h, exp2, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) ) ) -#endif { condition3 = 1; move16(); @@ -456,11 +445,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_sat( gain1_tmp, 1 ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_sat( gain2_tmp, 1 ) ) ) ) ) -#else - IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_o( gain1_tmp, 1, &Overflow ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_o( gain2_tmp, 1, &Overflow ) ) ) ) ) -#endif { clas_final = hTcxEnc->clas_final_old; move16(); @@ -553,10 +538,6 @@ Word16 mdct_classifier_ivas_fx( Word16 exp, exp1, exp2, exp3; Word32 gain1_tmp = 0, gain2_tmp = 0; Word32 L_tmp, L_tmp1; -#ifndef ISSUE_1867_replace_overflow_libenc - Flag Overflow = 0; - move16(); -#endif move16(); move16(); @@ -900,11 +881,7 @@ Word16 mdct_classifier_ivas_fx( test(); test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_sat( avrg_H1, 1 ) ) ) || ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( L_tmp, exp ), L_shl( avrg_l, exp1 ) ) ) || GT_32( Mult_32_32( L_shl( L_tmp1, exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) ) -#else - IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_o( avrg_H1, 1, &Overflow ) ) ) || ( LT_32( Mult_32_32( L_shl_o( peak_l, exp, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( L_tmp, exp, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) || GT_32( Mult_32_32( L_shl_o( L_tmp1, exp2, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( peak_h, exp2, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) ) ) -#endif { condition3 = 1; move16(); @@ -1005,11 +982,7 @@ Word16 mdct_classifier_ivas_fx( test(); test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_sat( gain1_tmp, 1 ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_sat( gain2_tmp, 1 ) ) ) ) ) -#else - IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_o( gain1_tmp, 1, &Overflow ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_o( gain2_tmp, 1, &Overflow ) ) ) ) ) -#endif { clas_final = hTcxEnc->clas_final_old; move16(); diff --git a/lib_enc/multi_harm_fx.c b/lib_enc/multi_harm_fx.c index ba68b6852..707dd397f 100644 --- a/lib_enc/multi_harm_fx.c +++ b/lib_enc/multi_harm_fx.c @@ -41,12 +41,6 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity Word32 L_acc; Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum; Word16 mean_dyn; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*------------------------------------------------------------------* * initialization @@ -214,11 +208,7 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity IF( EQ_16( i, ind_mins[k] ) ) { /* include the last peak point (new minimum) to the corr. sum */ -#ifdef ISSUE_1867_replace_overflow_libenc Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] ); -#else - Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow ); -#endif /* calculation of the norm. peak correlation */ test(); @@ -269,15 +259,9 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity k++; } -#ifdef ISSUE_1867_replace_overflow_libenc Lcorx2 = L_mac_sat( Lcorx2, S[i], S[i] ); Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] ); Lcorxy = L_mac_sat( Lcorxy, S[i], old_S[i] ); -#else - Lcorx2 = L_mac_o( Lcorx2, S[i], S[i], &Overflow ); - Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow ); - Lcorxy = L_mac_o( Lcorxy, S[i], old_S[i], &Overflow ); -#endif } Copy( S, old_S, ind_mins[0] ); @@ -396,12 +380,6 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni Word32 L_acc; Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum; Word16 mean_dyn; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*------------------------------------------------------------------* * initialization @@ -563,11 +541,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni IF( EQ_16( i, ind_mins[k] ) ) { /* include the last peak point (new minimum) to the corr. sum */ -#ifdef ISSUE_1867_replace_overflow_libenc Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] ); -#else - Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow ); -#endif /* calculation of the norm. peak correlation */ test(); @@ -618,15 +592,9 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni k++; } -#ifdef ISSUE_1867_replace_overflow_libenc Lcorx2 = L_mac_sat( Lcorx2, S[i], S[i] ); Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] ); Lcorxy = L_mac_sat( Lcorxy, S[i], old_S[i] ); -#else - Lcorx2 = L_mac_o( Lcorx2, S[i], S[i], &Overflow ); - Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow ); - Lcorxy = L_mac_o( Lcorxy, S[i], old_S[i], &Overflow ); -#endif } Copy( S, old_S, ind_mins[0] ); diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c index 9d192500f..9122be431 100644 --- a/lib_enc/nelp_enc_fx.c +++ b/lib_enc/nelp_enc_fx.c @@ -354,12 +354,6 @@ void nelp_encoder_fx( move32(); Word16 BP1_ORDER; Word16 rf_flag; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; RF_ENC_HANDLE hRF = st_fx->hRF; @@ -424,15 +418,10 @@ void nelp_encoder_fx( E1_fx = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc E1_fx = L_mac0_sat( E1_fx, in_fx[i], in_fx[i] ); /*Q(qE1+qE1) */ -#else - E1_fx = L_mac0_o( E1_fx, in_fx[i], in_fx[i], &Overflow ); /*Q(qE1+qE1) */ -#endif } qE1 = shl( qE1, 1 ); - ; qf = qIn; move16(); @@ -444,11 +433,7 @@ void nelp_encoder_fx( EL1_fx = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc EL1_fx = L_mac0_sat( EL1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qIn) */ -#else - EL1_fx = L_mac0_o( EL1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qIn) */ -#endif } qEL1 = shl( qEL1, 1 ); @@ -464,11 +449,7 @@ void nelp_encoder_fx( EH1_fx = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc EH1_fx = L_mac0_sat( EH1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEH1) */ -#else - EH1_fx = L_mac0_o( EH1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qEH1) */ -#endif } qEH1 = 2 * qEH1; move16(); @@ -484,11 +465,7 @@ void nelp_encoder_fx( Ltemp = L_deposit_l( 0 ); FOR( j = (Word16) ( i * lag ); j < (Word16) ( ( i + 1 ) * lag ); j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */ -#else - Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */ -#endif } /*Gains[i] = (float) sqrt(Gains[i]/lag); */ @@ -512,11 +489,7 @@ void nelp_encoder_fx( Ltemp = L_deposit_l( 0 ); FOR( j = (Word16) ( i * lag ); j < L_FRAME; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */ -#else - Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */ -#endif } /*Gains[i] = (float) sqrt(Gains[i]/(L_FRAME-(lag*i))); */ @@ -1121,12 +1094,6 @@ void nelp_encoder_ivas_fx( move32(); Word16 BP1_ORDER; Word16 rf_flag; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; RF_ENC_HANDLE hRF = st_fx->hRF; @@ -1193,11 +1160,7 @@ void nelp_encoder_ivas_fx( E1_fx = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc E1_fx = L_mac0_sat( E1_fx, in_fx[i], in_fx[i] ); /*Q(qE1+qE1) */ -#else - E1_fx = L_mac0_o( E1_fx, in_fx[i], in_fx[i], &Overflow ); /*Q(qE1+qE1) */ -#endif } qE1 = shl( qE1, 1 ); @@ -1212,11 +1175,7 @@ void nelp_encoder_ivas_fx( EL1_fx = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc EL1_fx = L_mac0_sat( EL1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qIn) */ -#else - EL1_fx = L_mac0_o( EL1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qIn) */ -#endif } qEL1 = shl( qEL1, 1 ); @@ -1232,11 +1191,7 @@ void nelp_encoder_ivas_fx( EH1_fx = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc EH1_fx = L_mac0_sat( EH1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEH1) */ -#else - EH1_fx = L_mac0_o( EH1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qEH1) */ -#endif } qEH1 = shl( qEH1, 1 ); move16(); @@ -1251,11 +1206,7 @@ void nelp_encoder_ivas_fx( Ltemp = L_deposit_l( 0 ); FOR( j = (Word16) ( i * lag ); j < (Word16) ( ( i + 1 ) * lag ); j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */ -#else - Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */ -#endif } /*Gains[i] = (float) sqrt(Gains[i]/lag); */ @@ -1279,11 +1230,7 @@ void nelp_encoder_ivas_fx( Ltemp = L_deposit_l( 0 ); FOR( j = i_mult( i, lag ); j < L_FRAME; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */ -#else - Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */ -#endif } /*Gains[i] = (float) sqrt(Gains[i]/(L_FRAME-(lag*i))); */ diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index fb07df485..181b1f10e 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -102,16 +102,8 @@ static Word16 noise_est_ln_q8_fx( { Word16 e_ener, f_ener; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - L_tmp = L_add_o( L_enr, L_shl( (Word32) 1L, q_new_plus_q_scale ), &Overflow ); /* +1.0f */ -#else L_tmp = L_add_sat( L_enr, L_shl( (Word32) 1L, q_new_plus_q_scale ) ); /* +1.0f */ -#endif if ( flag_add1p0 == 0 ) { L_tmp = L_add( L_enr, 0 ); /* +0 , no offset */ @@ -123,9 +115,11 @@ static Word16 noise_est_ln_q8_fx( f_ener = Log2_norm_lc( L_shl( L_tmp, e_ener ) ); e_ener = sub( sub( 30, e_ener ), q_new_plus_q_scale ); L_tmp = Mpy_32_16( e_ener, f_ener, 22713 ); /* Q16 (22713 = Ln(2) in Q15)*/ - return round_fx( L_shl( L_tmp, 8 ) ); /* Q8 */ + + return round_fx( L_shl( L_tmp, 8 ) ); /* Q8 */ } + /*-----------------------------------------------------------------* * eps_quota_fx() * @@ -668,11 +662,6 @@ void noise_est_down_fx( Word16 scale; Word32 totalNoise_temp; Word32 L_Etot, L_Etot_last, L_Etot_v_h2, L_Etot_v; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif L_Etot = L_shl( Etot, 16 ); /*Q24 for later AR1 computations*/ L_Etot_last = L_shl( *Etot_last, 16 ); @@ -687,15 +676,9 @@ void noise_est_down_fx( totalNoise_temp = L_deposit_l( 0 ); FOR( i = min_band; i <= max_band; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc totalNoise_temp = L_add_sat( totalNoise_temp, bckr[i] ); /*Q_new+QSCALE*/ -#else - totalNoise_temp = L_add_o( totalNoise_temp, bckr[i], &Overflow ); /*Q_new+QSCALE*/ -#endif } totalNoise_temp = L_max( totalNoise_temp, L_shl( e_min, 4 ) ); - - totalNoise_temp = L_max( totalNoise_temp, (Word32) 1L ); /* make sure log2_norm_lc does not cause table reading out of bounds */ /*totalNoise = 10.0f * (float)log10( *totalNoise );*/ @@ -715,11 +698,7 @@ void noise_est_down_fx( FOR( i = 0; i < NB_BANDS; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_add_sat( L_shr_r( *pt1, 1 ), L_shr_r( *pt2, 1 ) ); -#else - Ltmp = L_add_o( L_shr_r( *pt1, 1 ), L_shr_r( *pt2, 1 ), &Overflow ); -#endif /*Ltmp = L_shr_r(L_add(*pt1,*pt2),1);*/ enr[i] = Ltmp; move32(); /*Q_new+QSCALE*/ @@ -1010,19 +989,8 @@ void noise_est_fx( SP_MUS_CLAS_HANDLE hSpMusClas; hSpMusClas = st_fx->hSpMusClas; (void) ( ncharX ); - - /* Check if LR-VAD */ - { - hNoiseEst = st_fx->hNoiseEst; - } - + hNoiseEst = st_fx->hNoiseEst; GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*-----------------------------------------------------------------* * Initialization @@ -1073,6 +1041,7 @@ void noise_est_fx( } } } + /*-----------------------------------------------------------------* * Set the threshold for eps & non_sta based on input sampling rate * The reason is that in case of 8kHz sampling input, there is nothing @@ -1104,7 +1073,6 @@ void noise_est_fx( move16(); } - /*-----------------------------------------------------------------* * Estimation of pitch stationarity *-----------------------------------------------------------------*/ @@ -1117,13 +1085,8 @@ void noise_est_fx( Ltmp = L_deposit_h( corr_shift ); Ltmp = L_mac( Ltmp, st_fx->voicing_fx[0], 10923 ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_mac_sat( Ltmp, st_fx->voicing_fx[1], 10923 ); wtmp = mac_r_sat( Ltmp, st_fx->voicing_fx[2], 10923 ); -#else - Ltmp = L_mac_o( Ltmp, st_fx->voicing_fx[1], 10923, &Overflow ); - wtmp = mac_ro( Ltmp, st_fx->voicing_fx[2], 10923, &Overflow ); -#endif tmp_pc = pc; move16(); @@ -1139,16 +1102,15 @@ void noise_est_fx( * Multi-harmonic analysis *-----------------------------------------------------------------*/ + IF( st_fx->hSpMusClas != NULL ) { - IF( st_fx->hSpMusClas != NULL ) - { - i = 0; - move16(); - *loc_harm = multi_harm_fx( EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, - st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); - move16(); - } + i = 0; + move16(); + *loc_harm = multi_harm_fx( EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, + st_fx->bwidth, ( st_fx->hGSCEnc != NULL ) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map ); + move16(); } + /*-----------------------------------------------------------------* * Detection of frames with non-stationary spectral content *-----------------------------------------------------------------*/ @@ -1176,11 +1138,7 @@ void noise_est_fx( FOR( i = 10; i <= st_fx->max_band; i++ ) { Lnum = L_max( *pt1, *pt2 ); /* Don't need if anymore */ -#ifdef ISSUE_1867_replace_overflow_libenc Lsum_den = L_add_sat( Lsum_den, Lnum ); -#else - Lsum_den = L_add_o( Lsum_den, Lnum, &Overflow ); -#endif Ltmpden = L_min( *pt1, *pt2 ); if ( Ltmpden == 0 ) { @@ -1296,11 +1254,7 @@ void noise_est_fx( /* alpha = 0.064f * ftemp + 0.75f; */ Ltmp = Mult_32_16( (Word32) 137438953L, tmp ); /* Q31(.064)+Q8+1-16 --> Q24 */ Ltmp = L_mac( Ltmp, 256, 24576 ); /* Q8+Q15(.75)+1 --> Q24 */ -#ifdef ISSUE_1867_replace_overflow_libenc - alpha = round_fx_sat( L_shl_sat( Ltmp, 7 ) ); /*Q24 +7 --> Q31 Q15*/ -#else - alpha = round_fx_o( L_shl_o( Ltmp, 7, &Overflow ), &Overflow ); /*Q24 +7 --> Q31 Q15*/ -#endif + alpha = round_fx_sat( L_shl_sat( Ltmp, 7 ) ); /*Q24 +7 --> Q31 Q15*/ /*if( alpha > 0.999f { alpha = 0.999f;} */ alpha = s_min( alpha, 32735 ); /*.999 in Q15*/ @@ -1335,14 +1289,9 @@ void noise_est_fx( /* + 1.0f added to reduce sensitivity to non stationarity in low energies */ /* tmp_enr = enr[i] + 1.0f; */ tmp_Q = add( Q_new, Q_SCALE ); - Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */ L_tmp_enr = L_add_sat( enr[i], Ltmp ); /* enr scale dynamic */ L_tmp_ave_enr = L_add_sat( hNoiseEst->ave_enr_fx[i], Ltmp ); /* ave__enr scale dynamic */ -#else - L_tmp_enr = L_add_o( enr[i], Ltmp, &Overflow ); /* enr scale dynamic */ - L_tmp_ave_enr = L_add_o( hNoiseEst->ave_enr_fx[i], Ltmp, &Overflow ); /* ave__enr scale dynamic */ -#endif IF( LE_32( non_sta, th_sta ) ) /* Just to limit the saturation */ { @@ -1381,14 +1330,10 @@ void noise_est_fx( } */ /* ave_enr2:: calculation of another non-stationarity measure (following attacks) */ - Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */ - /*L_tmp_enr = L_add(enr[i] , Ltmp );*/ /* enr scale dynamic , done above */ -#ifdef ISSUE_1867_replace_overflow_libenc + Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */ + /*L_tmp_enr = L_add(enr[i] , Ltmp );*/ /* enr scale dynamic , done above */ L_tmp_ave_enr2 = L_add_sat( hNoiseEst->ave_enr2_fx[i], Ltmp ); /* ave__enr scale dynamic */ -#else - L_tmp_ave_enr2 = L_add_o( hNoiseEst->ave_enr2_fx[i], Ltmp, &Overflow ); /* ave__enr scale dynamic */ -#endif - IF( LE_32( Lnon_sta2, th_sta ) ) /* Just to limit the saturation */ + IF( LE_32( Lnon_sta2, th_sta ) ) /* Just to limit the saturation */ { Lnum = L_max( L_tmp_enr, L_tmp_ave_enr2 ); Lden = L_min( L_tmp_enr, L_tmp_ave_enr2 ); @@ -1419,11 +1364,7 @@ void noise_est_fx( /* log_enr = (float)ln_fx(enr[i]); */ log_enr16 = noise_est_ln_q8_fx( enr[i], 0, tmp_Q ); wtmp = abs_s( sub( log_enr16, hSpMusClas->past_log_enr_fx[i - START_BAND_SPMUS] ) ); -#ifdef ISSUE_1867_replace_overflow_libenc *non_staX = add_sat( *non_staX, wtmp ); -#else - *non_staX = add_o( *non_staX, wtmp, &Overflow ); -#endif move16(); /* Q8 */ hSpMusClas->past_log_enr_fx[i - START_BAND_SPMUS] = log_enr16; move16(); @@ -1439,11 +1380,7 @@ void noise_est_fx( tmp_floor = LN_E_MIN_PLUS_ONE_FX; move16(); /* non dynamic init constant in Q8 */ tmp_floor = noise_est_ln_q8_fx( hNoiseEst->bckr_fx[i], 1, tmp_Q ); -#ifdef ISSUE_1867_replace_overflow_libenc non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ) ); /* Q8 */ -#else - non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */ -#endif } ELSE /*ini_frame < 100*/ { @@ -1452,11 +1389,7 @@ void noise_est_fx( tmp_floor = LN_E_MIN_PLUS_ONE_FX; move16(); /* non dynamic init constant in Q8 */ tmp_floor = noise_est_ln_q8_fx( E_MIN_FX, 1, tmp_Q ); -#ifdef ISSUE_1867_replace_overflow_libenc non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ) ); /* Q8 */ -#else - non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */ -#endif } } @@ -1568,12 +1501,8 @@ void noise_est_fx( Ltmp = eps_quota_fx( epsP_h[0], epsP_l[0], epsP_h[2], epsP_l[2], 12 ); /* Word32 Q12 */ BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/ -#ifdef ISSUE_1867_replace_overflow_libenc epsP_0_2 = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12+16 -16 -> Q12 , NB saturation in Q12 sets max value to 7,999 */ -#else - epsP_0_2 = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12+16 -16 -> Q12 , NB saturation in Q12 sets max value to 7,999 */ -#endif BASOP_SATURATE_WARNING_ON_EVS epsP_0_2 = s_max( 0, epsP_0_2 ); /* min value is 0 , Q12 */ @@ -1610,13 +1539,9 @@ void noise_est_fx( /* epsP_2_16 = max(0 , min(8, epsP[2] / epsP[16])); */ Ltmp = eps_quota_fx( epsP_h[2], epsP_l[2], - epsP_h[16], epsP_l[16], 12 ); /* Word32 Q12 */ - BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/ -#ifdef ISSUE_1867_replace_overflow_libenc + epsP_h[16], epsP_l[16], 12 ); /* Word32 Q12 */ + BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/ epsP_2_16 = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12+16 -16 -> Q12 ,*/ -#else - epsP_2_16 = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12+16 -16 -> Q12 ,*/ -#endif /*NB saturation in Q12 sets max value to 7,999 */ BASOP_SATURATE_WARNING_ON_EVS @@ -1739,12 +1664,7 @@ void noise_est_fx( *-----------------------------------------------------------------*/ Ltmp = L_mult( st_fx->voicing_fx[0], 16384 ); Ltmp = L_mac( Ltmp, st_fx->voicing_fx[1], 16384 ); -#ifdef ISSUE_1867_replace_overflow_libenc cor_tmp = mac_r_sat( Ltmp, corr_shift, MAX_16 ); -#else - cor_tmp = mac_ro( Ltmp, corr_shift, MAX_16, &Overflow ); -#endif - LepsP = eps_quota_fx( epsP_h[2], epsP_l[2], epsP_h[16], epsP_l[16], 11 ); /* L_epsP in Q11 */ /* note this epsP2/eps16 is not limited to 8 as, epsP_2_16 is !! */ @@ -2346,12 +2266,6 @@ void noise_est_ivas_fx( Le_min_scaled = L_shl( E_MIN_FXQ31, sub( q_fr_bands, Q31 ) ); // q_fr_bands GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Check if LR-VAD */ IF( hFrontVad != NULL ) @@ -2454,7 +2368,6 @@ void noise_est_ivas_fx( move16(); } - /*-----------------------------------------------------------------* * Estimation of pitch stationarity *-----------------------------------------------------------------*/ @@ -2464,16 +2377,10 @@ void noise_est_ivas_fx( wtmp1 = abs_s( sub( st_fx->pitch[1], st_fx->pitch[0] ) ); pc = add( wtmp, wtmp1 ); - Ltmp = L_deposit_h( corr_shift ); Ltmp = L_mac( Ltmp, st_fx->voicing_fx[0], 10923 ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp = L_mac_sat( Ltmp, st_fx->voicing_fx[1], 10923 ); wtmp = mac_r_sat( Ltmp, st_fx->voicing_fx[2], 10923 ); -#else - Ltmp = L_mac_o( Ltmp, st_fx->voicing_fx[1], 10923, &Overflow ); - wtmp = mac_ro( Ltmp, st_fx->voicing_fx[2], 10923, &Overflow ); -#endif tmp_pc = pc; move16(); @@ -2685,11 +2592,7 @@ void noise_est_ivas_fx( /* alpha = 0.064f * ftemp + 0.75f; */ Ltmp = Madd_32_16( 12582912 /* 0.75 in Q24*/, 137438953, tmp ); // Q24 -#ifdef ISSUE_1867_replace_overflow_libenc - alpha = round_fx_sat( L_shl_sat( Ltmp, 7 ) ); /*Q24 +7 --> Q31 Q15*/ -#else - alpha = round_fx_o( L_shl_o( Ltmp, 7, &Overflow ), &Overflow ); /*Q24 +7 --> Q31 Q15*/ -#endif + alpha = round_fx_sat( L_shl_sat( Ltmp, 7 ) ); /*Q24 +7 --> Q31 Q15*/ /*if( alpha > 0.999f { alpha = 0.999f;} */ alpha = s_min( alpha, 32735 ); /*.999 in Q15*/ @@ -2842,11 +2745,7 @@ void noise_est_ivas_fx( IF( LT_16( ini_frame, 100 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, LN_E_MIN_PLUS_ONE_FX ) ) ); /* Q8 */ -#else - non_staB = add_o( non_staB, abs_s( sub( tmp_enr, LN_E_MIN_PLUS_ONE_FX ) ), &Overflow ); /* Q8 */ -#endif } ELSE /*ini_frame < 100*/ { @@ -2868,11 +2767,7 @@ void noise_est_ivas_fx( Ltmp1 = Mpy_32_16_1( Ltmp1, 22713 ); // Q15 tmp_floor = round_fx( L_shl( Ltmp1, 9 ) ); /* Q8 */ } -#ifdef ISSUE_1867_replace_overflow_libenc non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ) ); /* Q8 */ -#else - non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */ -#endif } } diff --git a/lib_enc/normalizecoefs_fx.c b/lib_enc/normalizecoefs_fx.c index 1dcf6b6e2..696bf272f 100644 --- a/lib_enc/normalizecoefs_fx.c +++ b/lib_enc/normalizecoefs_fx.c @@ -29,12 +29,7 @@ void normalizecoefs_fx( Word16 *pcoefs16; Word32 *pcoefs; Word16 subvec_start, subvec_end, num_coefs; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + pcoefs = coefs; pcoefs16 = coefs_norm; @@ -57,11 +52,7 @@ void normalizecoefs_fx( *pcoefs = Mpy_32_16_1( *pcoefs, INV2POWHALF ); move32(); } -#ifdef ISSUE_1867_replace_overflow_libenc *pcoefs16++ = round_fx_sat( L_shl_sat( *pcoefs++, 16 - k ) ); /* Q12 */ -#else - *pcoefs16++ = round_fx_o( L_shl_o( *pcoefs++, 16 - k, &Overflow ), &Overflow ); /* Q12 */ -#endif move16(); } } diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index be35a5a12..c20ec2479 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -964,12 +964,6 @@ void norm_corr_ivas_fx( Word16 h_e, e_max; Word32 L_tmp; Word64 W_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif k = negate( t_min ); h_e = add( 1, norm_s( h[0] ) ); // exponent of h @@ -987,15 +981,10 @@ void norm_corr_ivas_fx( FOR( t = t_min; t <= t_max; t++ ) { /* Compute correlation between xn[] and excf[] */ - L_tmp = L_mac( 0, xn[0], excf[0] ); FOR( i = 1; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, xn[i], excf[i] ); // (Q_new - 1) + (Q_new - h_e) + 1 -#else - L_tmp = L_mac_o( L_tmp, xn[i], excf[i], &Overflow ); // (Q_new - 1) + (Q_new - h_e) + 1 -#endif } exp = norm_l( L_tmp ); L_tmp = L_shl( L_tmp, exp ); @@ -1066,12 +1055,6 @@ void norm_corr_fx( Word16 corr, exp_corr, norm, exp_norm, exp, scale; Word16 excf[L_FRAME16k]; Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif k = negate( t_min ); @@ -1082,18 +1065,10 @@ void norm_corr_fx( conv_fx( &exc[k], h, excf, L_subfr ); /* Compute rounded down 1/sqrt(energy of xn[]) */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( 1, xn[0], xn[0] ); -#else - L_tmp = L_mac_o( 1, xn[0], xn[0], &Overflow ); -#endif FOR( i = 1; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, xn[i], xn[i] ); -#else - L_tmp = L_mac_o( L_tmp, xn[i], xn[i], &Overflow ); -#endif } exp = norm_l( L_tmp ); exp = sub( 30, exp ); @@ -1108,15 +1083,10 @@ void norm_corr_fx( FOR( t = t_min; t <= t_max; t++ ) { /* Compute correlation between xn[] and excf[] */ - L_tmp = L_mac( 1, xn[0], excf[0] ); FOR( i = 1; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, xn[i], excf[i] ); -#else - L_tmp = L_mac_o( L_tmp, xn[i], excf[i], &Overflow ); -#endif } exp = norm_l( L_tmp ); L_tmp = L_shl( L_tmp, exp ); @@ -1127,11 +1097,7 @@ void norm_corr_fx( L_tmp = L_mac( 1, excf[0], excf[0] ); FOR( i = 1; i < L_subfr; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, excf[i], excf[i] ); -#else - L_tmp = L_mac_o( L_tmp, excf[i], excf[i], &Overflow ); -#endif } exp = norm_l( L_tmp ); diff --git a/lib_enc/pitch_ol2_fx.c b/lib_enc/pitch_ol2_fx.c index 3e2ef6c31..ab97b6150 100644 --- a/lib_enc/pitch_ol2_fx.c +++ b/lib_enc/pitch_ol2_fx.c @@ -50,12 +50,6 @@ void pitch_ol2_fx( Word32 R1, R2; Word16 R0, exp_R0, exp_R1, exp_R2, j; Word16 pit_max; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* initialization */ pit_max = PIT_MAX; @@ -84,13 +78,8 @@ void pitch_ol2_fx( pt_cor_fx = cor_fx; FOR( t = t_min; t <= t_max; t++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc t0 = L_shl_sat( *pt_cor_32++, exp3 ); *pt_cor_fx++ = round_fx_sat( t0 ); -#else - t0 = L_shl_o( *pt_cor_32++, exp3, &Overflow ); - *pt_cor_fx++ = round_fx_o( t0, &Overflow ); -#endif move16(); } @@ -196,11 +185,7 @@ void pitch_ol2_fx( exp_R2 = norm_l( R2 ); R2 = L_shl( R2, exp_R2 ); -#ifdef ISSUE_1867_replace_overflow_libenc R1 = L_mult_sat( round_fx_sat( R1 ), round_fx_sat( R2 ) ); -#else - R1 = L_mult_o( round_fx_o( R1, &Overflow ), round_fx_o( R2, &Overflow ), &Overflow ); -#endif i = norm_l( R1 ); R1 = L_shl( R1, i ); @@ -210,19 +195,11 @@ void pitch_ol2_fx( R1 = Isqrt_lc( R1, &exp_R1 ); -#ifdef ISSUE_1867_replace_overflow_libenc R1 = L_mult( R0, round_fx_sat( R1 ) ); -#else - R1 = L_mult( R0, round_fx_o( R1, &Overflow ) ); -#endif exp_R0 = sub( 31, exp_R0 ); exp_R0 = sub( add( exp_R0, exp_R1 ), exp3 ); -#ifdef ISSUE_1867_replace_overflow_libenc *voicing_fr_fx = round_fx_sat( L_shl_sat( R1, exp_R0 ) ); /*Q15*/ -#else - *voicing_fr_fx = round_fx_o( L_shl_o( R1, exp_R0, &Overflow ), &Overflow ); /*Q15*/ -#endif move16(); } ELSE @@ -262,12 +239,6 @@ void StableHighPitchDetect_fx( Word16 tmp, tmp1, exp, diff16, cor_max16, exp1, exp2, pit_min_up; Word32 L_tmp, L_tmp1; Word16 Top; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*voicing = (voicing[0] + voicing[1] + voicing[2] )/3;*/ L_tmp = L_mult( voicing[0], 10923 /*1/3 in Q15*/ ); @@ -316,35 +287,21 @@ void StableHighPitchDetect_fx( tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) ); -#ifdef ISSUE_1867_replace_overflow_libenc BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_sat( diff ); -#else - BASOP_SATURATE_WARNING_ON_EVS - diff16 = round_fx_o( diff, &Overflow ); -#endif } ELSE { tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_sat( diff ); -#else - BASOP_SATURATE_WARNING_ON_EVS - diff16 = round_fx_o( diff, &Overflow ); -#endif } } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc diff16 = round_fx_sat( L_shl_sat( diff, 25 ) ); -#else - diff16 = round_fx_o( L_shl_o( diff, 25, &Overflow ), &Overflow ); -#endif } test(); test(); @@ -421,11 +378,7 @@ void StableHighPitchDetect_fx( L_tmp1 = Isqrt_lc( L_tmp1, &exp ); /*Q(31-exp)*/ cor_max = Mult_32_32( cor_max, L_tmp1 ); exp = 31 - ( shl( Q_new, 1 ) + 1 ) - ( 31 - exp ) + 31; -#ifdef ISSUE_1867_replace_overflow_libenc cor_max16 = round_fx_sat( L_shl_sat( cor_max, exp ) ); /*Q15*/ -#else - cor_max16 = round_fx_o( L_shl_o( cor_max, exp, &Overflow ), &Overflow ); /*Q15*/ -#endif /**voicing0_sm = add(mult_r(24576 ,(*voicing0_sm)) , mult_r(8192 , cor_max16));*/ *voicing0_sm = round_fx( L_mac( L_mult( 24576 /*.75f Q15*/, *voicing0_sm ), 8192 /*.25f Q15*/, cor_max16 ) ); move16(); @@ -490,12 +443,6 @@ void StableHighPitchDetect_ivas_fx( Word16 tmp, tmp1, exp, diff16, cor_max16, exp1, exp2, pit_min_up; Word32 L_tmp, L_tmp1; Word16 Top; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*voicing = (voicing[0] + voicing[1] + voicing[2] )/3;*/ L_tmp = L_mult( voicing[0], 10923 /*1/3 in Q15*/ ); @@ -551,35 +498,21 @@ void StableHighPitchDetect_ivas_fx( tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) ); -#ifdef ISSUE_1867_replace_overflow_libenc BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_sat( diff ); -#else - BASOP_SATURATE_WARNING_ON_EVS - diff16 = round_fx_o( diff, &Overflow ); -#endif } ELSE { tmp = div_s( 16384, tmp ); /*Q(15+exp)*/ BASOP_SATURATE_WARNING_OFF_EVS diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc BASOP_SATURATE_WARNING_ON_EVS diff16 = round_fx_sat( diff ); -#else - BASOP_SATURATE_WARNING_ON_EVS - diff16 = round_fx_o( diff, &Overflow ); -#endif } } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc diff16 = round_fx_sat( L_shl_sat( diff, 25 ) ); -#else - diff16 = round_fx_o( L_shl_o( diff, 25, &Overflow ), &Overflow ); -#endif } test(); test(); @@ -665,11 +598,7 @@ void StableHighPitchDetect_ivas_fx( L_tmp1 = Isqrt_lc( L_tmp1, &exp ); /*Q(31-exp)*/ cor_max = Mult_32_32( cor_max, L_tmp1 ); exp = add( sub( sub( 31, add( shl( Q_new, 1 ), 1 ) ), sub( 31, exp ) ), 31 ); -#ifdef ISSUE_1867_replace_overflow_libenc cor_max16 = round_fx_sat( L_shl_sat( cor_max, exp ) ); /*Q15*/ -#else - cor_max16 = round_fx_o( L_shl_o( cor_max, exp, &Overflow ), &Overflow ); /*Q15*/ -#endif /**voicing0_sm = add(mult_r(24576 ,(*voicing0_sm)) , mult_r(8192 , cor_max16));*/ *voicing0_sm = round_fx( L_mac( L_mult( 24576 /*.75f Q15*/, *voicing0_sm ), 8192 /*.25f Q15*/, cor_max16 ) ); move16(); diff --git a/lib_enc/pitch_ol_fx.c b/lib_enc/pitch_ol_fx.c index 8bf8065c8..a27db5859 100644 --- a/lib_enc/pitch_ol_fx.c +++ b/lib_enc/pitch_ol_fx.c @@ -182,11 +182,6 @@ void pitch_ol_fx( const Word16 *len, *len1, *sublen, *sublen1, *pit_max, *sec_length, *sec_length1; Word16 pit_min_coding; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif /*--------------------------------------------------------------* * Initialization @@ -738,11 +733,7 @@ void pitch_ol_fx( enr1_exp = 0; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc enr1 = add_sat( extract_h( dotp_fx( pt2, pt2, len[j], &enr1_exp ) ), 1 ); -#else - enr1 = add_o( extract_h( dotp_fx( pt2, pt2, len[j], &enr1_exp ) ), 1, &Overflow ); -#endif enr2 = L_mult( enr0[j], enr1 ); enr2_exp = norm_l( enr2 ); @@ -778,11 +769,7 @@ void pitch_ol_fx( move16(); /* selected moving vector */ enr1_exp = 0; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc enr1 = add_sat( extract_h( dotp_fx( pt4, pt4, len1[j], &enr1_exp ) ), 1 ); -#else - enr1 = add_o( extract_h( dotp_fx( pt4, pt4, len1[j], &enr1_exp ) ), 1, &Overflow ); -#endif enr2 = L_mult( enr0_1[j], enr1 ); enr2_exp = norm_l( enr2 ); @@ -877,11 +864,7 @@ void pitch_ol_fx( move16(); pitch_tmp[i] = pitchX[i][ind]; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc cor_tmp[i] = add_sat( corX[i][ind], corr_shift ); -#else - cor_tmp[i] = add_o( corX[i][ind], corr_shift, &Overflow ); -#endif move16(); /* Higher is the neighbour's correlation, higher is the weighting */ @@ -895,11 +878,7 @@ void pitch_ol_fx( move16(); pitch_tmp[i + NHFR] = pitchX[i][ind1]; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc cor_tmp[i + NHFR] = add_sat( corX[i][ind1], corr_shift ); -#else - cor_tmp[i + NHFR] = add_o( corX[i][ind1], corr_shift, &Overflow ); -#endif move16(); /* Higher is the neighbour's correlation, higher is the weighting */ @@ -1120,11 +1099,6 @@ void pitch_ol_ivas_fx( const Word16 *len, *len1, *sublen, *sublen1, *pit_max, *sec_length, *sec_length1; Word16 pit_min_coding; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif Word16 new_q; new_q = sub( 63, shl( qwsp, 1 ) ); @@ -1726,12 +1700,7 @@ void pitch_ol_ivas_fx( enr1 = ISqrt32( enr1, &enr1_exp ); /* 1/sqrt(energy) */ /*31-enr2_exp*/ Ltmp = Mpy_32_16_1( enr1, cor_buf[ind] ); -#ifdef ISSUE_1867_replace_overflow_libenc corX[i][j] = extract_h( L_shl_sat( Ltmp, add( enr1_exp, cor_buf_exp[ind] ) ) ); // Q15 -#else - - corX[i][j] = extract_h( L_shl_o( Ltmp, add( enr1_exp, cor_buf_exp[ind] ), &Overflow ) ); // Q15 -#endif move16(); Ltmp = Mpy_32_16_1( enr1, pt_cor0[ind] ); @@ -1774,11 +1743,7 @@ void pitch_ol_ivas_fx( enr1 = ISqrt32( enr1, &enr1_exp ); /* 1/sqrt(energy) */ /*31-enr1_exp*/ Ltmp = Mpy_32_16_1( enr1, cor_buf[ind1 + len_x] ); -#ifdef ISSUE_1867_replace_overflow_libenc corX[i][j + NSECT] = extract_h( L_shl_sat( Ltmp, add( enr1_exp, cor_buf_exp[ind1 + len_x] ) ) ); // Q15 -#else - corX[i][j + NSECT] = extract_h( L_shl_o( Ltmp, add( enr1_exp, cor_buf_exp[ind1 + len_x] ), &Overflow ) ); // Q15 -#endif move16(); Ltmp = Mpy_32_16_1( enr1, pt_cor0[ind1 + ( DELTA_COH - 1 ) + len_x] ); @@ -1855,11 +1820,7 @@ void pitch_ol_ivas_fx( move16(); pitch_tmp[i] = pitchX[i][ind]; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc cor_tmp[i] = add_sat( corX[i][ind], corr_shift ); -#else - cor_tmp[i] = add_o( corX[i][ind], corr_shift, &Overflow ); -#endif move16(); /* Higher is the neighbour's correlation, higher is the weighting */ @@ -1873,11 +1834,7 @@ void pitch_ol_ivas_fx( move16(); pitch_tmp[i + NHFR] = pitchX[i][ind1]; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc cor_tmp[i + NHFR] = add_sat( corX[i][ind1], corr_shift ); -#else - cor_tmp[i + NHFR] = add_o( corX[i][ind1], corr_shift, &Overflow ); -#endif move16(); /* Higher is the neighbour's correlation, higher is the weighting */ diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c index df422582d..5e977c8f7 100644 --- a/lib_enc/ppp_enc_fx.c +++ b/lib_enc/ppp_enc_fx.c @@ -618,18 +618,17 @@ static Word16 DTFS_quant_cw_fx( /* CALLED FROM : TX */ /*===================================================================*/ -static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X2_fx, Word16 *S_fx, Word16 *C_fx ) +static Word16 DTFS_alignment_fine_new_fx( + DTFS_STRUCTURE X1_fx, + DTFS_STRUCTURE X2_fx, + Word16 *S_fx, + Word16 *C_fx ) { Word16 temp, temp1, k, Qcorr, Qmaxcorr; Word16 n, fshift_fx, HalfLag, ab1[MAXLAG_WI], ab2[MAXLAG_WI]; Word32 corr_fx; Word32 maxcorr_fx, wcorr_fx, diff_corr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + IF( LT_16( X1_fx.lag_fx, X2_fx.lag_fx ) ) { DTFS_zeroPadd_fx( X2_fx.lag_fx, &X1_fx ); @@ -667,15 +666,9 @@ static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[temp % ( 4 * X2_fx.lag_fx )] ); corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[temp % ( 4 * X2_fx.lag_fx )] ); temp = add_sat( temp, temp1 ); -#else - corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[temp % ( 4 * X2_fx.lag_fx )], &Overflow ); - corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[temp % ( 4 * X2_fx.lag_fx )], &Overflow ); - temp = add_o( temp, temp1, &Overflow ); -#endif } temp = sub( 32767, extract_l( L_shr( L_mult( 82, abs_s( n ) ), 1 ) ) ); /* Q15 */ Qcorr = norm_l( corr_fx ); @@ -685,40 +678,23 @@ static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ wcorr_fx = L_mult_sat( temp1, temp ); /* Q(Qcorr-16+15+1)=Q(Qcorr) */ -#else - temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ - wcorr_fx = L_mult_o( temp1, temp, &Overflow ); /* Q(Qcorr-16+15+1)=Q(Qcorr) */ -#endif IF( GE_16( Qmaxcorr, Qcorr ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */ -#else - diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ -#endif } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ -#else - diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ -#endif } if ( diff_corr > 0 ) { fshift_fx = n; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc maxcorr_fx = (Word32) L_shl_sat( corr_fx, Qcorr ); /* Qcorr */ -#else - maxcorr_fx = (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ); /* Qcorr */ -#endif Qmaxcorr = Qcorr; move16(); } @@ -726,6 +702,8 @@ static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X return fshift_fx; } + + /*===================================================================*/ /* FUNCTION : LPCPowSpect_fx () */ /*-------------------------------------------------------------------*/ @@ -766,12 +744,7 @@ static void LPCPowSpect_fx( Word32 Ltemp, Lw; Word32 Lacc; Word16 tmp, exp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + FOR( k = 0; k < Nf; k++ ) { @@ -802,17 +775,11 @@ static void LPCPowSpect_fx( t1 = add( t1, (Word16) L_shr( Ltemp, 16 ) ); /* t1 is interpolated cos(w) */ Ltemp = L_shr( L_mult( LPC[i], t1 ), 1 ); /* Ltemp in Q27 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Re = L_add_sat( Re, Ltemp ); /* Re=1-sum(LPC[i]*cos(Lw)); */ - Ltemp = L_add_sat( Lw, 0x6000 ); /* add 0.75, which is 3pi/2 to convert sin to cos */ - Ltemp = L_shl_sat( Ltemp, 10 ); /* Q25 */ -#else - Re = L_add_o( Re, Ltemp, &Overflow ); /* Re=1-sum(LPC[i]*cos(Lw)); */ - Ltemp = L_add_o( Lw, 0x6000, &Overflow ); /* add 0.75, which is 3pi/2 to convert sin to cos */ - Ltemp = L_shl_o( Ltemp, 10, &Overflow ); /* Q25 */ -#endif - w = extract_h( Ltemp ); /* w is equivalent cos index */ - dl = extract_l( Ltemp ); /* dl is 6 bit left-over for interpolation */ + Re = L_add_sat( Re, Ltemp ); /* Re=1-sum(LPC[i]*cos(Lw)); */ + Ltemp = L_add_sat( Lw, 0x6000 ); /* add 0.75, which is 3pi/2 to convert sin to cos */ + Ltemp = L_shl_sat( Ltemp, 10 ); /* Q25 */ + w = extract_h( Ltemp ); /* w is equivalent cos index */ + dl = extract_l( Ltemp ); /* dl is 6 bit left-over for interpolation */ w = s_and( w, 511 ); t1 = cos_table[w]; /*t2=cos_table[s_and(add(w,1),511)]; */ @@ -832,13 +799,8 @@ static void LPCPowSpect_fx( t1 = add( t1, (Word16) L_shr( Ltemp, 16 ) ); /* t1 is interpolated cos(w) */ Ltemp = L_shr( L_mult( LPC[i], t1 ), 1 ); /* Ltemp in Q27 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Im = L_sub_sat( Im, Ltemp ); /* Im=sum(LPC[i]*sin(Lw)) */ - Lw = L_add_sat( Lw, freq[k] ); /* Lw=(i+1)*freq[k] */ -#else - Im = L_sub_o( Im, Ltemp, &Overflow ); /* Im=sum(LPC[i]*sin(Lw)) */ - Lw = L_add_o( Lw, freq[k], &Overflow ); /* Lw=(i+1)*freq[k] */ -#endif + Im = L_sub_sat( Im, Ltemp ); /* Im=sum(LPC[i]*sin(Lw)) */ + Lw = L_add_sat( Lw, freq[k] ); /* Lw=(i+1)*freq[k] */ } /* If necessary, we can block-normalize Re and Im to improve precision */ dh = extract_h( Re ); @@ -853,11 +815,7 @@ static void LPCPowSpect_fx( ELSE Lacc = L_mult0( dh, dl ); -#ifdef ISSUE_1867_replace_overflow_libenc Lacc = L_add_sat( L_shr( Lacc, 15 ), L_shr( L_mult_sat( dh, dh ), 1 ) ); /* Lacc=Re*Re */ -#else - Lacc = L_add_o( L_shr( Lacc, 15 ), L_shr( L_mult_o( dh, dh, &Overflow ), 1 ), &Overflow ); /* Lacc=Re*Re */ -#endif dh = extract_h( Im ); dl = extract_l( Im ); @@ -888,18 +846,16 @@ static void LPCPowSpect_fx( move16(); } Ltemp = L_deposit_h( tmp ); -#ifdef ISSUE_1867_replace_overflow_libenc out[k] = round_fx_sat( L_shl_sat( Ltemp, negate( add( exp, 8 ) ) ) ); -#else - out[k] = round_fx_o( L_shl_o( Ltemp, negate( add( exp, 8 ) ), &Overflow ), &Overflow ); -#endif move16(); /* out[k] = shl(tmp,-exp-8); in Q7 */ } + return; } + /*===================================================================*/ /* FUNCTION : erb_diff_fx () */ /*-------------------------------------------------------------------*/ diff --git a/lib_enc/pvq_encode_fx.c b/lib_enc/pvq_encode_fx.c index 0e8363654..943f81501 100644 --- a/lib_enc/pvq_encode_fx.c +++ b/lib_enc/pvq_encode_fx.c @@ -63,12 +63,6 @@ static Word16 one_pulse_search( UWord32 UL_left_l, UL_right_l, UL_dummy; Word32 L_tmp; UWord16 u_sgn; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif en_tmp = en_dn_shift; /* dummy assignment to avoid compiler warning for unused parameter */ @@ -90,14 +84,9 @@ static Word16 one_pulse_search( FOR( i = 0; i < dim; i++ ) /* FOR 3 ops */ { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp_corr = L_shl_sat( L_mac_sat( *L_xy_ptr, 1, x_abs[i] ), corr_up_shift ); /* actual in-loop target value, 2 ops */ corr_tmp = round_fx_sat( L_tmp_corr ); /* 1 op */ -#else - L_tmp_corr = L_shl_o( L_mac_o( *L_xy_ptr, 1, x_abs[i], &Overflow ), corr_up_shift, &Overflow ); /* actual in-loop target value, 2 ops */ - corr_tmp = round_fx_o( L_tmp_corr, &Overflow ); /* 1 op */ -#endif - corr_sq_tmp = mult( corr_tmp, corr_tmp ); /* CorrSq, is a 16bit for low compelxity cross multiplication 1 op */ + corr_sq_tmp = mult( corr_tmp, corr_tmp ); /* CorrSq, is a 16bit for low compelxity cross multiplication 1 op */ L_tmp_en_lc = L_mac( *L_yy_ptr, 1, y[i] ); /*Q1 result , energy may span up to ~14+1(Q1)+1(sign)=16 bits, 1 op */ /* extract_l without shift can always be used for this section as energy is guaranteed to stay in the lower word, 1 op */ @@ -212,12 +201,6 @@ void pvq_encode_ivas_fx( Word16 neg_gain_norm, shift_tot; Word16 high_pulse_density_flag; PvqEntry entry; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif L_proj_fac = 4096; move32(); @@ -371,13 +354,8 @@ void pvq_encode_ivas_fx( } Mpy_32_16_ss( L_isqrt, tmp, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) +1 */ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 +1 */ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ - xq[i] = round_fx_sat( L_tmp ); /* Q15, array move */ -#else - L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ -#endif + L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ + xq[i] = round_fx_sat( L_tmp ); /* Q15, array move */ move16(); L_xq[i] = L_tmp; /* Q31 currently unused */ move32(); @@ -427,12 +405,6 @@ void pvq_encode_fx( Word16 neg_gain_norm, shift_tot; Word16 high_pulse_density_flag; PvqEntry entry; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif L_proj_fac = 4096; move32(); @@ -586,13 +558,8 @@ void pvq_encode_fx( } Mpy_32_16_ss( L_isqrt, tmp, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) +1 */ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 +1 */ -#ifdef ISSUE_1867_replace_overflow_libenc - L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ - xq[i] = round_fx_sat( L_tmp ); /* Q15, array move */ -#else - L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15, array move */ -#endif + L_tmp = L_shr_sat( L_tmp, shift_tot ); /* Q31+x */ + xq[i] = round_fx_sat( L_tmp ); /* Q15, array move */ move16(); L_xq[i] = L_tmp; /* Q31 currently unused */ move32(); diff --git a/lib_enc/q_gain2p_fx.c b/lib_enc/q_gain2p_fx.c index ddb3eec9e..c576c25f6 100644 --- a/lib_enc/q_gain2p_fx.c +++ b/lib_enc/q_gain2p_fx.c @@ -145,13 +145,6 @@ static Word16 gain_enc( /* o : quantization pitch index const Word16 *p; const Word16 *t_qua_gain; Word32 L_tmp, dist_min, L_tmp1; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif - assert( ( func_type != FUNC_GAIN_ENC_UV ) && ( func_type != FUNC_GAIN_ENC_GACELP_UV ) ); @@ -167,15 +160,13 @@ static Word16 gain_enc( /* o : quantization pitch index /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ L_tmp = calc_gain_inov( code, lcode, &L_tmp1, &exp_L_tmp1 ); move16(); -#ifdef ISSUE_1867_replace_overflow_libenc *gain_inov = round_fx_sat( L_shl_sat( L_tmp, 15 - 3 ) ); /* gain_inov in Q12 */ -#else - *gain_inov = round_fx_o( L_shl_o( L_tmp, 15 - 3, &Overflow ), &Overflow ); /* gain_inov in Q12 */ -#endif move16(); + /*----------------------------------------------------------------* * calculate the predicted gain code *----------------------------------------------------------------*/ + IF( func_type == FUNC_GAIN_ENC_MLESS ) { /*j = 10 * log10((dot_product(code, code, lcode) + 0.01) / lcode) */ @@ -383,11 +374,7 @@ static Word16 gain_enc( /* o : quantization pitch index /* Here, we use L_mult0 to compensate the factor 0.5 applied to coeff[1..4] before */ L_tmp = L_add( L_tmp, L_shr( L_mult0( p[2 * i + 0], p[2 * i + 0] ), shr_coeff0 ) ); L_tmp = L_sub( L_tmp, L_shr( L_mult( p[2 * i + 0], coeff1 ), shr_coeff1 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = L_sub_sat( L_tmp, dist_min ); -#else - L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS if ( L_tmp1 < 0 ) { @@ -407,26 +394,19 @@ static Word16 gain_enc( /* o : quantization pitch index L_tmp = L_mult( g_code, gcode0 ); /* Q11*Q15 -> Q27 */ exp_gcode0 = add( exp_gcode0, -11 ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( L_tmp, exp_gcode0 ); /* Q27 -> Q16 */ -#else - L_tmp = L_shl_o( L_tmp, exp_gcode0, &Overflow ); /* Q27 -> Q16 */ -#endif *gain_code = L_tmp; move32(); /* Q16/Q12 => Q5 */ L_tmp = L_deposit_h( BASOP_Util_Divide3216_Scale( L_tmp, *gain_inov, &i ) ); -#ifdef ISSUE_1867_replace_overflow_libenc *past_gcode = L_shl_sat( L_tmp, sub( i, 15 - 12 ) ); -#else - *past_gcode = L_shl_o( L_tmp, sub( i, 15 - 12 ), &Overflow ); -#endif move16(); return index; } + Word16 gain_enc_uv_fx( /* o : quantization pitch index */ const Word16 *code, /* i : algebraic excitation */ const Word16 *code2, /* i : gaussian excitation */ @@ -454,12 +434,6 @@ Word16 gain_enc_uv_fx( /* o : quantization pitch ind Word16 index2; const Word16 log2_scale = 16; move16(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif pred_nrg_frame = 0; /* to suppress compilation warnings */ g_code2 = 0; /* to suppress compilation warnings */ exp_gcode2 = 0; /* to suppress compilation warnings */ @@ -467,7 +441,6 @@ Word16 gain_enc_uv_fx( /* o : quantization pitch ind move16(); move16(); - assert( ( func_type != FUNC_GAIN_ENC_MLESS ) ); /* Debug check value (not instrumented) */ @@ -615,11 +588,7 @@ Word16 gain_enc_uv_fx( /* o : quantization pitch ind } s1 = norm_l( *gain_code ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl( *gain_code, s1 ) ); -#else - tmp1 = round_fx_o( L_shl_o( *gain_code, s1, &Overflow ), &Overflow ); -#endif s1 = sub( 15, s1 ); tmp1 = mult_r( mult_r( tmp1, tmp1 ), g_coeff->y2y2 ); @@ -632,11 +601,7 @@ Word16 gain_enc_uv_fx( /* o : quantization pitch ind L_tmp1 = L_add( L_tmp, 0 ); s1 = norm_l( *gain_code ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl( *gain_code, s1 ) ); -#else - tmp1 = round_fx_o( L_shl_o( *gain_code, s1, &Overflow ), &Overflow ); -#endif s1 = sub( 15, s1 ); c_index2 = 0x7FFF; diff --git a/lib_enc/qlpc_stoch_fx.c b/lib_enc/qlpc_stoch_fx.c index 702afbadd..70a41378f 100644 --- a/lib_enc/qlpc_stoch_fx.c +++ b/lib_enc/qlpc_stoch_fx.c @@ -396,12 +396,6 @@ void Unified_weighting_fx( Word16 nf_fx; Word32 Bin_Ener_160_fx[160]; const Word32 *Freq_w_Table_fx, *Bin_Ener_fx; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*Config. weighting*/ IF( narrowBand ) @@ -440,11 +434,7 @@ void Unified_weighting_fx( L_tmp = L_deposit_l( 0 ); FOR( i = 95; i < 127; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, Bin_Ener_160_fx[i] ); /* Q_ener */ -#else - L_tmp = L_add_o( L_tmp, Bin_Ener_160_fx[i], &Overflow ); /* Q_ener */ -#endif } L_tmp = L_shr( L_tmp, 5 ); @@ -525,11 +515,7 @@ void Unified_weighting_fx( } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( L_deposit_l( sub_sat( w_fft_fx[i], min_fx ) ), 13 ); /* Q21 */ -#else - L_tmp = L_shl_o( L_deposit_l( sub_o( w_fft_fx[i], min_fx, &Overflow ) ), 13, &Overflow ); /* Q21 */ -#endif exp = norm_l( L_tmp ); frac = round_fx( L_shl( L_tmp, exp ) ); exp = sub( add( exp, 21 ), 30 ); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index c56190386..5fd11bd31 100644 --- a/lib_enc/scale_enc_fx.c +++ b/lib_enc/scale_enc_fx.c @@ -62,6 +62,8 @@ void Scale_wsp( Scale_sig( mem_decim2, 3, *Q_exp ); Copy( old_wsp12k8, wsp - L_WSP_MEM, L_WSP_MEM ); /* Now memory and wsp vector have the same scaling */ + + return; } /*-------------------------------------------------------------------* @@ -87,12 +89,6 @@ void Preemph_scaled( Word16 mu, shift, QVal; Word32 L_tmp, L_maxloc; Word16 Q_min; -#if !defined( ISSUE_1867_replace_overflow_libenc ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*---------------------------------------------------------------* * Perform fixed preemphasis through 1 - g z^-1 * @@ -100,13 +96,7 @@ void Preemph_scaled( *---------------------------------------------------------------*/ BASOP_SATURATE_WARNING_OFF_EVS - -#ifdef ISSUE_1867_replace_overflow_libenc QVal = shl_sat( 1, sub( 15, bits ) ); //?sat -#else - Overflow = 0; - QVal = shl_sat( 1, sub( 15, bits ) ); -#endif BASOP_SATURATE_WARNING_ON_EVS mu = shr( Preemph_factor, bits ); /* Q15 --> Q(15-bits) */ @@ -123,11 +113,7 @@ void Preemph_scaled( /* Equivalent to tmp = max((abs(x[i] - mu*x[i-1]),tmp) * finds the max of preemphasized signal */ L_tmp = L_mult( new_speech[i], QVal ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, new_speech[i - 1], mu ); -#else - L_tmp = L_msu_o( L_tmp, new_speech[i - 1], mu, &Overflow ); -#endif L_tmp = L_abs( L_tmp ); L_maxloc = L_max( L_tmp, L_maxloc ); } @@ -177,11 +163,7 @@ void Preemph_scaled( FOR( i = sub( Lframe, 1 ); i > 0; i-- ) { L_tmp = L_mult( new_speech[i], QVal ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, new_speech[i - 1], mu ); -#else - L_tmp = L_msu_o( L_tmp, new_speech[i - 1], mu, &Overflow ); -#endif L_tmp = L_shl( L_tmp, *Q_new ); new_speech[i] = round_fx_sat( L_tmp ); // Q_new } @@ -192,7 +174,11 @@ void Preemph_scaled( new_speech[0] = round_fx_sat( L_tmp ); *mem_preemph = tmp_fixed; move16(); + + return; } + + /*-------------------------------------------------------------------* * Scale_mem * @@ -214,11 +200,6 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled { Word16 i; Word32 e_min_scaled; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif e_min_scaled = L_shr_r( L_add( L_shr( E_MIN_FXQ15, sub( 14, add( *Q_new, QSCALE ) ) ), 1 ), 1 ); @@ -247,21 +228,12 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled /* Do scaling and valide minimum energy value */ FOR( i = 0; i < NB_BANDS; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc enrO[i] = L_max( L_shl_sat( enrO[i], Q_exp ), e_min_scaled ); bckr[i] = L_max( L_shl_sat( bckr[i], Q_exp ), e_min_scaled ); ave_enr[i] = L_max( L_shl_sat( ave_enr[i], Q_exp ), e_min_scaled ); ave_enr2[i] = L_max( L_shl_sat( ave_enr2[i], Q_exp ), e_min_scaled ); st_fr_bands1[i] = L_max( L_shl_sat( st_fr_bands1[i], Q_exp ), e_min_scaled ); st_fr_bands2[i] = L_max( L_shl_sat( st_fr_bands2[i], Q_exp ), e_min_scaled ); -#else - enrO[i] = L_max( L_shl_o( enrO[i], Q_exp, &Overflow ), e_min_scaled ); - bckr[i] = L_max( L_shl_o( bckr[i], Q_exp, &Overflow ), e_min_scaled ); - ave_enr[i] = L_max( L_shl_o( ave_enr[i], Q_exp, &Overflow ), e_min_scaled ); - ave_enr2[i] = L_max( L_shl_o( ave_enr2[i], Q_exp, &Overflow ), e_min_scaled ); - st_fr_bands1[i] = L_max( L_shl_o( st_fr_bands1[i], Q_exp, &Overflow ), e_min_scaled ); - st_fr_bands2[i] = L_max( L_shl_o( st_fr_bands2[i], Q_exp, &Overflow ), e_min_scaled ); -#endif move32(); move32(); move32(); @@ -271,9 +243,11 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled } } } + return e_min_scaled; } + void Scale_mem_enc( Word16 Q_exp, /* i : Diff scaling factor */ Word16 *old_speech16k, /* i/o: Speech memory */ diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index e1f9cf6e9..893e1faaf 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -69,12 +69,7 @@ void set_impulse_fx( Word16 krit_fx, krit_max_fx, gain16; Word32 Lrr, Ldd, Ltmp, Ltmp1; const Word16 *pt_Glt; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + krit_max_fx = -32768; move16(); @@ -125,21 +120,12 @@ void set_impulse_fx( /* nominator & DEnominator row <0> */ FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[i], gh_fx[i] ); // Q27 Ldd = L_mac_sat( Ldd, gh_fx[i], xn_fx[i] ); // Q27 -#else - Lrr = L_mac_o( Lrr, gh_fx[i], gh_fx[i], &Overflow ); // Q27 - Ldd = L_mac_o( Ldd, gh_fx[i], xn_fx[i], &Overflow ); // Q27 -#endif } rr_fx[start1] = Lrr; move32(); -#ifdef ISSUE_1867_replace_overflow_libenc dd_fx[start1] = round_fx_sat( Ldd ); // Q11 -#else - dd_fx[start1] = round_fx_o( Ldd, &Overflow ); // Q11 -#endif rr_fx[start1] = L_max( rr_fx[start1], 1 ); FOR( i = add( start1, 1 ); i < L_IMPULSE2; i++ ) @@ -153,25 +139,15 @@ void set_impulse_fx( gh_fx[j] = mac_r( L_deposit_h( gh_fx[j - 1] ), Glottal_cdbk_fx[m * L_IMPULSE + L_IMPULSE2 - i], h_orig_fx[j] ); // Q13 move16(); -#ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[j], gh_fx[j] ); // Q27 Ldd = L_mac_sat( Ldd, gh_fx[j], xn_fx[j] ); // Q27 -#else - Lrr = L_mac_o( Lrr, gh_fx[j], gh_fx[j], &Overflow ); // Q27 - Ldd = L_mac_o( Ldd, gh_fx[j], xn_fx[j], &Overflow ); // Q27 -#endif } gh_fx[0] = mult_r( Glottal_cdbk_fx[m * L_IMPULSE + L_IMPULSE2 - i], h_orig_fx[0] ); // Q13 move16(); -#ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[0], gh_fx[0] ); // Q27 Ldd = L_mac_sat( Ldd, gh_fx[0], xn_fx[0] ); // Q27 -#else - Lrr = L_mac_o( Lrr, gh_fx[0], gh_fx[0], &Overflow ); // Q27 - Ldd = L_mac_o( Ldd, gh_fx[0], xn_fx[0], &Overflow ); // Q27 -#endif - dd_fx[i] = round_fx_sat( Ldd ); // Q11 + dd_fx[i] = round_fx_sat( Ldd ); // Q11 rr_fx[i] = L_max( Lrr, 1 ); move32(); /* move rr and dd into rr[i] and dd[i] */ @@ -204,11 +180,7 @@ void set_impulse_fx( FOR( i = L_SUBFR - 2; i >= start2; i-- ) { /*rr[i] = rr[i+1] + gh[L_SUBFR+L_IMPULSE2-1-i]*gh[L_SUBFR+L_IMPULSE2-1-i];*/ -#ifdef ISSUE_1867_replace_overflow_libenc rr_fx[i] = L_mac_sat( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i] ); // Q27 -#else - rr_fx[i] = L_mac_o( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], &Overflow ); // Q27 -#endif move32(); } /* nominator rows */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 045000fce..24475be37 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -660,12 +660,6 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis Word16 tmp1, tmp2, exp2, scale, exp3; SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas; HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /*------------------------------------------------------------------* * Initialization @@ -794,18 +788,10 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis sum_PS = L_deposit_l( 0 ); FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sum_PS = L_add_sat( sum_PS, PS[i] ); -#else - sum_PS = L_add_o( sum_PS, PS[i], &Overflow ); -#endif } exp1 = norm_l( sum_PS ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl( sum_PS, exp1 ) ); -#else - tmp1 = round_fx_o( L_shl( sum_PS, exp1 ), &Overflow ); -#endif exp1 = sub( 30, exp1 ); FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) @@ -813,11 +799,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /*PS_norm[i] = PS[i] / sum_PS;*/ /*dPS[i] = (float)fabs(PS_norm[i] - st->past_PS[i]);*/ exp2 = norm_l( PS[i] ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp2 = round_fx_sat( L_shl( PS[i], exp2 ) ); -#else - tmp2 = round_fx_o( L_shl( PS[i], exp2 ), &Overflow ); -#endif exp2 = sub( 30, exp2 ); scale = shr( sub( tmp1, tmp2 ), 15 ); @@ -878,11 +860,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis ELSE { exp1 = norm_l( L_add( dPS[i], 336 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl_sat( L_add( dPS[i], 336 ), exp1 ) ); -#else - tmp1 = round_fx_o( L_shl_o( L_add( dPS[i], 336 ), exp1, &Overflow ), &Overflow ); -#endif exp1 = sub( 30, exp1 ); exp2 = norm_l( mx ); @@ -939,11 +917,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = 0; i < N_FEATURES; i++ ) { /**pFV = pSF[0] * *pFV + pSF[1];*/ -#ifdef ISSUE_1867_replace_overflow_libenc *pFV = round_fx_sat( L_shl_sat( L_mac( pSF_a[i], *pFV, pSF_m[i] ), ishift[i] ) ); -#else - *pFV = round_fx_o( L_shl_o( L_mac( pSF_a[i], *pFV, pSF_m[i] ), ishift[i], &Overflow ), &Overflow ); -#endif move16(); pFV++; } @@ -974,11 +948,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /* xm[p] = FV[p] - m_speech[k*N_FEATURES+p];*/ -#ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_speech_fx[k * N_FEATURES + p] ); -#else - xm[p] = sub_o( FV[p], m_speech_fx[k * N_FEATURES + p], &Overflow ); -#endif move16(); /*Q15 */ } @@ -994,11 +964,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /*xm[p] = FV[p] - m_noise[k*N_FEATURES+p];*/ -#ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_noise_fx[k * N_FEATURES + p] ); -#else - xm[p] = sub_o( FV[p], m_noise_fx[k * N_FEATURES + p], &Overflow ); -#endif move16(); /*Q15 */ } @@ -1013,11 +979,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /*xm[p] = FV[p] - m_music[k*N_FEATURES+p];*/ -#ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_music_fx[k * N_FEATURES + p] ); -#else - xm[p] = sub_o( FV[p], m_music_fx[k * N_FEATURES + p], &Overflow ); -#endif move16(); /*Q15 */ } @@ -1031,11 +993,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /* calculate log-probability */ /*log(0.0001)-0.5f * N_FEATURES * LOG_PI2 in Q9 */ -#ifdef ISSUE_1867_replace_overflow_libenc lps = extract_h( L_shl_sat( L_sub( max_s, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ -#else - lps = extract_h( L_shl_o( L_sub( max_s, LOG_PROB_CONST ), 16 - 1, &Overflow ) ); /*Q9 */ -#endif lps = s_max( lps, -10832 ); lpm = extract_h( L_shl( L_sub( max_m, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ @@ -1043,11 +1001,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /* lpn = (float)log(pyn) - 0.5f * N_FEATURES * (float)log(2*PI); */ -#ifdef ISSUE_1867_replace_overflow_libenc lpn = extract_h( L_shl_sat( L_sub( max_n, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ -#else - lpn = extract_h( L_shl_o( L_sub( max_n, LOG_PROB_CONST ), 16 - 1, &Overflow ) ); /*Q9 */ -#endif lpn = s_max( lpn, -10832 ); *high_lpn_flag_ptr = 0; @@ -1499,12 +1453,6 @@ static Word16 attack_det_fx( /* o : attack flag Word16 i, j, tmp, tmp1, attack, exp1; Word32 L_tmp, etmp, etmp2, finc[ATT_NSEG]; Word16 att_3lsub_pos; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif att_3lsub_pos = ATT_3LSUB_POS; move16(); @@ -1521,11 +1469,7 @@ static Word16 attack_det_fx( /* o : attack flag FOR( j = 1; j < ATT_SEG_LEN; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j] ); /*2*Qx */ -#else - L_tmp = L_mac0_o( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j], &Overflow ); /*2*Qx */ -#endif } finc[i] = L_tmp; @@ -1550,11 +1494,7 @@ static Word16 attack_det_fx( /* o : attack flag FOR( i = 1; i < att_3lsub_pos; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, L_shr_sat( finc[i], Qx ) ); /*Qx */ -#else - L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i], Qx ), &Overflow ); /*Qx */ -#endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ @@ -1566,11 +1506,7 @@ static Word16 attack_det_fx( /* o : attack flag L_tmp = L_shr_sat( finc[attack], Qx ); /*Qx */ FOR( i = 1; i < tmp1; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, L_shr_sat( finc[i + attack], Qx ) ); /*Qx */ -#else - L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i + attack], Qx ), &Overflow ); /*Qx */ -#endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp2 = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ @@ -2669,13 +2605,6 @@ static Word16 attack_det_ivas_fx( /* o : attack flag Word64 W_tmp; Word16 q_diff; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - att_3lsub_pos = ATT_3LSUB_POS; move16(); if ( GE_32( total_brate, ACELP_24k40 ) ) @@ -2691,11 +2620,7 @@ static Word16 attack_det_ivas_fx( /* o : attack flag FOR( j = 1; j < ATT_SEG_LEN; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j] ); /*2*Qx */ -#else - L_tmp = L_mac0_o( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j], &Overflow ); /*2*Qx */ -#endif } finc[i] = L_tmp; @@ -3736,12 +3661,6 @@ static void spec_analysis_fx( Word16 peak_idx[65]; Word16 valey_idx[65]; Word16 p2v[65]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* find spectral peaks */ k = 0; @@ -3824,15 +3743,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_1867_replace_overflow_libenc p2v[k] = sub_sat( shl_sat( peak[k], 1 ), add_sat( valley[i], valley[i + 1] ) ); -#else -#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 -#endif move16(); k = add( k, 1 ); } diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index 364bd1dce..a62963ff0 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -49,34 +49,21 @@ void stat_noise_uv_enc_fx( Word16 noisiness = 0; move16(); Word16 num, den, expn, expd; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + test(); test(); test(); IF( ( EQ_16( st_fx->coder_type, UNVOICED ) && uc_two_stage_flag == 0 ) || ( EQ_16( st_fx->coder_type, INACTIVE ) && LE_32( st_fx->core_brate, ACELP_9k60 ) ) ) { - /*-----------------------------------------------------------------* * Calculate and write the noisiness parameter *-----------------------------------------------------------------*/ + /* epsP[2] is located in LepsP[0] and epsP[16] in LepsP[1] */ expn = sub( norm_l( LepsP[0] ), 1 ); -#ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( LepsP[0], expn ) ); /*expn-16*/ -#else - num = extract_h( L_shl_o( LepsP[0], expn, &Overflow ) ); /*expn-16*/ -#endif expd = norm_l( LepsP[1] ); -#ifdef ISSUE_1867_replace_overflow_libenc - den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ -#else - den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ -#endif + den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ num = div_s( num, den ); /*expn-expd+15*/ num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ num = sub( num, 1024 ); /*num - 1*/ @@ -132,34 +119,21 @@ void stat_noise_uv_enc_ivas_fx( Word16 noisiness = 0; move16(); Word16 num, den, expn, expd; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + test(); test(); test(); IF( ( EQ_16( st_fx->coder_type, UNVOICED ) && uc_two_stage_flag == 0 ) || ( EQ_16( st_fx->coder_type, INACTIVE ) && LE_32( st_fx->core_brate, ACELP_9k60 ) ) ) { - /*-----------------------------------------------------------------* * Calculate and write the noisiness parameter *-----------------------------------------------------------------*/ + /* epsP[2] is located in LepsP[0] and epsP[16] in LepsP[1] */ expn = sub( norm_l( LepsP[0] ), 1 ); -#ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( LepsP[0], expn ) ); /*expn-16*/ -#else - num = extract_h( L_shl_o( LepsP[0], expn, &Overflow ) ); /*expn-16*/ -#endif expd = norm_l( LepsP[1] ); -#ifdef ISSUE_1867_replace_overflow_libenc - den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ -#else - den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ -#endif + den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ num = div_s( num, den ); /*expn-expd+15*/ num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ num = sub( num, 1024 ); /*num - 1*/ diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 4af21c5cb..bc849fe39 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -302,12 +302,6 @@ void swb_bwe_enc_ivas_fx( Word16 fb_ener_adjust_fx; Word16 ener_adjust_quan_fx = 0; move16(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 fb_band_begin; Word16 q_new_input_hp; @@ -409,11 +403,8 @@ void swb_bwe_enc_ivas_fx( *----------------------------------------------------------------------*/ /* tilt returned in Q24 goto to Q11 */ -#ifdef ISSUE_1867_replace_overflow_libenc tilt_nb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3 ) ); -#else - tilt_nb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3, &Overflow ), &Overflow ); -#endif + /*---------------------------------------------------------------------* * SWB BWE encoding * FB BWE encoding @@ -547,12 +538,8 @@ void swb_bwe_enc_ivas_fx( exp1 = norm_l( L_tmp ); L_tmp = L_shl( L_tmp, exp1 ); exp = sub( sub( 31, exp1 ), sub( 30, exp ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ fb_ener_adjust_fx = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ -#else - fb_ener_adjust_fx = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ -#endif } ELSE { @@ -632,16 +619,8 @@ void swb_bwe_enc_fx( Word16 fb_ener_adjust_fx; Word16 ener_adjust_quan_fx = 0; move16(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; - /*---------------------------------------------------------------------* * Delay the original input signal to be synchronized with ACELP core synthesis *---------------------------------------------------------------------*/ @@ -694,15 +673,13 @@ void swb_bwe_enc_fx( *----------------------------------------------------------------------*/ /* tilt returned in Q24 goto to Q11 */ -#ifdef ISSUE_1867_replace_overflow_libenc tilt_nb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3 ) ); -#else - tilt_nb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3, &Overflow ), &Overflow ); -#endif + /*---------------------------------------------------------------------* * SWB BWE encoding * FB BWE encoding *---------------------------------------------------------------------*/ + new_input_fx_exp = 0; move16(); /* MDCT of the core synthesis signal */ @@ -820,12 +797,8 @@ void swb_bwe_enc_fx( L_tmp = L_shl( L_tmp, exp1 ); // exp = 31 - exp1 - ( 30 - exp ); exp = add( 31 - 30, sub( exp, exp1 ) ); - L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ fb_ener_adjust_fx = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ -#else - fb_ener_adjust_fx = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ -#endif } ELSE { @@ -845,6 +818,8 @@ void swb_bwe_enc_fx( return; } + + /*==========================================================================*/ /* FUNCTION : static Word16 WB_BWE_fenv_q_fx() */ /*--------------------------------------------------------------------------*/ @@ -1026,13 +1001,6 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class Word16 sharplimit; Word16 numsharp, num, den; Word16 numharmonic, tmp, expn, expd, scale; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif - FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; mode = NORMAL; @@ -1067,28 +1035,16 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class { IF( hBWE_FD->prev_global_gain_fx == 0 ) { -#ifdef ISSUE_1867_replace_overflow_libenc gain_tmp = round_fx_sat( L_shl_sat( fGain, 30 ) ); /*Q14 */ -#else - gain_tmp = round_fx_o( L_shl_o( fGain, 30, &Overflow ), &Overflow ); /*Q14 */ -#endif } ELSE { expn = norm_l( fGain ); -#ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( fGain, expn ) ); -#else - num = extract_h( L_shl_o( fGain, expn, &Overflow ) ); -#endif expn = sub( sub( 30, expn ), shl( Q_shb, 1 ) ); expd = norm_l( hBWE_FD->prev_global_gain_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( hBWE_FD->prev_global_gain_fx, expd ) ); -#else - den = extract_h( L_shl_o( hBWE_FD->prev_global_gain_fx, expd, &Overflow ) ); -#endif expd = sub( sub( 30, expd ), shl( st_fx->prev_Q_shb, 1 ) ); scale = shr( sub( den, num ), 15 ); @@ -1186,13 +1142,9 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class move16(); } expd = norm_s( den ); - tmp = div_s( shl( 1, sub( 14, expd ) ), den ); /*Q(29-expd-Q_syn) */ - L_tmp = L_mult( tmp, peak ); /*Q(30-expd) */ -#ifdef ISSUE_1867_replace_overflow_libenc + tmp = div_s( shl( 1, sub( 14, expd ) ), den ); /*Q(29-expd-Q_syn) */ + L_tmp = L_mult( tmp, peak ); /*Q(30-expd) */ sharp = round_fx_sat( L_shl_sat( L_tmp, sub( expd, 4 ) ) ); /*Q10 */ -#else - sharp = round_fx_o( L_shl_o( L_tmp, sub( expd, 4 ), &Overflow ), &Overflow ); /*Q10 */ -#endif } ELSE { @@ -1388,12 +1340,7 @@ static void vqWithCand_w_fx( const Word16 *p_E_ROM_dico; Word16 dist, temp1; Word32 L_dist, L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + IF( flag ) { set32_fx( dist_min, MAX_32, surv ); /* FLT_MAX */ @@ -1409,22 +1356,14 @@ static void vqWithCand_w_fx( FOR( i = 0; i < E_ROM_dico_size; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc dist = sub_sat( x[0], *p_E_ROM_dico++ ); /*Q8 */ -#else - dist = sub_o( x[0], *p_E_ROM_dico++, &Overflow ); /*Q8 */ -#endif - L_dist = L_mult( dist, w[0] ); /*Q22 */ - L_dist = Mult_32_16( L_dist, dist ); /*Q15 */ - L_dist = L_shr( L_dist, 10 ); /*Q5 */ + L_dist = L_mult( dist, w[0] ); /*Q22 */ + L_dist = Mult_32_16( L_dist, dist ); /*Q15 */ + L_dist = L_shr( L_dist, 10 ); /*Q5 */ FOR( j = 1; j < dim; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc temp1 = sub_sat( x[j], *p_E_ROM_dico++ ); -#else - temp1 = sub_o( x[j], *p_E_ROM_dico++, &Overflow ); -#endif L_tmp = L_mult( temp1, w[j] ); /*Q22 */ L_tmp = Mult_32_16( L_tmp, temp1 ); /*Q15 */ L_dist = L_add( L_dist, L_shr( L_tmp, 10 ) ); /*Q5 */ @@ -1699,12 +1638,6 @@ static void msvq_interpol_fx( Word16 quant_select[SWB_FENV], w_env11[SWB_FENV / 2], w_env12[SWB_FENV / 2], tmp; Word32 L_tmp, distCand[N_CAND], L_dist, L_minDist; Word16 synth_energy[SWB_FENV]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Extract target vector */ FOR( n_band = 0; n_band < DIM11; n_band++ ) @@ -1744,21 +1677,13 @@ static void msvq_interpol_fx( /* Extract vector for odd position */ FOR( n_band = 0; n_band < DIM11; n_band++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc quant_tmp[n_band] = add_sat( quant_tmp1[n_band], quant_tmp2[n_band] ); -#else - quant_tmp[n_band] = add_o( quant_tmp1[n_band], quant_tmp2[n_band], &Overflow ); -#endif move16(); } FOR( n_band = 0; n_band < DIM12 - 1; n_band++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */ -#else - tmp = add_o( quant_tmp[n_band], quant_tmp[n_band + 1], &Overflow ); /*Q8 */ -#endif tmp = shr( tmp, 1 ); quant_tmp2[n_band] = sub( env_temp12[n_band], tmp ); move16(); /*Q8 */ @@ -1781,11 +1706,7 @@ static void msvq_interpol_fx( FOR( n_band = 0; n_band < DIM12 - 1; n_band++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( quant_tmp[n_band], quant_tmp[n_band + 1] ); -#else - tmp = add_o( quant_tmp[n_band], quant_tmp[n_band + 1], &Overflow ); -#endif tmp = shr( tmp, 1 ); quant_select[( n_band << 1 ) + 1] = add( tmp, quant_tmp2[n_band] ); move16(); /*Q8 */ @@ -1845,12 +1766,7 @@ static void msvq_interpol_2_fx( Word16 quant_select[SWB_FENV], w_env11[SWB_FENV / 2], w_env12[SWB_FENV / 2]; Word32 L_tmp, distCand[N_CAND], L_dist, L_minDist; Word16 synth_energy[SWB_FENV]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + /* Extract target vector */ FOR( n_band = 0; n_band < DIM11 - 1; n_band++ ) { @@ -1907,17 +1823,9 @@ static void msvq_interpol_2_fx( move16(); FOR( n_band = 1; n_band < DIM12 - 1; n_band++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp_q = add_sat( quant_tmp[n_band - 1], quant_tmp[n_band] ); -#else - tmp_q = add_o( quant_tmp[n_band - 1], quant_tmp[n_band], &Overflow ); -#endif tmp_q = shr( tmp_q, 1 ); -#ifdef ISSUE_1867_replace_overflow_libenc quant_tmp2[n_band] = sub_sat( env_temp12[n_band], tmp_q ); -#else - quant_tmp2[n_band] = sub_o( env_temp12[n_band], tmp_q, &Overflow ); -#endif move16(); } @@ -1938,17 +1846,9 @@ static void msvq_interpol_2_fx( move16(); /*Q8 */ FOR( n_band = 1; n_band < DIM12 - 1; n_band++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp_q = add_sat( quant_tmp[n_band - 1], quant_tmp[n_band] ); -#else - tmp_q = add_o( quant_tmp[n_band - 1], quant_tmp[n_band], &Overflow ); -#endif tmp_q = shr( tmp_q, 1 ); -#ifdef ISSUE_1867_replace_overflow_libenc quant_select[( n_band << 1 ) - 1] = add_sat( quant_tmp2[n_band], tmp_q ); -#else - quant_select[( n_band << 1 ) - 1] = add_o( quant_tmp2[n_band], tmp_q, &Overflow ); -#endif } L_dist = L_deposit_l( 0 ); @@ -2010,12 +1910,6 @@ static void calculate_Tonality_fx( Word16 org_spec[80], gen_spec[80]; Word32 L_log_gm_org, L_log_gm_gen; Word16 l_shift; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* to reduce dynamic range of original spectrum */ max = 0; @@ -2120,11 +2014,7 @@ static void calculate_Tonality_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_org, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc *SFM_org = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ -#else - *SFM_org = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ -#endif move16(); *SFM_org = s_max( 0, s_min( *SFM_org, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ @@ -2145,11 +2035,7 @@ static void calculate_Tonality_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_gen, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc *SFM_gen = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ -#else - *SFM_gen = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ -#endif move16(); *SFM_gen = s_max( 0, s_min( *SFM_gen, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ @@ -2178,12 +2064,6 @@ static void calculate_Tonality_ivas_fx( Word16 org_spec[80], gen_spec[80]; Word32 L_log_gm_org, L_log_gm_gen; Word16 l_shift; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* to reduce dynamic range of original spectrum */ max = 0; @@ -2288,11 +2168,7 @@ static void calculate_Tonality_ivas_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_org, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc *SFM_org = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ -#else - *SFM_org = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ -#endif move16(); *SFM_org = s_max( 0, s_min( *SFM_org, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ @@ -2313,11 +2189,7 @@ static void calculate_Tonality_ivas_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_gen, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc *SFM_gen = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ -#else - *SFM_gen = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ -#endif move16(); *SFM_gen = s_max( 0, s_min( *SFM_gen, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ @@ -2705,13 +2577,6 @@ static Word16 SWB_BWE_encoding_fx( Word16 SWB_tenv_tmp_fx[SWB_TENV]; Word16 max_fx; Word16 energy_factor_fx[SWB_FENV], w_env_fx[SWB_FENV]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif - FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; @@ -2752,11 +2617,8 @@ static Word16 SWB_BWE_encoding_fx( } /* tilt returned in Q24 go to Q11 */ -#ifdef ISSUE_1867_replace_overflow_libenc tilt_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3 ) ); -#else - tilt_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3, &Overflow ), &Overflow ); -#endif + test(); test(); IF( EQ_16( IsTransient, 1 ) && ( GT_16( tilt_fx, 16384 ) || GT_16( st_fx->clas, 1 ) ) ) @@ -2860,11 +2722,7 @@ static Word16 SWB_BWE_encoding_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &expn ); /*31-expn */ -#ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, sub( expn, 1 ) ) ); /*Q14 */ -#else - Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, sub( expn, 1 ), &Overflow ), &Overflow ); /*Q14 */ -#endif } ELSE { @@ -2876,11 +2734,7 @@ static Word16 SWB_BWE_encoding_fx( { L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ -#ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, 2 ) ); /*Q15 */ -#else - Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, 2, &Overflow ), &Overflow ); /*Q15 */ -#endif } ELSE IF( GT_16( Rat_tenv_fx, 16384 ) ) { @@ -3164,12 +3018,6 @@ static Word16 SWB_BWE_encoding_ivas_fx( Word16 SWB_tenv_tmp_fx[SWB_TENV]; Word16 max_fx; Word16 energy_factor_fx[SWB_FENV], w_env_fx[SWB_FENV]; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 inner_frame; Word16 q_shift; Word16 yos_fx_16[L_FRAME_MAX]; @@ -3229,11 +3077,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( } /* tilt returned in Q24 go to Q11 */ -#ifdef ISSUE_1867_replace_overflow_libenc tilt_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3 ) ); -#else - tilt_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3, &Overflow ), &Overflow ); -#endif test(); test(); IF( EQ_16( IsTransient, 1 ) && ( GT_16( tilt_fx, 16384 ) || GT_16( st_fx->clas, 1 ) ) ) @@ -3338,11 +3182,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( expn = sub( sub( 30, expn ), sub( shl( Q_insig_lp, 1 ), 7 ) ); expd = norm_l( WB_tenv_syn_fx ); -#ifdef ISSUE_1867_replace_overflow_libenc den = round_fx_sat( L_shl( WB_tenv_syn_fx, expd ) ); -#else - den = round_fx_o( L_shl( WB_tenv_syn_fx, expd ), &Overflow ); -#endif expd = sub( sub( 30, expd ), sub( shl( Q_insig_lp, 1 ), 7 ) ); scale = shr( sub( den, num ), 15 ); @@ -3355,11 +3195,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &expn ); /*31-expn */ -#ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, sub( expn, 1 ) ) ); /*Q14 */ -#else - Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, sub( expn, 1 ), &Overflow ), &Overflow ); /*Q14 */ -#endif } ELSE { @@ -3369,12 +3205,8 @@ static Word16 SWB_BWE_encoding_ivas_fx( IF( LT_16( Rat_tenv_fx, 8192 ) ) { - L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, 2 ) ); /*Q15 */ -#else - Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, 2, &Overflow ), &Overflow ); /*Q15 */ -#endif } ELSE IF( GT_16( Rat_tenv_fx, 16384 ) ) { diff --git a/lib_enc/swb_bwe_enc_hr_fx.c b/lib_enc/swb_bwe_enc_hr_fx.c index 872d7d403..5fa034fbf 100644 --- a/lib_enc/swb_bwe_enc_hr_fx.c +++ b/lib_enc/swb_bwe_enc_hr_fx.c @@ -117,12 +117,6 @@ void swb_bwe_enc_hr_fx( Word32 L_t_audio_tmp_fx[N_BANDS_BWE_HR * WIDTH_NONTRANS_FREQ_COEF]; #else Word32 L_t_audio_tmp_fx[L_FRAME48k]; -#endif -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; @@ -771,11 +765,7 @@ void swb_bwe_enc_hr_fx( { L_tmp = L_mult( temp, t_audio_fx[i] ); L_tmp = L_shr_sat( L_tmp, temp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc t_audio_fx[i] = round_fx_sat( L_tmp ); -#else - t_audio_fx[i] = round_fx_o( L_tmp, &Overflow ); -#endif move16(); } diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index ad178ab55..a8b6f0a6d 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -698,12 +698,7 @@ static void gethar_noisegn_fx( Word16 temp_lo, temp_hi; Word16 Qg; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + /*Generate HF noise*/ genhf_noise_fx( noise_flr_fx, Qss, L_xSynth_har, QsL, sspectra_fx, bands, har_bands, har_freq_est2, pos_max_hfe2, pul_res_fx, pk_sf_fx, fLenLow, fLenHigh, sbWidth, lagIndices, subband_offsets, subband_search_offset ); @@ -785,13 +780,8 @@ static void gethar_noisegn_fx( L_temp = L_Comp( exp, frac ); L_temp = Mpy_32_16_1( L_temp, 19728 ); /* log(2)/log(10)=.30102999566398119521 = 19728.3(Q16) Q(0+16+1)=Q17 */ -#ifdef ISSUE_1867_replace_overflow_libenc - L_temp = L_shl_sat( L_temp, 13 ); /* Q17+13=30 30-16=14 */ + L_temp = L_shl_sat( L_temp, 13 ); /* Q17+13=30 30-16=14 */ g_fx = round_fx_sat( L_temp ); -#else - L_temp = L_shl_o( L_temp, 13, &Overflow ); /* Q17+13=30 30-16=14 */ - g_fx = round_fx_o( L_temp, &Overflow ); -#endif } gqlevs_fx = 4; diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 0d9a3d0cb..1693ac3ac 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -697,12 +697,6 @@ void wb_tbe_enc_fx( Word16 avg_voice_fac; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; RF_ENC_HANDLE hRF = st_fx->hRF; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /*Word16 att = 32767;*/ @@ -1168,13 +1162,8 @@ void wb_tbe_enc_fx( exp = norm_s( voicingBufAvg_fx ); tmp = div_s( shl( 1, sub( 14, exp ) ), voicingBufAvg_fx ); /* (14-exp) */ L_tmp = L_mult( pitBufAvg_fx, tmp ); /* (21-exp) */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( L_tmp, add( exp, 10 ) ); tmp = round_fx_sat( L_tmp ); /* Q15 */ -#else - L_tmp = L_shl_o( L_tmp, add( exp, 10 ), &Overflow ); - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ -#endif } tmp = s_max( s_min( tmp, 32767 ), 22938 ); /* Q15 */ @@ -1304,12 +1293,6 @@ void wb_tbe_enc_ivas_fx( Word16 dummy = 0; Word16 avg_voice_fac; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif move16(); /*Word16 att = 32767;*/ @@ -1340,11 +1323,7 @@ void wb_tbe_enc_ivas_fx( FOR( j = 0; j < L_SUBFR16k; j = j + 4 ) { L_tmp = L_mult( hb_old_speech[i], ola_win_shb_switch_fold_fx[j] ); -#ifdef ISSUE_1867_replace_overflow_libenc hb_old_speech[i] = mac_r_sat( L_tmp, hb_speech[k], ola_win_shb_switch_fold_fx[L_SUBFR16k - 4 - j] ); -#else - hb_old_speech[i] = mac_ro( L_tmp, hb_speech[k], ola_win_shb_switch_fold_fx[L_SUBFR16k - 4 - j], &Overflow ); -#endif move16(); i--; k++; @@ -1832,13 +1811,8 @@ void wb_tbe_enc_ivas_fx( exp = norm_s( voicingBufAvg_fx ); tmp = div_s( shl( 1, sub( 14, exp ) ), voicingBufAvg_fx ); /* (14-exp) */ L_tmp = L_mult( pitBufAvg_fx, tmp ); /* (21-exp) */ -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_shl_sat( L_tmp, add( exp, 10 ) ); tmp = round_fx_sat( L_tmp ); /* Q15 */ -#else - L_tmp = L_shl_o( L_tmp, add( exp, 10 ), &Overflow ); - tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ -#endif } tmp = s_max( s_min( tmp, 32767 ), 22938 ); /* Q15 */ @@ -2019,12 +1993,6 @@ void swb_tbe_enc_fx( Word16 tilt_para; Word16 Q_bwe_exc_fb; Word16 n_subfr_saturation; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; RF_ENC_HANDLE hRF = st_fx->hRF; @@ -2491,13 +2459,8 @@ void swb_tbe_enc_fx( curr_pow_fx = L_shl( 21475l /*0.00001f Q31*/, tmp ); /* 2*(Q_bwe_exc) */ FOR( i = 0; i < L_SHB_LAHEAD + 10; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc prev_pow_fx = L_mac0_sat( prev_pow_fx, shaped_shb_excitation_fx[i], shaped_shb_excitation_fx[i] ); /* 2*Q_bwe_exc */ curr_pow_fx = L_mac0_sat( curr_pow_fx, shaped_shb_excitation_fx[i + L_SHB_LAHEAD + 10], shaped_shb_excitation_fx[i + L_SHB_LAHEAD + 10] ); /* 2*Q_bwe_exc */ -#else - prev_pow_fx = L_mac0_o( prev_pow_fx, shaped_shb_excitation_fx[i], shaped_shb_excitation_fx[i], &Overflow ); /* 2*Q_bwe_exc */ - curr_pow_fx = L_mac0_o( curr_pow_fx, shaped_shb_excitation_fx[i + L_SHB_LAHEAD + 10], shaped_shb_excitation_fx[i + L_SHB_LAHEAD + 10], &Overflow ); /* 2*Q_bwe_exc */ -#endif } if ( GT_16( voice_factors_fx[0], 24576 /*0.75f Q15*/ ) ) @@ -2531,20 +2494,12 @@ void swb_tbe_enc_fx( { FOR( ; i < L_SHB_LAHEAD + 10; i++ ) { - tmp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ ); /* Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + tmp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ ); /* Q15 */ L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), tmp ); /* Q31-exp */ -#else - L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */ -#endif tmp = sub( 32767 /*1.0f Q15*/, tmp ); Lscale = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ -#endif move16(); } } @@ -2553,19 +2508,11 @@ void swb_tbe_enc_fx( FOR( ; i < L_SHB_LAHEAD + 10; i++ ) { tmp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), tmp ); /* Q31-exp */ -#else - L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */ -#endif tmp = sub( 32767 /*1.0f Q15*/, tmp ); Lscale = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ -#endif move16(); } } @@ -2794,13 +2741,9 @@ void swb_tbe_enc_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), voicingBufAvg_fx ); /* (14-exp) */ /* sd_uq_q*pitBufAvg */ - L_tmp = Mult_32_16( L_tmp, pitBufAvg_fx ); /* Q13 * Q10 + 1 -16 => Q8 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /* Q8 + (14 - exp) - 15 => Q7 - exp */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( L_tmp, pitBufAvg_fx ); /* Q13 * Q10 + 1 -16 => Q8 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /* Q8 + (14 - exp) - 15 => Q7 - exp */ tmp = round_fx_sat( L_shl_sat( L_tmp, 31 - ( 7 - exp ) ) ); /* Q15 */ -#else - tmp = round_fx_o( L_shl_o( L_tmp, 31 - ( 7 - exp ), &Overflow ), &Overflow ); /* Q15 */ -#endif } tmp = s_min( tmp, 32767 /*1.0f Q15*/ ); @@ -2988,12 +2931,6 @@ void swb_tbe_enc_ivas_fx( Word16 tilt_para_fx; Word16 Q_bwe_exc_fb; Word16 n_subfr_saturation; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif Env_error_fx = 0; move16(); @@ -3869,12 +3806,8 @@ void swb_tbe_enc_ivas_fx( FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q(16-exp+Q_bwe_exc) */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] ); /* Q(16-exp+Q_bwe_exc) */ shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ -#endif move16(); } IF( exp < 0 ) @@ -3891,20 +3824,12 @@ void swb_tbe_enc_ivas_fx( { FOR( ; i < L_SHB_LAHEAD + 10; i++ ) { - tmp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ ); /* Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + tmp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ ); /* Q15 */ L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), tmp ); /* Q31-exp */ -#else - L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */ -#endif tmp = sub( 32767 /*1.0f Q15*/, tmp ); L_tmp = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 ); - L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ -#endif move16(); } } @@ -3913,19 +3838,11 @@ void swb_tbe_enc_ivas_fx( FOR( ; i < L_SHB_LAHEAD + 10; i++ ) { tmp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), tmp ); /* Q31-exp */ -#else - L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */ -#endif tmp = sub( 32767 /*1.0f Q15*/, tmp ); L_tmp = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 ); - L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */ -#endif move16(); } } @@ -4432,13 +4349,9 @@ void swb_tbe_enc_ivas_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), voicingBufAvg_fx ); /* (14-exp) */ /* sd_uq_q*pitBufAvg */ - L_tmp = Mult_32_16( L_tmp, pitBufAvg_fx ); /* Q13 * Q10 + 1 -16 => Q8 */ - L_tmp = Mult_32_16( L_tmp, tmp ); /* Q8 + (14 - exp) - 15 => Q7 - exp */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mult_32_16( L_tmp, pitBufAvg_fx ); /* Q13 * Q10 + 1 -16 => Q8 */ + L_tmp = Mult_32_16( L_tmp, tmp ); /* Q8 + (14 - exp) - 15 => Q7 - exp */ tmp = round_fx_sat( L_shl_sat( L_tmp, 31 - ( 7 - exp ) ) ); /* Q15 */ -#else - tmp = round_fx_o( L_shl_o( L_tmp, 31 - ( 7 - exp ), &Overflow ), &Overflow ); /* Q15 */ -#endif } tmp = s_min( tmp, 32767 /*1.0f Q15*/ ); tmp = s_max( tmp, 19661 /*0.6f Q15*/ ); @@ -4593,12 +4506,6 @@ static void EstimateSHBFrameGain_fx( Word16 exp_out; Word16 tmp; Word16 scaling = 0; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif move16(); /* initilaization */ @@ -4708,47 +4615,26 @@ static void EstimateSHBFrameGain_fx( FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r_sat( oriSHB[i], win_shb[i] ); /* Q_oriSHB */ oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_orisHB*/ sig = round_fx_sat( Mult_32_16( mod_syn[i], win_shb[i] ) ); /*Q_synSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2*Q_synSHB */ -#else - sig = mult_ro( oriSHB[i], win_shb[i], &Overflow ); /* Q_oriSHB */ - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_orisHB*/ - sig = round_fx_o( Mult_32_16( mod_syn[i], win_shb[i] ), &Overflow ); /*Q_synSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2*Q_synSHB */ -#endif } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc oriNrg = L_mac0_sat( oriNrg, oriSHB[i], oriSHB[i] ); /* 2*Q_oriSHB */ sig = round_fx_sat( mod_syn[i] ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2*Q_oriSHB */ -#else - oriNrg = L_mac0_o( oriNrg, oriSHB[i], oriSHB[i], &Overflow ); /* 2*Q_oriSHB */ - sig = round_fx_o( mod_syn[i], &Overflow ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB */ -#endif } tmp = add( l_frame, l_shb_lahead ); FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r_sat( oriSHB[i], win_shb[l_frame + l_shb_lahead - 1 - i] ); /* Q_oriSHB */ oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB */ sig = round_fx_sat( Mult_32_16( mod_syn[i], win_shb[l_frame + l_shb_lahead - 1 - i] ) ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2*Q_oriSHB */ -#else - sig = mult_ro( oriSHB[i], win_shb[l_frame + l_shb_lahead - 1 - i], &Overflow ); /* Q_oriSHB */ - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB */ - - sig = round_fx_o( Mult_32_16( mod_syn[i], win_shb[l_frame + l_shb_lahead - 1 - i] ), &Overflow ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB */ -#endif } IF( EQ_32( oriNrg, MAX_32 ) ) { @@ -4757,33 +4643,18 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB + 2*scaling */ -#else - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ -#endif } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = shl_sat( oriSHB[i], scaling ); oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB + 2*scaling */ -#else - sig = shl_sat( oriSHB[i], scaling ); - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ -#endif } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB + 2*scaling */ -#else - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ -#endif } } L_tmp = root_a_over_b_fx( oriNrg, 2 * Q_oriSHB, synNrg, 2 * Q_synSHB, &exp_out ); @@ -4819,12 +4690,6 @@ static void EstimateSHBFrameGain_ivas_fx( Word16 exp_out; Word16 tmp; Word16 scaling = 0; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move16(); /* initilaization */ @@ -4934,47 +4799,26 @@ static void EstimateSHBFrameGain_ivas_fx( FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r_sat( oriSHB[i], win_shb[i] ); /* Q_oriSHB */ oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_orisHB*/ sig = round_fx_sat( Mult_32_16( mod_syn[i], win_shb[i] ) ); /*Q_synSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2*Q_synSHB - 2*/ -#else - sig = mult_ro( oriSHB[i], win_shb[i], &Overflow ); /* Q_oriSHB */ - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_orisHB*/ - sig = round_fx_o( Mult_32_16( mod_syn[i], win_shb[i] ), &Overflow ); /*Q_synSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2*Q_synSHB - 2*/ -#endif } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc oriNrg = L_mac0_sat( oriNrg, oriSHB[i], oriSHB[i] ); /* 2*Q_oriSHB */ sig = round_fx_sat( mod_syn[i] ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2*Q_oriSHB - 2*/ -#else - oriNrg = L_mac0_o( oriNrg, oriSHB[i], oriSHB[i], &Overflow ); /* 2*Q_oriSHB */ - sig = round_fx_o( mod_syn[i], &Overflow ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB - 2*/ -#endif } tmp = add( l_frame, l_shb_lahead ); FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r_sat( oriSHB[i], win_shb[l_frame + l_shb_lahead - 1 - i] ); /* Q_oriSHB */ oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB */ sig = round_fx_sat( Mult_32_16( mod_syn[i], win_shb[l_frame + l_shb_lahead - 1 - i] ) ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2*Q_oriSHB - 2*/ -#else - sig = mult_ro( oriSHB[i], win_shb[l_frame + l_shb_lahead - 1 - i], &Overflow ); /* Q_oriSHB */ - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB */ - - sig = round_fx_o( Mult_32_16( mod_syn[i], win_shb[l_frame + l_shb_lahead - 1 - i] ), &Overflow ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB - 2*/ -#endif } IF( EQ_32( oriNrg, MAX_32 ) ) { @@ -4983,33 +4827,18 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB + 2*scaling */ -#else - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ -#endif } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = shl_sat( oriSHB[i], scaling ); oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB + 2*scaling */ -#else - sig = shl_sat( oriSHB[i], scaling ); - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ -#endif } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2*Q_oriSHB + 2*scaling */ -#else - sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ -#endif } } L_tmp = root_a_over_b_fx( oriNrg, shl( Q_oriSHB, 1 ), synNrg, sub( shl( Q_synSHB, 1 ), 2 ), &exp_out ); @@ -5123,12 +4952,6 @@ static void EstimateSHBGainShape_fx( Word16 length_tmp; Word32 L_tmp, normFact; Word16 scaling = 0; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move32(); move16(); move16(); @@ -5246,43 +5069,25 @@ static void EstimateSHBGainShape_fx( FOR( k = 0; k < length; k++ ) { sig = mult_r( oriSHB[j + k], subwin[k + 1] ); /* Q_oriSHB */ -#ifdef ISSUE_1867_replace_overflow_libenc oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */ sig = mult_r( synSHB[j + k], subwin[k + 1] ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_oriSHB */ -#else - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2* Q_oriSHB */ - sig = mult_r( synSHB[j + k], subwin[k + 1] ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2* Q_oriSHB */ -#endif } FOR( k = 0; k < ( join_length - length ); k++ ) { sig = mult_r( oriSHB[length + j + k], 32767 ); /* Q_oriSHB */ -#ifdef ISSUE_1867_replace_overflow_libenc oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */ sig = mult_r( synSHB[length + j + k], 32767 ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_oriSHB */ -#else - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2* Q_oriSHB */ - sig = mult_r( synSHB[length + j + k], 32767 ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2* Q_oriSHB */ -#endif } FOR( k = 0; k < length; k++ ) { sig = mult_r( oriSHB[j + join_length + k], subwin[length - k - 1] ); /* Q_oriSHB */ -#ifdef ISSUE_1867_replace_overflow_libenc oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */ sig = mult_r( synSHB[j + join_length + k], subwin[length - k - 1] ); /* Q_oriSHB */ synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_oriSHB */ -#else - oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2* Q_oriSHB */ - sig = mult_r( synSHB[j + join_length + k], subwin[length - k - 1] ); /* Q_oriSHB */ - synNrg = L_mac0_o( synNrg, sig, sig, &Overflow ); /* 2* Q_oriSHB */ -#endif } /* Only implemented in SWB because the length of samples in SWB frame is longer, more likely to saturate */ scaling = 0; @@ -5329,13 +5134,8 @@ static void EstimateSHBGainShape_fx( FOR( i = 0; i < num_gains; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc subgain[i] = round_fx_sat( L_shl_sat( L_subgain[i], sub( norm[i], n_max + 1 ) ) ); /* Q(14-n_max) */ L_sum_gain = L_mac0_sat( L_sum_gain, subgain[i], subgain[i] ); /* Q(28-2*n_max) */ -#else - subgain[i] = round_fx_o( L_shl_o( L_subgain[i], sub( norm[i], n_max + 1 ), &Overflow ), &Overflow ); /* Q(14-n_max) */ - L_sum_gain = L_mac0_o( L_sum_gain, subgain[i], subgain[i], &Overflow ); /* Q(28-2*n_max) */ -#endif move16(); } @@ -5349,12 +5149,8 @@ static void EstimateSHBGainShape_fx( { FOR( i = 0; i < num_gains; i++ ) { - L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ subgain[i] = s_max( round_fx_sat( L_shl_sat( L_tmp, add( n, n_max + 1 ) ) ), 3277 /*0.1f Q15*/ ); /* Q15 */ -#else - subgain[i] = s_max( round_fx_o( L_shl_o( L_tmp, add( n, n_max + 1 ), &Overflow ), &Overflow ), 3277 /*0.1f Q15*/ ); /* Q15 */ -#endif move16(); } } @@ -5363,11 +5159,7 @@ static void EstimateSHBGainShape_fx( FOR( i = 0; i < num_gains; i++ ) { L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ -#ifdef ISSUE_1867_replace_overflow_libenc - subgain[i] = round_fx_sat( L_shl_sat( L_tmp, add( n, n_max + 1 ) ) ); /* Q15 */ -#else - subgain[i] = round_fx_o( L_shl_o( L_tmp, add( n, n_max + 1 ), &Overflow ), &Overflow ); /* Q15 */ -#endif + subgain[i] = round_fx_sat( L_shl_sat( L_tmp, add( n, n_max + 1 ) ) ); /* Q15 */ move16(); } } @@ -6997,12 +6789,6 @@ static void first_VQstages_fx( move16(); Word16 maxC = LSFMBEST; move16(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /*float dd[16];*/ const Word16 *cb_stage, *cbp; @@ -7028,13 +6814,9 @@ static void first_VQstages_fx( L_tmp = L_deposit_l( 0 ); FOR( j = 0; j < N; j++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp1 = L_shl_sat( L_mult0( u[j], w[j] ), 7 ); /*x2.56 + Q8 + Q7 */ -#else - L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */ -#endif - L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */ - L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */ + L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */ + L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */ } set32_fx( dist[1], L_tmp, maxC ); @@ -7522,12 +7304,7 @@ void fb_tbe_enc_fx( Word16 tmp, tmp1, tmp2, exp, exp2, exp_norm; Word16 s_max_value, exp_temp, i; TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif + s_max_value = 0; FOR( i = 0; i < L_FRAME48k; i++ ) { @@ -7561,13 +7338,9 @@ void fb_tbe_enc_fx( Copy( hBWE_TD->old_input_fhb_fx, input_fhb, Sample_Delay_HP ); Copy( tmp_vec, input_fhb + Sample_Delay_HP, L_FRAME48k - Sample_Delay_HP ); Copy( tmp_vec + L_FRAME48k - Sample_Delay_HP, hBWE_TD->old_input_fhb_fx, Sample_Delay_HP ); - temp2 = sum2_fx_mod( input_fhb, L_FRAME48k / 2 ); /* Q11 */ -#ifdef ISSUE_1867_replace_overflow_libenc + temp2 = sum2_fx_mod( input_fhb, L_FRAME48k / 2 ); /* Q11 */ temp2 = L_add_sat( temp2, L_shl_sat( hBWE_TD->prev_fb_energy_fx, sub( sub( add( exp_temp, exp_temp ), 6 ), hBWE_TD->prev_fb_energy_fx_Q ) ) ); /* Q11 */ -#else - temp2 = L_add_o( temp2, L_shl_o( hBWE_TD->prev_fb_energy_fx, sub( sub( add( exp_temp, exp_temp ), 6 ), hBWE_TD->prev_fb_energy_fx_Q ), &Overflow ), &Overflow ); /* Q11 */ -#endif - hBWE_TD->prev_fb_energy_fx = sum2_fx_mod( input_fhb + L_FRAME48k / 2, L_FRAME48k / 2 ); /*Q11*/ + hBWE_TD->prev_fb_energy_fx = sum2_fx_mod( input_fhb + L_FRAME48k / 2, L_FRAME48k / 2 ); /*Q11*/ hBWE_TD->prev_fb_energy_fx_Q = sub( add( exp_temp, exp_temp ), 6 ); fb_exc_energy = sum2_fx_mod( fb_exc, L_FRAME16k ); /* Q(2*Q_fb_exc+1 -7) */ diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index c492fd100..9f8b26cf8 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -495,13 +495,6 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra { Word32 corr, ener; Word16 i, g, s1, s2, tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - s1 = sub( getScaleFactor16( speech, L_frame ), 4 ); s2 = sub( getScaleFactor16( pred_speech, L_frame ), 4 ); @@ -528,21 +521,13 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra ener = L_shl( ener, tmp ); s2 = sub( s2, tmp ); -#ifdef ISSUE_1867_replace_overflow_libenc g = divide1616( round_fx_sat( corr ), round_fx_sat( ener ) ); -#else - g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); -#endif BASOP_SATURATE_WARNING_OFF_EVS g = shl_sat( g, sub( s1, s2 ) ); BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ -#ifdef ISSUE_1867_replace_overflow_libenc g = shr( sub_sat( g, 0x1000 ), 13 ); -#else - g = shr( sub_o( g, 0x1000, &Overflow ), 13 ); -#endif g = s_max( g, -1 ); *gain_index = g; @@ -557,12 +542,6 @@ static void tcx_ltp_find_gain_ivas_fx( Word16 *speech /*Qx*/, Word16 *pred_speec { Word32 corr, ener; Word16 i, g, s1, s2, tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif s1 = sub( getScaleFactor16( speech, L_frame ), 4 ); s2 = sub( getScaleFactor16( pred_speech, L_frame ), 4 ); @@ -589,11 +568,7 @@ static void tcx_ltp_find_gain_ivas_fx( Word16 *speech /*Qx*/, Word16 *pred_speec ener = L_shl( ener, tmp ); s2 = sub( s2, tmp ); -#ifdef ISSUE_1867_replace_overflow_libenc g = divide1616( round_fx_sat( corr ), round_fx_sat( ener ) ); -#else - g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); -#endif BASOP_SATURATE_WARNING_OFF_EVS g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ BASOP_SATURATE_WARNING_ON_EVS @@ -650,12 +625,6 @@ void tcx_ltp_encode_fx( Word16 buf_zir[M + L_SUBFR], *zir; Word16 Aest[M + 1]; Word16 alpha, step; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif norm_corr = 0; move16(); @@ -813,18 +782,10 @@ void tcx_ltp_encode_fx( FOR( n = 0; n < L_subfr; n++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc speech_ltp[n] = sub_sat( speech[n], mult_r_sat( *gain, mult_r_sat( alpha, pred_speech[n] ) ) ); -#else - speech_ltp[n] = sub_o( speech[n], mult_ro( *gain, mult_ro( alpha, pred_speech[n], &Overflow ), &Overflow ), &Overflow ); -#endif move16(); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1867_replace_overflow_libenc alpha = add_sat( alpha, step ); -#else - alpha = add_o( alpha, step, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } } @@ -875,11 +836,7 @@ void tcx_ltp_encode_fx( FOR( n = 0; n < L_subfr; n++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc speech_ltp[n] = add_sat( sub_sat( speech[n], mult_r_sat( *gain, pred_speech[n] ) ), zir[n] ); -#else - speech_ltp[n] = add_o( sub_o( speech[n], mult_ro( *gain, pred_speech[n], &Overflow ), &Overflow ), zir[n], &Overflow ); -#endif move16(); } } @@ -897,11 +854,7 @@ void tcx_ltp_encode_fx( { FOR( n = L_subfr; n < L_frame; n++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc speech_ltp[n] = sub_sat( speech[n], mult( *gain, pred_speech[n] ) ); -#else - speech_ltp[n] = sub_o( speech[n], mult( *gain, pred_speech[n] ), &Overflow ); -#endif move16(); } } @@ -947,11 +900,6 @@ void tcx_ltp_encode_ivas_fx( Word16 Aest_fx[M + 1]; Word16 exponent; Word16 sqr; -#ifndef ISSUE_1867_replace_overflow_libenc - Flag Overflow = 0; - move32(); -#endif - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; tcxOnly = st->tcxonly; @@ -1243,11 +1191,7 @@ void tcx_ltp_encode_ivas_fx( FOR( n = 0; n < L_subfr; n++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc speech_ltp_fx[n] = sub_sat( speech_fx[n], mult_r_sat( hTcxEnc->tcxltp_gain, mult_r_sat( alpha_fx, pred_speech_fx[n] ) ) ); -#else - speech_ltp_fx[n] = sub_o( speech_fx[n], mult_ro( hTcxEnc->tcxltp_gain, mult_ro( alpha_fx, pred_speech_fx[n], &Overflow ), &Overflow ), &Overflow ); -#endif move16(); alpha_fx = add_sat( alpha_fx, step_fx ); } @@ -1297,11 +1241,7 @@ void tcx_ltp_encode_ivas_fx( FOR( n = 0; n < L_subfr; n++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc speech_ltp_fx[n] = add_sat( sub_sat( speech_fx[n], mult_r_sat( hTcxEnc->tcxltp_gain, pred_speech_fx[n] ) ), zir_fx[n] ); -#else - speech_ltp_fx[n] = add_o( sub_o( speech_fx[n], mult_ro( hTcxEnc->tcxltp_gain, pred_speech_fx[n], &Overflow ), &Overflow ), zir_fx[n], &Overflow ); -#endif move16(); } } @@ -1319,11 +1259,7 @@ void tcx_ltp_encode_ivas_fx( { FOR( n = L_subfr; n < L_frame; n++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc speech_ltp_fx[n] = sub_sat( speech_fx[n], mult( hTcxEnc->tcxltp_gain, pred_speech_fx[n] ) ); -#else - speech_ltp_fx[n] = sub_o( speech_fx[n], mult( hTcxEnc->tcxltp_gain, pred_speech_fx[n] ), &Overflow ); -#endif move16(); } } diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index b8f187205..bbeb26ee3 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -287,31 +287,16 @@ static void detectLowpassFac( const Word32 *powerSpec, Word16 powerSpec_e, Word1 { Word16 i, tmp; Word32 threshold; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - threshold = 256l /*0.1f * 2*NORM_MDCT_FACTOR Q3*/; /* Q3 */ move32(); BASOP_SATURATE_WARNING_OFF_EVS /* Allow saturation, because threshold is being compared to powerSpec[i] below. */ -#ifdef ISSUE_1867_replace_overflow_libenc threshold = L_shl_sat( threshold, sub( 28, powerSpec_e ) ); -#else - threshold = L_shl_o( threshold, sub( 28, powerSpec_e ), &Overflow ); -#endif IF( rectWin != 0 ) { /* compensate for bad side-lobe attenuation with asymmetric windows */ -#ifdef ISSUE_1867_replace_overflow_libenc threshold = L_shl_sat( threshold, 1 ); -#else - threshold = L_shl_o( threshold, 1, &Overflow ); -#endif } BASOP_SATURATE_WARNING_ON_EVS @@ -2504,12 +2489,6 @@ void tcx_noise_factor_ivas_fx( Word16 att; /* noise level attenuation factor for transient windows */ Word32 xMax; Word16 exp_spQ[N_MAX]; -#if !defined( ISSUE_1867_replace_overflow_libenc ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif assert( nTransWidth <= 16 ); @@ -2758,11 +2737,7 @@ void tcx_noise_factor_ivas_fx( tmp4 = BASOP_Util_Divide3232_Scale_newton( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); s = add( add( exp_sqErrorNrg, -15 ), s ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1867_replace_overflow_libenc tmp4 = L_shl_sat( tmp4, s ); -#else - tmp4 = L_shl_o( tmp4, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index 945b5c002..3f671f705 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -76,12 +76,6 @@ Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig, Word16 idx1; Word16 nSubdivisions; Word16 iSubdivisions; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move16(); move16(); @@ -127,11 +121,7 @@ Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig, /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1867_replace_overflow_libenc tmp32 = L_sub( L_shl_sat( L_tmp, s_min( 31, sub( shift, 24 - 31 * 2 ) ) ), 3277l /*HLM_MIN_NRG Q7*/ ); -#else - tmp32 = L_sub( L_shl_o( L_tmp, s_min( 31, sub( shift, 24 - 31 * 2 ) ), &Overflow ), 3277l /*HLM_MIN_NRG Q7*/ ); -#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ @@ -447,12 +437,6 @@ Word16 DetectTnsFilt_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configur Word16 idx1; Word16 nSubdivisions; Word16 iSubdivisions; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move16(); move16(); @@ -498,11 +482,7 @@ Word16 DetectTnsFilt_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configur /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1867_replace_overflow_libenc tmp32 = L_sub( L_shl_sat( L_tmp, s_min( 31, sub( shift, 24 - 31 * 2 ) ) ), 3277l /*HLM_MIN_NRG Q7*/ ); -#else - tmp32 = L_sub( L_shl_o( L_tmp, s_min( 31, sub( shift, 24 - 31 * 2 ) ), &Overflow ), 3277l /*HLM_MIN_NRG Q7*/ ); -#endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index e19a89e0b..842b63551 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -2203,12 +2203,6 @@ static void gain_trans_enc_fx( ) { Word16 i, imax, istart, tmp16, gain_trans, gscale; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif istart = 0; move16(); @@ -2216,19 +2210,11 @@ static void gain_trans_enc_fx( move16(); gscale = 7; move16(); -#ifdef ISSUE_1867_replace_overflow_libenc gain_trans = extract_h( L_shl_sat( gain_trans32, 16 ) ); /* Q7 */ -#else - gain_trans = extract_h( L_shl_o( gain_trans32, 16, &Overflow ) ); /* Q7 */ -#endif IF( GT_32( L_abs( gain_trans32 ), 29862L ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc gain_trans = extract_h( L_shl_sat( gain_trans32, 16 - 3 ) ); /* Q4 */ -#else - gain_trans = extract_h( L_shl_o( gain_trans32, 16 - 3, &Overflow ) ); /* Q4 */ -#endif istart = 4; move16(); imax = N_GAIN_TC - 1; @@ -2261,11 +2247,7 @@ static void gain_trans_enc_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /*exc[i] *= (*gain_trans);*/ -#ifdef ISSUE_1867_replace_overflow_libenc exc[i] = round_fx_sat( L_shl_sat( L_mult( exc[i], gain_trans ), tmp16 ) ); -#else - exc[i] = round_fx_o( L_shl_o( L_mult( exc[i], gain_trans ), tmp16, &Overflow ), &Overflow ); -#endif move16(); } @@ -2291,12 +2273,6 @@ void tc_classif_enc_fx( { Word32 temp; Word16 T_op, i; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif T_op = pitch; move16(); @@ -2371,11 +2347,7 @@ void tc_classif_enc_fx( L_sum = L_mac_sat( 1L, res[0], res[0] ); FOR( i = 1; i < len; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_sum = L_mac0_sat( L_sum, res[i], res[i] ); -#else - L_sum = L_mac0_o( L_sum, res[i], res[i], &Overflow ); -#endif } aver = L_sum; /*Q = 2*Q_new */ move32(); @@ -2388,13 +2360,8 @@ void tc_classif_enc_fx( L_temp1 = Mult_32_16( temp, 8192 ); /* Q=31-exp */ test(); -#ifdef ISSUE_1867_replace_overflow_libenc IF( GT_32( temp2, L_shl_sat( L_temp2, ( 31 - exp2 ) - ( 31 - exp ) ) ) && LT_32( aver, L_shl_sat( L_temp1, ( 31 - exp_aver ) - ( 31 - exp ) ) ) ) -#else - IF( GT_32( temp2, L_shl_o( L_temp2, ( 31 - exp2 ) - ( 31 - exp ), &Overflow ) ) && - LT_32( aver, L_shl_o( L_temp1, ( 31 - exp_aver ) - ( 31 - exp ), &Overflow ) ) ) -#endif { *position = position_tmp; move16(); diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 9883d9fae..349cbf268 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -199,6 +199,7 @@ static void sign_thr_snr_acc_ivas_fx( move32(); move32(); } + static void sign_thr_snr_acc_fx( Word32 *L_snr_sum, /* o: Q4 */ Word32 L_snr, /* i: Q4 */ @@ -208,12 +209,6 @@ static void sign_thr_snr_acc_fx( { /*if( snr >= sign_thr ) */ Word32 L_tmp; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif L_tmp = L_deposit_l( min_snr ); IF( GE_32( L_snr, L_deposit_l( sign_thr ) ) ) @@ -221,12 +216,8 @@ static void sign_thr_snr_acc_fx( L_tmp = L_add( L_snr, 0 ); /* Q4 */ } BASOP_SATURATE_WARNING_OFF_EVS /* may saturate in BASOP */ -#ifdef ISSUE_1867_replace_overflow_libenc *L_snr_sum = L_add_sat( *L_snr_sum, L_tmp ); /* Q4 */ -#else - *L_snr_sum = L_add_o( *L_snr_sum, L_tmp, &Overflow ); /* Q4 */ -#endif move32(); BASOP_SATURATE_WARNING_ON_EVS } @@ -702,12 +693,6 @@ Word16 wb_vad_fx( Word32 L_accum_ener_H; Word16 vad_bwidth_fx; Word16 last_7k2_coder_type; -#if !defined( ISSUE_1867_replace_overflow_libenc ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif if ( hNoiseEst == NULL ) { @@ -1052,35 +1037,19 @@ Word16 wb_vad_fx( tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ IF( LT_16( i, 2 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta1 ); /*Q13 */ -#else - tmp = add_o( tmp, delta1, &Overflow ); /*Q13 */ -#endif } ELSE IF( LT_16( i, 7 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta2 ); /*Q13 */ -#else - tmp = add_o( tmp, delta2, &Overflow ); /*Q13 */ -#endif } ELSE IF( LT_16( i, 18 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta3 ); /*Q13 */ -#else - tmp = add_o( tmp, delta3, &Overflow ); /*Q13 */ -#endif } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta4 ); /*Q13 */ -#else - tmp = add_o( tmp, delta4, &Overflow ); /*Q13 */ -#endif } tmp1 = tmp; @@ -1088,11 +1057,7 @@ Word16 wb_vad_fx( sub( 0, 0 ); if ( LT_16( i, 7 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc tmp1 = add_sat( tmp, 3277 ); /*.4 in Q13 ftmp1 = ftmp + 0.4f; */ -#else - tmp1 = add_o( tmp, 3277, &Overflow ); /*.4 in Q13 ftmp1 = ftmp + 0.4f; */ -#endif } tmp = s_min( tmp, 16384 ); /* Q13, ftmp = min(ftmp, 2.0f); */ @@ -1176,19 +1141,11 @@ Word16 wb_vad_fx( /* accumulate background noise energy in bands [0-2] and in bands [3-19]*/ IF( LT_16( i, 3 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_accum_ener_L = L_add_sat( L_accum_ener_L, hNoiseEst->bckr_fx[i] ); /*Q_new+QSCALE */ -#else - L_accum_ener_L = L_add_o( L_accum_ener_L, hNoiseEst->bckr_fx[i], &Overflow ); /*Q_new+QSCALE */ -#endif } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc L_accum_ener_H = L_add_sat( L_accum_ener_H, hNoiseEst->bckr_fx[i] ); /*Q_new+QSCALE */ -#else - L_accum_ener_H = L_add_o( L_accum_ener_H, hNoiseEst->bckr_fx[i], &Overflow ); /*Q_new+QSCALE */ -#endif } /* Identify the outlier band */ @@ -1282,11 +1239,7 @@ Word16 wb_vad_fx( } } /*st_fx->snr_sum_vad_fx = 0.5f * st->snr_sum_vad + 0.5f * snr_sum_ol;*/ -#ifdef ISSUE_1867_replace_overflow_libenc hVAD->L_snr_sum_vad_fx = L_shr( L_add_sat( hVAD->L_snr_sum_vad_fx, L_snr_sum_ol ), 1 ); /*Q4*/ -#else - hVAD->L_snr_sum_vad_fx = L_shr( L_add_o( hVAD->L_snr_sum_vad_fx, L_snr_sum_ol, &Overflow ), 1 ); /*Q4*/ -#endif move32(); /* snr_sum_ol = 10.0f * (float)log10( snr_sum_ol ); */ @@ -1400,11 +1353,7 @@ Word16 wb_vad_fx( thr1_ol = thr1; move16(); L_tmp2 = Msub_32_16( (Word32) 614, L_snr_outlier, 20972 ); /* .6*1024= */ /* 0.6 Q26(Q10 in high word) - Q4*Q21+1 */ -#ifdef ISSUE_1867_replace_overflow_libenc - tmp2 = round_fx( L_shl_sat( L_tmp2, 14 ) ); /* Q10(high word)+ 14 -16 --> Q8*/ -#else - tmp2 = round_fx( L_shl_o( L_tmp2, 14, &Overflow ) ); /* Q10(high word)+ 14 -16 --> Q8*/ -#endif + tmp2 = round_fx( L_shl_sat( L_tmp2, 14 ) ); /* Q10(high word)+ 14 -16 --> Q8*/ IF( L_tmp2 > 0 ) { thr1_ol = add( thr1_ol, tmp2 ); /* Q24 >>16 + Q8 */ @@ -1974,12 +1923,6 @@ Word16 wb_vad_ivas_fx( Word16 last_7k2_coder_type; Word16 q_shift, q_ener, q_diff1, q_diff2; Word16 q_L_snr_sum_ol, e_snr, f_snr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 L_msnr_e = 0, L_mssnr_e = 0, L_mssnr_hov_e = 0, L_msnr18_e = 0, L_msnr19_e = 0; move16(); /*L_msnr_e*/ move16(); /*L_mssnr_e*/ @@ -2444,19 +2387,11 @@ Word16 wb_vad_ivas_fx( /* accumulate background noise energy in bands [0-2] and in bands [3-19]*/ IF( LT_16( i, 3 ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_accum_ener_L = L_add_sat( L_accum_ener_L, hNoiseEst->bckr_fx[i] ); /* hNoiseEst->q_bckr */ -#else - L_accum_ener_L = L_add_o( L_accum_ener_L, hNoiseEst->bckr_fx[i], &Overflow ); /* hNoiseEst->q_bckr */ -#endif } ELSE { -#ifdef ISSUE_1867_replace_overflow_libenc L_accum_ener_H = L_add_sat( L_accum_ener_H, hNoiseEst->bckr_fx[i] ); /*hNoiseEst->q_bckr */ -#else - L_accum_ener_H = L_add_o( L_accum_ener_H, hNoiseEst->bckr_fx[i], &Overflow ); /*hNoiseEst->q_bckr */ -#endif } /* Identify the outlier band */ @@ -2470,11 +2405,8 @@ Word16 wb_vad_ivas_fx( move16(); } } /* end of band loop */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_snr_sum_HE_SAD = L_shl_sat( L_snr_sum_HE_SAD, sub( 4, q_snr_sum_HE_SAD ) ); // q_snr_sum_HE_SAD->q4 -#else - L_snr_sum_HE_SAD = L_shl_o( L_snr_sum_HE_SAD, sub( 4, q_snr_sum_HE_SAD ), &Overflow ); // q_snr_sum_HE_SAD->q4 -#endif snr_sumt = extract_h( L_shl( L_snr_sumt, Q4 ) ); // Q16 -> Q4 diff --git a/lib_enc/vad_param_updt_fx.c b/lib_enc/vad_param_updt_fx.c index 8cafb40da..a858c5cc6 100644 --- a/lib_enc/vad_param_updt_fx.c +++ b/lib_enc/vad_param_updt_fx.c @@ -34,12 +34,6 @@ void vad_param_updt_fx( Word16 i, ini_frame, corr_shift_temp[2]; VAD_HANDLE hVAD; DTX_ENC_HANDLE hDtxEnc = st_fx->hDtxEnc; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif corr_shift_temp[0] = corr_shift; /*Q15*/ corr_shift_temp[1] = corr_shiftR; /*Q15*/ @@ -162,18 +156,12 @@ void vad_param_updt_fx( } } - /* (voicing[0] + voicing[1] + voicing[2]) / 3 + corr_shift */ L_tmp = L_mult( st_fx->voicing_fx[0], 10923 ); L_tmp = L_mac( L_tmp, st_fx->voicing_fx[1], 10923 ); - L_tmp = L_mac( L_tmp, st_fx->voicing_fx[2], 10923 ); /*Q15 */ -#ifdef ISSUE_1867_replace_overflow_libenc + L_tmp = L_mac( L_tmp, st_fx->voicing_fx[2], 10923 ); /*Q15 */ L_tmp = L_mac_sat( L_tmp, corr_shift_temp[i], 32767 ); /*Q15 */ voice_tmp = round_fx_sat( L_tmp ); /*Q15 */ -#else - L_tmp = L_mac_o( L_tmp, corr_shift_temp[i], 32767, &Overflow ); /*Q15 */ - voice_tmp = round_fx_o( L_tmp, &Overflow ); /*Q15 */ -#endif /* abs(pitch[0] - *pitO) + abs(pitch[1] - pitch[0]) + abs(pitch[2] - pitch[1]) */ pitch_tmp = abs_s( sub( st_fx->pitch[0], old_pitch1 ) ); /*Q0 */ diff --git a/lib_enc/vbr_average_rate_fx.c b/lib_enc/vbr_average_rate_fx.c index 668dd06d7..f1f75a30a 100644 --- a/lib_enc/vbr_average_rate_fx.c +++ b/lib_enc/vbr_average_rate_fx.c @@ -47,13 +47,6 @@ void update_average_rate_fx( Word16 tmp; Word32 L_tmp; Word32 L_tmp1, L_tmp2; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - Word16 exp, recip, Qrecip; IF( EQ_16( hSC_VBR->numactive, RATEWIN ) ) /* goes into rate control only the numactive ==RATEWIN. So rate control is triggered after each RATEWIN avtive frames */ @@ -258,11 +251,8 @@ void update_average_rate_fx( /* sum the total number of bits (in kbytes) * 10 here */ /*st->sum_of_rates += (hSC_VBR->core_brate / 1000.0f) * 10; */ L_tmp = L_shl( Mult_32_16( core_brate_fx, 20972 ), 7 ); /*Q13*/ -#ifdef ISSUE_1867_replace_overflow_libenc hSC_VBR->sum_of_rates_fx = L_add_sat( hSC_VBR->sum_of_rates_fx, L_tmp ); -#else - hSC_VBR->sum_of_rates_fx = L_add_o( hSC_VBR->sum_of_rates_fx, L_tmp, &Overflow ); -#endif move32(); + return; } diff --git a/lib_enc/vlpc_2st_cod_fx.c b/lib_enc/vlpc_2st_cod_fx.c index 3f56add39..6db7cd3ef 100644 --- a/lib_enc/vlpc_2st_cod_fx.c +++ b/lib_enc/vlpc_2st_cod_fx.c @@ -30,13 +30,6 @@ Word16 vlpc_2st_cod_fx( /* output: number of allocated bits Word16 nq, xq[M]; Word32 L_tmp; Word16 gap; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif - /* 0 bit with true weighting: save 0.5 bit */ lsf_weight_2st( lsf, w, 1 ); /*w:0Q15*1.28*/ @@ -59,11 +52,7 @@ Word16 vlpc_2st_cod_fx( /* output: number of allocated bits BASOP_SATURATE_WARNING_OFF_EVS /* Allow saturate because we only need to know if the result is smaller than 8.0f */ FOR( i = 1; i < M; i++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac_sat( L_tmp, x[i], x[i] ); /*10Q21*/ -#else - L_tmp = L_mac_o( L_tmp, x[i], x[i], &Overflow ); /*10Q21*/ -#endif } BASOP_SATURATE_WARNING_ON_EVS diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 705c5f6ea..a78ec7648 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -123,12 +123,6 @@ ivas_error ppp_voiced_encoder_fx( Word32 low_band_en_fx; Word32 curr_Engy, prev_Engy; Word16 temp_Fs; -#if !defined( ISSUE_1867_replace_overflow_libenc ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif DTFS_STRUCTURE *CURRP_NQ_FX; DTFS_STRUCTURE *TMPDTFS_FX; DTFS_STRUCTURE *TMPDTFS2_FX; @@ -566,11 +560,7 @@ ivas_error ppp_voiced_encoder_fx( /*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 */ test(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( ( GT_32( res_enratio_fx, 10240 ) ) && ( LT_16( extract_h( L_shl_sat( tmp_fx, sub( 31, Qtmp ) ) ), 21299 ) ) ) -#else - if ( ( GT_32( res_enratio_fx, 10240 ) ) && ( LT_16( extract_h( L_shl_o( tmp_fx, sub( 31, Qtmp ), &Overflow ) ), 21299 ) ) ) -#endif { PPP_MODE_E = 'B'; move16(); @@ -581,11 +571,7 @@ ivas_error ppp_voiced_encoder_fx( /* if ( res_enratio > 3.0 && tmp < 1.2 ) */ /*3 in Q11, 1.2 in Q14 // L_shl(tmp_fx,sub(31,Qtmp)) makes tmp_fx FIXED Q14 */ test(); -#ifdef ISSUE_1867_replace_overflow_libenc if ( ( GT_32( res_enratio_fx, 6144 ) ) && ( LT_16( extract_h( L_shl_sat( tmp_fx, sub( 30, Qtmp ) ) ), 19661 ) ) ) -#else - if ( ( GT_32( res_enratio_fx, 6144 ) ) && ( LT_16( extract_h( L_shl_o( tmp_fx, sub( 30, Qtmp ), &Overflow ) ), 19661 ) ) ) -#endif { PPP_MODE_E = 'B'; move16(); @@ -599,12 +585,7 @@ ivas_error ppp_voiced_encoder_fx( IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ { /* if (res_enratio < 0.025) */ -#ifdef ISSUE_1867_replace_overflow_libenc - IF( LT_32( L_shl_sat( res_enratio_fx, 4 ), 819 ) ) - /*0x0333 = 0.025 in Q15, res_enratio_fx in Q15 after shl 4 */ -#else - 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 */ -#endif + IF( LT_32( L_shl_sat( res_enratio_fx, 4 ), 819 ) ) /*0x0333 = 0.025 in Q15, res_enratio_fx in Q15 after shl 4 */ { hSC_VBR->bump_up = 1; move16(); @@ -620,11 +601,7 @@ ivas_error ppp_voiced_encoder_fx( ELSE { /* if ( res_enratio < 0.092f) */ -#ifdef ISSUE_1867_replace_overflow_libenc if ( LT_32( L_shl_sat( res_enratio_fx, 4 ), 3015 ) ) /*3015 = 0.092 in Q15, res_enratio_fx in Q15 after shl 4 */ -#else - if ( LT_32( L_shl_o( res_enratio_fx, 4, &Overflow ), 3015 ) ) /*3015 = 0.092 in Q15, res_enratio_fx in Q15 after shl 4 */ -#endif { hSC_VBR->bump_up = 1; move16(); @@ -633,12 +610,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_1867_replace_overflow_libenc if ( LT_32( L_min( L_shl_sat( res_enratio_fx, 4 ), 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_sat( -1, sub( Qtmp, 1 ) ) ) ) -#endif { hSC_VBR->bump_up = 1; move16(); @@ -757,11 +729,7 @@ ivas_error ppp_voiced_encoder_fx( Ltemp1 = L_negate( Ltemp1 ); } expa = norm_l( Ltemp2 ); -#ifdef ISSUE_1867_replace_overflow_libenc fraca = extract_h( L_shl( Ltemp2, expa ) ); -#else - fraca = extract_h( L_shl_o( Ltemp2, expa, &Overflow ) ); -#endif expa = sub( 30, expa ); expb = norm_l( Ltemp1 ); @@ -774,11 +742,7 @@ ivas_error ppp_voiced_encoder_fx( tmp = div_s( fracb, fraca ); exp = sub( expb, expa ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltemp_fx = L_shl_sat( tmp, add( exp, 14 ) ); -#else - Ltemp_fx = L_shl_o( tmp, add( exp, 14 ), &Overflow ); -#endif /*-------------------------------------------*/ sp_hb_enratio_fx = L_add( Ltemp_fx, 0 ); /* Q29 */ } @@ -802,11 +766,7 @@ ivas_error ppp_voiced_encoder_fx( move32(); Qadj = sub( hSC_VBR->Q_prev_cw_en_fx, shl( CURRP_NQ_FX->Q, 1 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp_32 = L_shl_sat( Ltmp_32, Qadj ); /* shift left required to adjust Q of CURRP_NQ_FX = Q_prev_cw_en_fx */ -#else - Ltmp_32 = L_shl_o( Ltmp_32, Qadj, &Overflow ); /* shift left required to adjust Q of CURRP_NQ_FX = Q_prev_cw_en_fx */ -#endif /* 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 */ @@ -911,11 +871,7 @@ ivas_error ppp_voiced_encoder_fx( /* compute energy of impz */ FOR( x_fx = 0; x_fx < 160; x_fx++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc energy_impz_fx = L_add_sat( energy_impz_fx, L_mult0( impzo_fx[x_fx], impzo_fx[x_fx] ) ); -#else - energy_impz_fx = L_add_o( energy_impz_fx, L_mult0( impzo_fx[x_fx], impzo_fx[x_fx] ), &Overflow ); -#endif } /*energy_impz = (float)(10*log10((float)energy_impz)); */ @@ -929,11 +885,7 @@ ivas_error ppp_voiced_encoder_fx( Ltmp_32 = DTFS_getEngy_fx( CURRP_Q_E_FX ); /*Q = 2*(CURRP_Q_E_FX->Q) */ move32(); Qadj = sub( hSC_VBR->Q_prev_cw_en_fx, shl( CURRP_Q_E_FX->Q, 1 ) ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltmp_32 = L_shl_sat( Ltmp_32, Qadj ); /* shift left required to adjust Q of CURRP_Q_E_FX = Q_prev_cw_en_fx */ -#else - Ltmp_32 = L_shl_o( Ltmp_32, Qadj, &Overflow ); /* shift left required to adjust Q of CURRP_Q_E_FX = Q_prev_cw_en_fx */ -#endif /* if ((DTFS_getEngy(*CURRP_Q_E) > st->prev_cw_en)&&(max(pos_q,neg_q)>3.5) && energy_impz>15.0 && tmpres>0.7) */ test(); test(); @@ -995,13 +947,9 @@ ivas_error ppp_voiced_encoder_fx( fracb = shl( fracb, scale ); expb = sub( expb, scale ); - tmp = div_s( fracb, fraca ); /* tmp in Q15 */ - exp = sub( expb, expa ); /* ans = tmp*2^(exp) */ -#ifdef ISSUE_1867_replace_overflow_libenc + tmp = div_s( fracb, fraca ); /* tmp in Q15 */ + exp = sub( expb, expa ); /* ans = tmp*2^(exp) */ Ltemp_fx = L_shl_sat( tmp, add( exp, 12 ) ); /* make tmp Q27 */ -#else - Ltemp_fx = L_shl_o( tmp, add( exp, 12 ), &Overflow ); /* make tmp Q27 */ -#endif } test(); IF( GT_32( Ltemp_fx, 6710886 ) && ( !hSC_VBR->rate_control ) ) /* 0.05 in Q27 = 6710886 */ @@ -1037,11 +985,7 @@ ivas_error ppp_voiced_encoder_fx( tmp = div_s( fracb, fraca ); exp = sub( expb, expa ); -#ifdef ISSUE_1867_replace_overflow_libenc Ltemp_fx = L_shl_sat( tmp, add( exp, 14 ) ); /* answer in Q29 */ -#else - Ltemp_fx = L_shl_o( tmp, add( exp, 14 ), &Overflow ); /* answer in Q29 */ -#endif } /*-------------------------------------------*/ @@ -1109,11 +1053,7 @@ ivas_error ppp_voiced_encoder_fx( exp = sub( 30, add( expa, sub( 31, exp ) ) ); frac = Log2_norm_lc( L_tmp ); L_tmp = Mpy_32_16( exp, frac, 12330 ); /* L_tmp is always Q13 */ -#ifdef ISSUE_1867_replace_overflow_libenc - Ltemp = L_shl_sat( L_tmp, 10 ); /* Ltemp is always Q23 */ -#else - Ltemp = L_shl_o( L_tmp, 10, &Overflow ); /* Ltemp is always Q23 */ -#endif + Ltemp = L_shl_sat( L_tmp, 10 ); /* Ltemp is always Q23 */ } ELSE { @@ -1296,12 +1236,7 @@ static void synthesis_filter_fx( Word16 b[], Word16 x[], Word16 y[], Word16 buf[ { Word32 acc; Word16 i, j; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + FOR( i = 0; i < N; i++ ) { acc = L_deposit_h( *x++ ); /*Q16 */ @@ -1310,28 +1245,15 @@ static void synthesis_filter_fx( Word16 b[], Word16 x[], Word16 y[], Word16 buf[ FOR( j = P - 1; j > 0; j-- ) { /* acc = L_sub(acc, L_mult(memory[j], coef[j])); */ -#ifdef ISSUE_1867_replace_overflow_libenc acc = L_msu_sat( acc, buf[j], b[j] ); /*Q13 */ -#else - acc = L_msu_o( acc, buf[j], b[j], &Overflow ); /*Q13 */ -#endif buf[j] = buf[j - 1]; move16(); } /* acc = L_sub(acc, L_mult(memory[0], coef[0])); */ -#ifdef ISSUE_1867_replace_overflow_libenc acc = L_msu_sat( acc, buf[0], b[0] ); acc = L_shl_sat( acc, 3 ); *y++ = round_fx_sat( acc ); buf[0] = round_fx_sat( acc ); -#else - acc = L_msu_o( acc, buf[0], b[0], &Overflow ); - acc = L_shl_o( acc, 3, &Overflow ); - - *y++ = round_fx_o( acc, &Overflow ); - - buf[0] = round_fx_o( acc, &Overflow ); -#endif move16(); move16(); } @@ -1376,12 +1298,7 @@ static Word32 DTFS_freq_corr_fx( Word16 exp, tmp; Word32 L_tmp; Word16 Q_num, Q_den; -#if !defined( ISSUE_1867_replace_overflow_libenc ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + IF( LT_16( X1_DTFS_fx.lag_fx, X2_DTFS_fx.lag_fx ) ) { DTFS_zeroPadd_fx( X2_DTFS_fx.lag_fx, &X1_DTFS_fx ); @@ -1416,13 +1333,8 @@ static Word32 DTFS_freq_corr_fx( FOR( k = lk; k < hk; k++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc corr_fx = L_mac0_sat( corr_fx, X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ); /* Q(1) */ corr_fx = L_mac0_sat( corr_fx, X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ); /* Q(1) */ -#else - corr_fx = L_mac0_o( corr_fx, X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ); /* Q(1) */ - corr_fx = L_mac0_o( corr_fx, X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ); /* Q(1) */ -#endif } Qr = norm_l( corr_fx ); @@ -1432,12 +1344,8 @@ static Word32 DTFS_freq_corr_fx( move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc E1_fx = round_fx_sat( L_shl_sat( corr_fx, Qr ) ); /* Q(Qr-16) */ -#else - E1_fx = round_fx_o( L_shl_o( corr_fx, Qr, &Overflow ), &Overflow ); /* Q(Qr-16) */ -#endif - Num = L_mult0( E1_fx, E1_fx ); /* Q(2+2*Qr-32+1) */ + Num = L_mult0( E1_fx, E1_fx ); /* Q(2+2*Qr-32+1) */ Q_num = sub( shl( add( add( X1_DTFS_fx.Q, X2_DTFS_fx.Q ), Qr ), 1 ), 32 ); /* PORTING: Handling the functions with variable no. of arguments */ @@ -1450,11 +1358,7 @@ static Word32 DTFS_freq_corr_fx( move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc E1_fx = round_fx_sat( L_shl_sat( E_fx, q1 ) ); /* Q(1+q1-16) */ -#else - E1_fx = round_fx_o( L_shl_o( E_fx, q1, &Overflow ), &Overflow ); /* Q(1+q1-16) */ -#endif /* PORTING: Handling the functions with variable no. of arguments */ E_fx = DTFS_getEngy_band_fx( X2_DTFS_fx, lband, hband ); /* Q(1) */ q2 = norm_l( E_fx ); @@ -1464,12 +1368,8 @@ static Word32 DTFS_freq_corr_fx( move16(); } -#ifdef ISSUE_1867_replace_overflow_libenc E2_fx = round_fx_sat( L_shl_sat( E_fx, q2 ) ); /* Q(1+q2-16) */ -#else - E2_fx = round_fx_o( L_shl_o( E_fx, q2, &Overflow ), &Overflow ); /* Q(1+q2-16) */ -#endif - Den = L_mult0( E1_fx, E2_fx ); /* Q(2+q1+q2-32+1) */ + Den = L_mult0( E1_fx, E2_fx ); /* Q(2+q1+q2-32+1) */ Q_den = sub( add( shl( add( X2_DTFS_fx.Q, X1_DTFS_fx.Q ), 1 ), add( q1, q2 ) ), 32 ); Num = L_max( Num, 1 ); @@ -1483,25 +1383,14 @@ static Word32 DTFS_freq_corr_fx( } ELSE { - expa = norm_l( Num ); -#ifdef ISSUE_1867_replace_overflow_libenc fraca = extract_h( L_shl_sat( Num, expa ) ); -#else - fraca = extract_h( L_shl_o( Num, expa, &Overflow ) ); -#endif expa = sub( 30, add( expa, Q_num ) ); - expb = norm_l( Den ); -#ifdef ISSUE_1867_replace_overflow_libenc fracb = round_fx_sat( L_shl( Den, expb ) ); -#else - fracb = round_fx_o( L_shl_o( Den, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, add( expb, Q_den ) ); - scale = shr( sub( fraca, fracb ), 15 ); fracb = shl_sat( fracb, scale ); expb = sub( expb, scale ); @@ -1521,8 +1410,11 @@ static Word32 DTFS_freq_corr_fx( *Qout = sub( 30, exp ); move16(); } + return Result; } + + /*===================================================================*/ /* FUNCTION : DTFS_alignment_extract_td_fx () */ /*-------------------------------------------------------------------*/ @@ -1547,12 +1439,7 @@ static Word16 DTFS_alignment_extract_td_fx( Word16 *x1, Word16 *x2, Word16 lag ) { Word16 j, k, idx, Adiff_fx; Word32 maxcorr, corr; -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + maxcorr = L_add( MIN_32, 0 ); Adiff_fx = (Word16) ( s_max( 4, shr( lag, 3 ) ) ); @@ -1563,11 +1450,7 @@ static Word16 DTFS_alignment_extract_td_fx( Word16 *x1, Word16 *x2, Word16 lag ) corr = L_deposit_l( 0 ); FOR( k = 0; k < lag; k++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc corr = L_mac_sat( corr, x1[k], x2[( k - j + lag ) % lag] ); -#else - corr = L_mac_o( corr, x1[k], x2[( k - j + lag ) % lag], &Overflow ); -#endif } IF( GT_32( corr, maxcorr ) ) { @@ -1610,15 +1493,11 @@ static Word32 DTFS_getEngy_band_fx( Word32 freq_fx, L_lband, L_hband; Word32 en_fx = 0; move32(); -#ifndef ISSUE_1867_replace_overflow_libenc -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif + L_lband = L_mult( lband, X_fx.lag_fx ); /* Q0 * Q0 -> Q1 */ L_hband = L_mult( hband, X_fx.lag_fx ); /* Q0 * Q0 -> Q1 */ HalfLag = s_min( shr( sub( X_fx.lag_fx, 1 ), 1 ), X_fx.nH_4kHz_fx ); + /* get lband and hband */ FOR( k = 1; k <= HalfLag; k++ ) { @@ -1643,13 +1522,8 @@ static Word32 DTFS_getEngy_band_fx( FOR( k = lk; k < hk; k++ ) { -#ifdef ISSUE_1867_replace_overflow_libenc en_fx = L_mac0_sat( en_fx, X_fx.a_fx[k], X_fx.a_fx[k] ); /* 2*X1.Q+1 */ en_fx = L_mac0_sat( en_fx, X_fx.b_fx[k], X_fx.b_fx[k] ); -#else - en_fx = L_mac0_o( en_fx, X_fx.a_fx[k], X_fx.a_fx[k], &Overflow ); /* 2*X1.Q+1 */ - en_fx = L_mac0_o( en_fx, X_fx.b_fx[k], X_fx.b_fx[k], &Overflow ); -#endif } if ( lband == 0 ) @@ -1661,17 +1535,14 @@ static Word32 DTFS_getEngy_band_fx( test(); IF( ( s_and( X_fx.lag_fx, 1 ) == 0 ) && ( hband == X_fx.upper_cut_off_freq_fx ) ) { -#ifdef ISSUE_1867_replace_overflow_libenc en_fx = L_mac0_sat( en_fx, X_fx.a_fx[k], X_fx.a_fx[k] ); en_fx = L_mac0_sat( en_fx, X_fx.b_fx[k], X_fx.b_fx[k] ); -#else - en_fx = L_mac0_o( en_fx, X_fx.a_fx[k], X_fx.a_fx[k], &Overflow ); - en_fx = L_mac0_o( en_fx, X_fx.b_fx[k], X_fx.b_fx[k], &Overflow ); -#endif } return en_fx; /* 2*X1.Q */ } + + /*---------------------------------------------------------------------* * sc_vbr_enc_init_fx() * diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index b0c2210f3..3cc8f4fc1 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -78,10 +78,8 @@ #define MAX_NR_OUTPUTS ( 2 ) -#ifdef FIX_1942_ASSERTION_LOWSHELF #define M60Q9 ( -30720 ) //-60 in Q9 #define M120Q8 ( -30720 ) //-120 in Q8 -#endif static const Word16 init_loop_delay[IVAS_REV_MAX_NR_BRANCHES] = { 37, 31, 29, 23, 19, 17, 13, 11 }; static const Word16 default_loop_delay_48k[IVAS_REV_MAX_NR_BRANCHES] = { 2309, 1861, 1523, 1259, 1069, 919, 809, 719 }; @@ -659,19 +657,12 @@ static ivas_error compute_t60_coeffs_fx( { Word16 bin_idx, loop_idx, tf_T60_len, len; ivas_error error; -#ifdef FIX_1942_ASSERTION_LOWSHELF Word16 loop_delay_sec_fx, tmp, tmp_e; -#else - Word16 loop_delay_sec_fx, tmp; -#endif Word32 freq_Nyquist_fx = L_shr( output_Fs, 1 ); Word16 target_gains_db_fx[RV_LENGTH_NR_FC]; // Q8 Word16 norm_f_fx[RV_LENGTH_NR_FC]; Word16 *pCoeffs_a_fx, *pCoeffs_b_fx; Word16 e; -#ifndef FIX_1942_ASSERTION_LOWSHELF - const Word16 min120q8 = -30720; // -120 in Q8 -#endif error = IVAS_ERR_OK; move32(); tf_T60_len = nr_fc_fft_filter; @@ -697,17 +688,12 @@ static ivas_error compute_t60_coeffs_fx( IF( EQ_32( pParams->pRt60_fx[bin_idx], 0 ) ) { // If RT60 is 0, target gain is -120dB -#ifdef FIX_1942_ASSERTION_LOWSHELF target_gains_db_fx[bin_idx] = M120Q8; move16(); -#else - target_gains_db_fx[bin_idx] = min120q8; -#endif } ELSE { tmp = BASOP_Util_Divide3232_Scale( L_deposit_h( loop_delay_sec_fx ), pParams->pRt60_fx[bin_idx], &e ); -#ifdef FIX_1942_ASSERTION_LOWSHELF tmp_e = add( e, sub( 0, 5 ) ); // L_deposit_h( loop_delay_sec_fx ):Q0.31, pParams->pRt60_fx[bin_idx]:Q5.26 tmp_e = add( tmp_e, 6 ); // + Q6.9(M60Q9) @@ -737,24 +723,6 @@ static ivas_error compute_t60_coeffs_fx( } } } -#else - IF( LT_16( e, -1 ) ) - { - target_gains_db_fx[bin_idx] = min120q8; - } - ELSE - { - tmp = shr( tmp, sub( 5, e ) ); // scaling tmp to Q15 - target_gains_db_fx[bin_idx] = mult( shr( min120q8, 1 ), tmp ); // Q8 - } - } - // gain < - 120 ? -120: gain - IF( LT_16( target_gains_db_fx[bin_idx], -30720 ) ) - { - target_gains_db_fx[bin_idx] = -30720; - move16(); - } -#endif } pCoeffs_a_fx = &pParams->pT60_filter_coeff_fx[add( shl( i_mult( len, loop_idx ), 1 ), len )]; // Q14 @@ -1038,13 +1006,11 @@ static ivas_error calc_jot_t60_coeffs_fx( L_tmp = BASOP_util_Pow2( L_deposit_h( tmp_fx ), exph, &e ); lin_gain_hf_fx = extract_l( L_shr( L_tmp, sub( 16, e ) ) ); -#ifdef FIX_1942_ASSERTION_LOWSHELF IF( EQ_16( lin_gain_hf_fx, 0 ) ) { lin_gain_hf_fx = 1; move16(); } -#endif /* call low-pass iir shelf */ calc_low_shelf_first_order_filter_fx( pCoeffB_fx, pCoeffA_fx, f0_fx, lin_gain_lf_fx, lin_gain_hf_fx ); -- GitLab From 8e7d8af3c7aa39119a0ff7aa3af79c6a45678750 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 15 Oct 2025 17:26:38 +0200 Subject: [PATCH 4/4] accept switches --- lib_com/hp50_fx.c | 4 +- lib_com/options.h | 25 ----- lib_com/prot_fx.h | 24 ++--- lib_com/swb_tbe_com_fx.c | 59 +++-------- lib_com/tcx_ltp_fx.c | 98 ++---------------- lib_dec/acelp_core_dec_fx.c | 7 -- lib_dec/bass_psfilter_fx.c | 4 - lib_dec/core_switching_dec_fx.c | 12 +-- lib_dec/dec_ace_fx.c | 6 +- lib_dec/dec_gen_voic_fx.c | 18 ---- lib_dec/dec_tran_fx.c | 18 ---- lib_dec/er_dec_tcx_fx.c | 64 ++---------- lib_dec/fd_cng_dec_fx.c | 15 +-- lib_dec/ivas_cpe_dec_fx.c | 8 -- lib_dec/ivas_jbm_dec_fx.c | 40 +------- lib_dec/ivas_mdct_core_dec_fx.c | 6 -- lib_dec/ivas_out_setup_conversion_fx.c | 99 ++----------------- lib_dec/ivas_stereo_dft_dec_fx.c | 5 - lib_dec/ivas_tcx_core_dec_fx.c | 3 - lib_dec/ivas_td_low_rate_dec_fx.c | 5 +- lib_dec/jbm_pcmdsp_apa_fx.c | 18 +--- lib_dec/stat_dec.h | 2 - lib_dec/swb_tbe_dec_fx.c | 18 +--- lib_enc/cod_ace_fx.c | 6 -- lib_enc/enc_gen_voic_fx.c | 19 ---- lib_enc/enc_tran_fx.c | 11 --- lib_enc/fd_cng_enc_fx.c | 10 +- lib_enc/ivas_core_enc_fx.c | 9 -- lib_enc/ivas_omasa_enc_fx.c | 7 -- lib_enc/ivas_td_low_rate_enc_fx.c | 4 - lib_enc/lsf_enc_fx.c | 4 - lib_enc/swb_pre_proc_fx.c | 17 +--- lib_enc/swb_tbe_enc_fx.c | 6 +- .../ivas_dirac_dec_binaural_functions_fx.c | 68 ++----------- lib_rend/ivas_dirac_rend_fx.c | 71 ------------- 35 files changed, 67 insertions(+), 723 deletions(-) diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index fedc06d23..1586bc252 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -286,7 +286,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * } -#ifdef HP20_FIX32_RECODING void hp20_fx_32_opt( Word32 signal_fx[], const Word16 lg, @@ -448,7 +447,8 @@ void hp20_fx_32_opt( return; } -#endif + + void hp20_fx_32( Word32 signal_fx[], const Word16 lg, diff --git a/lib_com/options.h b/lib_com/options.h index 593903f95..669d8d53a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -73,33 +73,8 @@ /* ################### Start FIXES switches ########################### */ -#define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */ -#define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */ -#define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */ -#define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */ -#define FIX_1985_SBA_714_HF_LOSS /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/ -#define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */ #define FIX_1995_REVERB_INIT /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */ -#define FIX_1996_MASKING_NOISE /* Dlb: Heavy precision loss in ola buffers causing discontinuity*/ -#define FIX1998_APA_EXEC_SCALING /* FhG: fix scaling of apa_exec_ivas_fx(); avoid continuously worse scaling with previous data */ -#define FIX2007_BASSPSFILTER_OVERFLOW /* FhG: use saturing operator, to avoid overflow in bass_psfilter_fx() */ -#define FIX_ISSUE_2004_LPC_SHB_SAT /* Dolby: Issue 2004: prevent saturation of the LPC SHB filter */ - -#define FIX_2009_HIGH_NOISE_FLOOR_FOR_FX_DEC /* FhG: Corrected the q_input in the input of generate_masking_noise_dirac_ivas_fx() */ -#define FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for dtx discontinuities */ -#define FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for FER discontinuities */ -#define FIX_2000_NON_LINEARITY_OVERSHOOT /* Eri: Issue 2000: SWB TBE energy overshoot in non-linearity. Aligns with float */ -#define FIX_2010_PREP_TBE_EXC /* FhG: fix issues with varying Q-values for code_preQ_fx[] */ -#define FIX_2025_FDCNG_MULT /* Nokia, FhG: Fix LB FDCNG noise introduced by changing mult to i_mult */ - -#define FIX_1962_FORMAT_CONV_SPECTRAL_DIFF /* FhG: Improved precision of targetEnergy in ivas_ls_setup_conversion_process_mdct_fx() */ -#define FIX_2003_CON_TCX_OVERFLOW /* FhG: Use a dynamic scaling factor for the synth buffer at the output of con_tcx_ivas_fx() */ -#define HP20_FIX32_RECODING /* FhG: optimized hp20_fx_32 calculation and applied it as hp20_fx_32_opt in decoder */ -#define OPT_TCXLTP_FILTER_LOOP /* FhG: optimize loop in tcx_ltp_synth_filter */ -#define FIX_2049_DIFF_IN_DECORR_TAIL /* FhG: correct scale values in ivas_dirac_dec_binaural_process_output_fx() */ -#define FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE /* Dolby/FhG: fix for issue 2026: Saturation in SWB TBE re-scaling function preventing StereoDownmix complexity job to complete */ -#define FIX_2021_BANDWIDTH_EXTENSION_PROBLEM /* FhG: increase cldfb buffer precision*/ #define FIX_2083_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in makeCustomLsSetup()*/ #define FIX_2085_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in ivas_dirac_config_fx() */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index dcd22861c..a22e51ccb 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3308,18 +3308,16 @@ void prep_tbe_exc_fx( Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/ const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */ const Word16 code_preQ_fx[], /* i : prequantizer excitation */ -#ifdef FIX_2010_PREP_TBE_EXC - const Word16 Q_code_preQ, /* i : Q, prequantizer excitation */ -#endif - const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */ - const Word16 T0, /* i : integer pitch variables Q0 */ - const Word16 T0_frac, /* i : Fractional pitch variables Q0*/ - const Word16 coder_type, /* i : coding type */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 element_mode, /* i : element mode */ - const Word16 idchan, /* i : channel ID */ - const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ + const Word16 Q_code_preQ, /* i : Q, prequantizer excitation */ + const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */ + const Word16 T0, /* i : integer pitch variables Q0 */ + const Word16 T0_frac, /* i : Fractional pitch variables Q0*/ + const Word16 coder_type, /* i : coding type */ + const Word32 core_brate, /* i : core bitrate */ + const Word16 element_mode, /* i : element mode */ + const Word16 idchan, /* i : channel ID */ + const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ + const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ ); /*! r: Formant filter strength [0,1] */ @@ -10488,13 +10486,11 @@ void hp20_fx_32( Word32 mem_fx[], const Word32 Fs ); -#ifdef HP20_FIX32_RECODING void hp20_fx_32_opt( Word32 signal_fx[], const Word16 lg, Word32 mem_fx[], const Word32 Fs ); -#endif void getTCXMode_ivas_fx( Decoder_State *st, /* i/o: decoder memory state */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 126f8ce25..b7fe74dee 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -5965,21 +5965,10 @@ void non_linearity_ivas_fx( } #ifdef NONBE_1328_FIX_NON_LINEARITY -#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT sc_factor = s_max( sub( 13, norm_s( add( j, 1 ) ) ), 0 ); /* Adapt the scaling factor allowed depending of max position */ sc_factor = s_max( sc_factor, 1 ); /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */ -#else - /* sc_factor = 32; */ /* Here we divide prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */ - /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */ - sc_factor = shl_sat( 1, sub( 16, max( 13 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */ - sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 ); /* note: The thresholding is purposely different between float and BASOP implementations. */ -#endif test(); -#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT IF( prev_scale <= 0 || GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) ) /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */ -#else - IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) ) -#endif #else test(); IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ) /*Q30 -> Q31*/, scale /*Q31*/ ) ) @@ -6057,23 +6046,12 @@ void non_linearity_ivas_fx( } #ifdef NONBE_1328_FIX_NON_LINEARITY -#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */ sc_factor = s_max( sub( 12, norm_s( add( sub( j, length_half ), 1 ) ) ), 0 ); /* allowed intra frame jump is smaller */ sc_factor = s_max( sc_factor, 1 ); /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */ -#else - /* sc_factor = 32; */ /* Here we divide prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */ - /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */ - sc_factor = shl_sat( 1, sub( 16, max( 12 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */ - sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 ); /* note: The thresholding is purposely different between float and BASOP implementations. */ -#endif test(); -#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT IF( prev_scale <= 0 || GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) ) /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */ -#else - IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) ) -#endif #else IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ), scale ) ) #endif @@ -7008,18 +6986,16 @@ void prep_tbe_exc_fx( Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/ const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */ const Word16 code_preQ_fx[], /* i : prequantizer excitation */ -#ifdef FIX_2010_PREP_TBE_EXC - const Word16 Q_code_preQ, /* i : Q, prequantizer excitation */ -#endif - const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */ - const Word16 T0, /* i : integer pitch variables Q0 */ - const Word16 T0_frac, /* i : Fractional pitch variables Q0*/ - const Word16 coder_type, /* i : coding type */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 element_mode, /* i : element mode */ - const Word16 idchan, /* i : channel ID */ - const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ + const Word16 Q_code_preQ, /* i : Q, prequantizer excitation */ + const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */ + const Word16 T0, /* i : integer pitch variables Q0 */ + const Word16 T0_frac, /* i : Fractional pitch variables Q0*/ + const Word16 coder_type, /* i : coding type */ + const Word32 core_brate, /* i : core bitrate */ + const Word16 element_mode, /* i : element mode */ + const Word16 idchan, /* i : channel ID */ + const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ + const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ ) { @@ -7092,32 +7068,21 @@ void prep_tbe_exc_fx( ELSE { Word16 shift = 4; -#ifdef FIX_2010_PREP_TBE_EXC - /* multrus 2025-09-15 - TODO: - - leave shift = 4, since this is legacy code from EVS; - - check with vaillancourt, whether we really have a different scaling of code_preQ_fx[] for IVAS - - if the different scalings are confirmed, this condition could be simplified - */ IF( NE_16( element_mode, EVS_MONO ) ) { /* shift of 4 assumes code_preQ_fx[] in Q10 - this is however not always given */ shift = add( 2 + 1 - 1, Q_code_preQ ); /* gain_preQ_fx in Q2, code_preQ_fx[] in Q_code_preQ, 1 additional left-shift by L_mult() - factor of 2 (from "2 * gain_preQ * code_preQ[i]") */ shift = sub( 16, shift ); } -#endif + move16(); IF( gain_preQ_fx != 0 ) { FOR( i = 0; i < L_subfr; i++ ) { /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */ - Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ -#ifdef FIX_2010_PREP_TBE_EXC + Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q_code_preQ */ -#else - Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ -#endif Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 3c54f64ea..a584de16a 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -484,7 +484,6 @@ static void tcx_ltp_synth_filter( step = negate( step ); } -#ifdef OPT_TCXLTP_FILTER_LOOP IF( zir != NULL ) { IF( fade != 0 ) @@ -632,57 +631,16 @@ static void tcx_ltp_synth_filter( } } } -#else - FOR( j = 0; j < length; j++ ) - { - s = L_deposit_l( 0 ); - s2 = L_deposit_l( 0 ); - k = 0; - move16(); - FOR( i = 0; i < L; i++ ) - { - s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); /* Qx */ - s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); /* Qx */ - k = k + pitch_res; - } - - /* s2 *= ALPHA; - normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s; - zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j]; - fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */ - i = sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ); /* Qx */ - k = mult_r( gain, i ); /* Qx */ - if ( fade != 0 ) - k = mult_r( k, alpha ); /* Qx */ - k = add_sat( synth[j], k ); /* Qx */ - if ( zir != NULL ) - { - k = sub_sat( k, zir[j] ); /* Qx */ - } - - synth_ltp[j] = k; /* Qx */ - move16(); - - BASOP_SATURATE_WARNING_OFF_EVS; - if ( fade != 0 ) - { - alpha = add_sat( alpha, step ); - } - BASOP_SATURATE_WARNING_ON_EVS; - - x0++; - x1++; - y0++; - y1++; - } -#endif } ELSE { Copy( synth, synth_ltp, length ); /* Qx */ } + + return; } + static void tcx_ltp_synth_filter32( Word32 *synth_ltp, /* Qx */ Word32 *synth, /* Qx */ @@ -744,10 +702,11 @@ static void tcx_ltp_synth_filter32( } if ( fade < 0 ) + { step = negate( step ); + } } -#ifdef OPT_TCXLTP_FILTER_LOOP IF( fade != 0 ) { IF( zir != NULL ) @@ -894,57 +853,16 @@ static void tcx_ltp_synth_filter32( } } } -#else - FOR( j = 0; j < length; j++ ) - { - s = L_deposit_l( 0 ); - s2 = L_deposit_l( 0 ); - k = 0; - move16(); - FOR( i = 0; i < L; i++ ) - { - s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); /* Qx */ - s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); /* Qx */ - k = k + pitch_res; - } - - /* s2 *= ALPHA; - normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s; - zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j]; - fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */ - L_tmp = L_sub_sat( s, Mpy_32_16_r( s2, ALPHA ) ); /* Qx */ - L_tmp2 = Mpy_32_16_r( L_tmp, gain ); /* Qx */ - IF( fade != 0 ) - L_tmp2 = Mpy_32_16_r( L_tmp2, alpha ); /* Qx */ - L_tmp2 = L_add_sat( synth[j], L_tmp2 ); /* Qx */ - if ( zir != NULL ) - { - L_tmp2 = L_sub_sat( L_tmp2, zir[j] ); /* Qx */ - } - - synth_ltp[j] = L_tmp2; /* Qx */ - move16(); - - BASOP_SATURATE_WARNING_OFF_EVS; - if ( fade != 0 ) - { - alpha = add_sat( alpha, step ); - } - BASOP_SATURATE_WARNING_ON_EVS; - - x0++; - x1++; - y0++; - y1++; - } -#endif } ELSE { Copy32( synth, synth_ltp, length ); /* Qx */ } + + return; } + static void tcx_ltp_synth_filter_10( Word16 *out, /* Qx */ Word16 *in, /* Qx */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index cf32fdf56..00d6ce926 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1637,16 +1637,11 @@ ivas_error acelp_core_dec_fx( IF( NE_16( st->element_mode, last_element_mode ) ) { set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen ); -#ifdef FIX_1996_MASKING_NOISE set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen ); -#endif } Word32 psyn_32_fx[L_FRAME16k]; Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6 -#ifndef FIX_1996_MASKING_NOISE - Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 ); // Q15 -#endif generate_masking_noise_ivas_fx( psyn_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); Copy_Scale_sig_32_16( psyn_32_fx, psyn_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( st->Q_syn, exp ) ); // Q = st->Q_syn @@ -1738,9 +1733,7 @@ ivas_error acelp_core_dec_fx( IF( st->idchan == 0 ) { set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen ); -#ifdef FIX_1996_MASKING_NOISE set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen ); -#endif } IF( hStereoCng != NULL && ( st->idchan == 0 ) ) { diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index 599c3aa98..bb2158057 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -555,11 +555,7 @@ void bass_psfilter_fx( FOR( i = 0; i < subfr_len; i++ ) { /* err[i] = syn_fx[i] - gain*syn2_fx[i] */ -#ifdef FIX2007_BASSPSFILTER_OVERFLOW err[i] = msu_r( L_shr_sat( L_mult0( gain, syn2_fx[i] ), exp2 ), syn_fx[i], 16384 ); /* Q15 */ -#else - err[i] = msu_r( L_shr( L_mult0( gain, syn2_fx[i] ), exp2 ), syn_fx[i], 16384 ); /* Q15 */ -#endif move16(); /* the sign is inverted but it is not important because we calculate energy with 'err[i]' x 'err[i]' diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index be95ebaf0..162e45812 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1630,26 +1630,18 @@ ivas_error core_switching_post_dec_ivas_fx( test(); IF( EQ_16( st_fx->last_core, HQ_CORE ) || st_fx->last_core == TCX_20_CORE || st_fx->last_core == TCX_10_CORE ) /* MDCT to ACELP transition */ { -#ifdef FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES Word16 Q_old_postdec = 0; move16(); -#endif Qtmp = s_min( *Qsynth, 0 ); IF( hHQ_core != NULL ) { Qtmp = s_min( s_min( *Qsynth, hHQ_core->Q_old_postdec ), hHQ_core->Q_old_wtda ); -#ifdef FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES Q_old_postdec = hHQ_core->Q_old_postdec; move16(); -#endif } - Scale_sig( synth, output_frame, sub( Qtmp, *Qsynth ) ); /* Qtmp */ -#ifndef FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES - Scale_sig( st_fx->delay_buf_out_fx, delay_comp, Qtmp ); /*delay buff_out_fx is Q0*/ -#else + Scale_sig( synth, output_frame, sub( Qtmp, *Qsynth ) ); /* Qtmp */ Scale_sig( st_fx->delay_buf_out_fx, delay_comp, sub( Qtmp, Q_old_postdec ) ); /* delay buff_out_fx is Qtmp */ -#endif IF( hHQ_core != NULL ) { Scale_sig( hHQ_core->old_out_fx, L_FRAME48k, sub( Qtmp, hHQ_core->Q_old_wtda ) ); /* Qtmp */ @@ -1707,9 +1699,7 @@ ivas_error core_switching_post_dec_ivas_fx( move16(); ptmp1++; ptmp2++; -#ifdef FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES tmpF = add( tmpF, tmp ); /* Q15 */ -#endif } } ELSE diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index b6554e02c..8453a16cf 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -526,19 +526,15 @@ void decoder_acelp_fx( /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ + gain_code = gain_code_tmp; move32(); gain_pit = gain_pit_tmp; move16(); IF( st->igf != 0 ) { -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( st->L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc, gain_preQ, code_preQ, Q10, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 ); -#else - prep_tbe_exc_fx( st->L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc, - gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 ); -#endif } /*---------------------------------------------------------* diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index 39412a22e..53da3c36a 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -100,9 +100,7 @@ ivas_error decod_gen_voic_fx( Word16 pf_temp[MAXLAG_WI]; Word16 pf_n2[MAXLAG_WI]; MUSIC_POSTFILT_HANDLE hMusicPF; -#ifdef FIX_2010_PREP_TBE_EXC Word16 Q_code_preQ; -#endif gain_pit_fx = 0; gain_code_fx = 0; @@ -326,15 +324,6 @@ ivas_error decod_gen_voic_fx( idx = idiv1616( i_subfr_fx, L_SUBFR ); } -#ifdef FIX_2010_PREP_TBE_EXC - /* - 2025-09-15 multrus: - TODO: - check with vaillancourt - - where this difference between EVS and IVAS comes from - - where Q_code_preQ could be derived - - whether any of the above calculations need to be adjusted - */ Q_code_preQ = Q6; move16(); if ( EQ_16( st_fx->element_mode, EVS_MONO ) ) @@ -347,13 +336,6 @@ ivas_error decod_gen_voic_fx( &voice_factors_fx[idx], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_code_preQ, st_fx->Q_exc, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, - &voice_factors_fx[idx], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, - st_fx->Q_exc, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, - st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#endif - /*----------------------------------------------------------------* * Excitation enhancements (update of total excitation signal) diff --git a/lib_dec/dec_tran_fx.c b/lib_dec/dec_tran_fx.c index b30b1a8c0..4bee037ef 100644 --- a/lib_dec/dec_tran_fx.c +++ b/lib_dec/dec_tran_fx.c @@ -71,15 +71,12 @@ void decod_tran_fx( Word16 gain_code16; Word32 L_tmp; Word16 tmp16, tmp1_fx, tmp_fx; -#ifdef FIX_2010_PREP_TBE_EXC Word16 Q_code_preQ; -#endif GSC_DEC_HANDLE hGSCDec; hGSCDec = st_fx->hGSCDec; MUSIC_POSTFILT_HANDLE hMusicPF; hMusicPF = st_fx->hMusicPF; - gain_code_fx = 0; /* Quantized algebraic codeebook gain */ move32(); norm_gain_code_fx = 0; /* normalized algebraic codeebook gain Q16 */ @@ -257,15 +254,6 @@ void decod_tran_fx( tmp_idx_2 = idiv1616( i_subfr, L_SUBFR ); } -#ifdef FIX_2010_PREP_TBE_EXC - /* - 2025-09-15 multrus: - TODO: - check with vaillancourt - - where this difference between EVS and IVAS comes from - - where Q_code_preQ could be derived - - whether any of the above calculations need to be adjusted - */ Q_code_preQ = Q6; move16(); if ( EQ_16( st_fx->element_mode, EVS_MONO ) ) @@ -278,12 +266,6 @@ void decod_tran_fx( &voice_factors_fx[tmp_idx_2], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_code_preQ, st_fx->Q_exc, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, - &voice_factors_fx[tmp_idx_2], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, - st_fx->Q_exc, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, - st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#endif /*----------------------------------------------------------------* * Excitation enhancements (update of total excitation signal) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 4671ab1b2..7cb4f897b 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -924,13 +924,12 @@ void con_tcx_fx( } void con_tcx_ivas_fx( - Decoder_State *st, /* i/o: coder memory state */ - Word16 synth[], - /* i/o: synth[] */ /*Q0 */ - const Word16 coh, /* i : coherence of stereo signal Q14*/ - Word16 *noise_seed, /* i/o: noise seed for stereo Q0*/ - const Word16 only_left, /* i : TD-PLC only in left channel Q0*/ - const Word16 *A_cng /* i : CNG LP filter coefficients Q14*/ + Decoder_State *st, /* i/o: coder memory state */ + Word16 synth[], /* i/o: synth[] Q0 */ + const Word16 coh, /* i : coherence of stereo signal Q14*/ + Word16 *noise_seed, /* i/o: noise seed for stereo Q0 */ + const Word16 only_left, /* i : TD-PLC only in left channel Q0 */ + const Word16 *A_cng /* i : CNG LP filter coefficients Q14*/ ) { Word16 i, s, c, L_frame, L_subfr, fLowPassFilter, T0; @@ -941,11 +940,7 @@ void con_tcx_ivas_fx( Word16 pre_emph_buf; Word16 hp_filt[L_FIR_FER2]; Word16 alpha; -#ifdef FIX_2003_CON_TCX_OVERFLOW Word16 tmp_deemph, gain, gainCNG, gain_inov, scf; -#else - Word16 tmp_deemph, gain, gainCNG, gain_inov; -#endif Word16 *pt_exc, *pt1_exc; Word16 Tc, tmpSeed; Word16 fUseExtrapolatedPitch; @@ -1020,32 +1015,20 @@ void con_tcx_ivas_fx( /* set excitation memory*/ exc = buf + OLD_EXC_SIZE_DEC; -#ifdef FIX_2003_CON_TCX_OVERFLOW tmp_deemph = synth[-1]; /*st->Q_syn_factor*/ move16(); pre_emph_buf = synth[-1]; /*st->Q_syn_factor*/ move16(); -#else - tmp_deemph = synth[-1]; /*Q0*/ - move16(); - pre_emph_buf = synth[-1]; /*Q0*/ -#endif test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { /* apply pre-emphasis to the signal */ -#ifdef FIX_2003_CON_TCX_OVERFLOW mem = shl( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); -#else - mem = synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )]; /*Q0*/ -#endif move16(); Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); -#ifdef FIX_2003_CON_TCX_OVERFLOW scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ -#endif st->Mode2_lp_gainc = L_deposit_l( 0 ); @@ -1089,17 +1072,11 @@ void con_tcx_ivas_fx( ELSE { /* apply pre-emphasis to the signal */ -#ifdef FIX_2003_CON_TCX_OVERFLOW mem = shl( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/ -#else - mem = synth[( -L_frame - 1 )]; /*Q0*/ -#endif move16(); Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); -#ifdef FIX_2003_CON_TCX_OVERFLOW scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ -#endif - Copy( st->old_Aq_12_8_fx, A_local, M + 1 ); /*Q14*/ + Copy( st->old_Aq_12_8_fx, A_local, M + 1 ); /*Q14*/ offset = shr( L_frame, 1 ); IF( GE_16( st->last_good, UNVOICED_TRANSITION ) ) @@ -1714,18 +1691,10 @@ void con_tcx_ivas_fx( syn = buf + M; /*Q_syn*/ Copy( synth - M, buf, M ); /*Q_syn*/ -#ifdef FIX_2003_CON_TCX_OVERFLOW scf = norm_s( tmp_deemph ); new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow -#else - new_Q = sub( Q_exc, 3 ); -#endif new_Q = s_max( new_Q, -1 ); -#ifdef FIX_2003_CON_TCX_OVERFLOW new_Q = s_min( new_Q, scf ); -#else - new_Q = s_min( new_Q, norm_s( tmp_deemph ) ); -#endif tmp16 = s_min( new_Q, st->prev_Q_syn ); st->prev_Q_syn = new_Q; @@ -1736,15 +1705,11 @@ void con_tcx_ivas_fx( move16(); Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */ -#ifdef FIX_2003_CON_TCX_OVERFLOW if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) { Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); -#else - tmp_deemph = shl_sat( tmp_deemph, Q_syn ); -#endif st->Q_syn = Q_syn; move16(); @@ -1809,9 +1774,6 @@ void con_tcx_ivas_fx( /* Deemphasis and output synth and ZIR */ deemph_fx( syn, st->preemph_fac, add( L_frame, shr( L_frame, 1 ) ), &tmp_deemph ); -#ifndef FIX_2003_CON_TCX_OVERFLOW - bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, 0, 0, 0 ); /*Q_syn*/ -#endif lerp( syn + sub( L_frame, shr( L_frame, 1 ) ), hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) ); hTcxDec->Q_old_syn_Overl = Q_syn; @@ -1834,7 +1796,6 @@ void con_tcx_ivas_fx( hHQ_core->Q_old_wtda = Q_syn; move16(); -#ifdef FIX_2003_CON_TCX_OVERFLOW scf = add( getScaleFactor16( syn, L_frame ), Q_syn ); IF( LT_16( scf, 0 ) ) // Only avoid left shift in bufferCopyFX when overflow could occur { @@ -1851,17 +1812,6 @@ void con_tcx_ivas_fx( Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( st->Q_syn_factor, Q_syn ) ); hTcxDec->Q_syn_OverlFB = st->Q_syn_factor; -#else - /* As long as there is no synth scaling factor introduced, which - is given to the outside, there might occur overflows here */ - BASOP_SATURATE_WARNING_OFF_EVS - bufferCopyFx( syn, synth, L_frame, Q_syn, 0, 0, 0 ); /*Q_syn*/ - BASOP_SATURATE_WARNING_ON_EVS - - Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( 0, Q_syn ) ); /*Q0*/ - hTcxDec->Q_syn_OverlFB = 0; - move16(); -#endif /* copy total excitation exc2 as 16kHz for acelp mode1 decoding */ IF( st->hWIDec != NULL ) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index d3b963452..850767d3e 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -88,9 +88,7 @@ void initFdCngDec_ivas_fx( hFdCngDec->hFdCngCom->olapBufferAna = hFdCngDec->olapBufferAna; set16_fx( hFdCngDec->olapBufferSynth2, 0, FFTLEN ); hFdCngDec->hFdCngCom->olapBufferSynth2 = hFdCngDec->olapBufferSynth2; -#ifdef FIX_1996_MASKING_NOISE set32_fx( hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, FFTLEN ); -#endif /* Set some counters and flags */ @@ -4996,29 +4994,18 @@ void generate_masking_noise_lb_dirac_fx( overwriting it with the synthesis in case of shared tc and synth channel memory, i.e. non-TSM mode */ slot_size_cng = shr( hFdCngCom->frameSize, 4 /* DEFAULT_JBM_CLDFB_TIMESLOTS */ ); /* move start indices forward to the end of the last subframe */ -#ifdef FIX_2025_FDCNG_MULT cur_subframe_start_outfs = i_mult( nCldfbTs, hSpatParamRendCom->slot_size ); cur_subframe_start_cngfs = i_mult( nCldfbTs, slot_size_cng ); -#else - cur_subframe_start_outfs = mult( nCldfbTs, hSpatParamRendCom->slot_size ); - cur_subframe_start_cngfs = mult( nCldfbTs, slot_size_cng ); -#endif /* go from the last subframe back and move the LB noise */ FOR( cur_subframe = sub( hSpatParamRendCom->nb_subframes, 1 ); cur_subframe >= 0; cur_subframe-- ) { Word16 move_size, subframe_size_outfs; -#ifdef FIX_2025_FDCNG_MULT move_size = i_mult( slot_size_cng, hSpatParamRendCom->subframe_nbslots[cur_subframe] ); subframe_size_outfs = i_mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ); cur_subframe_start_outfs = sub( cur_subframe_start_outfs, i_mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ) ); cur_subframe_start_cngfs = sub( cur_subframe_start_cngfs, i_mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], slot_size_cng ) ); -#else - move_size = mult( slot_size_cng, hSpatParamRendCom->subframe_nbslots[cur_subframe] ); - subframe_size_outfs = mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ); - cur_subframe_start_outfs = sub( cur_subframe_start_outfs, mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ) ); - cur_subframe_start_cngfs = sub( cur_subframe_start_cngfs, mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], slot_size_cng ) ); -#endif + /* move cna */ Copy32( tdBuffer + cur_subframe_start_cngfs, tdBuffer + cur_subframe_start_outfs, move_size ); diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index ac16c4a2d..743add272 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -664,11 +664,7 @@ ivas_error ivas_cpe_dec_fx( IF( NE_16( shift, 31 ) ) { -#ifdef FIX_1946_CRASH_JBM_PROCESSING shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */ -#else - shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q16 ); /* Q16 for guard bits */ -#endif IF( GT_16( shift, hCPE->hStereoDft->q_dft ) ) { @@ -973,11 +969,7 @@ static ivas_error stereo_dft_dec_main( IF( NE_16( shift, 31 ) ) { -#ifdef FIX_1946_CRASH_JBM_PROCESSING shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */ -#else - shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q16 ); /* Q16 for guard bits */ -#endif IF( GT_16( shift, hCPE->hStereoDft->q_dft ) ) { diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 3976a511b..1f0ce7da7 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -159,11 +159,7 @@ ivas_error ivas_jbm_dec_tc_fx( /* HP filtering */ FOR( n = 0; n < s_min( nchan_out, st_ivas->nchan_transport ); n++ ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) @@ -236,11 +232,7 @@ ivas_error ivas_jbm_dec_tc_fx( } /* HP filtering */ -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } test(); @@ -591,11 +583,7 @@ ivas_error ivas_jbm_dec_tc_fx( /* HP filtering */ FOR( n = 0; n < nchan_remapped; n++ ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) @@ -788,11 +776,7 @@ ivas_error ivas_jbm_dec_tc_fx( FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } Word16 output_q = 11; @@ -1031,11 +1015,7 @@ ivas_error ivas_jbm_dec_tc_fx( /* HP filtering */ FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } nchan_remapped = ivas_sba_remapTCs_fx( &p_output_fx[sba_ch_idx], st_ivas, output_frame ); @@ -1148,11 +1128,7 @@ ivas_error ivas_jbm_dec_tc_fx( { IF( NE_16( n, LFE_CHANNEL ) ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } } @@ -1210,11 +1186,7 @@ ivas_error ivas_jbm_dec_tc_fx( { IF( NE_16( n, LFE_CHANNEL ) ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } } @@ -1280,11 +1252,7 @@ ivas_error ivas_jbm_dec_tc_fx( /* HP filtering */ FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } /* Rendering */ @@ -1498,11 +1466,7 @@ ivas_error ivas_jbm_dec_tc_fx( /* HP filtering */ FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { -#ifdef HP20_FIX32_RECODING hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#else - hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); -#endif } IF( EQ_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) @@ -1643,7 +1607,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( } ELSE #endif - IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) ) + IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) ) { /* Rendering */ IF( EQ_16( st_ivas->ism_mode, ISM_MODE_PARAM ) ) @@ -1660,7 +1624,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( } ELSE #endif - IF( EQ_16( st_ivas->renderer_type, RENDERER_PARAM_ISM ) || EQ_16( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) + IF( EQ_16( st_ivas->renderer_type, RENDERER_PARAM_ISM ) || EQ_16( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) { ivas_param_ism_dec_digest_tc_fx( st_ivas, n_render_timeslots, p_data_f_fx, Q11 ); diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index bfe81d4bb..5b54997e9 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1187,10 +1187,8 @@ void ivas_mdct_core_reconstruct_fx( set16_fx( synthFB_fx, 0, L_FRAME_PLUS + M ); IF( st->core != ACELP_CORE ) { -#ifdef FIX_2003_CON_TCX_OVERFLOW st->Q_syn_factor = 0; move16(); -#endif Word16 q_win0 = Q15; move16(); Word16 q_winFB0 = Q15; @@ -1429,11 +1427,7 @@ void ivas_mdct_core_reconstruct_fx( { #endif Copy( synthFB_fx, signal_outFB_fx[ch], st->hTcxDec->L_frameTCX ); -#ifdef FIX_2003_CON_TCX_OVERFLOW e_sig[ch] = sub( 15, q_syn + st->Q_syn_factor ); -#else - e_sig[ch] = sub( 15, q_syn ); -#endif move16(); #ifndef FIX_938_COMPILER_WARNING } diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 3842b0f6b..a3801bc06 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -662,13 +662,8 @@ void ivas_ls_setup_conversion_process_mdct_fx( Word16 inChannels, outChannels, num_CPE; Word16 transform_type[MAX_CICP_CHANNELS][2]; Word16 frameSize; -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF Word64 targetEnergy64[MAX_SFB + 2], dmxEnergy64[MAX_SFB + 2]; Word16 scf1, scf2; -#else - Word32 targetEnergy[MAX_SFB + 2], dmxEnergy[MAX_SFB + 2]; - Word16 dmxEnergy_exp[MAX_SFB + 2], dmxEnergy_exp_temp; -#endif Word32 dmxCoeff; Word32 dmxSignalReal[L_FRAME48k], dmxSignalImag[L_FRAME48k]; Word32 eqGain; @@ -753,20 +748,12 @@ void ivas_ls_setup_conversion_process_mdct_fx( /* set overall frequency resolution of (sub)frame to maximum of (sub)frame, requires conversion if both channels are not the same */ frameSize = hLsSetUpConversion->sfbOffset[hLsSetUpConversion->sfbCnt]; move16(); -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF set64_fx( targetEnergy64, 0, MAX_SFB + 2 ); set64_fx( dmxEnergy64, 0, MAX_SFB + 2 ); scf1 = 63; scf2 = 63; move16(); move16(); -#else - set32_fx( targetEnergy, 0, MAX_SFB + 2 ); - set32_fx( dmxEnergy, 0, MAX_SFB + 2 ); - set16_fx( dmxEnergy_exp, 0, MAX_SFB + 2 ); - dmxEnergy_exp_temp = 0; - move16(); -#endif FOR( chOutIdx = 0; chOutIdx < outChannels; chOutIdx++ ) { @@ -785,12 +772,9 @@ void ivas_ls_setup_conversion_process_mdct_fx( /* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */ IF( dmxCoeff ) { -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF Word64 targetEne64; Word32 tmpDMXSig; -#else - Word32 tmpDMXSig, targetEne; -#endif + /* Convert the signal resolution to TCX20 */ /* initially, set pointers to input; if conversion occurs in (sub)frame, set to convertRes */ pTmp[0] = x[chInIdx][0]; // Q(q_output) @@ -833,13 +817,8 @@ void ivas_ls_setup_conversion_process_mdct_fx( stop = hLsSetUpConversion->sfbOffset[bandIdx + 1]; move16(); -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF targetEne64 = 0; move64(); -#else - targetEne = 0; - move32(); -#endif /* Loop over all the bins in the band */ FOR( binIdx = start; binIdx < stop; binIdx++ ) @@ -847,30 +826,18 @@ void ivas_ls_setup_conversion_process_mdct_fx( tmpDMXSig = Mpy_32_32( L_shl_sat( dmxCoeff, 1 ), sig[0][binIdx] ); dmxSignalReal[binIdx] = L_add( dmxSignalReal[binIdx], tmpDMXSig ); move32(); -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF targetEne64 = W_mac_32_32( targetEne64, tmpDMXSig, tmpDMXSig ); -#else - targetEne = L_add( targetEne, Mpy_32_32( tmpDMXSig, tmpDMXSig ) ); -#endif tmpDMXSig = Mpy_32_32( L_shl_sat( dmxCoeff, 1 ), mdst[binIdx] ); dmxSignalImag[binIdx] = L_add( dmxSignalImag[binIdx], tmpDMXSig ); move32(); -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF targetEne64 = W_mac_32_32( targetEne64, tmpDMXSig, tmpDMXSig ); -#else - targetEne = L_add( targetEne, Mpy_32_32( tmpDMXSig, tmpDMXSig ) ); -#endif } -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF + targetEnergy64[bandIdx] = W_add( targetEnergy64[bandIdx], W_shr( targetEne64, 1 ) ); if ( NE_64( targetEnergy64[bandIdx], 0 ) ) { scf1 = s_min( scf1, W_norm( targetEnergy64[bandIdx] ) ); } -#else - targetEnergy[bandIdx] = L_add( targetEnergy[bandIdx], targetEne ); - move32(); -#endif } /* end of band loop */ } } @@ -878,28 +845,17 @@ void ivas_ls_setup_conversion_process_mdct_fx( FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ ) { -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF Word32 tmpReal, tmpImag; Word64 DMXEne64; -#else - Word32 tmpReal, tmpImag, DMXEne; - Word16 DMXEne_exp; -#endif + start = hLsSetUpConversion->sfbOffset[bandIdx]; move16(); stop = hLsSetUpConversion->sfbOffset[bandIdx + 1]; move16(); /* Loop over all the bins in the band */ -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF DMXEne64 = 0; move64(); -#else - DMXEne = 0; - move32(); - DMXEne_exp = 0; - move16(); -#endif FOR( binIdx = start; binIdx < stop; binIdx++ ) { @@ -907,39 +863,22 @@ void ivas_ls_setup_conversion_process_mdct_fx( move32(); tmpImag = dmxSignalImag[binIdx]; move32(); -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF DMXEne64 = W_mac_32_32( DMXEne64, tmpReal, tmpReal ); DMXEne64 = W_mac_32_32( DMXEne64, tmpImag, tmpImag ); -#else - DMXEne = BASOP_Util_Add_Mant32Exp( DMXEne, DMXEne_exp, L_add( Mpy_32_32( tmpReal, tmpReal ), Mpy_32_32( tmpImag, tmpImag ) ), sub( 40, shl( q_output, 1 ) ), &DMXEne_exp ); -#endif } -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF + dmxEnergy64[bandIdx] = W_add( dmxEnergy64[bandIdx], W_shr( DMXEne64, 1 ) ); if ( NE_64( dmxEnergy64[bandIdx], 0 ) ) { scf2 = s_min( scf2, W_norm( dmxEnergy64[bandIdx] ) ); } -#else - dmxEnergy[bandIdx] = BASOP_Util_Add_Mant32Exp( dmxEnergy[bandIdx], dmxEnergy_exp[bandIdx], DMXEne, DMXEne_exp, &dmxEnergy_exp[bandIdx] ); - move32(); - dmxEnergy_exp_temp = s_max( dmxEnergy_exp_temp, dmxEnergy_exp[bandIdx] ); -#endif } } /* end of out channel loop */ -#ifndef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF - /* Scaling to common exponent */ - FOR( bandIdx = 0; bandIdx < MAX_SFB + 2; bandIdx++ ) - { - dmxEnergy[bandIdx] = L_shl( dmxEnergy[bandIdx], sub( dmxEnergy_exp[bandIdx], dmxEnergy_exp_temp ) ); - move32(); - } -#endif + /* Step 3: Peform energy smoothing */ Word16 te_scale = getScaleFactor32( hLsSetUpConversion->targetEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt ); scale_sig32( hLsSetUpConversion->targetEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, te_scale ); -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF Word16 dmx_scale = getScaleFactor32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt ); scale_sig32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, dmx_scale ); @@ -948,17 +887,9 @@ void ivas_ls_setup_conversion_process_mdct_fx( Word16 dmxEnergy_e = sub( add( sub( 40, shl( q_output, 1 ) ), 1 ), scf2 ); Word16 dmx_max_e = s_max( dmxEnergy_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_scale ) ); -#else - Word16 dmx_sacle = getScaleFactor32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt ); - scale_sig32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, dmx_sacle ); - - Word16 te_max_e = s_max( sub( 40, shl( q_output, 1 ) ), sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) ); - Word16 dmx_max_e = s_max( dmxEnergy_exp_temp, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ); -#endif FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ ) { -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF Word32 targetEnergy, dmxEnergy; targetEnergy = W_extract_h( W_shl( targetEnergy64[bandIdx], scf1 ) ); @@ -972,16 +903,6 @@ void ivas_ls_setup_conversion_process_mdct_fx( move32(); hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx] = dmxEnergy; move32(); -#else - targetEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( targetEnergy[bandIdx], sub( te_max_e, sub( 40, shl( q_output, 1 ) ) ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], sub( te_max_e, sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) ) ) ) ); - move32(); - dmxEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( dmxEnergy[bandIdx], sub( dmx_max_e, dmxEnergy_exp_temp ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], sub( dmx_max_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ) ) ) ); - move32(); - hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx] = targetEnergy[bandIdx]; /* te_prev_exp = 40 - 2*q_output */ - move32(); - hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx] = dmxEnergy[bandIdx]; /* dmx_prev_exp = 40 - 2*q_output */ - move32(); -#endif } hLsSetUpConversion->te_prev_exp[0] = te_max_e; /* te_prev_exp = 40 - 2*q_output */ @@ -1015,13 +936,10 @@ void ivas_ls_setup_conversion_process_mdct_fx( move16(); /* Compute Eq gains */ -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF ivas_lssetupconversion_computeEQFactor_fx( &hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->te_prev_exp[0], &hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->dmx_prev_exp[0], &eqGain ); // Q(eqGain) = 30 -#else - ivas_lssetupconversion_computeEQFactor_fx( &targetEnergy[bandIdx], hLsSetUpConversion->te_prev_exp[0], &dmxEnergy[bandIdx], hLsSetUpConversion->dmx_prev_exp[0], &eqGain ); // Q(eqGain) = 30 -#endif + FOR( binIdx = start; binIdx < stop; binIdx++ ) { x[chInIdx][0][binIdx] = Mpy_32_32( L_shl( x[chInIdx][0][binIdx], 1 ), eqGain ); // Q - 1 @@ -1041,13 +959,10 @@ void ivas_ls_setup_conversion_process_mdct_fx( move16(); /* Compute Eq gains */ -#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF ivas_lssetupconversion_computeEQFactor_fx( &hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->te_prev_exp[0], &hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->dmx_prev_exp[0], &eqGain ); -#else - ivas_lssetupconversion_computeEQFactor_fx( &targetEnergy[bandIdx], hLsSetUpConversion->te_prev_exp[0], &dmxEnergy[bandIdx], hLsSetUpConversion->dmx_prev_exp[0], &eqGain ); -#endif + FOR( subFrameIdx = 0; subFrameIdx < NB_DIV; subFrameIdx++ ) { IF( EQ_16( transform_type[chInIdx][subFrameIdx], TCX_10 ) ) diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 789305f48..37d441aca 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -3161,21 +3161,16 @@ void stereo_dft_generate_res_pred_fx( move32(); DFT_PRED_RES[2 * i + 1] = L_add( L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i + 1], g_short ), q_shift0 ), L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_long_ind][2 * i + 1], g_long ), q_shift1 ) ); /* q_dft */ move32(); -#ifndef FIX_1946_CRASH_JBM_PROCESSING - past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */ -#endif } test(); IF( !bfi || GE_16( b, hStereoDft->res_cod_band_max ) ) { Word16 q_div; Word16 op; -#ifdef FIX_1946_CRASH_JBM_PROCESSING FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */ } -#endif op = BASOP_Util_Divide3232_Scale( L_add( 1, dmx_nrg ), L_add( 1, past_dmx_nrg ), &q_div ); /* q_sqrt */ q_sqrt = q_div; move16(); diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index afe1b71db..077c5b2f4 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -918,9 +918,6 @@ void stereo_tcx_core_dec_fx( Word32 signal_out_32_fx[L_FRAME48k]; Word16 exp; Copy_Scale_sig_16_32_no_sat( signal_out_fx, signal_out_32_fx, st->hFdCngDec->hFdCngCom->frameSize, Q6 ); -#ifndef FIX_1996_MASKING_NOISE - Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 ); -#endif generate_masking_noise_ivas_fx( signal_out_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); Copy_Scale_sig_32_16( signal_out_32_fx, signal_out_fx, st->hFdCngDec->hFdCngCom->frameSize, negate( exp ) ); // Q0 Copy_Scale_sig_32_16( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, st->hFdCngDec->hFdCngCom->olapBufferSynth2, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), -Q15 ); // Q0 diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c index 385096ba6..59543f4da 100644 --- a/lib_dec/ivas_td_low_rate_dec_fx.c +++ b/lib_dec/ivas_td_low_rate_dec_fx.c @@ -326,11 +326,8 @@ void decod_gen_2sbfr_fx( * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( L_frame, 2 * L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/], bwe_exc, 0, NULL, Q10, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame, 2 * L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/], bwe_exc, 0, NULL, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#endif + voice_factors[i_subfr / L_SUBFR + 1] = voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/]; /* Q15 */ move16(); diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 94b4cb6bd..7b64250b1 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -76,10 +76,8 @@ struct apa_state_t bool evs_compat_mode; Word16 *buf_out_fx; - Word16 Q_buf_out; /* stores the scaling of buf_out_fx */ -#ifdef FIX1998_APA_EXEC_SCALING + Word16 Q_buf_out; /* stores the scaling of buf_out_fx */ Word16 Q_a_out_init_old; /* stores initially determined max. scaling of data in buf_out_fx, before beeing adjusted to previous frame scaling */ -#endif UWord16 buf_out_capacity; UWord16 l_buf_out; @@ -193,10 +191,8 @@ ivas_error apa_init( } memset( ps->buf_out_fx, 0, ( sizeof( Word16 ) * ps->buf_out_capacity ) ); ps->Q_buf_out = Q15; -#ifdef FIX1998_APA_EXEC_SCALING ps->Q_a_out_init_old = Q15; move16(); -#endif move16(); ps->evs_compat_mode = false; @@ -279,10 +275,8 @@ UWord8 apa_reconfigure( ps->buf_out_fx = (Word16 *) malloc( sizeof( Word16 ) * ps->buf_out_capacity ); memset( ps->buf_out_fx, 0, ( sizeof( Word16 ) * ps->buf_out_capacity ) ); ps->Q_buf_out = Q15; -#ifdef FIX1998_APA_EXEC_SCALING ps->Q_a_out_init_old = Q15; move16(); -#endif move16(); IF( !ps->buf_out_fx ) { @@ -908,15 +902,11 @@ UWord8 apa_exec_ivas_fx( Word32 expScaling, actScaling; UWord32 statsResetThreshold, statsResetShift; Word16 Q_a_out; -#ifdef FIX1998_APA_EXEC_SCALING Word16 Q_a_out_init_old; -#endif Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 - Q1 ); -#ifdef FIX1998_APA_EXEC_SCALING Q_a_out_init_old = Q_a_out; /* store the possible scaling of a_in, to be re-used in the next frame */ move16(); -#endif statsResetThreshold = 1637; move32(); statsResetShift = 2; @@ -983,15 +973,11 @@ UWord8 apa_exec_ivas_fx( Word16 a_tmp[APA_BUF]; Word16 *buf_out_ptr = &( ps->buf_out_fx[ps->l_buf_out - ps->l_frm] ); -#ifdef FIX1998_APA_EXEC_SCALING /* don't compare against actual scaling in ps->Q_buf_out, but possible scaling in ps->Q_a_out_init_old; otherwise we are constantly reducing the scaling over time, leading to precision issues alternative approach: determine scaling of ps->buf_out_fx, but this is costly due to the sheer amount of samples stored there... */ Q_a_out = s_min( Q_a_out, ps->Q_a_out_init_old ); -#else - Q_a_out = s_min( Q_a_out, ps->Q_buf_out ); -#endif Scale_sig( ps->buf_out_fx, ps->buf_out_capacity, sub( Q_a_out, ps->Q_buf_out ) ); // Q_buf_out -> Q_a_out IF( EQ_32( ps->scale, 100 ) ) { @@ -1105,10 +1091,8 @@ UWord8 apa_exec_ivas_fx( } ps->l_buf_out = (UWord16) L_add( ps->l_buf_out, l_frm_out ); move16(); -#ifdef FIX1998_APA_EXEC_SCALING ps->Q_a_out_init_old = Q_a_out_init_old; move16(); -#endif *l_out = l_frm_out; move16(); diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index a1e9af428..81951104e 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1310,9 +1310,7 @@ typedef struct Decoder_State Word16 Q_syn; Word16 Q_syn2; Word16 Q_syn_cng; -#ifdef FIX_2003_CON_TCX_OVERFLOW Word16 Q_syn_factor; // This q_factor is used to avoid using fixed Q0 for synth[] at the output of con_tcx_ivas_fx(). It is then used for two consecutive TCX concealment processes. It cannot be greater than 0. -#endif Word16 prev_Q_syn; Word16 prev_Q_bwe_exc; diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index c3291bde2..f1bea2e23 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2705,12 +2705,8 @@ void swb_tbe_dec_fx( FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ -#endif move16(); } IF( exp < 0 ) @@ -2731,12 +2727,8 @@ void swb_tbe_dec_fx( L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */ temp = sub( 32767 /*1.0f Q15*/, temp ); Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ -#endif move16(); } } @@ -2748,12 +2740,8 @@ void swb_tbe_dec_fx( L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */ temp = sub( 32767 /*1.0f Q15*/, temp ); Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ -#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -#else - shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ -#endif move16(); } } diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c index ca0142a44..5a6e094a2 100644 --- a/lib_enc/cod_ace_fx.c +++ b/lib_enc/cod_ace_fx.c @@ -363,15 +363,9 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * IF( st->igf != 0 ) { -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], - bwe_exc, gain_preQ, code_preQ, Q_new, T0, T0_frac, st->coder_type, st->core_brate, - st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#endif } /*---------------------------------------------------------* diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 1324bd178..233dbb8f6 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -403,22 +403,10 @@ void encod_gen_voic_fx( * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_2010_PREP_TBE_EXC - /* multrus 2025-09-15 - TODO: - - check with vaillancourt, whether Q10 is the correct scaling - it contradicts comments above, where it's rather indicated as Q6 - - comparing againt float, Q10 seems to be correct - */ prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q10, Q_new, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, - &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_new, - T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, - st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#endif /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. @@ -801,17 +789,10 @@ void encod_gen_voic_ivas_fx( * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_AVQ_OUT_DEC, Q_new, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, - &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_new, - T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, - st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#endif /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 6f029849b..87642fc44 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -304,13 +304,8 @@ Word16 encod_tran_fx( * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc_fx, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], - bwe_exc_fx, gain_preQ, code_preQ, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#endif /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. @@ -689,15 +684,9 @@ Word16 encod_tran_ivas_fx( * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc_fx, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], - bwe_exc_fx, gain_preQ, code_preQ, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, - st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); -#endif /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 8b41b4e78..6834958d1 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -2467,11 +2467,7 @@ void FdCng_encodeSID_ivas_fx( v_fx[i] = Mpy_32_32( 671088640 /*10 in Q26*/, BASOP_Util_Log10( E_fx[i], hFdCngEnc->msNoiseEst_fx_exp ) ); // Q20 = 26+25-31 move32(); } -#ifdef FIX_1980_CRASH_FDCNG_ENCODESID e_fx = L_add( e_fx, L_shr( v_fx[i], 1 ) ); // Q19, add one bit headroom -#else - e_fx = L_add( e_fx, v_fx[i] ); // Q20 -#endif } /* Normalize MSVQ input */ @@ -2540,11 +2536,7 @@ void FdCng_encodeSID_ivas_fx( { gain_fx = L_add( gain_fx, v_fx[i] ); // Q = 31 - v_e } -#ifdef FIX_1980_CRASH_FDCNG_ENCODESID - e_fx = L_shl( e_fx, sub( 12, v_e ) ); // Q = 31 - v_e -#else - e_fx = L_shl( e_fx, sub( 11, v_e ) ); // Q = 31 - v_e -#endif + e_fx = L_shl( e_fx, sub( 12, v_e ) ); // Q = 31 - v_e gain_fx = Mpy_32_16_1( L_sub( e_fx, gain_fx ), div_s( 1, N ) ); // Q = 31 - v_e gain_fx = L_shl( gain_fx, sub( v_e, 8 ) ); // Q23 diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index dfca3d7ba..d03f58ed5 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -697,7 +697,6 @@ ivas_error ivas_core_enc_fx( { /* Common pre-processing for SWB(FB) TBE and SWB(FB) BWE */ /* Scaling cldfb_state_fx */ -#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM Word16 q_shift, scf_cldfb; scf_cldfb = L_norm_arr( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length ); @@ -719,18 +718,10 @@ ivas_error ivas_core_enc_fx( scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, q_shift ); // st->cldfbSynTd->Q_cldfb_state -> q_realImagBuffer st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 ); } -#else - scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, sub( q_re_im_buf[n], st->cldfbSynTd->Q_cldfb_state ) ); // st->cldfbSynTd->Q_cldfb_state -> q_realImagBuffer -#endif swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, new_swb_speech_fx, shb_speech_fx, &Q_shb_spch, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], hCPE ); -#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 ); -#else - /* Re-scaling cldfb_state_fx */ - scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, negate( sub( q_re_im_buf[n], st->cldfbSynTd->Q_cldfb_state ) ) ); // q_realImagBuffer -> st->cldfbSynTd->Q_cldfb_state -#endif } ELSE IF( GE_32( input_Fs, 32000 ) ) { diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index cbbbacf09..912d615d7 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1430,14 +1430,7 @@ static void ivas_omasa_energy_and_ratio_est_fx( { q_cldfb = q_data; move16(); -#ifdef FIX_1987_CRASH_OMASA_ENERGY cldfbAnalysis_ts_fx_var_q( &( data_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &q_cldfb ); -#else - scale_sig32( hOMasa->cldfbAnaEnc[i]->cldfb_state_fx, hOMasa->cldfbAnaEnc[i]->cldfb_state_length, sub( q_cldfb, hOMasa->cldfbAnaEnc[i]->Q_cldfb_state ) ); - hOMasa->cldfbAnaEnc[i]->Q_cldfb_state = q_cldfb; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &q_cldfb ); -#endif norm_Chnl = s_min( norm_Chnl, L_norm_arr( Chnl_ImagBuffer_fx[i], 60 ) ); norm_Chnl = s_min( norm_Chnl, L_norm_arr( Chnl_RealBuffer_fx[i], 60 ) ); } diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index 8832af43c..21fa71312 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -376,11 +376,7 @@ void encod_gen_2sbfr( * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_2010_PREP_TBE_EXC prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, Q10, Q_new, T0, T0_frac, coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#else - prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, Q_new, T0, T0_frac, coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#endif voice_factors[i_subfr / L_SUBFR + 1] = voice_factors[i_subfr / L_SUBFR]; /* Q15 */ move16(); diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 1f024b81d..4d15fba43 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -2532,11 +2532,7 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( 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 */ FOR( j = 1; j < M; j++ ) { -#ifdef FIX_1979_SAT_MISSING_IN_LSF_ENC L_tmp = L_mac_sat( 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_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif } e[i] = L_tmp; move32(); diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index f857cbec0..6a108ce6f 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -1104,10 +1104,8 @@ void swb_pre_proc_ivas_fx( IF( ( ( st->core == ACELP_CORE ) && NE_16( st->extl, SWB_BWE_HIGHRATE ) && NE_16( st->extl, FB_BWE_HIGHRATE ) ) || ( ( EQ_32( st->total_brate, ACELP_9k60 ) || st->rf_mode ) && EQ_16( st->bwidth, SWB ) && ( st->element_mode == EVS_MONO ) ) ) { -#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM Word64 CldfbHB64_fx = 0; move64(); -#endif Word32 CldfbHB_fx = 0; // fixed counterpart Word16 CldfbHB_fx_e = 0; // fixed counterpart #ifdef BASOP_NOGLOB_DECLARE_LOCAL @@ -1218,28 +1216,15 @@ void swb_pre_proc_ivas_fx( { FOR( ts = 0; ts < CLDFB_NO_COL_MAX; ts++ ) { -#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM CldfbHB64_fx = W_mac_32_32( CldfbHB64_fx, realBufferFlipped[ts][nB], realBufferFlipped[ts][nB] ); CldfbHB64_fx = W_mac_32_32( CldfbHB64_fx, imagBufferFlipped[ts][nB], imagBufferFlipped[ts][nB] ); -#else - realQ_neg1 = extract_l( L_shr( realBufferFlipped[ts][nB], 16 ) ); - imagQ_neg1 = extract_l( L_shr( imagBufferFlipped[ts][nB], 16 ) ); /* Q(-1), headroom needed */ - - CldfbHB_fx = L_mac0_o( CldfbHB_fx, realQ_neg1, realQ_neg1, &Overflow ); - CldfbHB_fx = L_mac0_o( CldfbHB_fx, imagQ_neg1, imagQ_neg1, &Overflow ); /* Q(-2) */ -#endif } } -#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM + Word16 scf = W_norm( CldfbHB64_fx ); CldfbHB64_fx = W_shl( CldfbHB64_fx, scf ); CldfbHB_fx = W_extract_h( CldfbHB64_fx ); CldfbHB_fx_e = sub( Q31, add( shl( q_reImBuffer, 1 ), sub( scf, Q31 ) ) ); -#else - CldfbHB_fx_e = sub( Q31, shl( sub( q_reImBuffer, Q16 ), 1 ) ); - exp = norm_l( CldfbHB_fx ); - CldfbHB_fx = L_shl( CldfbHB_fx, exp ); /* CldfbHB_ener = CldfbHB_fl*2^(exp) */ -#endif Cldfbtemp1 = Log2_norm_lc( CldfbHB_fx ); /* Log2_norm_lc(t) = 2^15*(log2(t/2^30)) */ Cldfbtemp1 = sub( shr( Cldfbtemp1, 6 ), shl( add( sub( Q31 - Q30, CldfbHB_fx_e ), exp ), 9 ) ); CldfbHB_fx = L_mult( Cldfbtemp1, 9864 ); /* Q9 + Q15 + Q1 = Q25 */ diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 1693ac3ac..f06722314 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -3050,7 +3050,6 @@ void swb_tbe_enc_ivas_fx( enerG = Enr_1_Az_fx( lpc_shb1, 2 * L_SUBFR ); /* Q3 */ /* if the LP gain is greater than a threshold, avoid saturation */ -#ifdef FIX_ISSUE_2004_LPC_SHB_SAT Word16 flag_sat = 0; Word16 lpc_shb_fx0_req_shift = sub( norm_s( lpc_shb_fx[0] ), 2 ); IF( GT_16( lpc_shb_fx0_req_shift, 0 ) ) @@ -3066,9 +3065,6 @@ void swb_tbe_enc_ivas_fx( } IF( GT_16( enerG, 256 /* 32.0 in Q3 */ ) || flag_sat ) -#else - IF( GT_16( enerG, 256 /*32 Q3*/ ) ) -#endif { set16_fx( lpc_shb_fx, 0, LPC_SHB_ORDER + 1 ); E_LPC_lev_dur( R_h, R_l, lpc_shb_fx, LepsP, 2, NULL ); /* LPC in Q14 */ @@ -6807,7 +6803,7 @@ static void first_VQstages_fx( dist[1] = dist_buf + maxC; move16(); - set16_fx( idx_buf, 0, ( const Word16 )( 2 * stagesVQ * maxC ) ); + set16_fx( idx_buf, 0, (const Word16) ( 2 * stagesVQ * maxC ) ); set16_fx( parents, 0, maxC ); /* Set up inital distance vector */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f98d4d5b2..30f3f37ce 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -76,9 +76,7 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; #define ONE_DIV_EPSILON_EXP ( 40 ) #define ADAPT_HTPROTO_ROT_LIM_1 0.8f -#ifdef FIX_1819_EIGENVALUE_ERROR #define SMALL_EIGENVALUE 50 -#endif #define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ @@ -109,11 +107,8 @@ typedef struct parambin_rend_config_data *------------------------------------------------------------------------*/ static void ivas_dirac_dec_binaural_internal_fx( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, Word32 *output_f[] /*Q11*/, const Word16 nchan_transport, const Word16 subframe ); -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL + static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME] /*q_inp*/[CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX], Word16 *q_out ); -#else -static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME] /*q_inp*/[CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word32 decIm[] /*q_inp*/[CLDFB_NO_CHANNELS_MAX] ); -#endif static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 subframe, Word32 *subFrameTotalEne, Word16 *subFrameTotalEne_e, Word32 *IIReneLimiter, Word16 q ); @@ -848,11 +843,7 @@ static void ivas_dirac_dec_binaural_internal_fx( slot, st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag, -#ifdef FIX_2009_HIGH_NOISE_FLOOR_FOR_FX_DEC st_ivas->hTcBuffer->q_tc_fx, &q_cldfb[2][slot] ); -#else - 11, &q_cldfb[2][slot] ); -#endif generate_masking_noise_dirac_ivas_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ @@ -887,18 +878,10 @@ static void ivas_dirac_dec_binaural_internal_fx( { Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1( Cldfb_RealBuffer_in_fx[0][slot][b], 23170 ); Cldfb_RealBuffer_in_fx[1][slot][b] = L_add( L_add( Cldfb_RealBuffer_in_fx[0][slot][b], L_shr( Cldfb_RealBuffer_in_fx[1][slot][b], 1 ) ), Cldfb_RealBuffer_in_fx[0][slot][b] ); -#ifdef FIX_2009_HIGH_NOISE_FLOOR_FOR_FX_DEC Cldfb_RealBuffer_in_fx[0][slot][b] = L_add( Cldfb_RealBuffer_in_fx[0][slot][b], L_shr( Cldfb_RealBuffer_in_fx[2][slot][b], add( sub( q_cldfb[2][slot], q_input ), 6 ) ) ); -#else - Cldfb_RealBuffer_in_fx[0][slot][b] = L_add( Cldfb_RealBuffer_in_fx[0][slot][b], L_shr( Cldfb_RealBuffer_in_fx[2][slot][b], 1 ) ); -#endif Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( Cldfb_ImagBuffer_in_fx[0][slot][b], 23170 ); Cldfb_ImagBuffer_in_fx[1][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[1][slot][b], 1 ) ); -#ifdef FIX_2009_HIGH_NOISE_FLOOR_FOR_FX_DEC Cldfb_ImagBuffer_in_fx[0][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], add( sub( q_cldfb[2][slot], q_input ), 6 ) ) ); -#else - Cldfb_ImagBuffer_in_fx[0][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], 1 ) ); -#endif move32(); move32(); move32(); @@ -1267,15 +1250,9 @@ static void ivas_dirac_dec_decorrelate_slot_fx( Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*q_inp*/ Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*q_inp*/ Word16 q_inp, -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX], - Word16 *q_out -#else - Word32 decRe[][CLDFB_NO_CHANNELS_MAX], /*q_inp*/ - Word32 decIm[][CLDFB_NO_CHANNELS_MAX] /*q_inp*/ -#endif -) + Word16 *q_out ) { Word16 offset, ch, bin; Word32 onset_filter_fx[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ @@ -1327,11 +1304,9 @@ static void ivas_dirac_dec_decorrelate_slot_fx( move32(); } } -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL + *q_out = q_decorrelatedFrameInterleaved; -#else - // q_decorrelatedFrameInterleaved will be same as q_inp/q_protoFrame // -#endif + return; } @@ -2751,11 +2726,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( move16(); move16(); move16(); -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL Word32 decSlotRe_fx[CLDFB_SLOTS_PER_SUBFRAME][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[CLDFB_SLOTS_PER_SUBFRAME][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; -#else - Word32 decSlotRe_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; -#endif Word32 outSlotRe_fx[CLDFB_NO_CHANNELS_MAX], outSlotIm_fx[CLDFB_NO_CHANNELS_MAX]; Word16 q_inp[6][CLDFB_SLOTS_PER_SUBFRAME]; Word16 interpVal_fx; @@ -2765,11 +2736,9 @@ static void ivas_dirac_dec_binaural_process_output_fx( move16(); Word16 ch_len = s_max( 4, numInChannels ); Word16 eff_q; -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL Word16 q_decSlot[CLDFB_SLOTS_PER_SUBFRAME]; Word16 q_decSlotMin = 31; move16(); -#endif IF( processReverb ) { @@ -2816,7 +2785,6 @@ static void ivas_dirac_dec_binaural_process_output_fx( move16(); } -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL IF( !hDiracDecBin->useTdDecorr && ( max_band_decorr > 0 ) ) { FOR( slot = 0; slot < nSlots; slot++ ) @@ -2858,7 +2826,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( } } } -#endif + eff_q = sub( add( q_inp_mix, q_mat ), 15 ); FOR( Word16 i = 0; i < ch_len; i++ ) @@ -2917,31 +2885,18 @@ static void ivas_dirac_dec_binaural_process_output_fx( { if ( recompute == 1 ) { -#ifndef FIX_2049_DIFF_IN_DECORR_TAIL - ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_inp_mix, decSlotRe_fx, decSlotIm_fx ); -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL Copy32( decSlotRe_fx[slot][chA], decorrRe_fx[chA][slot], CLDFB_NO_CHANNELS_MAX ); Copy32( decSlotIm_fx[slot][chA], decorrIm_fx[chA][slot], CLDFB_NO_CHANNELS_MAX ); -#else - Copy32( decSlotRe_fx[chA], decorrRe_fx[chA][slot], CLDFB_NO_CHANNELS_MAX ); - Copy32( decSlotIm_fx[chA], decorrIm_fx[chA][slot], CLDFB_NO_CHANNELS_MAX ); -#endif } } else { FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL Copy32( decorrRe_fx[chA][slot], decSlotRe_fx[slot][chA], CLDFB_NO_CHANNELS_MAX ); Copy32( decorrIm_fx[chA][slot], decSlotIm_fx[slot][chA], CLDFB_NO_CHANNELS_MAX ); -#else - Copy32( decorrRe_fx[chA][slot], decSlotRe_fx[chA], CLDFB_NO_CHANNELS_MAX ); - Copy32( decorrIm_fx[chA][slot], decSlotIm_fx[chA], CLDFB_NO_CHANNELS_MAX ); -#endif } } } @@ -2969,13 +2924,8 @@ static void ivas_dirac_dec_binaural_process_output_fx( } ELSE { -#ifdef FIX_2049_DIFF_IN_DECORR_TAIL decSlotRePointer_fx = decSlotRe_fx[slot][chB]; decSlotImPointer_fx = decSlotIm_fx[slot][chB]; -#else - decSlotRePointer_fx = decSlotRe_fx[chB]; - decSlotImPointer_fx = decSlotIm_fx[chB]; -#endif } } ELSE @@ -4675,20 +4625,18 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#ifdef FIX_1819_EIGENVALUE_ERROR IF( D_fx[0] != 0 && D_fx[1] == 0 ) // Due to an eig2x2 error, sometimes D_fx[1] becomes zero, which implies that the input matrix should be singular (i.e., determinant = 0). { Word32 det_fx = L_sub_sat( Mult_32_32( tmpRe_fx[0][0], tmpRe_fx[1][1] ), - L_add_sat( - Mult_32_32( tmpRe_fx[1][0], tmpRe_fx[1][0] ), - Mult_32_32( tmpIm_fx[1][0], tmpIm_fx[1][0] ) ) ); + L_add_sat( Mult_32_32( tmpRe_fx[1][0], tmpRe_fx[1][0] ), + Mult_32_32( tmpIm_fx[1][0], tmpIm_fx[1][0] ) ) ); if ( det_fx != 0 ) { D_fx[1] = SMALL_EIGENVALUE; // Setting D_fx[1] to epsilon has no effect, as the value is too small to affect the output. move32(); } } -#endif + IF( D_fx[0] == 0 ) { temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 83615cfb7..f7b51e8b1 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2632,17 +2632,11 @@ void protoSignalComputation4_fx( Word32 sq_tmp_fx; Word32 *p_proto_buffer_fx; Word16 min_q_shift, q_shift; -#ifndef FIX_1985_SBA_714_HF_LOSS - Word16 min_q_shift2, q_shift2; -#endif Word32 re, im; Word16 proto_power_smooth_fx_q, sq_tmp_q; -#ifdef FIX_1985_SBA_714_HF_LOSS Word64 ref_pow64[CLDFB_NO_CHANNELS_MAX], re64; Word16 sf1, sf2; -#endif -#ifdef FIX_1985_SBA_714_HF_LOSS FOR( l = 0; l < num_freq_bands; l++ ) { re64 = W_mult_32_32( RealBuffer_fx[0][0][l], RealBuffer_fx[0][0][l] ); @@ -2673,69 +2667,7 @@ void protoSignalComputation4_fx( reference_power_fx[l] = W_extract_h( W_shl( ref_pow64[l], sf2 ) ); } reference_power_q[1] = sub( add( shl( q_cldfb, 1 ), sf2 ), 31 ); -#else - min_q_shift = Q31; - move16(); - q_shift = Q31; - move16(); - min_q_shift2 = Q31; - move16(); - q_shift2 = Q31; - move16(); - sq_tmp_q = 0; - move16(); - - set_zero_fx( reference_power_fx, num_freq_bands ); - - /* calculate the shift possible for both RealBuffer_fx and ImagBuffer_fx buffers*/ - FOR( k = 0; k < s_max( 4, nchan_transport ); k++ ) - { - q_shift = L_norm_arr( RealBuffer_fx[k][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ); - min_q_shift = s_min( q_shift, min_q_shift ); - q_shift = L_norm_arr( ImagBuffer_fx[k][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ); - min_q_shift = s_min( q_shift, min_q_shift ); - q_shift2 = L_norm_arr( RealBuffer_fx[k][0] + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - min_q_shift2 = s_min( q_shift2, min_q_shift2 ); - q_shift2 = L_norm_arr( ImagBuffer_fx[k][0] + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - min_q_shift2 = s_min( q_shift2, min_q_shift2 ); - } - q_shift = min_q_shift; - min_q_shift = sub( min_q_shift, find_guarded_bits_fx( i_mult( 2, 4 ) ) ); - q_shift2 = min_q_shift2; - min_q_shift2 = sub( min_q_shift2, find_guarded_bits_fx( i_mult( 2, 4 ) ) ); - FOR( k = 0; k < 4; k++ ) - { - FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ ) - { - re = L_shl( RealBuffer_fx[k][0][l], min_q_shift ); // q_cldfb+min_q_shift - im = L_shl( ImagBuffer_fx[k][0][l], min_q_shift ); // q_cldfb+min_q_shift - - sq_tmp_fx = Madd_32_32( Mpy_32_32( re, re ), im, im ); // 2*(q_cldfb+min_q_shift)-31 - - reference_power_fx[l] = Madd_32_16( reference_power_fx[l], sq_tmp_fx, 16384 /*0.5 in Q15*/ ); // 2*(q_cldfb+min_q_shift)-31 - move32(); - } - FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) - { - re = L_shl( RealBuffer_fx[k][0][l], min_q_shift2 ); // q_cldfb+min_q_shift - im = L_shl( ImagBuffer_fx[k][0][l], min_q_shift2 ); // q_cldfb+min_q_shift - - sq_tmp_fx = Madd_32_32( Mpy_32_32( re, re ), im, im ); // 2*(q_cldfb+min_q_shift)-31 - - reference_power_fx[l] = Madd_32_16( reference_power_fx[l], sq_tmp_fx, 16384 /*0.5 in Q15*/ ); // 2*(q_cldfb+min_q_shift)-31 - move32(); - } - } - sq_tmp_q = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); - reference_power_q[0] = sq_tmp_q; - move16(); - sq_tmp_q = sub( add( add( q_cldfb, min_q_shift2 ), add( q_cldfb, min_q_shift2 ) ), 31 ); - reference_power_q[1] = sq_tmp_q; - move16(); -#endif - -#ifdef FIX_1985_SBA_714_HF_LOSS min_q_shift = Q31; /* calculate the shift possible for both RealBuffer_fx and ImagBuffer_fx buffers*/ FOR( k = 0; k < s_max( 4, nchan_transport ); k++ ) @@ -2746,9 +2678,6 @@ void protoSignalComputation4_fx( min_q_shift = s_min( q_shift, min_q_shift ); } min_q_shift = sub( min_q_shift, find_guarded_bits_fx( 2 ) ); -#else - min_q_shift = sub( s_min( q_shift, q_shift2 ), find_guarded_bits_fx( 2 ) ); -#endif /*For decorrelated diffuseness*/ FOR( l = 0; l < num_outputs_diff; l++ ) -- GitLab