Loading lib_com/pvq_com_fx.c +12 −0 Original line number Diff line number Diff line Loading @@ -427,9 +427,11 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); Loading @@ -456,7 +458,11 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); #ifdef ISSUE_1836_replace_overflow_libcom QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat #else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ #endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ Loading Loading @@ -527,9 +533,11 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif FOR( band = 0; band < num_sfm; band++ ) Loading @@ -552,7 +560,11 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ #ifdef ISSUE_1836_replace_overflow_libcom gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat #else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); #endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); Loading lib_com/residu_fx.c +39 −3 Original line number Diff line number Diff line Loading @@ -62,9 +62,11 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif q = add( norm_s( a[0] ), 1 ); Loading @@ -72,11 +74,37 @@ void Residu3_lc_fx( { q = add( q, shift ); } #ifdef ISSUE_1796_replace_shl_o *y++ = shl_sat( x[0], shift ); #ifdef ISSUE_1836_replace_overflow_libcom *y++ = shl_sat( x[0], shift ); //??sat move16(); FOR( i = 1; i < m; i++ ) { s = L_mult_sat( x[i], a[0] ); //??sat /* Stop at i to Avoid Mults with Zeros */ FOR( j = 1; j <= i; j++ ) { s = L_mac_sat( s, x[i - j], a[j] ); //??sat } s = L_shl_sat( s, q ); //??sat *y++ = round_fx_sat( s ); //??sat } FOR( ; i < lg; i++ ) { s = L_mult_sat( x[i], a[0] ); //??sat FOR( j = 1; j <= m; j++ ) { s = L_mac_sat( s, x[i - j], a[j] ); //??sat } s = L_shl_sat( s, q ); //??sat *y++ = round_fx_sat( s ); //??sat } #else *y++ = shl_o( x[0], shift, &Overflow ); #endif move16(); FOR( i = 1; i < m; i++ ) Loading @@ -103,6 +131,8 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } #endif } /*--------------------------------------------------------------------* Loading Loading @@ -155,9 +185,11 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) Loading @@ -174,7 +206,11 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( s32 ); //??sat #else y[i] = round_fx_o( s32, &Overflow ); #endif move16(); } } Loading lib_com/stat_noise_uv_mod_fx.c +24 −8 Original line number Diff line number Diff line Loading @@ -74,9 +74,11 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /*---------------------------------------------------------* Loading Loading @@ -109,7 +111,11 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom min_alpha = add_sat( tmp_res, 16384 ); //??sat #else min_alpha = add_o( tmp_res, 16384, &Overflow ); #endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ Loading Loading @@ -161,8 +167,8 @@ void stat_noise_uv_mod_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1796_replace_shl_o exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif Loading Loading @@ -190,8 +196,8 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1796_replace_shl_o tmp_res = shl_sat( tmp_res, tmp_shift ); #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif Loading Loading @@ -258,7 +264,11 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat #else tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ #endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ Loading Loading @@ -392,9 +402,11 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /*---------------------------------------------------------* Loading Loading @@ -424,7 +436,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); #ifdef ISSUE_1836_replace_overflow_libcom min_alpha = add_sat( tmp_res, 16384 ); //??sat #else min_alpha = add_o( tmp_res, 16384, &Overflow ); #endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); Loading Loading @@ -475,8 +491,8 @@ void stat_noise_uv_mod_ivas_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1796_replace_shl_o exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif Loading Loading @@ -504,8 +520,8 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1796_replace_shl_o tmp_res = shl_sat( tmp_res, tmp_shift ); #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif Loading lib_com/swb_bwe_com_fx.c +9 −0 Original line number Diff line number Diff line Loading @@ -623,12 +623,21 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } #ifdef ISSUE_1836_replace_overflow_libcom L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat #else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); #endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat #else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); #endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ Loading lib_com/swb_bwe_com_lr_fx.c +33 −6 Original line number Diff line number Diff line Loading @@ -927,9 +927,11 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif *Qss = 10; Loading Loading @@ -986,7 +988,11 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); #ifdef ISSUE_1836_replace_overflow_libcom max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat #else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ #endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; Loading @@ -1010,6 +1016,18 @@ void SpectrumSmoothing_fx( } ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) { #ifdef ISSUE_1836_replace_overflow_libcom IF( L_inBuf_pss[j] >= 0 ) { outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat move32(); } ELSE { outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat move16(); } #else IF( L_inBuf_pss[j] >= 0 ) { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); Loading @@ -1020,6 +1038,7 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); move16(); } #endif } ELSE { Loading Loading @@ -2225,9 +2244,11 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif *QbeL = 3; Loading Loading @@ -2338,7 +2359,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1836_replace_overflow_libcom //??sat E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); Loading Loading @@ -2380,13 +2401,19 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ #ifdef ISSUE_1836_replace_overflow_libcom IF ( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat #else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) #endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } #ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); #endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ Loading Loading @@ -3213,7 +3240,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -3252,8 +3279,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); #ifdef ISSUE_1796_replace_shl_o *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ #ifdef ISSUE_1836_replace_overflow_libcom *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif Loading Loading @@ -3326,8 +3353,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); #ifdef ISSUE_1796_replace_shl_o ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); #ifdef ISSUE_1836_replace_overflow_libcom ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif Loading Loading
lib_com/pvq_com_fx.c +12 −0 Original line number Diff line number Diff line Loading @@ -427,9 +427,11 @@ void NearOppSplitAdjustment_fx( Word16 qac, qboth, qskew, qavg, qmin, Midx; Word32 L_QIb, L_qnum; Word16 QIb, QIa; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif rangeCoderFinalizationFBits_fx( Qac, INTac, &qac ); Loading @@ -456,7 +458,11 @@ void NearOppSplitAdjustment_fx( } *qnear = qboth; /* Q3 */ move16(); #ifdef ISSUE_1836_replace_overflow_libcom QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/ //??sat #else QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/ #endif if ( LE_16( QIb, qboth ) ) { *qnear = QIb; /* Q0 */ Loading Loading @@ -527,9 +533,11 @@ void fine_gain_quant_fx( Word16 tmp1, tmp2, exp1, exp2; Word32 L_tmp; UWord16 lsb; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif FOR( band = 0; band < num_sfm; band++ ) Loading @@ -552,7 +560,11 @@ void fine_gain_quant_fx( tmp1 = sub( tmp1, exp1 ); L_tmp = L_Comp( tmp1, exp2 ); Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ #ifdef ISSUE_1836_replace_overflow_libcom gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) ); //??sat #else gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); #endif idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); Loading
lib_com/residu_fx.c +39 −3 Original line number Diff line number Diff line Loading @@ -62,9 +62,11 @@ void Residu3_lc_fx( Word16 i, j; Word32 s; Word16 q; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif q = add( norm_s( a[0] ), 1 ); Loading @@ -72,11 +74,37 @@ void Residu3_lc_fx( { q = add( q, shift ); } #ifdef ISSUE_1796_replace_shl_o *y++ = shl_sat( x[0], shift ); #ifdef ISSUE_1836_replace_overflow_libcom *y++ = shl_sat( x[0], shift ); //??sat move16(); FOR( i = 1; i < m; i++ ) { s = L_mult_sat( x[i], a[0] ); //??sat /* Stop at i to Avoid Mults with Zeros */ FOR( j = 1; j <= i; j++ ) { s = L_mac_sat( s, x[i - j], a[j] ); //??sat } s = L_shl_sat( s, q ); //??sat *y++ = round_fx_sat( s ); //??sat } FOR( ; i < lg; i++ ) { s = L_mult_sat( x[i], a[0] ); //??sat FOR( j = 1; j <= m; j++ ) { s = L_mac_sat( s, x[i - j], a[j] ); //??sat } s = L_shl_sat( s, q ); //??sat *y++ = round_fx_sat( s ); //??sat } #else *y++ = shl_o( x[0], shift, &Overflow ); #endif move16(); FOR( i = 1; i < m; i++ ) Loading @@ -103,6 +131,8 @@ void Residu3_lc_fx( s = L_shl_o( s, q, &Overflow ); *y++ = round_fx_o( s, &Overflow ); } #endif } /*--------------------------------------------------------------------* Loading Loading @@ -155,9 +185,11 @@ void Residu3_fx( Word64 s64; Word32 s32; Word16 q; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) Loading @@ -174,7 +206,11 @@ void Residu3_fx( } s64 = W_mac_16_16( s64, x[i - 16], a[16] ); s32 = W_shl_sat_l( s64, q ); #ifdef ISSUE_1836_replace_overflow_libcom y[i] = round_fx_sat( s32 ); //??sat #else y[i] = round_fx_o( s32, &Overflow ); #endif move16(); } } Loading
lib_com/stat_noise_uv_mod_fx.c +24 −8 Original line number Diff line number Diff line Loading @@ -74,9 +74,11 @@ void stat_noise_uv_mod_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /*---------------------------------------------------------* Loading Loading @@ -109,7 +111,11 @@ void stat_noise_uv_mod_fx( move16(); tmp_res = div_l( L_tmp_res, tmp_den ); move16(); #ifdef ISSUE_1836_replace_overflow_libcom min_alpha = add_sat( tmp_res, 16384 ); //??sat #else min_alpha = add_o( tmp_res, 16384, &Overflow ); #endif move16(); /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ Loading Loading @@ -161,8 +167,8 @@ void stat_noise_uv_mod_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1796_replace_shl_o exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif Loading Loading @@ -190,8 +196,8 @@ void stat_noise_uv_mod_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1796_replace_shl_o tmp_res = shl_sat( tmp_res, tmp_shift ); #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif Loading Loading @@ -258,7 +264,11 @@ void stat_noise_uv_mod_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */ //??sat #else tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ #endif Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ Loading Loading @@ -392,9 +402,11 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /*---------------------------------------------------------* Loading Loading @@ -424,7 +436,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_l( L_tmp_res, tmp_den ); #ifdef ISSUE_1836_replace_overflow_libcom min_alpha = add_sat( tmp_res, 16384 ); //??sat #else min_alpha = add_o( tmp_res, 16384, &Overflow ); #endif /**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/ min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) ); Loading Loading @@ -475,8 +491,8 @@ void stat_noise_uv_mod_ivas_fx( FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1796_replace_shl_o exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??sat #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif Loading Loading @@ -504,8 +520,8 @@ void stat_noise_uv_mod_ivas_fx( tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1796_replace_shl_o tmp_res = shl_sat( tmp_res, tmp_shift ); #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); //??sat #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif Loading
lib_com/swb_bwe_com_fx.c +9 −0 Original line number Diff line number Diff line Loading @@ -623,12 +623,21 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = L_add_o( L_ener_tot, L_ener, &Overflow ); } #ifdef ISSUE_1836_replace_overflow_libcom L_ener = L_deposit_l( abs_s( sub_sat( sp[1], sp[0] ) ) ); //??sat #else L_ener = L_deposit_l( abs_s( sub_o( sp[1], sp[0], &Overflow ) ) ); #endif FOR( i = 2; i < N; i++ ) { /* Eq to (sp[i] - sp[i-1]) * (sp[i-1] - sp[i-2]) < 0 */ #ifdef ISSUE_1836_replace_overflow_libcom tmp1 = sub_sat( sp[i], sp[i - 1] ); //??sat tmp2 = sub_sat( sp[i - 1], sp[i - 2] ); //??sat #else tmp1 = sub_o( sp[i], sp[i - 1], &Overflow ); tmp2 = sub_o( sp[i - 1], sp[i - 2], &Overflow ); #endif tmp2 = mult( tmp1, tmp2 ); tmp1 = abs_s( tmp1 ); /* to Get either 0 or -1 in 'tmp2' */ Loading
lib_com/swb_bwe_com_lr_fx.c +33 −6 Original line number Diff line number Diff line Loading @@ -927,9 +927,11 @@ void SpectrumSmoothing_fx( Word16 reset_flag; Word16 pp, pk; Word16 exp_norm; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif *Qss = 10; Loading Loading @@ -986,7 +988,11 @@ void SpectrumSmoothing_fx( IF( GT_32( L_max_val[i], 0x1L ) ) { exp_normd = norm_l( L_max_val[i] ); #ifdef ISSUE_1836_replace_overflow_libcom max_val_norm_fx = div_s( 0x2800, round_fx_sat( L_shl( L_max_val[i], exp_normd ) ) ); /* Q10-(Qs+exp_normd-16) */ //??sat #else max_val_norm_fx = div_s( 0x2800, round_fx_o( L_shl_o( L_max_val[i], exp_normd, &Overflow ), &Overflow ) ); /* Q10-(Qs+exp_normd-16) */ #endif Qmax_val_norm[i] = sub( 10 - 12 + 16 + 15, exp_normd ); move16(); /* 10 - (12+exp_normd-16) +15 */ ; Loading @@ -1010,6 +1016,18 @@ void SpectrumSmoothing_fx( } ELSE IF( LT_32( L_abs( L_inBuf_pss[j] ), L_max_val[i] ) ) { #ifdef ISSUE_1836_replace_overflow_libcom IF( L_inBuf_pss[j] >= 0 ) { outBuf_pss_fx[j] = round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl( L_inBuf_pss[j], exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ); //??sat //??sat move32(); } ELSE { outBuf_pss_fx[j] = negate( round_fx_sat( L_shl_sat( Mpy_32_16_r( L_shl_sat( L_abs( L_inBuf_pss[j] ), exp_norm ), max_val_norm_fx ), sub( exp_shift, exp_norm ) ) ) ); //??sat //??sat //??sat move16(); } #else IF( L_inBuf_pss[j] >= 0 ) { outBuf_pss_fx[j] = round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_inBuf_pss[j], exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ); Loading @@ -1020,6 +1038,7 @@ void SpectrumSmoothing_fx( outBuf_pss_fx[j] = negate( round_fx_o( L_shl_o( Mpy_32_16_r( L_shl_o( L_abs( L_inBuf_pss[j] ), exp_norm, &Overflow ), max_val_norm_fx ), sub( exp_shift, exp_norm ), &Overflow ), &Overflow ) ); move16(); } #endif } ELSE { Loading Loading @@ -2225,9 +2244,11 @@ void ton_ene_est_fx( Word16 temp2_fx, Qtemp2; Word16 temp_fx; #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif *QbeL = 3; Loading Loading @@ -2338,7 +2359,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1836_replace_overflow_libcom //??sat E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); #else E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); Loading Loading @@ -2380,13 +2401,19 @@ void ton_ene_est_fx( L_temp = Mult_32_16( L_temp, E_r_fx ); /* 0.12f: 257698038 (Q31) */ #ifdef ISSUE_1836_replace_overflow_libcom IF ( GE_32( L_shl_sat( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ) ), 257698038 ) ) //??sat #else if ( GE_32( L_shl_o( L_temp, sub( 31, add( add( shl( Qavg_pe[k], 1 ), QE_r ), 1 - 15 ) ), &Overflow ), 257698038 ) ) #endif { ni_gain_fx[k] = mult_r( 1638, ni_gain_fx[k] ); /* 0.05 : 1638(Q15) */ move16(); } #ifndef ISSUE_1836_replace_overflow_libcom Overflow = 0; move16(); #endif ni_gain_fx[k] = shl( ni_gain_fx[k], sub( Qni_gain, Qavg_pe[k] ) ); move16(); assert( Qni_gain == 8 ); /* 358 is '(short)(1.4*pow(2,Qni_gain))' */ Loading Loading @@ -3213,7 +3240,7 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1836_replace_overflow_libcom #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -3252,8 +3279,8 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); #ifdef ISSUE_1796_replace_shl_o *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ #ifdef ISSUE_1836_replace_overflow_libcom *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ //??sat #else *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ #endif Loading Loading @@ -3326,8 +3353,8 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); #ifdef ISSUE_1796_replace_shl_o ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); #ifdef ISSUE_1836_replace_overflow_libcom ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); //??sat #else ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); #endif Loading