Loading lib_enc/scale_enc_fx.c +30 −0 Original line number Diff line number Diff line Loading @@ -86,9 +86,11 @@ void Preemph_scaled( Word16 mu, shift, QVal; Word32 L_tmp, L_maxloc; Word16 Q_min; #if !defined( ISSUE_1867_replace_overflow_libenc ) && !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /*---------------------------------------------------------------* Loading @@ -97,8 +99,17 @@ void Preemph_scaled( *---------------------------------------------------------------*/ BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1867_replace_overflow_libenc QVal = shl_sat( 1, sub( 15, bits ) ); //?sat #else Overflow = 0; #ifdef ISSUE_1796_replace_shl_o QVal = shl_sat( 1, sub( 15, bits ) ); #else QVal = shl_o( 1, sub( 15, bits ), &Overflow ); #endif #endif BASOP_SATURATE_WARNING_ON_EVS mu = shr( Preemph_factor, bits ); /* Q15 --> Q(15-bits) */ Loading @@ -115,7 +126,11 @@ void Preemph_scaled( /* Equivalent to tmp = max((abs(x[i] - mu*x[i-1]),tmp) * finds the max of preemphasized signal */ L_tmp = L_mult( new_speech[i], QVal ); #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, new_speech[i - 1], mu ); //??sat #else L_tmp = L_msu_o( L_tmp, new_speech[i - 1], mu, &Overflow ); #endif L_tmp = L_abs( L_tmp ); L_maxloc = L_max( L_tmp, L_maxloc ); } Loading Loading @@ -165,7 +180,11 @@ void Preemph_scaled( FOR( i = sub( Lframe, 1 ); i > 0; i-- ) { L_tmp = L_mult( new_speech[i], QVal ); #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, new_speech[i - 1], mu ); //??sat #else L_tmp = L_msu_o( L_tmp, new_speech[i - 1], mu, &Overflow ); #endif L_tmp = L_shl( L_tmp, *Q_new ); new_speech[i] = round_fx_sat( L_tmp ); // Q_new } Loading Loading @@ -198,8 +217,10 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled { Word16 i; Word32 e_min_scaled; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif e_min_scaled = L_shr_r( L_add( L_shr( E_MIN_FXQ15, sub( 14, add( *Q_new, QSCALE ) ) ), 1 ), 1 ); Loading Loading @@ -229,12 +250,21 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled /* Do scaling and valide minimum energy value */ FOR( i = 0; i < NB_BANDS; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc enrO[i] = L_max( L_shl_sat( enrO[i], Q_exp ), e_min_scaled ); //??sat bckr[i] = L_max( L_shl_sat( bckr[i], Q_exp ), e_min_scaled ); //??sat ave_enr[i] = L_max( L_shl_sat( ave_enr[i], Q_exp ), e_min_scaled ); //??sat ave_enr2[i] = L_max( L_shl_sat( ave_enr2[i], Q_exp ), e_min_scaled ); //??sat st_fr_bands1[i] = L_max( L_shl_sat( st_fr_bands1[i], Q_exp ), e_min_scaled ); //??sat st_fr_bands2[i] = L_max( L_shl_sat( st_fr_bands2[i], Q_exp ), e_min_scaled ); //??sat #else enrO[i] = L_max( L_shl_o( enrO[i], Q_exp, &Overflow ), e_min_scaled ); bckr[i] = L_max( L_shl_o( bckr[i], Q_exp, &Overflow ), e_min_scaled ); ave_enr[i] = L_max( L_shl_o( ave_enr[i], Q_exp, &Overflow ), e_min_scaled ); ave_enr2[i] = L_max( L_shl_o( ave_enr2[i], Q_exp, &Overflow ), e_min_scaled ); st_fr_bands1[i] = L_max( L_shl_o( st_fr_bands1[i], Q_exp, &Overflow ), e_min_scaled ); st_fr_bands2[i] = L_max( L_shl_o( st_fr_bands2[i], Q_exp, &Overflow ), e_min_scaled ); #endif move32(); move32(); move32(); Loading lib_enc/set_impulse_fx.c +39 −11 Original line number Diff line number Diff line Loading @@ -65,9 +65,11 @@ void set_impulse_fx( Word16 krit_fx, krit_max_fx, gain16; Word32 Lrr, Ldd, Ltmp, Ltmp1; const Word16 *pt_Glt; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif krit_max_fx = -32768; move16(); Loading Loading @@ -119,12 +121,21 @@ void set_impulse_fx( /* nominator & DEnominator row <0> */ FOR( i = 0; i < L_SUBFR; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[i], gh_fx[i] ); // Q27 //??sat Ldd = L_mac_sat( Ldd, gh_fx[i], xn_fx[i] ); // Q27 //??sat #else Lrr = L_mac_o( Lrr, gh_fx[i], gh_fx[i], &Overflow ); // Q27 Ldd = L_mac_o( Ldd, gh_fx[i], xn_fx[i], &Overflow ); // Q27 #endif } rr_fx[start1] = Lrr; move32(); #ifdef ISSUE_1867_replace_overflow_libenc dd_fx[start1] = round_fx_sat( Ldd ); // Q11 //??sat #else dd_fx[start1] = round_fx_o( Ldd, &Overflow ); // Q11 #endif rr_fx[start1] = L_max( rr_fx[start1], 1 ); FOR( i = add( start1, 1 ); i < L_IMPULSE2; i++ ) Loading @@ -138,14 +149,24 @@ void set_impulse_fx( gh_fx[j] = mac_r( L_deposit_h( gh_fx[j - 1] ), Glottal_cdbk_fx[m * L_IMPULSE + L_IMPULSE2 - i], h_orig_fx[j] ); // Q13 move16(); #ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[j], gh_fx[j] ); // Q27 //??sat Ldd = L_mac_sat( Ldd, gh_fx[j], xn_fx[j] ); // Q27 //??sat #else Lrr = L_mac_o( Lrr, gh_fx[j], gh_fx[j], &Overflow ); // Q27 Ldd = L_mac_o( Ldd, gh_fx[j], xn_fx[j], &Overflow ); // Q27 #endif } gh_fx[0] = mult_r( Glottal_cdbk_fx[m * L_IMPULSE + L_IMPULSE2 - i], h_orig_fx[0] ); // Q13 move16(); #ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[0], gh_fx[0] ); // Q27 //??sat Ldd = L_mac_sat( Ldd, gh_fx[0], xn_fx[0] ); // Q27 //??sat #else Lrr = L_mac_o( Lrr, gh_fx[0], gh_fx[0], &Overflow ); // Q27 Ldd = L_mac_o( Ldd, gh_fx[0], xn_fx[0], &Overflow ); // Q27 #endif dd_fx[i] = round_fx_sat( Ldd ); // Q11 rr_fx[i] = L_max( Lrr, 1 ); move32(); Loading Loading @@ -179,8 +200,11 @@ void set_impulse_fx( FOR( i = L_SUBFR - 2; i >= start2; i-- ) { /*rr[i] = rr[i+1] + gh[L_SUBFR+L_IMPULSE2-1-i]*gh[L_SUBFR+L_IMPULSE2-1-i];*/ rr_fx[i] = L_mac_o( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], &Overflow ); // Q27 #ifdef ISSUE_1867_replace_overflow_libenc rr_fx[i] = L_mac_sat( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i] ); // Q27 //??sat #else rr_fx[i] = L_mac_o( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], &Overflow ); // Q27 #endif move32(); } /* nominator rows <L_IMPULSE2,L_SUBFR-1> */ Loading @@ -202,7 +226,11 @@ void set_impulse_fx( num = div_s( num, den ); krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ #ifdef ISSUE_1867_replace_overflow_libenc krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ //??sat #else krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ #endif IF( GT_16( krit_fx, krit_max_fx ) ) { Loading lib_enc/speech_music_classif_fx.c +70 −4 Original line number Diff line number Diff line Loading @@ -662,9 +662,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis Word16 tmp1, tmp2, exp2, scale, exp3; SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas; HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif /*------------------------------------------------------------------* Loading Loading @@ -794,10 +796,18 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis sum_PS = L_deposit_l( 0 ); FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc sum_PS = L_add_sat( sum_PS, PS[i] ); //??sat #else sum_PS = L_add_o( sum_PS, PS[i], &Overflow ); #endif } exp1 = norm_l( sum_PS ); #ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl( sum_PS, exp1 ) ); //??sat #else tmp1 = round_fx_o( L_shl( sum_PS, exp1 ), &Overflow ); #endif exp1 = sub( 30, exp1 ); FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) Loading @@ -805,7 +815,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /*PS_norm[i] = PS[i] / sum_PS;*/ /*dPS[i] = (float)fabs(PS_norm[i] - st->past_PS[i]);*/ exp2 = norm_l( PS[i] ); #ifdef ISSUE_1867_replace_overflow_libenc tmp2 = round_fx_sat( L_shl( PS[i], exp2 ) ); //??sat #else tmp2 = round_fx_o( L_shl( PS[i], exp2 ), &Overflow ); #endif exp2 = sub( 30, exp2 ); scale = shr( sub( tmp1, tmp2 ), 15 ); Loading Loading @@ -866,7 +880,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis ELSE { exp1 = norm_l( L_add( dPS[i], 336 ) ); #ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl_sat( L_add( dPS[i], 336 ), exp1 ) ); //??sat //??sat #else tmp1 = round_fx_o( L_shl_o( L_add( dPS[i], 336 ), exp1, &Overflow ), &Overflow ); #endif exp1 = sub( 30, exp1 ); exp2 = norm_l( mx ); Loading Loading @@ -923,7 +941,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = 0; i < N_FEATURES; i++ ) { /**pFV = pSF[0] * *pFV + pSF[1];*/ #ifdef ISSUE_1867_replace_overflow_libenc *pFV = round_fx_sat( L_shl_sat( L_mac( pSF_a[i], *pFV, pSF_m[i] ), ishift[i] ) ); //??sat //??sat #else *pFV = round_fx_o( L_shl_o( L_mac( pSF_a[i], *pFV, pSF_m[i] ), ishift[i], &Overflow ), &Overflow ); #endif move16(); pFV++; } Loading Loading @@ -954,7 +976,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /* xm[p] = FV[p] - m_speech[k*N_FEATURES+p];*/ #ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_speech_fx[k * N_FEATURES + p] ); //??sat #else xm[p] = sub_o( FV[p], m_speech_fx[k * N_FEATURES + p], &Overflow ); #endif move16(); /*Q15 */ } Loading @@ -970,7 +996,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /*xm[p] = FV[p] - m_noise[k*N_FEATURES+p];*/ #ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_noise_fx[k * N_FEATURES + p] ); //??sat #else xm[p] = sub_o( FV[p], m_noise_fx[k * N_FEATURES + p], &Overflow ); #endif move16(); /*Q15 */ } Loading @@ -985,7 +1015,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /*xm[p] = FV[p] - m_music[k*N_FEATURES+p];*/ #ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_music_fx[k * N_FEATURES + p] ); //??sat #else xm[p] = sub_o( FV[p], m_music_fx[k * N_FEATURES + p], &Overflow ); #endif move16(); /*Q15 */ } Loading @@ -999,7 +1033,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /* calculate log-probability */ /*log(0.0001)-0.5f * N_FEATURES * LOG_PI2 in Q9 */ #ifdef ISSUE_1867_replace_overflow_libenc lps = extract_h( L_shl_sat( L_sub( max_s, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ //??sat #else lps = extract_h( L_shl_o( L_sub( max_s, LOG_PROB_CONST ), 16 - 1, &Overflow ) ); /*Q9 */ #endif lps = s_max( lps, -10832 ); lpm = extract_h( L_shl( L_sub( max_m, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ Loading @@ -1007,7 +1045,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /* lpn = (float)log(pyn) - 0.5f * N_FEATURES * (float)log(2*PI); */ #ifdef ISSUE_1867_replace_overflow_libenc lpn = extract_h( L_shl_sat( L_sub( max_n, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ //??sat #else lpn = extract_h( L_shl_o( L_sub( max_n, LOG_PROB_CONST ), 16 - 1, &Overflow ) ); /*Q9 */ #endif lpn = s_max( lpn, -10832 ); *high_lpn_flag_ptr = 0; Loading Loading @@ -1459,9 +1501,11 @@ static Word16 attack_det_fx( /* o : attack flag Word16 i, j, tmp, tmp1, attack, exp1; Word32 L_tmp, etmp, etmp2, finc[ATT_NSEG]; Word16 att_3lsub_pos; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif att_3lsub_pos = ATT_3LSUB_POS; Loading @@ -1479,7 +1523,11 @@ static Word16 attack_det_fx( /* o : attack flag FOR( j = 1; j < ATT_SEG_LEN; j++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j] ); /*2*Qx */ //??sat #else L_tmp = L_mac0_o( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j], &Overflow ); /*2*Qx */ #endif } finc[i] = L_tmp; Loading @@ -1504,7 +1552,11 @@ static Word16 attack_det_fx( /* o : attack flag FOR( i = 1; i < att_3lsub_pos; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, L_shr_sat( finc[i], Qx ) ); /*Qx */ //??sat //??sat #else L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i], Qx ), &Overflow ); /*Qx */ #endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ Loading @@ -1516,7 +1568,11 @@ static Word16 attack_det_fx( /* o : attack flag L_tmp = L_shr_sat( finc[attack], Qx ); /*Qx */ FOR( i = 1; i < tmp1; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, L_shr_sat( finc[i + attack], Qx ) ); /*Qx */ //??sat //??sat #else L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i + attack], Qx ), &Overflow ); /*Qx */ #endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp2 = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ Loading Loading @@ -2615,9 +2671,11 @@ static Word16 attack_det_ivas_fx( /* o : attack flag Word64 W_tmp; Word16 q_diff; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif att_3lsub_pos = ATT_3LSUB_POS; Loading @@ -2635,7 +2693,11 @@ static Word16 attack_det_ivas_fx( /* o : attack flag FOR( j = 1; j < ATT_SEG_LEN; j++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j] ); /*2*Qx */ //??sat #else L_tmp = L_mac0_o( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j], &Overflow ); /*2*Qx */ #endif } finc[i] = L_tmp; Loading Loading @@ -3762,7 +3824,11 @@ static void spec_analysis_fx( test(); IF( GT_16( peak_idx[k], valey_idx[i] ) && LT_16( peak_idx[k], valey_idx[i + 1] ) ) { #ifdef ISSUE_1796_replace_shl_o p2v[k] = sub_o( shl_sat( peak[k], 1 ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); #else p2v[k] = sub_o( shl_o( peak[k], 1, &Overflow ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); #endif move16(); k = add( k, 1 ); } Loading lib_enc/stat_noise_uv_enc_fx.c +26 −6 Original line number Diff line number Diff line Loading @@ -50,9 +50,11 @@ void stat_noise_uv_enc_fx( Word16 noisiness = 0; move16(); Word16 num, den, expn, expd; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif test(); test(); Loading @@ -65,9 +67,17 @@ void stat_noise_uv_enc_fx( *-----------------------------------------------------------------*/ /* epsP[2] is located in LepsP[0] and epsP[16] in LepsP[1] */ expn = sub( norm_l( LepsP[0] ), 1 ); #ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( LepsP[0], expn ) ); /*expn-16*/ #else num = extract_h( L_shl_o( LepsP[0], expn, &Overflow ) ); /*expn-16*/ #endif expd = norm_l( LepsP[1] ); #ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ #else den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ #endif num = div_s( num, den ); /*expn-expd+15*/ num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ num = sub( num, 1024 ); /*num - 1*/ Loading Loading @@ -123,9 +133,11 @@ void stat_noise_uv_enc_ivas_fx( Word16 noisiness = 0; move16(); Word16 num, den, expn, expd; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif test(); test(); Loading @@ -138,9 +150,17 @@ void stat_noise_uv_enc_ivas_fx( *-----------------------------------------------------------------*/ /* epsP[2] is located in LepsP[0] and epsP[16] in LepsP[1] */ expn = sub( norm_l( LepsP[0] ), 1 ); #ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( LepsP[0], expn ) ); /*expn-16*/ #else num = extract_h( L_shl_o( LepsP[0], expn, &Overflow ) ); /*expn-16*/ #endif expd = norm_l( LepsP[1] ); #ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ #else den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ #endif num = div_s( num, den ); /*expn-expd+15*/ num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ num = sub( num, 1024 ); /*num - 1*/ Loading lib_enc/swb_bwe_enc_fx.c +155 −11 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
lib_enc/scale_enc_fx.c +30 −0 Original line number Diff line number Diff line Loading @@ -86,9 +86,11 @@ void Preemph_scaled( Word16 mu, shift, QVal; Word32 L_tmp, L_maxloc; Word16 Q_min; #if !defined( ISSUE_1867_replace_overflow_libenc ) && !defined( ISSUE_1796_replace_shl_o ) #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /*---------------------------------------------------------------* Loading @@ -97,8 +99,17 @@ void Preemph_scaled( *---------------------------------------------------------------*/ BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1867_replace_overflow_libenc QVal = shl_sat( 1, sub( 15, bits ) ); //?sat #else Overflow = 0; #ifdef ISSUE_1796_replace_shl_o QVal = shl_sat( 1, sub( 15, bits ) ); #else QVal = shl_o( 1, sub( 15, bits ), &Overflow ); #endif #endif BASOP_SATURATE_WARNING_ON_EVS mu = shr( Preemph_factor, bits ); /* Q15 --> Q(15-bits) */ Loading @@ -115,7 +126,11 @@ void Preemph_scaled( /* Equivalent to tmp = max((abs(x[i] - mu*x[i-1]),tmp) * finds the max of preemphasized signal */ L_tmp = L_mult( new_speech[i], QVal ); #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, new_speech[i - 1], mu ); //??sat #else L_tmp = L_msu_o( L_tmp, new_speech[i - 1], mu, &Overflow ); #endif L_tmp = L_abs( L_tmp ); L_maxloc = L_max( L_tmp, L_maxloc ); } Loading Loading @@ -165,7 +180,11 @@ void Preemph_scaled( FOR( i = sub( Lframe, 1 ); i > 0; i-- ) { L_tmp = L_mult( new_speech[i], QVal ); #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_msu_sat( L_tmp, new_speech[i - 1], mu ); //??sat #else L_tmp = L_msu_o( L_tmp, new_speech[i - 1], mu, &Overflow ); #endif L_tmp = L_shl( L_tmp, *Q_new ); new_speech[i] = round_fx_sat( L_tmp ); // Q_new } Loading Loading @@ -198,8 +217,10 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled { Word16 i; Word32 e_min_scaled; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif e_min_scaled = L_shr_r( L_add( L_shr( E_MIN_FXQ15, sub( 14, add( *Q_new, QSCALE ) ) ), 1 ), 1 ); Loading Loading @@ -229,12 +250,21 @@ Word32 Scale_mem_pre_proc( /* o : Min energy scaled /* Do scaling and valide minimum energy value */ FOR( i = 0; i < NB_BANDS; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc enrO[i] = L_max( L_shl_sat( enrO[i], Q_exp ), e_min_scaled ); //??sat bckr[i] = L_max( L_shl_sat( bckr[i], Q_exp ), e_min_scaled ); //??sat ave_enr[i] = L_max( L_shl_sat( ave_enr[i], Q_exp ), e_min_scaled ); //??sat ave_enr2[i] = L_max( L_shl_sat( ave_enr2[i], Q_exp ), e_min_scaled ); //??sat st_fr_bands1[i] = L_max( L_shl_sat( st_fr_bands1[i], Q_exp ), e_min_scaled ); //??sat st_fr_bands2[i] = L_max( L_shl_sat( st_fr_bands2[i], Q_exp ), e_min_scaled ); //??sat #else enrO[i] = L_max( L_shl_o( enrO[i], Q_exp, &Overflow ), e_min_scaled ); bckr[i] = L_max( L_shl_o( bckr[i], Q_exp, &Overflow ), e_min_scaled ); ave_enr[i] = L_max( L_shl_o( ave_enr[i], Q_exp, &Overflow ), e_min_scaled ); ave_enr2[i] = L_max( L_shl_o( ave_enr2[i], Q_exp, &Overflow ), e_min_scaled ); st_fr_bands1[i] = L_max( L_shl_o( st_fr_bands1[i], Q_exp, &Overflow ), e_min_scaled ); st_fr_bands2[i] = L_max( L_shl_o( st_fr_bands2[i], Q_exp, &Overflow ), e_min_scaled ); #endif move32(); move32(); move32(); Loading
lib_enc/set_impulse_fx.c +39 −11 Original line number Diff line number Diff line Loading @@ -65,9 +65,11 @@ void set_impulse_fx( Word16 krit_fx, krit_max_fx, gain16; Word32 Lrr, Ldd, Ltmp, Ltmp1; const Word16 *pt_Glt; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif krit_max_fx = -32768; move16(); Loading Loading @@ -119,12 +121,21 @@ void set_impulse_fx( /* nominator & DEnominator row <0> */ FOR( i = 0; i < L_SUBFR; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[i], gh_fx[i] ); // Q27 //??sat Ldd = L_mac_sat( Ldd, gh_fx[i], xn_fx[i] ); // Q27 //??sat #else Lrr = L_mac_o( Lrr, gh_fx[i], gh_fx[i], &Overflow ); // Q27 Ldd = L_mac_o( Ldd, gh_fx[i], xn_fx[i], &Overflow ); // Q27 #endif } rr_fx[start1] = Lrr; move32(); #ifdef ISSUE_1867_replace_overflow_libenc dd_fx[start1] = round_fx_sat( Ldd ); // Q11 //??sat #else dd_fx[start1] = round_fx_o( Ldd, &Overflow ); // Q11 #endif rr_fx[start1] = L_max( rr_fx[start1], 1 ); FOR( i = add( start1, 1 ); i < L_IMPULSE2; i++ ) Loading @@ -138,14 +149,24 @@ void set_impulse_fx( gh_fx[j] = mac_r( L_deposit_h( gh_fx[j - 1] ), Glottal_cdbk_fx[m * L_IMPULSE + L_IMPULSE2 - i], h_orig_fx[j] ); // Q13 move16(); #ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[j], gh_fx[j] ); // Q27 //??sat Ldd = L_mac_sat( Ldd, gh_fx[j], xn_fx[j] ); // Q27 //??sat #else Lrr = L_mac_o( Lrr, gh_fx[j], gh_fx[j], &Overflow ); // Q27 Ldd = L_mac_o( Ldd, gh_fx[j], xn_fx[j], &Overflow ); // Q27 #endif } gh_fx[0] = mult_r( Glottal_cdbk_fx[m * L_IMPULSE + L_IMPULSE2 - i], h_orig_fx[0] ); // Q13 move16(); #ifdef ISSUE_1867_replace_overflow_libenc Lrr = L_mac_sat( Lrr, gh_fx[0], gh_fx[0] ); // Q27 //??sat Ldd = L_mac_sat( Ldd, gh_fx[0], xn_fx[0] ); // Q27 //??sat #else Lrr = L_mac_o( Lrr, gh_fx[0], gh_fx[0], &Overflow ); // Q27 Ldd = L_mac_o( Ldd, gh_fx[0], xn_fx[0], &Overflow ); // Q27 #endif dd_fx[i] = round_fx_sat( Ldd ); // Q11 rr_fx[i] = L_max( Lrr, 1 ); move32(); Loading Loading @@ -179,8 +200,11 @@ void set_impulse_fx( FOR( i = L_SUBFR - 2; i >= start2; i-- ) { /*rr[i] = rr[i+1] + gh[L_SUBFR+L_IMPULSE2-1-i]*gh[L_SUBFR+L_IMPULSE2-1-i];*/ rr_fx[i] = L_mac_o( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], &Overflow ); // Q27 #ifdef ISSUE_1867_replace_overflow_libenc rr_fx[i] = L_mac_sat( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i] ); // Q27 //??sat #else rr_fx[i] = L_mac_o( rr_fx[i + 1], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], gh_fx[L_SUBFR + L_IMPULSE2 - 1 - i], &Overflow ); // Q27 #endif move32(); } /* nominator rows <L_IMPULSE2,L_SUBFR-1> */ Loading @@ -202,7 +226,11 @@ void set_impulse_fx( num = div_s( num, den ); krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ #ifdef ISSUE_1867_replace_overflow_libenc krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ //??sat #else krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ #endif IF( GT_16( krit_fx, krit_max_fx ) ) { Loading
lib_enc/speech_music_classif_fx.c +70 −4 Original line number Diff line number Diff line Loading @@ -662,9 +662,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis Word16 tmp1, tmp2, exp2, scale, exp3; SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas; HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif /*------------------------------------------------------------------* Loading Loading @@ -794,10 +796,18 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis sum_PS = L_deposit_l( 0 ); FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc sum_PS = L_add_sat( sum_PS, PS[i] ); //??sat #else sum_PS = L_add_o( sum_PS, PS[i], &Overflow ); #endif } exp1 = norm_l( sum_PS ); #ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl( sum_PS, exp1 ) ); //??sat #else tmp1 = round_fx_o( L_shl( sum_PS, exp1 ), &Overflow ); #endif exp1 = sub( 30, exp1 ); FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) Loading @@ -805,7 +815,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /*PS_norm[i] = PS[i] / sum_PS;*/ /*dPS[i] = (float)fabs(PS_norm[i] - st->past_PS[i]);*/ exp2 = norm_l( PS[i] ); #ifdef ISSUE_1867_replace_overflow_libenc tmp2 = round_fx_sat( L_shl( PS[i], exp2 ) ); //??sat #else tmp2 = round_fx_o( L_shl( PS[i], exp2 ), &Overflow ); #endif exp2 = sub( 30, exp2 ); scale = shr( sub( tmp1, tmp2 ), 15 ); Loading Loading @@ -866,7 +880,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis ELSE { exp1 = norm_l( L_add( dPS[i], 336 ) ); #ifdef ISSUE_1867_replace_overflow_libenc tmp1 = round_fx_sat( L_shl_sat( L_add( dPS[i], 336 ), exp1 ) ); //??sat //??sat #else tmp1 = round_fx_o( L_shl_o( L_add( dPS[i], 336 ), exp1, &Overflow ), &Overflow ); #endif exp1 = sub( 30, exp1 ); exp2 = norm_l( mx ); Loading Loading @@ -923,7 +941,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = 0; i < N_FEATURES; i++ ) { /**pFV = pSF[0] * *pFV + pSF[1];*/ #ifdef ISSUE_1867_replace_overflow_libenc *pFV = round_fx_sat( L_shl_sat( L_mac( pSF_a[i], *pFV, pSF_m[i] ), ishift[i] ) ); //??sat //??sat #else *pFV = round_fx_o( L_shl_o( L_mac( pSF_a[i], *pFV, pSF_m[i] ), ishift[i], &Overflow ), &Overflow ); #endif move16(); pFV++; } Loading Loading @@ -954,7 +976,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /* xm[p] = FV[p] - m_speech[k*N_FEATURES+p];*/ #ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_speech_fx[k * N_FEATURES + p] ); //??sat #else xm[p] = sub_o( FV[p], m_speech_fx[k * N_FEATURES + p], &Overflow ); #endif move16(); /*Q15 */ } Loading @@ -970,7 +996,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /*xm[p] = FV[p] - m_noise[k*N_FEATURES+p];*/ #ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_noise_fx[k * N_FEATURES + p] ); //??sat #else xm[p] = sub_o( FV[p], m_noise_fx[k * N_FEATURES + p], &Overflow ); #endif move16(); /*Q15 */ } Loading @@ -985,7 +1015,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( p = 0; p < N_FEATURES; p++ ) { /*xm[p] = FV[p] - m_music[k*N_FEATURES+p];*/ #ifdef ISSUE_1867_replace_overflow_libenc xm[p] = sub_sat( FV[p], m_music_fx[k * N_FEATURES + p] ); //??sat #else xm[p] = sub_o( FV[p], m_music_fx[k * N_FEATURES + p], &Overflow ); #endif move16(); /*Q15 */ } Loading @@ -999,7 +1033,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /* calculate log-probability */ /*log(0.0001)-0.5f * N_FEATURES * LOG_PI2 in Q9 */ #ifdef ISSUE_1867_replace_overflow_libenc lps = extract_h( L_shl_sat( L_sub( max_s, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ //??sat #else lps = extract_h( L_shl_o( L_sub( max_s, LOG_PROB_CONST ), 16 - 1, &Overflow ) ); /*Q9 */ #endif lps = s_max( lps, -10832 ); lpm = extract_h( L_shl( L_sub( max_m, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ Loading @@ -1007,7 +1045,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis /* lpn = (float)log(pyn) - 0.5f * N_FEATURES * (float)log(2*PI); */ #ifdef ISSUE_1867_replace_overflow_libenc lpn = extract_h( L_shl_sat( L_sub( max_n, LOG_PROB_CONST ), 16 - 1 ) ); /*Q9 */ //??sat #else lpn = extract_h( L_shl_o( L_sub( max_n, LOG_PROB_CONST ), 16 - 1, &Overflow ) ); /*Q9 */ #endif lpn = s_max( lpn, -10832 ); *high_lpn_flag_ptr = 0; Loading Loading @@ -1459,9 +1501,11 @@ static Word16 attack_det_fx( /* o : attack flag Word16 i, j, tmp, tmp1, attack, exp1; Word32 L_tmp, etmp, etmp2, finc[ATT_NSEG]; Word16 att_3lsub_pos; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif att_3lsub_pos = ATT_3LSUB_POS; Loading @@ -1479,7 +1523,11 @@ static Word16 attack_det_fx( /* o : attack flag FOR( j = 1; j < ATT_SEG_LEN; j++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j] ); /*2*Qx */ //??sat #else L_tmp = L_mac0_o( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j], &Overflow ); /*2*Qx */ #endif } finc[i] = L_tmp; Loading @@ -1504,7 +1552,11 @@ static Word16 attack_det_fx( /* o : attack flag FOR( i = 1; i < att_3lsub_pos; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, L_shr_sat( finc[i], Qx ) ); /*Qx */ //??sat //??sat #else L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i], Qx ), &Overflow ); /*Qx */ #endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ Loading @@ -1516,7 +1568,11 @@ static Word16 attack_det_fx( /* o : attack flag L_tmp = L_shr_sat( finc[attack], Qx ); /*Qx */ FOR( i = 1; i < tmp1; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_add_sat( L_tmp, L_shr_sat( finc[i + attack], Qx ) ); /*Qx */ //??sat //??sat #else L_tmp = L_add_o( L_tmp, L_shr_sat( finc[i + attack], Qx ), &Overflow ); /*Qx */ #endif } L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(14-exp1+Qx) */ etmp2 = L_shl( L_tmp, sub( exp1, 14 ) ); /*Qx */ Loading Loading @@ -2615,9 +2671,11 @@ static Word16 attack_det_ivas_fx( /* o : attack flag Word64 W_tmp; Word16 q_diff; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif att_3lsub_pos = ATT_3LSUB_POS; Loading @@ -2635,7 +2693,11 @@ static Word16 attack_det_ivas_fx( /* o : attack flag FOR( j = 1; j < ATT_SEG_LEN; j++ ) { #ifdef ISSUE_1867_replace_overflow_libenc L_tmp = L_mac0_sat( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j] ); /*2*Qx */ //??sat #else L_tmp = L_mac0_o( L_tmp, inp[i * ATT_SEG_LEN + j], inp[i * ATT_SEG_LEN + j], &Overflow ); /*2*Qx */ #endif } finc[i] = L_tmp; Loading Loading @@ -3762,7 +3824,11 @@ static void spec_analysis_fx( test(); IF( GT_16( peak_idx[k], valey_idx[i] ) && LT_16( peak_idx[k], valey_idx[i + 1] ) ) { #ifdef ISSUE_1796_replace_shl_o p2v[k] = sub_o( shl_sat( peak[k], 1 ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); #else p2v[k] = sub_o( shl_o( peak[k], 1, &Overflow ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); #endif move16(); k = add( k, 1 ); } Loading
lib_enc/stat_noise_uv_enc_fx.c +26 −6 Original line number Diff line number Diff line Loading @@ -50,9 +50,11 @@ void stat_noise_uv_enc_fx( Word16 noisiness = 0; move16(); Word16 num, den, expn, expd; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif test(); test(); Loading @@ -65,9 +67,17 @@ void stat_noise_uv_enc_fx( *-----------------------------------------------------------------*/ /* epsP[2] is located in LepsP[0] and epsP[16] in LepsP[1] */ expn = sub( norm_l( LepsP[0] ), 1 ); #ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( LepsP[0], expn ) ); /*expn-16*/ #else num = extract_h( L_shl_o( LepsP[0], expn, &Overflow ) ); /*expn-16*/ #endif expd = norm_l( LepsP[1] ); #ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ #else den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ #endif num = div_s( num, den ); /*expn-expd+15*/ num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ num = sub( num, 1024 ); /*num - 1*/ Loading Loading @@ -123,9 +133,11 @@ void stat_noise_uv_enc_ivas_fx( Word16 noisiness = 0; move16(); Word16 num, den, expn, expd; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif test(); test(); Loading @@ -138,9 +150,17 @@ void stat_noise_uv_enc_ivas_fx( *-----------------------------------------------------------------*/ /* epsP[2] is located in LepsP[0] and epsP[16] in LepsP[1] */ expn = sub( norm_l( LepsP[0] ), 1 ); #ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( LepsP[0], expn ) ); /*expn-16*/ #else num = extract_h( L_shl_o( LepsP[0], expn, &Overflow ) ); /*expn-16*/ #endif expd = norm_l( LepsP[1] ); #ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( LepsP[1], expd ) ); /*expd-16*/ #else den = extract_h( L_shl_o( LepsP[1], expd, &Overflow ) ); /*expd-16*/ #endif num = div_s( num, den ); /*expn-expd+15*/ num = shr_sat( num, add( sub( expn, expd ), 5 ) ); /*Q10*/ num = sub( num, 1024 ); /*num - 1*/ Loading
lib_enc/swb_bwe_enc_fx.c +155 −11 File changed.Preview size limit exceeded, changes collapsed. Show changes