Loading lib_com/tcx_ltp_fx.c +15 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" #ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ Loading Loading @@ -389,9 +395,11 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); Loading @@ -408,10 +416,17 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat #else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ #endif move16(); x0++; Loading lib_com/tcx_mdct_fx.c +24 −2 Original line number Diff line number Diff line Loading @@ -8,6 +8,12 @@ #include "prot_fx.h" #include "basop_util.h" #ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ Loading Loading @@ -107,9 +113,11 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); Loading @@ -126,7 +134,11 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } FOR( i = 0; i < m / 2; i++ ) Loading @@ -136,7 +148,11 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ #else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ #endif move32(); } Loading @@ -163,9 +179,11 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); Loading @@ -182,7 +200,11 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } FOR( i = 0; i < m / 2; i++ ) Loading lib_com/tcx_utils_fx.c +32 −4 Original line number Diff line number Diff line Loading @@ -12,6 +12,12 @@ #define inv_int InvIntTable #ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-------------------------------------------------------------------* * getInvFrameLen() * Loading Loading @@ -991,8 +997,10 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /* FDNS_NPTS = 64 */ Loading Loading @@ -1044,7 +1052,11 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x++; } Loading @@ -1063,7 +1075,11 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x += k; gains++; Loading Loading @@ -1389,9 +1405,11 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif assert( lpcGains[0] >= 0x4000 ); Loading Loading @@ -1438,7 +1456,11 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_tmp ); /* Q15 */ #else tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ #endif fac = tmp; /* Q15 */ move16(); Loading Loading @@ -2081,8 +2103,10 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif maxX = L_deposit_l( 1 ); Loading Loading @@ -2129,7 +2153,11 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ #else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ #endif if ( corr < 0 ) tmp = negate( tmp ); Loading lib_com/tns_base.c +12 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,12 @@ #define MAX_SUBDIVISIONS 3 #ifndef ISSUE_1836_FILEACTIVE_tns_base_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ Loading Loading @@ -439,9 +445,11 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif move16(); Loading Loading @@ -475,7 +483,11 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; #ifdef ISSUE_1836_replace_overflow_libcom tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ #else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ #endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ Loading lib_com/tools_fx.c +177 −19 Original line number Diff line number Diff line Loading @@ -52,6 +52,12 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" #ifndef ISSUE_1836_FILEACTIVE_tools_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ Loading Loading @@ -308,18 +314,21 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ #ifdef ISSUE_1796_replace_shl_o idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat #else L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ #endif Loading @@ -329,7 +338,11 @@ Word16 usquant_fx( /* o: index of the winning codeword */ /* *xq = idx*delta + qlow; */ L_tmp = L_deposit_l( qlow ); /*Qx */ L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ #ifdef ISSUE_1836_replace_overflow_libcom *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #endif return idx; } /*-------------------------------------------------------------------* Loading Loading @@ -395,14 +408,20 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { #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; Loading Loading @@ -456,15 +475,21 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); #else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); #endif } return L_tmp; Loading Loading @@ -684,7 +709,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading @@ -711,8 +736,8 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o y[i] = shl_sat( x[i], exp0 ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = shl_sat( x[i], exp0 ); //??sat #else y[i] = shl_o( x[i], exp0, &Overflow ); #endif Loading @@ -733,7 +758,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading @@ -755,8 +780,8 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif Loading @@ -772,8 +797,8 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( 1, exp0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( 1, exp0 ); //??sat #else tmp = shl_o( 1, exp0, &Overflow ); #endif Loading @@ -793,10 +818,12 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( exp0 == 0 ) Loading @@ -813,8 +840,8 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif Loading @@ -822,7 +849,11 @@ void Copy_Scale_sig_16_32_no_sat( } return; } #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat #else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); #endif IF( L_tmp >= 0x7FFF ) { Loading Loading @@ -854,9 +885,11 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif tmp = add( 16, exp0 ); Loading @@ -864,7 +897,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); #else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); #endif move16(); } } Loading @@ -872,7 +909,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( x[i] ); //??sat #else y[i] = round_fx_o( x[i], &Overflow ); #endif move16(); } } Loading @@ -890,9 +931,11 @@ void Scale_sig32( ) { Word16 i; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( 0 == exp0 ) { Loading @@ -901,7 +944,11 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom x[i] = L_shl_sat( x[i], exp0 ); #else x[i] = L_shl_o( x[i], exp0, &Overflow ); #endif move32(); /* saturation can occur here */ } } Loading Loading @@ -1896,10 +1943,12 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif idx = 0; Loading @@ -1916,6 +1965,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat if ( weights[3] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat if ( weights[2] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat if ( weights[1] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat if ( weights[0] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } #else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { Loading @@ -1936,6 +2007,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } #endif if ( LT_32( dist, minDist ) ) { idx = c; Loading Loading @@ -1965,6 +2037,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat if ( weights[0] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat if ( weights[1] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat if ( weights[2] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat if ( weights[3] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } #else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { Loading @@ -1985,6 +2079,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } #endif if ( LT_32( dist, minDist ) ) { idx = c; Loading Loading @@ -2451,9 +2546,11 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) Loading @@ -2464,15 +2561,23 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); #ifdef ISSUE_1836_replace_overflow_libcom num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat #else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); #endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); #ifdef ISSUE_1836_replace_overflow_libcom den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat #else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); #endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1836_replace_overflow_libcom //??sat num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); Loading Loading @@ -2632,9 +2737,11 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); Loading @@ -2647,14 +2754,27 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom s = L_mult_sat( buf_in[K + i], h[0] ); //??sat #else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); #endif FOR( j = 1; j <= K; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat #else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); #endif } #ifdef ISSUE_1836_replace_overflow_libcom s = L_shl_sat( s, shift ); //??sat y[i] = round_fx_sat( s ); /*Qx */ //??sat #else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ #endif move16(); } } Loading Loading @@ -2790,8 +2910,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif idx = 0; Loading @@ -2802,10 +2924,18 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x, cb[c] ); #else tmp = sub_o( x, cb[c], &Overflow ); #endif /*dist += tmp*tmp; */ #ifdef ISSUE_1836_replace_overflow_libcom L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat #else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); #endif if ( LT_32( L_dist, L_mindist ) ) { Loading Loading @@ -2943,9 +3073,11 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( exp0 == 0 ) { Loading @@ -2960,12 +3092,20 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_shl_sat( x[i], tmp ); //??sat #else y[i] = L_shl_o( x[i], tmp, &Overflow ); #endif move16(); } return; } #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat #else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); #endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); Loading Loading @@ -3142,9 +3282,11 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); Loading @@ -3152,7 +3294,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat #else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); #endif move16(); } } Loading @@ -3160,7 +3306,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat #else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); #endif move16(); } } Loading Loading @@ -3287,7 +3437,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ #ifdef ISSUE_1836_replace_overflow_libcom temp = mult_r( *signal++, 16384 ); #else temp = mult_ro( *signal++, 16384, &Overflow ); #endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ Loading @@ -3297,7 +3451,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom temp = mult_r( *signal++, 16384 ); #else temp = mult_ro( *signal++, 16384, &Overflow ); #endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } #ifdef ISSUE_1799_replace_L_shr_o Loading Loading
lib_com/tcx_ltp_fx.c +15 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,12 @@ #include "basop_util.h" #include "rom_com.h" #ifndef ISSUE_1836_FILEACTIVE_tcx_ltp_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ Loading Loading @@ -389,9 +395,11 @@ void predict_signal( Word16 j; Word32 s; const Word16 *x0, *win; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif x0 = &excI[-T0 - 1]; frac = negate( frac ); Loading @@ -408,10 +416,17 @@ void predict_signal( FOR( j = 0; j < L_subfr; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */ //??sat s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */ //??sat s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */ //??sat excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */ //??sat #else s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */ s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */ excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */ #endif move16(); x0++; Loading
lib_com/tcx_mdct_fx.c +24 −2 Original line number Diff line number Diff line Loading @@ -8,6 +8,12 @@ #include "prot_fx.h" #include "basop_util.h" #ifndef ISSUE_1836_FILEACTIVE_tcx_mdct_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif static Word16 TCX_MDCT_GetScaleFactor( const Word16 L, /* Q0 */ Word16 *factor_e /* Q0 */ Loading Loading @@ -107,9 +113,11 @@ void TCX_MDCT( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); *y_e = add( *y_e, factor_e ); Loading @@ -126,7 +134,11 @@ void TCX_MDCT( } FOR( i = 0; i < l / 2; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } FOR( i = 0; i < m / 2; i++ ) Loading @@ -136,7 +148,11 @@ void TCX_MDCT( } FOR( i = 0; i < r / 2; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */ #else y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */ #endif move32(); } Loading @@ -163,9 +179,11 @@ void TCX_MDST( Word16 factor, neg_factor; Word16 factor_e; (void) element_mode; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */ *y_e = add( *y_e, factor_e ); Loading @@ -182,7 +200,11 @@ void TCX_MDST( } FOR( i = 0; i < l / 2; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */ //??sat #else y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */ #endif move32(); } FOR( i = 0; i < m / 2; i++ ) Loading
lib_com/tcx_utils_fx.c +32 −4 Original line number Diff line number Diff line Loading @@ -12,6 +12,12 @@ #define inv_int InvIntTable #ifndef ISSUE_1836_FILEACTIVE_tcx_utils_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-------------------------------------------------------------------* * getInvFrameLen() * Loading Loading @@ -991,8 +997,10 @@ void mdct_shaping( Word32 *px = x; /*Qx*/ Word16 const *pgains = gains; Word16 const *pgainsexp = gains_exp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /* FDNS_NPTS = 64 */ Loading Loading @@ -1044,7 +1052,11 @@ void mdct_shaping( FOR( l = 0; l < k; l++ ) { #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x++; } Loading @@ -1063,7 +1075,11 @@ void mdct_shaping( gains_exp = pgainsexp; FOR( i = 0; i < FDNS_NPTS; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/ #else *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/ #endif move32(); x += k; gains++; Loading Loading @@ -1389,9 +1405,11 @@ void PsychAdaptLowFreqDeemph( Word16 i; Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif assert( lpcGains[0] >= 0x4000 ); Loading Loading @@ -1438,7 +1456,11 @@ void PsychAdaptLowFreqDeemph( L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = round_fx_sat( L_tmp ); /* Q15 */ #else tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */ #endif fac = tmp; /* Q15 */ move16(); Loading Loading @@ -2081,8 +2103,10 @@ void tcx_get_gain( Word32 corr, ener; Word16 sx, sy, corr_e, ener_e; Word16 i, tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif maxX = L_deposit_l( 1 ); Loading Loading @@ -2129,7 +2153,11 @@ void tcx_get_gain( ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/ ener_e = sub( ener_e, tmp ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/ #else tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/ #endif if ( corr < 0 ) tmp = negate( tmp ); Loading
lib_com/tns_base.c +12 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,12 @@ #define MAX_SUBDIVISIONS 3 #ifndef ISSUE_1836_FILEACTIVE_tns_base_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*---------------------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------------------*/ Loading Loading @@ -439,9 +445,11 @@ Word16 ITF_Detect_fx( Word32 L_tmp, tmp32; Word16 tmpbuf[325]; Word16 n, i; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif move16(); Loading Loading @@ -475,7 +483,11 @@ Word16 ITF_Detect_fx( /* Check threshold HLM_MIN_NRG */ BASOP_SATURATE_WARNING_OFF_EVS; #ifdef ISSUE_1836_replace_overflow_libcom tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ #else tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/ #endif BASOP_SATURATE_WARNING_ON_EVS; /* get pre-shift for autocorrelation */ Loading
lib_com/tools_fx.c +177 −19 Original line number Diff line number Diff line Loading @@ -52,6 +52,12 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" #ifndef ISSUE_1836_FILEACTIVE_tools_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ #define INV_BANDS3 10923 /* 1/9 in Q15 */ Loading Loading @@ -308,18 +314,21 @@ Word16 usquant_fx( /* o: index of the winning codeword */ Word16 idx; Word16 tmp, exp; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* idx = (short)( (x - qlow)/delta + 0.5f); */ exp = norm_s( delta ); tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */ L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ #ifdef ISSUE_1796_replace_shl_o idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */ //??sat idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */ //??sat #else L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */ idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */ #endif Loading @@ -329,7 +338,11 @@ Word16 usquant_fx( /* o: index of the winning codeword */ /* *xq = idx*delta + qlow; */ L_tmp = L_deposit_l( qlow ); /*Qx */ L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */ #ifdef ISSUE_1836_replace_overflow_libcom *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #endif return idx; } /*-------------------------------------------------------------------* Loading Loading @@ -395,14 +408,20 @@ Word32 sum2_fx( /* o : sum of all squared vector elements { Word16 i; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { #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; Loading Loading @@ -456,15 +475,21 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element { Word16 i; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < lvec; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) ); #else L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow ); #endif } return L_tmp; Loading Loading @@ -684,7 +709,7 @@ void Copy_Scale_sig( { Word16 i; Word16 tmp; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading @@ -711,8 +736,8 @@ void Copy_Scale_sig( } FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o y[i] = shl_sat( x[i], exp0 ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = shl_sat( x[i], exp0 ); //??sat #else y[i] = shl_o( x[i], exp0, &Overflow ); #endif Loading @@ -733,7 +758,7 @@ void Copy_Scale_sig_16_32_DEPREC( { Word16 i; Word16 tmp; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading @@ -755,8 +780,8 @@ void Copy_Scale_sig_16_32_DEPREC( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif Loading @@ -772,8 +797,8 @@ void Copy_Scale_sig_16_32_DEPREC( #else assert( exp0 < 16 ); #endif #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( 1, exp0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( 1, exp0 ); //??sat #else tmp = shl_o( 1, exp0, &Overflow ); #endif Loading @@ -793,10 +818,12 @@ void Copy_Scale_sig_16_32_no_sat( { Word16 i; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( exp0 == 0 ) Loading @@ -813,8 +840,8 @@ void Copy_Scale_sig_16_32_no_sat( /*Should not happen */ FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_deposit_l( shl_sat( x[i], exp0 ) ); //??sat #else y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) ); #endif Loading @@ -822,7 +849,11 @@ void Copy_Scale_sig_16_32_no_sat( } return; } #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat #else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); #endif IF( L_tmp >= 0x7FFF ) { Loading Loading @@ -854,9 +885,11 @@ void Copy_Scale_sig_32_16( { Word16 i; Word16 tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif tmp = add( 16, exp0 ); Loading @@ -864,7 +897,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) ); #else y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow ); #endif move16(); } } Loading @@ -872,7 +909,11 @@ void Copy_Scale_sig_32_16( { FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( x[i] ); //??sat #else y[i] = round_fx_o( x[i], &Overflow ); #endif move16(); } } Loading @@ -890,9 +931,11 @@ void Scale_sig32( ) { Word16 i; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( 0 == exp0 ) { Loading @@ -901,7 +944,11 @@ void Scale_sig32( FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom x[i] = L_shl_sat( x[i], exp0 ); #else x[i] = L_shl_o( x[i], exp0, &Overflow ); #endif move32(); /* saturation can occur here */ } } Loading Loading @@ -1896,10 +1943,12 @@ Word16 w_vquant_fx( Word16 tmp; Word16 c, idx, j; Word32 dist, minDist; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif idx = 0; Loading @@ -1916,6 +1965,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat if ( weights[3] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat if ( weights[2] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat if ( weights[1] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat if ( weights[0] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } #else tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow ); if ( weights[3] != 0 ) { Loading @@ -1936,6 +2007,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } #endif if ( LT_32( dist, minDist ) ) { idx = c; Loading Loading @@ -1965,6 +2037,28 @@ Word16 w_vquant_fx( { dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x[0], shr( cb[j++], Qx ) ); //??sat if ( weights[0] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[1], shr( cb[j++], Qx ) ); //??sat if ( weights[1] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[2], shr( cb[j++], Qx ) ); //??sat if ( weights[2] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } tmp = sub_sat( x[3], shr( cb[j++], Qx ) ); //??sat if ( weights[3] != 0 ) { dist = L_mac0_sat( dist, tmp, tmp ); //??sat } #else tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow ); if ( weights[0] != 0 ) { Loading @@ -1985,6 +2079,7 @@ Word16 w_vquant_fx( { dist = L_mac0_o( dist, tmp, tmp, &Overflow ); } #endif if ( LT_32( dist, minDist ) ) { idx = c; Loading Loading @@ -2451,9 +2546,11 @@ Word32 root_a_over_b_fx( Word16 tmp, num, den, scale; Word16 exp, exp_num, exp_den; Word32 L_tmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif test(); IF( ( a <= 0 ) || ( b <= 0 ) ) Loading @@ -2464,15 +2561,23 @@ Word32 root_a_over_b_fx( } exp_num = norm_l( b ); #ifdef ISSUE_1836_replace_overflow_libcom num = round_fx_sat( L_shl_sat( b, exp_num ) ); //??sat #else num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow ); #endif exp_num = sub( sub( 30, exp_num ), Q_b ); exp_den = norm_l( a ); #ifdef ISSUE_1836_replace_overflow_libcom den = round_fx_sat( L_shl_sat( a, exp_den ) ); //??sat #else den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow ); #endif exp_den = sub( sub( 30, exp_den ), Q_a ); scale = shr( sub( den, num ), 15 ); #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1836_replace_overflow_libcom //??sat num = shl_sat( num, scale ); #else num = shl_o( num, scale, &Overflow ); Loading Loading @@ -2632,9 +2737,11 @@ void fir_fx( const Word16 x[], /* i : input vector Word16 buf_in[L_FRAME32k + L_FILT_MAX]; Word16 i, j; Word32 s; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* prepare the input buffer (copy and update memory) */ Copy( mem, buf_in, K ); Loading @@ -2647,14 +2754,27 @@ void fir_fx( const Word16 x[], /* i : input vector /* do the filtering */ FOR( i = 0; i < L; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom s = L_mult_sat( buf_in[K + i], h[0] ); //??sat #else s = L_mult_o( buf_in[K + i], h[0], &Overflow ); #endif FOR( j = 1; j <= K; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom s = L_mac_sat( s, h[j], buf_in[K + i - j] ); //??sat #else s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow ); #endif } #ifdef ISSUE_1836_replace_overflow_libcom s = L_shl_sat( s, shift ); //??sat y[i] = round_fx_sat( s ); /*Qx */ //??sat #else s = L_shl_o( s, shift, &Overflow ); y[i] = round_fx_o( s, &Overflow ); /*Qx */ #endif move16(); } } Loading Loading @@ -2790,8 +2910,10 @@ Word16 squant_fx( /* o: index of the winning codeword */ Word16 tmp; Word16 c, idx; Word32 L_mindist, L_dist; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif idx = 0; Loading @@ -2802,10 +2924,18 @@ Word16 squant_fx( /* o: index of the winning codeword */ FOR( c = 0; c < cbsize; c++ ) { L_dist = L_deposit_l( 0 ); #ifdef ISSUE_1836_replace_overflow_libcom tmp = sub_sat( x, cb[c] ); #else tmp = sub_o( x, cb[c], &Overflow ); #endif /*dist += tmp*tmp; */ #ifdef ISSUE_1836_replace_overflow_libcom L_dist = L_mac_sat( L_dist, tmp, tmp ); //??sat #else L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow ); #endif if ( LT_32( L_dist, L_mindist ) ) { Loading Loading @@ -2943,9 +3073,11 @@ void Copy_Scale_sig32( Word16 i; Word32 L_tmp; Word16 tmp = exp0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( exp0 == 0 ) { Loading @@ -2960,12 +3092,20 @@ void Copy_Scale_sig32( { FOR( i = 0; i < lg; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = L_shl_sat( x[i], tmp ); //??sat #else y[i] = L_shl_o( x[i], tmp, &Overflow ); #endif move16(); } return; } #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shl_sat( 1, exp0 - 1 ); //??sat #else L_tmp = L_shl_o( 1, exp0 - 1, &Overflow ); #endif FOR( i = 0; i < lg; i++ ) { y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) ); Loading Loading @@ -3142,9 +3282,11 @@ void add_vec_fx( ) { Word16 i, Qyx1, Qyx2; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif Qyx1 = sub( Qx1, Qy ); Qyx2 = sub( Qx2, Qy ); Loading @@ -3152,7 +3294,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) ); //??sat //??sat #else y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow ); #endif move16(); } } Loading @@ -3160,7 +3306,11 @@ void add_vec_fx( { FOR( i = 0; i < N; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //??sat //!!sat //!!sat #else y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow ); #endif move16(); } } Loading Loading @@ -3287,7 +3437,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) FOR( i = 0; i < j; i++ ) { /* divide by 2 so energy will be divided by 4 */ #ifdef ISSUE_1836_replace_overflow_libcom temp = mult_r( *signal++, 16384 ); #else temp = mult_ro( *signal++, 16384, &Overflow ); #endif L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow ); } FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */ Loading @@ -3297,7 +3451,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) L_temp = L_mult0( temp, temp ); FOR( j = 1; j < 8; j++ ) { #ifdef ISSUE_1836_replace_overflow_libcom temp = mult_r( *signal++, 16384 ); #else temp = mult_ro( *signal++, 16384, &Overflow ); #endif L_temp = L_mac0_o( L_temp, temp, temp, &Overflow ); } #ifdef ISSUE_1799_replace_L_shr_o Loading