Loading lib_enc/tcx_ltp_enc_fx.c +47 −1 Original line number Diff line number Diff line Loading @@ -542,7 +542,11 @@ 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 ) ); //??sat //??sat #else g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); #endif BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o g = shl_sat( g, sub( s1, s2 ) ); Loading @@ -552,7 +556,11 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ #ifdef ISSUE_1867_replace_overflow_libenc g = shr( sub_sat( g, 0x1000 ), 13 ); //??sat #else g = shr( sub_o( g, 0x1000, &Overflow ), 13 ); #endif g = s_max( g, -1 ); *gain_index = g; Loading @@ -567,9 +575,11 @@ 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 ); Loading Loading @@ -597,9 +607,13 @@ 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 ) ); //??sat //??sat #else g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); #endif BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1867_replace_overflow_libenc g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ #else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ Loading Loading @@ -655,10 +669,12 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, 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; Loading Loading @@ -819,10 +835,18 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, 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] ) ) ); //??sat //??sat //??sat #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 ); //??sat #else alpha = add_o( alpha, step, &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS; } } Loading Loading @@ -873,7 +897,11 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, 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] ); //??sat //??sat //??sat #else speech_ltp[n] = add_o( sub_o( speech[n], mult_ro( *gain, pred_speech[n], &Overflow ), &Overflow ), zir[n], &Overflow ); #endif move16(); } } Loading @@ -891,7 +919,11 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, { 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] ) ); //??sat #else speech_ltp[n] = sub_o( speech[n], mult( *gain, pred_speech[n] ), &Overflow ); #endif move16(); } } Loading Loading @@ -934,8 +966,10 @@ 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; Loading Loading @@ -1230,7 +1264,11 @@ 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] ) ) ); //??sat //??sat //??sat #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 ); } Loading Loading @@ -1280,7 +1318,11 @@ 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] ); //??sat //??sat //??sat #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(); } } Loading @@ -1298,7 +1340,11 @@ 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] ) ); //??sat #else speech_ltp_fx[n] = sub_o( speech_fx[n], mult( hTcxEnc->tcxltp_gain, pred_speech_fx[n] ), &Overflow ); #endif move16(); } } Loading lib_enc/tcx_utils_enc_fx.c +16 −0 Original line number Diff line number Diff line Loading @@ -287,21 +287,31 @@ 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 ) ); //??sat #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 ); //??sat #else threshold = L_shl_o( threshold, 1, &Overflow ); #endif } BASOP_SATURATE_WARNING_ON_EVS Loading Loading @@ -2517,9 +2527,11 @@ 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 ) && !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif assert( nTransWidth <= 16 ); Loading Loading @@ -2774,7 +2786,11 @@ 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 ); //??sat #else tmp4 = L_shl_o( tmp4, s, &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE Loading lib_enc/tns_base_enc_fx.c +12 −0 Original line number Diff line number Diff line Loading @@ -76,9 +76,11 @@ 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(); Loading Loading @@ -125,7 +127,11 @@ 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*/ ); //??sat #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 */ Loading Loading @@ -441,9 +447,11 @@ 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(); Loading Loading @@ -490,7 +498,11 @@ 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*/ ); //??sat #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 */ Loading lib_enc/transition_enc_fx.c +25 −0 Original line number Diff line number Diff line Loading @@ -2187,9 +2187,11 @@ 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; Loading @@ -2198,11 +2200,19 @@ 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 */ //??sat #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 */ //??sat #else gain_trans = extract_h( L_shl_o( gain_trans32, 16 - 3, &Overflow ) ); /* Q4 */ #endif istart = 4; move16(); imax = N_GAIN_TC - 1; Loading Loading @@ -2235,7 +2245,11 @@ 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 ) ); //??sat //??sat #else exc[i] = round_fx_o( L_shl_o( L_mult( exc[i], gain_trans ), tmp16, &Overflow ), &Overflow ); #endif move16(); } } Loading @@ -2258,9 +2272,11 @@ 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; Loading Loading @@ -2336,7 +2352,11 @@ 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] ); //??sat #else L_sum = L_mac0_o( L_sum, res[i], res[i], &Overflow ); #endif } aver = L_sum; /*Q = 2*Q_new */ move32(); Loading @@ -2349,8 +2369,13 @@ 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 ) ) ) && //??sat LT_32( aver, L_shl_sat( L_temp1, ( 31 - exp_aver ) - ( 31 - exp ) ) ) ) //??sat #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(); Loading lib_enc/vad_fx.c +58 −0 Original line number Diff line number Diff line Loading @@ -208,9 +208,11 @@ 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 ); Loading @@ -219,7 +221,11 @@ 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 */ //??sat #else *L_snr_sum = L_add_o( *L_snr_sum, L_tmp, &Overflow ); /* Q4 */ #endif move32(); BASOP_SATURATE_WARNING_ON_EVS } Loading Loading @@ -695,9 +701,11 @@ 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 ) && !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif if ( hNoiseEst == NULL ) Loading Loading @@ -1047,19 +1055,35 @@ Word16 wb_vad_fx( #endif IF( LT_16( i, 2 ) ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta1 ); /*Q13 */ //??sat #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 */ //??sat #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 */ //??sat #else tmp = add_o( tmp, delta3, &Overflow ); /*Q13 */ #endif } ELSE { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta4 ); /*Q13 */ //??sat #else tmp = add_o( tmp, delta4, &Overflow ); /*Q13 */ #endif } tmp1 = tmp; Loading @@ -1067,7 +1091,11 @@ 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; */ //??sat #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); */ Loading Loading @@ -1151,11 +1179,19 @@ 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 */ //??sat #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 */ //??sat #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 */ Loading Loading @@ -1249,7 +1285,11 @@ 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*/ //??sat #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 ); */ Loading Loading @@ -1363,7 +1403,11 @@ 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*/ //??sat #else tmp2 = round_fx( L_shl_o( L_tmp2, 14, &Overflow ) ); /* Q10(high word)+ 14 -16 --> Q8*/ #endif IF( L_tmp2 > 0 ) { thr1_ol = add( thr1_ol, tmp2 ); /* Q24 >>16 + Q8 */ Loading Loading @@ -1933,9 +1977,11 @@ 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*/ Loading Loading @@ -2401,11 +2447,19 @@ 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_o( L_accum_ener_L, hNoiseEst->bckr_fx[i], &Overflow ); /* 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 */ //??sat #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 */ Loading @@ -2419,7 +2473,11 @@ 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 //??sat #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 Loading Loading
lib_enc/tcx_ltp_enc_fx.c +47 −1 Original line number Diff line number Diff line Loading @@ -542,7 +542,11 @@ 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 ) ); //??sat //??sat #else g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); #endif BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o g = shl_sat( g, sub( s1, s2 ) ); Loading @@ -552,7 +556,11 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ #ifdef ISSUE_1867_replace_overflow_libenc g = shr( sub_sat( g, 0x1000 ), 13 ); //??sat #else g = shr( sub_o( g, 0x1000, &Overflow ), 13 ); #endif g = s_max( g, -1 ); *gain_index = g; Loading @@ -567,9 +575,11 @@ 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 ); Loading Loading @@ -597,9 +607,13 @@ 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 ) ); //??sat //??sat #else g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); #endif BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1867_replace_overflow_libenc g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ #else g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ Loading Loading @@ -655,10 +669,12 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, 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; Loading Loading @@ -819,10 +835,18 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, 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] ) ) ); //??sat //??sat //??sat #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 ); //??sat #else alpha = add_o( alpha, step, &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS; } } Loading Loading @@ -873,7 +897,11 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, 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] ); //??sat //??sat //??sat #else speech_ltp[n] = add_o( sub_o( speech[n], mult_ro( *gain, pred_speech[n], &Overflow ), &Overflow ), zir[n], &Overflow ); #endif move16(); } } Loading @@ -891,7 +919,11 @@ void tcx_ltp_encode_fx( Word16 tcxltp_on, { 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] ) ); //??sat #else speech_ltp[n] = sub_o( speech[n], mult( *gain, pred_speech[n] ), &Overflow ); #endif move16(); } } Loading Loading @@ -934,8 +966,10 @@ 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; Loading Loading @@ -1230,7 +1264,11 @@ 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] ) ) ); //??sat //??sat //??sat #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 ); } Loading Loading @@ -1280,7 +1318,11 @@ 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] ); //??sat //??sat //??sat #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(); } } Loading @@ -1298,7 +1340,11 @@ 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] ) ); //??sat #else speech_ltp_fx[n] = sub_o( speech_fx[n], mult( hTcxEnc->tcxltp_gain, pred_speech_fx[n] ), &Overflow ); #endif move16(); } } Loading
lib_enc/tcx_utils_enc_fx.c +16 −0 Original line number Diff line number Diff line Loading @@ -287,21 +287,31 @@ 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 ) ); //??sat #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 ); //??sat #else threshold = L_shl_o( threshold, 1, &Overflow ); #endif } BASOP_SATURATE_WARNING_ON_EVS Loading Loading @@ -2517,9 +2527,11 @@ 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 ) && !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif assert( nTransWidth <= 16 ); Loading Loading @@ -2774,7 +2786,11 @@ 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 ); //??sat #else tmp4 = L_shl_o( tmp4, s, &Overflow ); #endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE Loading
lib_enc/tns_base_enc_fx.c +12 −0 Original line number Diff line number Diff line Loading @@ -76,9 +76,11 @@ 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(); Loading Loading @@ -125,7 +127,11 @@ 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*/ ); //??sat #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 */ Loading Loading @@ -441,9 +447,11 @@ 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(); Loading Loading @@ -490,7 +498,11 @@ 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*/ ); //??sat #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 */ Loading
lib_enc/transition_enc_fx.c +25 −0 Original line number Diff line number Diff line Loading @@ -2187,9 +2187,11 @@ 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; Loading @@ -2198,11 +2200,19 @@ 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 */ //??sat #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 */ //??sat #else gain_trans = extract_h( L_shl_o( gain_trans32, 16 - 3, &Overflow ) ); /* Q4 */ #endif istart = 4; move16(); imax = N_GAIN_TC - 1; Loading Loading @@ -2235,7 +2245,11 @@ 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 ) ); //??sat //??sat #else exc[i] = round_fx_o( L_shl_o( L_mult( exc[i], gain_trans ), tmp16, &Overflow ), &Overflow ); #endif move16(); } } Loading @@ -2258,9 +2272,11 @@ 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; Loading Loading @@ -2336,7 +2352,11 @@ 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] ); //??sat #else L_sum = L_mac0_o( L_sum, res[i], res[i], &Overflow ); #endif } aver = L_sum; /*Q = 2*Q_new */ move32(); Loading @@ -2349,8 +2369,13 @@ 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 ) ) ) && //??sat LT_32( aver, L_shl_sat( L_temp1, ( 31 - exp_aver ) - ( 31 - exp ) ) ) ) //??sat #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(); Loading
lib_enc/vad_fx.c +58 −0 Original line number Diff line number Diff line Loading @@ -208,9 +208,11 @@ 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 ); Loading @@ -219,7 +221,11 @@ 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 */ //??sat #else *L_snr_sum = L_add_o( *L_snr_sum, L_tmp, &Overflow ); /* Q4 */ #endif move32(); BASOP_SATURATE_WARNING_ON_EVS } Loading Loading @@ -695,9 +701,11 @@ 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 ) && !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif if ( hNoiseEst == NULL ) Loading Loading @@ -1047,19 +1055,35 @@ Word16 wb_vad_fx( #endif IF( LT_16( i, 2 ) ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta1 ); /*Q13 */ //??sat #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 */ //??sat #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 */ //??sat #else tmp = add_o( tmp, delta3, &Overflow ); /*Q13 */ #endif } ELSE { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( tmp, delta4 ); /*Q13 */ //??sat #else tmp = add_o( tmp, delta4, &Overflow ); /*Q13 */ #endif } tmp1 = tmp; Loading @@ -1067,7 +1091,11 @@ 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; */ //??sat #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); */ Loading Loading @@ -1151,11 +1179,19 @@ 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 */ //??sat #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 */ //??sat #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 */ Loading Loading @@ -1249,7 +1285,11 @@ 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*/ //??sat #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 ); */ Loading Loading @@ -1363,7 +1403,11 @@ 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*/ //??sat #else tmp2 = round_fx( L_shl_o( L_tmp2, 14, &Overflow ) ); /* Q10(high word)+ 14 -16 --> Q8*/ #endif IF( L_tmp2 > 0 ) { thr1_ol = add( thr1_ol, tmp2 ); /* Q24 >>16 + Q8 */ Loading Loading @@ -1933,9 +1977,11 @@ 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*/ Loading Loading @@ -2401,11 +2447,19 @@ 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_o( L_accum_ener_L, hNoiseEst->bckr_fx[i], &Overflow ); /* 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 */ //??sat #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 */ Loading @@ -2419,7 +2473,11 @@ 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 //??sat #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 Loading