Loading lib_com/low_rate_band_att_fx.c +6 −31 Original line number Diff line number Diff line Loading @@ -8,11 +8,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" #ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*--------------------------------------------------------------------------* * fine_gain_pred() Loading Loading @@ -44,11 +39,9 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FOR( band = 0; band < num_sfm; band++ ) Loading Loading @@ -88,11 +81,7 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ #ifdef ISSUE_1836_replace_overflow_libcom gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat #else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ #endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ Loading @@ -108,11 +97,7 @@ void ivas_fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = 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 */ Loading Loading @@ -169,11 +154,9 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif FOR( band = 0; band < num_sfm; band++ ) Loading Loading @@ -206,11 +189,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 */ //??sat //??sat #else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ #endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ Loading @@ -226,11 +205,7 @@ void fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = 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 */ Loading lib_com/lpc_tools_fx.c +6 −124 Original line number Diff line number Diff line Loading @@ -42,12 +42,6 @@ #include "rom_com.h" #include "basop_util.h" #ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-----------------------------------------------------------------* * Local constants Loading Loading @@ -415,10 +409,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ Loading @@ -435,11 +427,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); #ifdef ISSUE_1836_replace_overflow_libcom L_32 = L_shl_sat( L_32, 2 ); //??sat #else L_32 = L_shl_o( L_32, 2, &Overflow ); #endif return ( L_32 ); } Loading Loading @@ -475,11 +463,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif BASOP_SATURATE_WARNING_OFF_EVS Loading Loading @@ -540,21 +526,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat #else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); #endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); Loading @@ -569,11 +546,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { Loading Loading @@ -612,11 +585,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif 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 */ Loading Loading @@ -652,11 +621,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom A[i] = round_fx_sat( L_shl_sat( t0, k ) ); #else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); #endif move16(); } Loading Loading @@ -692,11 +657,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif BASOP_SATURATE_WARNING_OFF_EVS Loading Loading @@ -757,21 +720,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat #else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); #endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); Loading @@ -786,11 +740,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { Loading Loading @@ -829,11 +779,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif 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 */ Loading Loading @@ -869,11 +815,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat #else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); #endif move16(); } Loading Loading @@ -909,13 +851,10 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ # #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif BASOP_SATURATE_WARNING_OFF_EVS Loading Loading @@ -976,21 +915,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ /* 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 ); Loading @@ -1005,11 +935,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { Loading Loading @@ -1048,11 +974,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif 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 */ Loading Loading @@ -1088,11 +1010,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom A[i] = L_shl_sat( t0, k ); //??sat #else A[i] = L_shl_o( t0, k, &Overflow ); #endif move16(); } Loading Loading @@ -1560,11 +1478,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* half length FFT */ Loading Loading @@ -1740,22 +1656,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat move16(); tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat move16(); BASOP_SATURATE_WARNING_ON_EVS RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); move16(); ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); move16(); BASOP_SATURATE_WARNING_OFF_EVS tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat move16(); tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat move16(); #else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); Loading @@ -1770,7 +1670,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); #endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); Loading @@ -1791,22 +1690,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat move16(); tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat move16(); BASOP_SATURATE_WARNING_ON_EVS RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); move16(); ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); move16(); BASOP_SATURATE_WARNING_OFF_EVS tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat move16(); tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat move16(); #else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); Loading @@ -1821,7 +1704,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); #endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); Loading lib_com/lsf_tools_fx.c +31 −118 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_com/lsp_conv_poly_fx.c +5 −83 Original line number Diff line number Diff line Loading @@ -9,12 +9,6 @@ #include "prot_fx.h" #include "wmc_auto.h" #ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-------------------------------------------------------------------* * Local constants Loading Loading @@ -342,10 +336,8 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif exp_den = norm_l( in32 ); Loading @@ -353,17 +345,14 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); #ifdef ISSUE_1836_replace_overflow_libcom exp_den = shl( exp_den, 1 ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #ifdef ISSUE_1796_replace_shl_o exp_den = shl_sat( exp_den, 1 ); #else exp_den = shl_o( exp_den, 1, &Overflow ); #endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ #endif return Ltmp; } Loading @@ -379,10 +368,8 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif IF( re == 0 ) Loading @@ -395,11 +382,7 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } Loading @@ -414,11 +397,7 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } Loading Loading @@ -448,8 +427,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #ifdef ISSUE_1799_replace_L_shr_o L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif Loading Loading @@ -530,10 +509,8 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /*---------------------------------------------------------------------* Loading @@ -556,11 +533,7 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom r[0] = L_add_sat( r[0], G[i] ); #else r[0] = L_add_o( r[0], G[i], &Overflow ); #endif move32(); } Loading Loading @@ -594,47 +567,18 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom gp = L_add_sat( G[i], G[N - i - 1] ); //??sat #else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); #endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); #ifdef ISSUE_1836_replace_overflow_libcom r[1] = L_add_sat( r[1], mh ); //??sat #else r[1] = L_add_o( r[1], mh, &Overflow ); #endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); /*r[j] = L_mac(r[j], c[j], gp);*/ Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); c[j + 1] = mult_r( c[j], x[i - 1] ); move16(); c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat move16(); /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat move32(); #else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); Loading @@ -654,55 +598,33 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); #endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); #else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); #endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ #ifdef ISSUE_1836_replace_overflow_libcom gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_sat( r[0], gp ); //??sat #else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); #endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat #else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); #endif } return; Loading lib_com/math_op.c +7 −29 Original line number Diff line number Diff line Loading @@ -23,12 +23,6 @@ #include <stdlib.h> #include <stdio.h> #ifndef ISSUE_1836_FILEACTIVE_math_op_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*___________________________________________________________________________ | | | Function Name : Isqrt | Loading Loading @@ -234,30 +228,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { #ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat } #else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } #endif } IF( expi < 0 ) { Loading @@ -267,32 +251,26 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); #ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat #else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); #endif } } IF( expi > 0 ) { #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( x[0], expi ); //??sat L_sum = L_mac_sat( 1, tmp, tmp ); //??sat FOR( i = 1; i < lg; i++ ) { tmp = shl_sat( x[i], expi ); //??sat L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat } #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( x[0], expi ); #else tmp = shl_o( x[0], expi, &Overflow ); #endif L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( x[i], expi ); #else tmp = shl_o( x[i], expi, &Overflow ); #endif L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } #endif } /* Normalize acc in Q31 */ Loading Loading
lib_com/low_rate_band_att_fx.c +6 −31 Original line number Diff line number Diff line Loading @@ -8,11 +8,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" #ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*--------------------------------------------------------------------------* * fine_gain_pred() Loading Loading @@ -44,11 +39,9 @@ void ivas_fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FOR( band = 0; band < num_sfm; band++ ) Loading Loading @@ -88,11 +81,7 @@ void ivas_fine_gain_pred_fx( tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ #ifdef ISSUE_1836_replace_overflow_libcom gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat #else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ #endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ Loading @@ -108,11 +97,7 @@ void ivas_fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = 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 */ Loading Loading @@ -169,11 +154,9 @@ void fine_gain_pred_fx( Word16 tmp, exp, exp2; Word32 L_tmp; UWord16 lsb; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif FOR( band = 0; band < num_sfm; band++ ) Loading Loading @@ -206,11 +189,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 */ //??sat //??sat #else gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ #endif test(); test(); IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */ Loading @@ -226,11 +205,7 @@ void fine_gain_pred_fx( /*gp *= 1.0f - 0.05f / accuracy; */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat #else tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ #endif tmp = 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 */ Loading
lib_com/lpc_tools_fx.c +6 −124 Original line number Diff line number Diff line Loading @@ -42,12 +42,6 @@ #include "rom_com.h" #include "basop_util.h" #ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-----------------------------------------------------------------* * Local constants Loading Loading @@ -415,10 +409,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word { Word16 approx /*, hi, lo, n_hi , n_lo*/; Word32 L_32; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /* First approximation: 1 / L_denom = 1/denom_hi */ Loading @@ -435,11 +427,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word L_32 = Mpy_32_32( L_num, L_32 ); #ifdef ISSUE_1836_replace_overflow_libcom L_32 = L_shl_sat( L_32, 2 ); //??sat #else L_32 = L_shl_o( L_32, 2, &Overflow ); #endif return ( L_32 ); } Loading Loading @@ -475,11 +463,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif BASOP_SATURATE_WARNING_OFF_EVS Loading Loading @@ -540,21 +526,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat #else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); #endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); Loading @@ -569,11 +546,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { Loading Loading @@ -612,11 +585,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif 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 */ Loading Loading @@ -652,11 +621,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom A[i] = round_fx_sat( L_shl_sat( t0, k ) ); #else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); #endif move16(); } Loading Loading @@ -692,11 +657,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif BASOP_SATURATE_WARNING_OFF_EVS Loading Loading @@ -757,21 +720,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ /* Compose and add R[i] in Q3 */ #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_mac_sat( t0, Rl[i], 1 ); //??sat t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat #else t0 = L_mac_o( t0, Rl[i], 1, &Overflow ); t0 = L_msu_o( t0, Rh[i], -32768, &Overflow ); #endif /* K = -t0 / Alpha */ t1 = L_abs( t0 ); Loading @@ -786,11 +740,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { Loading Loading @@ -829,11 +779,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif 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 */ Loading Loading @@ -869,11 +815,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat #else A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow ); #endif move16(); } Loading Loading @@ -909,13 +851,10 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* Word32 t0, t1, t2; /* temporary variables */ Word16 flag; Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ # #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif BASOP_SATURATE_WARNING_OFF_EVS Loading Loading @@ -976,21 +915,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); } #ifdef ISSUE_1836_replace_overflow_libcom t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat #else t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */ #endif /* No overflow possible */ /* 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 ); Loading @@ -1005,11 +935,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* { t2 = L_negate( t2 ); /* K =-t0/Alpha */ } #ifdef ISSUE_1836_replace_overflow_libcom t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ //??sat #else t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */ #endif test(); if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) { Loading Loading @@ -1048,11 +974,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ /* Alpha = Alpha * (1-K**2) */ #ifdef ISSUE_1836_replace_overflow_libcom t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ //??sat #else t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */ #endif 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 */ Loading Loading @@ -1088,11 +1010,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* FOR( i = 1; i <= order; i++ ) { t0 = L_Comp( Ah[i], Al[i] ); #ifdef ISSUE_1836_replace_overflow_libcom A[i] = L_shl_sat( t0, k ); //??sat #else A[i] = L_shl_o( t0, k, &Overflow ); #endif move16(); } Loading Loading @@ -1560,11 +1478,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 lpc[19]; move16(); #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* half length FFT */ Loading Loading @@ -1740,22 +1656,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat move16(); tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat move16(); BASOP_SATURATE_WARNING_ON_EVS RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); move16(); ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); move16(); BASOP_SATURATE_WARNING_OFF_EVS tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat move16(); tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat move16(); #else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow ); Loading @@ -1770,7 +1670,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow ); move16(); #endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); Loading @@ -1791,22 +1690,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) ); Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1836_replace_overflow_libcom tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat move16(); tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat move16(); BASOP_SATURATE_WARNING_ON_EVS RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re ); move16(); ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im ); move16(); BASOP_SATURATE_WARNING_OFF_EVS tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat move16(); tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat move16(); #else tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow ); move16(); tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow ); Loading @@ -1821,7 +1704,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ move16(); tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow ); move16(); #endif BASOP_SATURATE_WARNING_ON_EVS RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im ); move16(); Loading
lib_com/lsf_tools_fx.c +31 −118 File changed.Preview size limit exceeded, changes collapsed. Show changes
lib_com/lsp_conv_poly_fx.c +5 −83 Original line number Diff line number Diff line Loading @@ -9,12 +9,6 @@ #include "prot_fx.h" #include "wmc_auto.h" #ifndef ISSUE_1836_FILEACTIVE_lsp_conv_poly_fx_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*-------------------------------------------------------------------* * Local constants Loading Loading @@ -342,10 +336,8 @@ static Word32 b_inv_sq( Word16 m_den, exp_den; Word16 div_out; Word32 Ltmp; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif exp_den = norm_l( in32 ); Loading @@ -353,17 +345,14 @@ static Word32 b_inv_sq( exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); m_den = mult_r( m_den, m_den ); #ifdef ISSUE_1836_replace_overflow_libcom exp_den = shl( exp_den, 1 ); div_out = div_s( 8192, m_den ); Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ //??sat #ifdef ISSUE_1796_replace_shl_o exp_den = shl_sat( exp_den, 1 ); #else exp_den = shl_o( exp_den, 1, &Overflow ); #endif div_out = div_s( 8192, m_den ); Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ #endif return Ltmp; } Loading @@ -379,10 +368,8 @@ static Word32 inv_pow( Word32 mh; UWord16 ml; Word32 r0, s0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif IF( re == 0 ) Loading @@ -395,11 +382,7 @@ static Word32 inv_pow( { exp1 = norm_l( re ); tmp = extract_h( L_shl( re, exp1 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); //??sat #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); r0 = L_add( L_tmp, mh ); } Loading @@ -414,11 +397,7 @@ static Word32 inv_pow( { exp2 = norm_l( se ); tmp = extract_h( L_shl( se, exp2 ) ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 ); #else L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); #endif Mpy_32_16_ss( L_tmp, x, &mh, &ml ); s0 = L_sub( L_tmp, mh ); } Loading Loading @@ -448,8 +427,8 @@ static Word32 inv_pow( } tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); exp1 = add( exp1, exp2 ); #ifdef ISSUE_1836_replace_overflow_libcom L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ //??sat #ifdef ISSUE_1799_replace_L_shr_o L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */ #else L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ #endif Loading Loading @@ -530,10 +509,8 @@ static void spectautocorr_fx( UWord16 ml; Word32 r[M + 1]; Word16 exp0; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif /*---------------------------------------------------------------------* Loading @@ -556,11 +533,7 @@ static void spectautocorr_fx( move32(); FOR( i = 2; i < N - 1; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom r[0] = L_add_sat( r[0], G[i] ); #else r[0] = L_add_o( r[0], G[i], &Overflow ); #endif move32(); } Loading Loading @@ -594,47 +567,18 @@ static void spectautocorr_fx( move16(); /* 1.0 in Q15 */ FOR( i = 1; i < imid; i++ ) { #ifdef ISSUE_1836_replace_overflow_libcom gp = L_add_sat( G[i], G[N - i - 1] ); //??sat #else gp = L_add_o( G[i], G[N - i - 1], &Overflow ); #endif gn = L_sub( G[i], G[N - i - 1] ); /*r[1] = L_mac(r[1], x[i-1], gn);*/ Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); #ifdef ISSUE_1836_replace_overflow_libcom r[1] = L_add_sat( r[1], mh ); //??sat #else r[1] = L_add_o( r[1], mh, &Overflow ); #endif move32(); c[1] = x[i - 1]; move16(); FOR( j = 2; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); /*r[j] = L_mac(r[j], c[j], gp);*/ Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); c[j + 1] = mult_r( c[j], x[i - 1] ); move16(); c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) ); //??sat //??sat move16(); /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_sat( r[j + 1], mh ); //??sat move32(); #else c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); Loading @@ -654,55 +598,33 @@ static void spectautocorr_fx( Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); move32(); #endif } c[j] = mult_r( c[j - 1], x[i - 1] ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) ); //??sat move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_sat( r[j], mh ); //??sat move32(); #else c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); move16(); Mpy_32_16_ss( gp, c[j], &mh, &ml ); r[j] = L_add_o( r[j], mh, &Overflow ); move32(); #endif } /*---------------------------------------------------------------------* * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as * well as the lower half of the unit circle. *---------------------------------------------------------------------*/ #ifdef ISSUE_1836_replace_overflow_libcom gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 ); //??sat gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_sat( r[0], gp ); //??sat #else gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); r[0] = L_add_o( r[0], gp, &Overflow ); #endif move32(); exp0 = norm_l( r[0] ); L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); FOR( j = 1; j < M; j += 2 ) { #ifdef ISSUE_1836_replace_overflow_libcom L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] ); //??sat L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); //??sat #else L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); #endif } return; Loading
lib_com/math_op.c +7 −29 Original line number Diff line number Diff line Loading @@ -23,12 +23,6 @@ #include <stdlib.h> #include <stdio.h> #ifndef ISSUE_1836_FILEACTIVE_math_op_c #ifdef ISSUE_1836_replace_overflow_libcom #undef ISSUE_1836_replace_overflow_libcom #endif #endif /*___________________________________________________________________________ | | | Function Name : Isqrt | Loading Loading @@ -234,30 +228,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val { Word16 i, sft, tmp; Word32 L_sum; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */ IF( expi == 0 ) { #ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat } #else L_sum = L_mac_o( 1, x[0], x[0], &Overflow ); FOR( i = 1; i < lg; i++ ) { L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow ); } #endif } IF( expi < 0 ) { Loading @@ -267,32 +251,26 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val FOR( i = 1; i < lg; i++ ) { tmp = mult_r( x[i], sft ); #ifdef ISSUE_1836_replace_overflow_libcom L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat #else L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); #endif } } IF( expi > 0 ) { #ifdef ISSUE_1836_replace_overflow_libcom tmp = shl_sat( x[0], expi ); //??sat L_sum = L_mac_sat( 1, tmp, tmp ); //??sat FOR( i = 1; i < lg; i++ ) { tmp = shl_sat( x[i], expi ); //??sat L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat } #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( x[0], expi ); #else tmp = shl_o( x[0], expi, &Overflow ); #endif L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); FOR( i = 1; i < lg; i++ ) { #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( x[i], expi ); #else tmp = shl_o( x[i], expi, &Overflow ); #endif L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); } #endif } /* Normalize acc in Q31 */ Loading