Loading lib_enc/swb_bwe_enc_fx.c +144 −12 Original line number Diff line number Diff line Loading @@ -303,9 +303,11 @@ void swb_bwe_enc_ivas_fx( Word16 fb_ener_adjust_fx; Word16 ener_adjust_quan_fx = 0; move16(); #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif Word16 fb_band_begin; Word16 q_new_input_hp; Loading Loading @@ -408,7 +410,11 @@ void swb_bwe_enc_ivas_fx( *----------------------------------------------------------------------*/ /* tilt returned in Q24 goto to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_nb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3 ) ); //??sat //??sat #else tilt_nb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3, &Overflow ), &Overflow ); #endif /*---------------------------------------------------------------------* * SWB BWE encoding * FB BWE encoding Loading Loading @@ -543,7 +549,11 @@ void swb_bwe_enc_ivas_fx( L_tmp = L_shl( L_tmp, exp1 ); exp = sub( sub( 31, exp1 ), sub( 30, exp ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ #ifdef ISSUE_1867_replace_overflow_libenc fb_ener_adjust_fx = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else fb_ener_adjust_fx = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE { Loading Loading @@ -623,9 +633,11 @@ void swb_bwe_enc_fx( Word16 fb_ener_adjust_fx; Word16 ener_adjust_quan_fx = 0; move16(); #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Loading Loading @@ -683,7 +695,11 @@ void swb_bwe_enc_fx( *----------------------------------------------------------------------*/ /* tilt returned in Q24 goto to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_nb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3 ) ); //??sat //??sat #else tilt_nb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3, &Overflow ), &Overflow ); #endif /*---------------------------------------------------------------------* * SWB BWE encoding * FB BWE encoding Loading Loading @@ -806,7 +822,11 @@ void swb_bwe_enc_fx( // exp = 31 - exp1 - ( 30 - exp ); exp = add( 31 - 30, sub( exp, exp1 ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ #ifdef ISSUE_1867_replace_overflow_libenc fb_ener_adjust_fx = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else fb_ener_adjust_fx = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE { Loading Loading @@ -1007,9 +1027,11 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class Word16 sharplimit; Word16 numsharp, num, den; Word16 numharmonic, tmp, expn, expd, scale; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Loading Loading @@ -1046,16 +1068,28 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class { IF( hBWE_FD->prev_global_gain_fx == 0 ) { #ifdef ISSUE_1867_replace_overflow_libenc gain_tmp = round_fx_sat( L_shl_sat( fGain, 30 ) ); /*Q14 */ //??sat //??sat #else gain_tmp = round_fx_o( L_shl_o( fGain, 30, &Overflow ), &Overflow ); /*Q14 */ #endif } ELSE { expn = norm_l( fGain ); #ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( fGain, expn ) ); #else num = extract_h( L_shl_o( fGain, expn, &Overflow ) ); #endif expn = sub( sub( 30, expn ), shl( Q_shb, 1 ) ); expd = norm_l( hBWE_FD->prev_global_gain_fx ); #ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( hBWE_FD->prev_global_gain_fx, expd ) ); #else den = extract_h( L_shl_o( hBWE_FD->prev_global_gain_fx, expd, &Overflow ) ); #endif expd = sub( sub( 30, expd ), shl( st_fx->prev_Q_shb, 1 ) ); scale = shr( sub( den, num ), 15 ); Loading Loading @@ -1163,7 +1197,11 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class expd = norm_s( den ); tmp = div_s( shl( 1, sub( 14, expd ) ), den ); /*Q(29-expd-Q_syn) */ L_tmp = L_mult( tmp, peak ); /*Q(30-expd) */ #ifdef ISSUE_1867_replace_overflow_libenc sharp = round_fx_sat( L_shl_sat( L_tmp, sub( expd, 4 ) ) ); /*Q10 */ //??sat //??sat #else sharp = round_fx_o( L_shl_o( L_tmp, sub( expd, 4 ), &Overflow ), &Overflow ); /*Q10 */ #endif } ELSE { Loading Loading @@ -1363,9 +1401,11 @@ static void vqWithCand_w_fx( const Word16 *p_E_ROM_dico; Word16 dist, temp1; Word32 L_dist, L_tmp; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( flag ) { Loading @@ -1382,14 +1422,22 @@ static void vqWithCand_w_fx( FOR( i = 0; i < E_ROM_dico_size; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc dist = sub_sat( x[0], *p_E_ROM_dico++ ); /*Q8 */ //??sat #else dist = sub_o( x[0], *p_E_ROM_dico++, &Overflow ); /*Q8 */ #endif L_dist = L_mult( dist, w[0] ); /*Q22 */ L_dist = Mult_32_16( L_dist, dist ); /*Q15 */ L_dist = L_shr( L_dist, 10 ); /*Q5 */ FOR( j = 1; j < dim; j++ ) { #ifdef ISSUE_1867_replace_overflow_libenc temp1 = sub_sat( x[j], *p_E_ROM_dico++ ); //??sat #else temp1 = sub_o( x[j], *p_E_ROM_dico++, &Overflow ); #endif L_tmp = L_mult( temp1, w[j] ); /*Q22 */ L_tmp = Mult_32_16( L_tmp, temp1 ); /*Q15 */ L_dist = L_add( L_dist, L_shr( L_tmp, 10 ) ); /*Q5 */ Loading Loading @@ -1664,9 +1712,11 @@ static void msvq_interpol_fx( Word16 quant_select[SWB_FENV], w_env11[SWB_FENV / 2], w_env12[SWB_FENV / 2], tmp; Word32 L_tmp, distCand[N_CAND], L_dist, L_minDist; Word16 synth_energy[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* Extract target vector */ Loading Loading @@ -1707,13 +1757,21 @@ static void msvq_interpol_fx( /* Extract vector for odd position */ FOR( n_band = 0; n_band < DIM11; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc quant_tmp[n_band] = add_sat( quant_tmp1[n_band], quant_tmp2[n_band] ); //??sat #else quant_tmp[n_band] = add_o( quant_tmp1[n_band], quant_tmp2[n_band], &Overflow ); #endif move16(); } FOR( n_band = 0; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */ //??sat #else tmp = add_o( quant_tmp[n_band], quant_tmp[n_band + 1], &Overflow ); /*Q8 */ #endif tmp = shr( tmp, 1 ); quant_tmp2[n_band] = sub( env_temp12[n_band], tmp ); move16(); /*Q8 */ Loading @@ -1736,7 +1794,11 @@ static void msvq_interpol_fx( FOR( n_band = 0; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( quant_tmp[n_band], quant_tmp[n_band + 1] ); //??sat #else tmp = add_o( quant_tmp[n_band], quant_tmp[n_band + 1], &Overflow ); #endif tmp = shr( tmp, 1 ); quant_select[( n_band << 1 ) + 1] = add( tmp, quant_tmp2[n_band] ); move16(); /*Q8 */ Loading Loading @@ -1796,9 +1858,11 @@ static void msvq_interpol_2_fx( Word16 quant_select[SWB_FENV], w_env11[SWB_FENV / 2], w_env12[SWB_FENV / 2]; Word32 L_tmp, distCand[N_CAND], L_dist, L_minDist; Word16 synth_energy[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* Extract target vector */ FOR( n_band = 0; n_band < DIM11 - 1; n_band++ ) Loading Loading @@ -1856,9 +1920,17 @@ static void msvq_interpol_2_fx( move16(); FOR( n_band = 1; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp_q = add_sat( quant_tmp[n_band - 1], quant_tmp[n_band] ); //??sat #else tmp_q = add_o( quant_tmp[n_band - 1], quant_tmp[n_band], &Overflow ); #endif tmp_q = shr( tmp_q, 1 ); #ifdef ISSUE_1867_replace_overflow_libenc quant_tmp2[n_band] = sub_sat( env_temp12[n_band], tmp_q ); //??sat #else quant_tmp2[n_band] = sub_o( env_temp12[n_band], tmp_q, &Overflow ); #endif move16(); } Loading @@ -1879,9 +1951,17 @@ static void msvq_interpol_2_fx( move16(); /*Q8 */ FOR( n_band = 1; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp_q = add_sat( quant_tmp[n_band - 1], quant_tmp[n_band] ); //??sat #else tmp_q = add_o( quant_tmp[n_band - 1], quant_tmp[n_band], &Overflow ); #endif tmp_q = shr( tmp_q, 1 ); #ifdef ISSUE_1867_replace_overflow_libenc quant_select[( n_band << 1 ) - 1] = add_sat( quant_tmp2[n_band], tmp_q ); //??sat #else quant_select[( n_band << 1 ) - 1] = add_o( quant_tmp2[n_band], tmp_q, &Overflow ); #endif } L_dist = L_deposit_l( 0 ); Loading Loading @@ -1943,9 +2023,11 @@ static void calculate_Tonality_fx( Word16 org_spec[80], gen_spec[80]; Word32 L_log_gm_org, L_log_gm_gen; Word16 l_shift; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* to reduce dynamic range of original spectrum */ Loading Loading @@ -2051,7 +2133,11 @@ static void calculate_Tonality_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_org, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_org = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_org = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_org = s_max( 0, s_min( *SFM_org, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading @@ -2072,7 +2158,11 @@ static void calculate_Tonality_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_gen, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_gen = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_gen = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_gen = s_max( 0, s_min( *SFM_gen, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading Loading @@ -2101,9 +2191,11 @@ static void calculate_Tonality_ivas_fx( Word16 org_spec[80], gen_spec[80]; Word32 L_log_gm_org, L_log_gm_gen; Word16 l_shift; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* to reduce dynamic range of original spectrum */ Loading Loading @@ -2209,7 +2301,11 @@ static void calculate_Tonality_ivas_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_org, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_org = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_org = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_org = s_max( 0, s_min( *SFM_org, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading @@ -2230,7 +2326,11 @@ static void calculate_Tonality_ivas_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_gen, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_gen = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_gen = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_gen = s_max( 0, s_min( *SFM_gen, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading Loading @@ -2618,9 +2718,11 @@ static Word16 SWB_BWE_encoding_fx( Word16 SWB_tenv_tmp_fx[SWB_TENV]; Word16 max_fx; Word16 energy_factor_fx[SWB_FENV], w_env_fx[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Loading Loading @@ -2663,7 +2765,11 @@ static Word16 SWB_BWE_encoding_fx( } /* tilt returned in Q24 go to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3 ) ); //??sat //??sat #else tilt_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3, &Overflow ), &Overflow ); #endif test(); test(); IF( EQ_16( IsTransient, 1 ) && ( GT_16( tilt_fx, 16384 ) || GT_16( st_fx->clas, 1 ) ) ) Loading Loading @@ -2767,7 +2873,11 @@ static Word16 SWB_BWE_encoding_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &expn ); /*31-expn */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, sub( expn, 1 ) ) ); /*Q14 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, sub( expn, 1 ), &Overflow ), &Overflow ); /*Q14 */ #endif } ELSE { Loading @@ -2779,7 +2889,11 @@ static Word16 SWB_BWE_encoding_fx( { L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, 2 ) ); /*Q15 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, 2, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE IF( GT_16( Rat_tenv_fx, 16384 ) ) { Loading Loading @@ -3063,9 +3177,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( Word16 SWB_tenv_tmp_fx[SWB_TENV]; Word16 max_fx; Word16 energy_factor_fx[SWB_FENV], w_env_fx[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif Word16 inner_frame; Word16 q_shift; Loading Loading @@ -3126,7 +3242,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( } /* tilt returned in Q24 go to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3 ) ); //??sat //??sat #else tilt_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3, &Overflow ), &Overflow ); #endif test(); test(); IF( EQ_16( IsTransient, 1 ) && ( GT_16( tilt_fx, 16384 ) || GT_16( st_fx->clas, 1 ) ) ) Loading Loading @@ -3231,7 +3351,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( expn = sub( sub( 30, expn ), sub( shl( Q_insig_lp, 1 ), 7 ) ); expd = norm_l( WB_tenv_syn_fx ); #ifdef ISSUE_1867_replace_overflow_libenc den = round_fx_sat( L_shl( WB_tenv_syn_fx, expd ) ); //??sat #else den = round_fx_o( L_shl( WB_tenv_syn_fx, expd ), &Overflow ); #endif expd = sub( sub( 30, expd ), sub( shl( Q_insig_lp, 1 ), 7 ) ); scale = shr( sub( den, num ), 15 ); Loading @@ -3244,7 +3368,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &expn ); /*31-expn */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, sub( expn, 1 ) ) ); /*Q14 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, sub( expn, 1 ), &Overflow ), &Overflow ); /*Q14 */ #endif } ELSE { Loading @@ -3255,7 +3383,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( IF( LT_16( Rat_tenv_fx, 8192 ) ) { L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, 2 ) ); /*Q15 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, 2, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE IF( GT_16( Rat_tenv_fx, 16384 ) ) { Loading lib_enc/swb_bwe_enc_hr_fx.c +6 −0 Original line number Diff line number Diff line Loading @@ -117,9 +117,11 @@ void swb_bwe_enc_hr_fx( #else Word32 L_t_audio_tmp_fx[L_FRAME48k]; #endif #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; Loading Loading @@ -768,7 +770,11 @@ void swb_bwe_enc_hr_fx( { L_tmp = L_mult( temp, t_audio_fx[i] ); L_tmp = L_shr_sat( L_tmp, temp2 ); #ifdef ISSUE_1867_replace_overflow_libenc t_audio_fx[i] = round_fx_sat( L_tmp ); //??sat #else t_audio_fx[i] = round_fx_o( L_tmp, &Overflow ); #endif move16(); } Loading lib_enc/swb_bwe_enc_lr_fx.c +8 −1 Original line number Diff line number Diff line Loading @@ -698,9 +698,11 @@ static void gethar_noisegn_fx( Word16 temp_lo, temp_hi; Word16 Qg; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif /*Generate HF noise*/ genhf_noise_fx( noise_flr_fx, Qss, L_xSynth_har, QsL, sspectra_fx, bands, har_bands, har_freq_est2, pos_max_hfe2, pul_res_fx, pk_sf_fx, fLenLow, Loading Loading @@ -783,8 +785,13 @@ static void gethar_noisegn_fx( L_temp = L_Comp( exp, frac ); L_temp = Mpy_32_16_1( L_temp, 19728 ); /* log(2)/log(10)=.30102999566398119521 = 19728.3(Q16) Q(0+16+1)=Q17 */ #ifdef ISSUE_1867_replace_overflow_libenc L_temp = L_shl_sat( L_temp, 13 ); /* Q17+13=30 30-16=14 */ //??sat g_fx = round_fx_sat( L_temp ); //??sat #else L_temp = L_shl_o( L_temp, 13, &Overflow ); /* Q17+13=30 30-16=14 */ g_fx = round_fx_o( L_temp, &Overflow ); #endif } gqlevs_fx = 4; Loading lib_enc/swb_tbe_enc_fx.c +243 −77 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
lib_enc/swb_bwe_enc_fx.c +144 −12 Original line number Diff line number Diff line Loading @@ -303,9 +303,11 @@ void swb_bwe_enc_ivas_fx( Word16 fb_ener_adjust_fx; Word16 ener_adjust_quan_fx = 0; move16(); #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif Word16 fb_band_begin; Word16 q_new_input_hp; Loading Loading @@ -408,7 +410,11 @@ void swb_bwe_enc_ivas_fx( *----------------------------------------------------------------------*/ /* tilt returned in Q24 goto to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_nb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3 ) ); //??sat //??sat #else tilt_nb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3, &Overflow ), &Overflow ); #endif /*---------------------------------------------------------------------* * SWB BWE encoding * FB BWE encoding Loading Loading @@ -543,7 +549,11 @@ void swb_bwe_enc_ivas_fx( L_tmp = L_shl( L_tmp, exp1 ); exp = sub( sub( 31, exp1 ), sub( 30, exp ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ #ifdef ISSUE_1867_replace_overflow_libenc fb_ener_adjust_fx = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else fb_ener_adjust_fx = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE { Loading Loading @@ -623,9 +633,11 @@ void swb_bwe_enc_fx( Word16 fb_ener_adjust_fx; Word16 ener_adjust_quan_fx = 0; move16(); #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Loading Loading @@ -683,7 +695,11 @@ void swb_bwe_enc_fx( *----------------------------------------------------------------------*/ /* tilt returned in Q24 goto to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_nb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3 ) ); //??sat //??sat #else tilt_nb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_input_lp_fx, Q_slb_speech, st_fx->L_frame ), 3, &Overflow ), &Overflow ); #endif /*---------------------------------------------------------------------* * SWB BWE encoding * FB BWE encoding Loading Loading @@ -806,7 +822,11 @@ void swb_bwe_enc_fx( // exp = 31 - exp1 - ( 30 - exp ); exp = add( 31 - 30, sub( exp, exp1 ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31-exp */ #ifdef ISSUE_1867_replace_overflow_libenc fb_ener_adjust_fx = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ //??sat //??sat #else fb_ener_adjust_fx = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE { Loading Loading @@ -1007,9 +1027,11 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class Word16 sharplimit; Word16 numsharp, num, den; Word16 numharmonic, tmp, expn, expd, scale; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Loading Loading @@ -1046,16 +1068,28 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class { IF( hBWE_FD->prev_global_gain_fx == 0 ) { #ifdef ISSUE_1867_replace_overflow_libenc gain_tmp = round_fx_sat( L_shl_sat( fGain, 30 ) ); /*Q14 */ //??sat //??sat #else gain_tmp = round_fx_o( L_shl_o( fGain, 30, &Overflow ), &Overflow ); /*Q14 */ #endif } ELSE { expn = norm_l( fGain ); #ifdef ISSUE_1867_replace_overflow_libenc num = extract_h( L_shl( fGain, expn ) ); #else num = extract_h( L_shl_o( fGain, expn, &Overflow ) ); #endif expn = sub( sub( 30, expn ), shl( Q_shb, 1 ) ); expd = norm_l( hBWE_FD->prev_global_gain_fx ); #ifdef ISSUE_1867_replace_overflow_libenc den = extract_h( L_shl( hBWE_FD->prev_global_gain_fx, expd ) ); #else den = extract_h( L_shl_o( hBWE_FD->prev_global_gain_fx, expd, &Overflow ) ); #endif expd = sub( sub( 30, expd ), shl( st_fx->prev_Q_shb, 1 ) ); scale = shr( sub( den, num ), 15 ); Loading Loading @@ -1163,7 +1197,11 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class expd = norm_s( den ); tmp = div_s( shl( 1, sub( 14, expd ) ), den ); /*Q(29-expd-Q_syn) */ L_tmp = L_mult( tmp, peak ); /*Q(30-expd) */ #ifdef ISSUE_1867_replace_overflow_libenc sharp = round_fx_sat( L_shl_sat( L_tmp, sub( expd, 4 ) ) ); /*Q10 */ //??sat //??sat #else sharp = round_fx_o( L_shl_o( L_tmp, sub( expd, 4 ), &Overflow ), &Overflow ); /*Q10 */ #endif } ELSE { Loading Loading @@ -1363,9 +1401,11 @@ static void vqWithCand_w_fx( const Word16 *p_E_ROM_dico; Word16 dist, temp1; Word32 L_dist, L_tmp; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif IF( flag ) { Loading @@ -1382,14 +1422,22 @@ static void vqWithCand_w_fx( FOR( i = 0; i < E_ROM_dico_size; i++ ) { #ifdef ISSUE_1867_replace_overflow_libenc dist = sub_sat( x[0], *p_E_ROM_dico++ ); /*Q8 */ //??sat #else dist = sub_o( x[0], *p_E_ROM_dico++, &Overflow ); /*Q8 */ #endif L_dist = L_mult( dist, w[0] ); /*Q22 */ L_dist = Mult_32_16( L_dist, dist ); /*Q15 */ L_dist = L_shr( L_dist, 10 ); /*Q5 */ FOR( j = 1; j < dim; j++ ) { #ifdef ISSUE_1867_replace_overflow_libenc temp1 = sub_sat( x[j], *p_E_ROM_dico++ ); //??sat #else temp1 = sub_o( x[j], *p_E_ROM_dico++, &Overflow ); #endif L_tmp = L_mult( temp1, w[j] ); /*Q22 */ L_tmp = Mult_32_16( L_tmp, temp1 ); /*Q15 */ L_dist = L_add( L_dist, L_shr( L_tmp, 10 ) ); /*Q5 */ Loading Loading @@ -1664,9 +1712,11 @@ static void msvq_interpol_fx( Word16 quant_select[SWB_FENV], w_env11[SWB_FENV / 2], w_env12[SWB_FENV / 2], tmp; Word32 L_tmp, distCand[N_CAND], L_dist, L_minDist; Word16 synth_energy[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* Extract target vector */ Loading Loading @@ -1707,13 +1757,21 @@ static void msvq_interpol_fx( /* Extract vector for odd position */ FOR( n_band = 0; n_band < DIM11; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc quant_tmp[n_band] = add_sat( quant_tmp1[n_band], quant_tmp2[n_band] ); //??sat #else quant_tmp[n_band] = add_o( quant_tmp1[n_band], quant_tmp2[n_band], &Overflow ); #endif move16(); } FOR( n_band = 0; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */ //??sat #else tmp = add_o( quant_tmp[n_band], quant_tmp[n_band + 1], &Overflow ); /*Q8 */ #endif tmp = shr( tmp, 1 ); quant_tmp2[n_band] = sub( env_temp12[n_band], tmp ); move16(); /*Q8 */ Loading @@ -1736,7 +1794,11 @@ static void msvq_interpol_fx( FOR( n_band = 0; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp = add_sat( quant_tmp[n_band], quant_tmp[n_band + 1] ); //??sat #else tmp = add_o( quant_tmp[n_band], quant_tmp[n_band + 1], &Overflow ); #endif tmp = shr( tmp, 1 ); quant_select[( n_band << 1 ) + 1] = add( tmp, quant_tmp2[n_band] ); move16(); /*Q8 */ Loading Loading @@ -1796,9 +1858,11 @@ static void msvq_interpol_2_fx( Word16 quant_select[SWB_FENV], w_env11[SWB_FENV / 2], w_env12[SWB_FENV / 2]; Word32 L_tmp, distCand[N_CAND], L_dist, L_minDist; Word16 synth_energy[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* Extract target vector */ FOR( n_band = 0; n_band < DIM11 - 1; n_band++ ) Loading Loading @@ -1856,9 +1920,17 @@ static void msvq_interpol_2_fx( move16(); FOR( n_band = 1; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp_q = add_sat( quant_tmp[n_band - 1], quant_tmp[n_band] ); //??sat #else tmp_q = add_o( quant_tmp[n_band - 1], quant_tmp[n_band], &Overflow ); #endif tmp_q = shr( tmp_q, 1 ); #ifdef ISSUE_1867_replace_overflow_libenc quant_tmp2[n_band] = sub_sat( env_temp12[n_band], tmp_q ); //??sat #else quant_tmp2[n_band] = sub_o( env_temp12[n_band], tmp_q, &Overflow ); #endif move16(); } Loading @@ -1879,9 +1951,17 @@ static void msvq_interpol_2_fx( move16(); /*Q8 */ FOR( n_band = 1; n_band < DIM12 - 1; n_band++ ) { #ifdef ISSUE_1867_replace_overflow_libenc tmp_q = add_sat( quant_tmp[n_band - 1], quant_tmp[n_band] ); //??sat #else tmp_q = add_o( quant_tmp[n_band - 1], quant_tmp[n_band], &Overflow ); #endif tmp_q = shr( tmp_q, 1 ); #ifdef ISSUE_1867_replace_overflow_libenc quant_select[( n_band << 1 ) - 1] = add_sat( quant_tmp2[n_band], tmp_q ); //??sat #else quant_select[( n_band << 1 ) - 1] = add_o( quant_tmp2[n_band], tmp_q, &Overflow ); #endif } L_dist = L_deposit_l( 0 ); Loading Loading @@ -1943,9 +2023,11 @@ static void calculate_Tonality_fx( Word16 org_spec[80], gen_spec[80]; Word32 L_log_gm_org, L_log_gm_gen; Word16 l_shift; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* to reduce dynamic range of original spectrum */ Loading Loading @@ -2051,7 +2133,11 @@ static void calculate_Tonality_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_org, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_org = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_org = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_org = s_max( 0, s_min( *SFM_org, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading @@ -2072,7 +2158,11 @@ static void calculate_Tonality_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_gen, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_gen = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_gen = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_gen = s_max( 0, s_min( *SFM_gen, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading Loading @@ -2101,9 +2191,11 @@ static void calculate_Tonality_ivas_fx( Word16 org_spec[80], gen_spec[80]; Word32 L_log_gm_org, L_log_gm_gen; Word16 l_shift; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif /* to reduce dynamic range of original spectrum */ Loading Loading @@ -2209,7 +2301,11 @@ static void calculate_Tonality_ivas_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_org, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_org = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_org = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_org = s_max( 0, s_min( *SFM_org, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading @@ -2230,7 +2326,11 @@ static void calculate_Tonality_ivas_fx( L_tmp2 = Mpy_32_16_1( L_log_gm_gen, inv_len ); /* Q14 */ L_tmp = L_sub( L_tmp1, L_tmp2 ); #ifdef ISSUE_1867_replace_overflow_libenc *SFM_gen = round_fx_sat( L_shl_sat( L_tmp, 14 ) ); /*Q12 */ //??sat //??sat #else *SFM_gen = round_fx_o( L_shl_o( L_tmp, 14, &Overflow ), &Overflow ); /*Q12 */ #endif move16(); *SFM_gen = s_max( 0, s_min( *SFM_gen, 24547 ) ); move16(); /*0.0001 and 5.993 in Q12 */ Loading Loading @@ -2618,9 +2718,11 @@ static Word16 SWB_BWE_encoding_fx( Word16 SWB_tenv_tmp_fx[SWB_TENV]; Word16 max_fx; Word16 energy_factor_fx[SWB_FENV], w_env_fx[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Loading Loading @@ -2663,7 +2765,11 @@ static Word16 SWB_BWE_encoding_fx( } /* tilt returned in Q24 go to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3 ) ); //??sat //??sat #else tilt_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3, &Overflow ), &Overflow ); #endif test(); test(); IF( EQ_16( IsTransient, 1 ) && ( GT_16( tilt_fx, 16384 ) || GT_16( st_fx->clas, 1 ) ) ) Loading Loading @@ -2767,7 +2873,11 @@ static Word16 SWB_BWE_encoding_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &expn ); /*31-expn */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, sub( expn, 1 ) ) ); /*Q14 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, sub( expn, 1 ), &Overflow ), &Overflow ); /*Q14 */ #endif } ELSE { Loading @@ -2779,7 +2889,11 @@ static Word16 SWB_BWE_encoding_fx( { L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, 2 ) ); /*Q15 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, 2, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE IF( GT_16( Rat_tenv_fx, 16384 ) ) { Loading Loading @@ -3063,9 +3177,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( Word16 SWB_tenv_tmp_fx[SWB_TENV]; Word16 max_fx; Word16 energy_factor_fx[SWB_FENV], w_env_fx[SWB_FENV]; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif Word16 inner_frame; Word16 q_shift; Loading Loading @@ -3126,7 +3242,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( } /* tilt returned in Q24 go to Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc tilt_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3 ) ); //??sat //??sat #else tilt_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( insig_fx, 0, L_FRAME32k ), 3, &Overflow ), &Overflow ); #endif test(); test(); IF( EQ_16( IsTransient, 1 ) && ( GT_16( tilt_fx, 16384 ) || GT_16( st_fx->clas, 1 ) ) ) Loading Loading @@ -3231,7 +3351,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( expn = sub( sub( 30, expn ), sub( shl( Q_insig_lp, 1 ), 7 ) ); expd = norm_l( WB_tenv_syn_fx ); #ifdef ISSUE_1867_replace_overflow_libenc den = round_fx_sat( L_shl( WB_tenv_syn_fx, expd ) ); //??sat #else den = round_fx_o( L_shl( WB_tenv_syn_fx, expd ), &Overflow ); #endif expd = sub( sub( 30, expd ), sub( shl( Q_insig_lp, 1 ), 7 ) ); scale = shr( sub( den, num ), 15 ); Loading @@ -3244,7 +3368,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &expn ); /*31-expn */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, sub( expn, 1 ) ) ); /*Q14 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, sub( expn, 1 ), &Overflow ), &Overflow ); /*Q14 */ #endif } ELSE { Loading @@ -3255,7 +3383,11 @@ static Word16 SWB_BWE_encoding_ivas_fx( IF( LT_16( Rat_tenv_fx, 8192 ) ) { L_tmp = L_mult( Rat_tenv_fx, 19661 ); /*Q29 */ #ifdef ISSUE_1867_replace_overflow_libenc Rat_tenv_fx = round_fx_sat( L_shl_sat( L_tmp, 2 ) ); /*Q15 */ //??sat //??sat #else Rat_tenv_fx = round_fx_o( L_shl_o( L_tmp, 2, &Overflow ), &Overflow ); /*Q15 */ #endif } ELSE IF( GT_16( Rat_tenv_fx, 16384 ) ) { Loading
lib_enc/swb_bwe_enc_hr_fx.c +6 −0 Original line number Diff line number Diff line Loading @@ -117,9 +117,11 @@ void swb_bwe_enc_hr_fx( #else Word32 L_t_audio_tmp_fx[L_FRAME48k]; #endif #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; Loading Loading @@ -768,7 +770,11 @@ void swb_bwe_enc_hr_fx( { L_tmp = L_mult( temp, t_audio_fx[i] ); L_tmp = L_shr_sat( L_tmp, temp2 ); #ifdef ISSUE_1867_replace_overflow_libenc t_audio_fx[i] = round_fx_sat( L_tmp ); //??sat #else t_audio_fx[i] = round_fx_o( L_tmp, &Overflow ); #endif move16(); } Loading
lib_enc/swb_bwe_enc_lr_fx.c +8 −1 Original line number Diff line number Diff line Loading @@ -698,9 +698,11 @@ static void gethar_noisegn_fx( Word16 temp_lo, temp_hi; Word16 Qg; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif /*Generate HF noise*/ genhf_noise_fx( noise_flr_fx, Qss, L_xSynth_har, QsL, sspectra_fx, bands, har_bands, har_freq_est2, pos_max_hfe2, pul_res_fx, pk_sf_fx, fLenLow, Loading Loading @@ -783,8 +785,13 @@ static void gethar_noisegn_fx( L_temp = L_Comp( exp, frac ); L_temp = Mpy_32_16_1( L_temp, 19728 ); /* log(2)/log(10)=.30102999566398119521 = 19728.3(Q16) Q(0+16+1)=Q17 */ #ifdef ISSUE_1867_replace_overflow_libenc L_temp = L_shl_sat( L_temp, 13 ); /* Q17+13=30 30-16=14 */ //??sat g_fx = round_fx_sat( L_temp ); //??sat #else L_temp = L_shl_o( L_temp, 13, &Overflow ); /* Q17+13=30 30-16=14 */ g_fx = round_fx_o( L_temp, &Overflow ); #endif } gqlevs_fx = 4; Loading
lib_enc/swb_tbe_enc_fx.c +243 −77 File changed.Preview size limit exceeded, changes collapsed. Show changes