Loading lib_com/options.h +3 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,9 @@ #define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define ISSUE_1866_replace_overflow_libdec /* FhG: BE - Replace BASOPoverflow operators all over the lib_dec module if Overflow result is not used*/ #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ Loading lib_dec/FEC_HQ_core_fx.c +26 −14 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -80,8 +80,8 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); #ifdef ISSUE_1796_replace_shl_o b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ #ifdef ISSUE_1866_replace_overflow_libdec b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ //??sat #else b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ #endif Loading Loading @@ -168,7 +168,7 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -390,8 +390,8 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { #ifdef ISSUE_1796_replace_shl_o hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); #ifdef ISSUE_1866_replace_overflow_libdec hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); //??sat #else hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); #endif Loading Loading @@ -449,9 +449,11 @@ void ivas_HQ_FEC_Mem_update_fx( HQ_DEC_HANDLE hHQ_core; hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif move32(); // for tmp_energy_fx IF( EQ_16( output_frame, L_FRAME8k ) ) Loading Loading @@ -530,8 +532,8 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } #ifdef ISSUE_1796_replace_shl_o tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ #ifdef ISSUE_1866_replace_overflow_libdec tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ //??sat #else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ #endif Loading Loading @@ -654,7 +656,11 @@ void ivas_HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); #ifdef ISSUE_1866_replace_overflow_libdec *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) ); //??sat #else *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); #endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); Loading Loading @@ -736,9 +742,11 @@ void HQ_FEC_Mem_update_fx( HQ_DEC_HANDLE hHQ_core; hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif move32(); // tmp_energy_fx Loading Loading @@ -819,8 +827,8 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } #ifdef ISSUE_1796_replace_shl_o tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ #ifdef ISSUE_1866_replace_overflow_libdec tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ //??sat #else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ #endif Loading Loading @@ -944,7 +952,11 @@ void HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); #ifdef ISSUE_1866_replace_overflow_libdec *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) ); //??sat #else *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); #endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); Loading Loading @@ -1015,7 +1027,7 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -1086,8 +1098,8 @@ static Word16 find_best_delay_fx( L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ #ifdef ISSUE_1866_replace_overflow_libdec tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ //??sat #else tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ #endif Loading lib_dec/FEC_HQ_phase_ecu_fx.c +7 −0 Original line number Diff line number Diff line Loading @@ -2916,13 +2916,20 @@ static Word32 mult_32_32_q( const Word32 a, const Word32 b, const Word16 q ) { Word32 hi; UWord32 lo; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Mpy_32_32_ss( a, b, &hi, &lo ); return L_or( L_shl_o( hi, sub( 32 - 1, q ), &Overflow ), L_lshr( (Word32) lo, add( q, 1 ) ) ); #else Mpy_32_32_ss( a, b, &hi, &lo ); return L_or( L_shl_sat( hi, sub( 32 - 1, q ) ), L_lshr( (Word32) lo, add( q, 1 ) ) ); //??sat #endif } static void fir_dwn_fx( Loading lib_dec/FEC_fx.c +23 −13 Original line number Diff line number Diff line Loading @@ -95,9 +95,11 @@ void FEC_exc_estim_fx( Word32 cond3; Word32 predPitchLag; GSC_DEC_HANDLE hGSCDec; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif hGSCDec = st_fx->hGSCDec; Loading Loading @@ -126,7 +128,7 @@ void FEC_exc_estim_fx( gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */ } #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1866_replace_overflow_libdec tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 ); #else tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow ); Loading Loading @@ -191,8 +193,8 @@ void FEC_exc_estim_fx( { test(); test(); #ifdef ISSUE_1796_replace_shl_o IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && #ifdef ISSUE_1866_replace_overflow_libdec IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && //??sat GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ #else Loading @@ -210,8 +212,8 @@ void FEC_exc_estim_fx( { test(); test(); #ifdef ISSUE_1796_replace_shl_o IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && #ifdef ISSUE_1866_replace_overflow_libdec IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && //??sat GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ #else Loading Loading @@ -313,7 +315,11 @@ void FEC_exc_estim_fx( IF( LE_16( st_fx->nbLostCmpt, 1 ) ) { /* if stable, do not decrease the energy, pitch_gain = 0 */ #ifdef ISSUE_1866_replace_overflow_libdec alpha = mac_r_sat( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX ); /*st_fx->stab_fac_fx in Q15*/ //??sat #else alpha = mac_ro( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX, &Overflow ); /*st_fx->stab_fac_fx in Q15*/ #endif } ELSE IF( EQ_16( st_fx->nbLostCmpt, 2 ) ) { Loading Loading @@ -362,7 +368,11 @@ void FEC_exc_estim_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &exp ); #ifdef ISSUE_1866_replace_overflow_libdec gain = extract_h( L_shl_sat( L_tmp, exp ) ); //??sat #else gain = extract_h( L_shl_o( L_tmp, exp, &Overflow ) ); #endif gain = s_min( gain, 32113 ); /*0.98 */ gain = s_max( gain, 27853 ); /*0.85 */ Loading Loading @@ -768,7 +778,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 { Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e; Word32 tmp_pit2; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading @@ -782,8 +792,8 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/ BASOP_SATURATE_WARNING_OFF_EVS /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/ #ifdef ISSUE_1796_replace_shl_o tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); #ifdef ISSUE_1866_replace_overflow_libdec tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); //??sat #else tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); #endif Loading lib_dec/LD_music_post_filter_fx.c +26 −9 Original line number Diff line number Diff line Loading @@ -69,8 +69,10 @@ void LD_music_post_filter_fx( Word16 mant, exp1, s_ave, tmp16, old_tmp16; Word16 diff_sc; Word16 old_tmp16_1; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif move16(); move16(); Loading Loading @@ -186,7 +188,11 @@ void LD_music_post_filter_fx( FOR( k = j; k < mfreq_bindiv_LD[i] + j; k++ ) { /*m_ave += lf_E[k];*/ #ifdef ISSUE_1866_replace_overflow_libdec Ltmp = L_add_sat( lf_E[k], Ltmp ); /*2*Qdct+10*/ //??sat #else Ltmp = L_add_o( lf_E[k], Ltmp, &Overflow ); /*2*Qdct+10*/ #endif max_val = L_max( max_val, lf_E[k] ); } Ltmp_max = L_max( Ltmp_max, max_val ); /*2*Qdct+10*/ Loading Loading @@ -442,8 +448,10 @@ static void spectrum_mod_dct_fx( Word32 Lshift; Word32 dot5_scaled; const Word32 *Lpt2; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif move16(); Loading Loading @@ -523,7 +531,11 @@ static void spectrum_mod_dct_fx( IF( music_flag != 0 ) /* prevent subtraction on clean speech */ { #ifdef ISSUE_1866_replace_overflow_libdec IF( LE_32( maxNoise, L_shl_sat( 10, scaling ) ) ) //??sat #else IF( LE_32( maxNoise, L_shl_o( 10, scaling, &Overflow ) ) ) #endif { minE = 18432 / 2; /*Q14*/ move16(); Loading Loading @@ -599,16 +611,21 @@ static void spectrum_mod_dct_fx( Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/ e_binE = sub( add( e_tmp, e_binE ), 15 ); #ifdef ISSUE_1799_replace_L_shr_o Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ #ifdef ISSUE_1866_replace_overflow_libdec Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ //??sat Lgain = L_add_sat( Ltmp, Lshift ); /*Saturation can occure here result in Q30*/ //??sat #else Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ #endif Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/ #endif } Lpt2++; #ifdef ISSUE_1866_replace_overflow_libdec gain = round_fx_sat( Lgain ); /*gain in Q30-16 = Q14*/ //??sat #else gain = round_fx_o( Lgain, &Overflow ); /*gain in Q30-16 = Q14*/ #endif /*if (gain < minE)gain = minE;*/ gain = s_max( gain, minE ); /*Q14*/ /*if (gain > 1.0f+MAX_GN)gain = 1.0f+MAX_GN;*/ Loading Loading @@ -905,7 +922,7 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif Loading @@ -929,8 +946,8 @@ static Word16 norm_lfe( exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */ /* Need to shl by 3 to take into account the 3 multiplications */ } #ifdef ISSUE_1796_replace_shl_o tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ #ifdef ISSUE_1866_replace_overflow_libdec tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ //??sat #else tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ #endif Loading Loading
lib_com/options.h +3 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,9 @@ #define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define ISSUE_1866_replace_overflow_libdec /* FhG: BE - Replace BASOPoverflow operators all over the lib_dec module if Overflow result is not used*/ #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ Loading
lib_dec/FEC_HQ_core_fx.c +26 −14 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -80,8 +80,8 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); #ifdef ISSUE_1796_replace_shl_o b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ #ifdef ISSUE_1866_replace_overflow_libdec b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ //??sat #else b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ #endif Loading Loading @@ -168,7 +168,7 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -390,8 +390,8 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { #ifdef ISSUE_1796_replace_shl_o hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); #ifdef ISSUE_1866_replace_overflow_libdec hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); //??sat #else hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); #endif Loading Loading @@ -449,9 +449,11 @@ void ivas_HQ_FEC_Mem_update_fx( HQ_DEC_HANDLE hHQ_core; hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif move32(); // for tmp_energy_fx IF( EQ_16( output_frame, L_FRAME8k ) ) Loading Loading @@ -530,8 +532,8 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } #ifdef ISSUE_1796_replace_shl_o tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ #ifdef ISSUE_1866_replace_overflow_libdec tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ //??sat #else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ #endif Loading Loading @@ -654,7 +656,11 @@ void ivas_HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); #ifdef ISSUE_1866_replace_overflow_libdec *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) ); //??sat #else *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); #endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); Loading Loading @@ -736,9 +742,11 @@ void HQ_FEC_Mem_update_fx( HQ_DEC_HANDLE hHQ_core; hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif move32(); // tmp_energy_fx Loading Loading @@ -819,8 +827,8 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } #ifdef ISSUE_1796_replace_shl_o tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ #ifdef ISSUE_1866_replace_overflow_libdec tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ //??sat #else tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ #endif Loading Loading @@ -944,7 +952,11 @@ void HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); #ifdef ISSUE_1866_replace_overflow_libdec *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) ); //??sat #else *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); #endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); Loading Loading @@ -1015,7 +1027,7 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -1086,8 +1098,8 @@ static Word16 find_best_delay_fx( L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ #ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ #ifdef ISSUE_1866_replace_overflow_libdec tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ //??sat #else tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ #endif Loading
lib_dec/FEC_HQ_phase_ecu_fx.c +7 −0 Original line number Diff line number Diff line Loading @@ -2916,13 +2916,20 @@ static Word32 mult_32_32_q( const Word32 a, const Word32 b, const Word16 q ) { Word32 hi; UWord32 lo; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Mpy_32_32_ss( a, b, &hi, &lo ); return L_or( L_shl_o( hi, sub( 32 - 1, q ), &Overflow ), L_lshr( (Word32) lo, add( q, 1 ) ) ); #else Mpy_32_32_ss( a, b, &hi, &lo ); return L_or( L_shl_sat( hi, sub( 32 - 1, q ) ), L_lshr( (Word32) lo, add( q, 1 ) ) ); //??sat #endif } static void fir_dwn_fx( Loading
lib_dec/FEC_fx.c +23 −13 Original line number Diff line number Diff line Loading @@ -95,9 +95,11 @@ void FEC_exc_estim_fx( Word32 cond3; Word32 predPitchLag; GSC_DEC_HANDLE hGSCDec; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif hGSCDec = st_fx->hGSCDec; Loading Loading @@ -126,7 +128,7 @@ void FEC_exc_estim_fx( gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */ } #ifdef ISSUE_1796_replace_shl_o #ifdef ISSUE_1866_replace_overflow_libdec tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 ); #else tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow ); Loading Loading @@ -191,8 +193,8 @@ void FEC_exc_estim_fx( { test(); test(); #ifdef ISSUE_1796_replace_shl_o IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && #ifdef ISSUE_1866_replace_overflow_libdec IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && //??sat GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ #else Loading @@ -210,8 +212,8 @@ void FEC_exc_estim_fx( { test(); test(); #ifdef ISSUE_1796_replace_shl_o IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && #ifdef ISSUE_1866_replace_overflow_libdec IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && //??sat GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ #else Loading Loading @@ -313,7 +315,11 @@ void FEC_exc_estim_fx( IF( LE_16( st_fx->nbLostCmpt, 1 ) ) { /* if stable, do not decrease the energy, pitch_gain = 0 */ #ifdef ISSUE_1866_replace_overflow_libdec alpha = mac_r_sat( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX ); /*st_fx->stab_fac_fx in Q15*/ //??sat #else alpha = mac_ro( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX, &Overflow ); /*st_fx->stab_fac_fx in Q15*/ #endif } ELSE IF( EQ_16( st_fx->nbLostCmpt, 2 ) ) { Loading Loading @@ -362,7 +368,11 @@ void FEC_exc_estim_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &exp ); #ifdef ISSUE_1866_replace_overflow_libdec gain = extract_h( L_shl_sat( L_tmp, exp ) ); //??sat #else gain = extract_h( L_shl_o( L_tmp, exp, &Overflow ) ); #endif gain = s_min( gain, 32113 ); /*0.98 */ gain = s_max( gain, 27853 ); /*0.85 */ Loading Loading @@ -768,7 +778,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 { Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e; Word32 tmp_pit2; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading @@ -782,8 +792,8 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/ BASOP_SATURATE_WARNING_OFF_EVS /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/ #ifdef ISSUE_1796_replace_shl_o tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); #ifdef ISSUE_1866_replace_overflow_libdec tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); //??sat #else tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); #endif Loading
lib_dec/LD_music_post_filter_fx.c +26 −9 Original line number Diff line number Diff line Loading @@ -69,8 +69,10 @@ void LD_music_post_filter_fx( Word16 mant, exp1, s_ave, tmp16, old_tmp16; Word16 diff_sc; Word16 old_tmp16_1; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif move16(); move16(); Loading Loading @@ -186,7 +188,11 @@ void LD_music_post_filter_fx( FOR( k = j; k < mfreq_bindiv_LD[i] + j; k++ ) { /*m_ave += lf_E[k];*/ #ifdef ISSUE_1866_replace_overflow_libdec Ltmp = L_add_sat( lf_E[k], Ltmp ); /*2*Qdct+10*/ //??sat #else Ltmp = L_add_o( lf_E[k], Ltmp, &Overflow ); /*2*Qdct+10*/ #endif max_val = L_max( max_val, lf_E[k] ); } Ltmp_max = L_max( Ltmp_max, max_val ); /*2*Qdct+10*/ Loading Loading @@ -442,8 +448,10 @@ static void spectrum_mod_dct_fx( Word32 Lshift; Word32 dot5_scaled; const Word32 *Lpt2; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif move16(); Loading Loading @@ -523,7 +531,11 @@ static void spectrum_mod_dct_fx( IF( music_flag != 0 ) /* prevent subtraction on clean speech */ { #ifdef ISSUE_1866_replace_overflow_libdec IF( LE_32( maxNoise, L_shl_sat( 10, scaling ) ) ) //??sat #else IF( LE_32( maxNoise, L_shl_o( 10, scaling, &Overflow ) ) ) #endif { minE = 18432 / 2; /*Q14*/ move16(); Loading Loading @@ -599,16 +611,21 @@ static void spectrum_mod_dct_fx( Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/ e_binE = sub( add( e_tmp, e_binE ), 15 ); #ifdef ISSUE_1799_replace_L_shr_o Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ #ifdef ISSUE_1866_replace_overflow_libdec Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ //??sat Lgain = L_add_sat( Ltmp, Lshift ); /*Saturation can occure here result in Q30*/ //??sat #else Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ #endif Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/ #endif } Lpt2++; #ifdef ISSUE_1866_replace_overflow_libdec gain = round_fx_sat( Lgain ); /*gain in Q30-16 = Q14*/ //??sat #else gain = round_fx_o( Lgain, &Overflow ); /*gain in Q30-16 = Q14*/ #endif /*if (gain < minE)gain = minE;*/ gain = s_max( gain, minE ); /*Q14*/ /*if (gain > 1.0f+MAX_GN)gain = 1.0f+MAX_GN;*/ Loading Loading @@ -905,7 +922,7 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; #ifndef ISSUE_1796_replace_shl_o #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif Loading @@ -929,8 +946,8 @@ static Word16 norm_lfe( exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */ /* Need to shl by 3 to take into account the 3 multiplications */ } #ifdef ISSUE_1796_replace_shl_o tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ #ifdef ISSUE_1866_replace_overflow_libdec tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ //??sat #else tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ #endif Loading