Loading lib_com/options.h +5 −1 Original line number Diff line number Diff line Loading @@ -73,16 +73,20 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives in lib_com - BE */ #define ISSUE_1836_replace_overflow_libcom /* FhG: BE - replace overflow operators by non-overflow-alternatives in lib_com */ #define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */ #define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ #define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ #define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */ #define FIX_1978_SAT_MISSING_IN_GAIN_ENC /* VA: Fix add saturation missing that lead to a crash in P800-10 */ #define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */ #define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */ #define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */ #define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */ #define FIX_1985_SBA_714_HF_LOSS /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/ #define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */ /* #################### Start BASOP porting switches ############################ */ Loading lib_com/stat_noise_uv_mod_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ void stat_noise_uv_mod_fx( { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif Loading Loading @@ -197,7 +197,7 @@ void stat_noise_uv_mod_fx( tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif Loading lib_enc/acelp_core_switch_enc_fx.c +13 −1 Original line number Diff line number Diff line Loading @@ -726,9 +726,11 @@ static void bwe_switch_enc_fx( Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ Word16 n, L; BSTR_ENC_HANDLE hBstr; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hBstr = st_fx->hBstr; L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS ); Loading Loading @@ -845,7 +847,11 @@ static void bwe_switch_enc_fx( L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); #ifdef ISSUE_1867_replace_overflow_libenc gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ #else gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ #endif ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); /* Q0 */ push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); Loading @@ -872,9 +878,11 @@ static void bwe_switch_enc_ivas_fx( Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ Word16 n, L; BSTR_ENC_HANDLE hBstr; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hBstr = st_fx->hBstr; L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS ); Loading Loading @@ -988,7 +996,11 @@ static void bwe_switch_enc_ivas_fx( L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); #ifdef ISSUE_1867_replace_overflow_libenc gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ #else gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ #endif ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); Loading lib_enc/acelp_enc_util_fx.c +14 −2 Original line number Diff line number Diff line Loading @@ -161,8 +161,10 @@ void E_ACELP_conv( { Word16 i, k; Word32 L_tmp; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif FOR( k = 0; k < L_SUBFR; k++ ) { Loading @@ -175,7 +177,11 @@ void E_ACELP_conv( L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*h2 4Q11*/ } L_tmp = W_sat_l( L_tmp_64 ); /* 4Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Q0 */ #else cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Q0 */ #endif } } Loading @@ -187,8 +193,10 @@ void E_ACELP_conv_ivas_fx( { Word16 i, k; Word32 L_tmp; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif FOR( k = 0; k < L_SUBFR; k++ ) { Loading @@ -201,7 +209,11 @@ void E_ACELP_conv_ivas_fx( L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*Qnew + 11*/ } L_tmp = W_sat_l( L_tmp_64 ); /* Qnew + 11 */ #ifdef ISSUE_1867_replace_overflow_libenc cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Qnew*/ #else cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Qnew*/ #endif move16(); } } Loading lib_enc/analy_sp_fx.c +26 −8 Original line number Diff line number Diff line Loading @@ -898,10 +898,12 @@ static void find_enr( Word32 etot; Word16 exp_etot; Word32 *tmpptr; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif ptR = &data[1]; /* first real */ Loading Loading @@ -949,7 +951,11 @@ static void find_enr( /* *ptE *= 4.0 / (L_FFT*L_FFT) */ /* normalization - corresponds to FFT normalization by 2/L_FFT */ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc *ptE = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE - 2 */ #else *ptE = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE - 2 */ #endif move32(); /* scaled by Q_new + QSCALE - 2 */ BASOP_SATURATE_WARNING_ON_EVS; /*band[i] += *ptE++;*/ Loading @@ -975,7 +981,11 @@ static void find_enr( exp_band = sub( exp_band, shift_to_norm ); exp_band = sub( diff_scaleP1, exp_band ); BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc band[i] = L_shl_sat( Ltmp1, exp_band ); /* Q15 + exp_band */ #else band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); /* Q15 + exp_band */ #endif move32(); /* band scaled by Q_new + QSCALE */ BASOP_SATURATE_WARNING_ON_EVS; Loading Loading @@ -1026,7 +1036,11 @@ static void find_enr( /* *ptE *= 4.0 / (L_FFT*L_FFT) */ /* normalization - corresponds to FFT normalization by 2/L_FFT */ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc *Bin_E = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE */ #else *Bin_E = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE */ #endif move32(); /* scaled by Q_new + QSCALE - 2 */ BASOP_SATURATE_WARNING_ON_EVS; Bin_E++; Loading @@ -1048,7 +1062,11 @@ static void find_enr( exp_band = sub( exp_band, shift_to_norm ); exp_band = sub( diff_scaleP1, exp_band ); BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc band[i] = L_shl_sat( Ltmp1, exp_band ); #else band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); #endif move32(); /* band scaled by Q_new + QSCALE */ BASOP_SATURATE_WARNING_ON_EVS; Loading Loading
lib_com/options.h +5 −1 Original line number Diff line number Diff line Loading @@ -73,16 +73,20 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives in lib_com - BE */ #define ISSUE_1836_replace_overflow_libcom /* FhG: BE - replace overflow operators by non-overflow-alternatives in lib_com */ #define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */ #define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ #define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ #define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */ #define FIX_1978_SAT_MISSING_IN_GAIN_ENC /* VA: Fix add saturation missing that lead to a crash in P800-10 */ #define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */ #define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */ #define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */ #define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */ #define FIX_1985_SBA_714_HF_LOSS /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/ #define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */ /* #################### Start BASOP porting switches ############################ */ Loading
lib_com/stat_noise_uv_mod_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ void stat_noise_uv_mod_fx( { exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ #ifdef ISSUE_1836_replace_overflow_libcom exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ //??Sat exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */ #else exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ #endif Loading Loading @@ -197,7 +197,7 @@ void stat_noise_uv_mod_fx( tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); #ifdef ISSUE_1836_replace_overflow_libcom tmp_res = shl_sat( tmp_res, tmp_shift ); //??Sat tmp_res = shl_sat( tmp_res, tmp_shift ); #else tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); #endif Loading
lib_enc/acelp_core_switch_enc_fx.c +13 −1 Original line number Diff line number Diff line Loading @@ -726,9 +726,11 @@ static void bwe_switch_enc_fx( Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ Word16 n, L; BSTR_ENC_HANDLE hBstr; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hBstr = st_fx->hBstr; L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS ); Loading Loading @@ -845,7 +847,11 @@ static void bwe_switch_enc_fx( L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); #ifdef ISSUE_1867_replace_overflow_libenc gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ #else gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ #endif ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); /* Q0 */ push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); Loading @@ -872,9 +878,11 @@ static void bwe_switch_enc_ivas_fx( Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ Word16 n, L; BSTR_ENC_HANDLE hBstr; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hBstr = st_fx->hBstr; L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS ); Loading Loading @@ -988,7 +996,11 @@ static void bwe_switch_enc_ivas_fx( L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); #ifdef ISSUE_1867_replace_overflow_libenc gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ #else gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ #endif ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); Loading
lib_enc/acelp_enc_util_fx.c +14 −2 Original line number Diff line number Diff line Loading @@ -161,8 +161,10 @@ void E_ACELP_conv( { Word16 i, k; Word32 L_tmp; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif FOR( k = 0; k < L_SUBFR; k++ ) { Loading @@ -175,7 +177,11 @@ void E_ACELP_conv( L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*h2 4Q11*/ } L_tmp = W_sat_l( L_tmp_64 ); /* 4Q11 */ #ifdef ISSUE_1867_replace_overflow_libenc cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Q0 */ #else cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Q0 */ #endif } } Loading @@ -187,8 +193,10 @@ void E_ACELP_conv_ivas_fx( { Word16 i, k; Word32 L_tmp; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif #endif FOR( k = 0; k < L_SUBFR; k++ ) { Loading @@ -201,7 +209,11 @@ void E_ACELP_conv_ivas_fx( L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*Qnew + 11*/ } L_tmp = W_sat_l( L_tmp_64 ); /* Qnew + 11 */ #ifdef ISSUE_1867_replace_overflow_libenc cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Qnew*/ #else cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Qnew*/ #endif move16(); } } Loading
lib_enc/analy_sp_fx.c +26 −8 Original line number Diff line number Diff line Loading @@ -898,10 +898,12 @@ static void find_enr( Word32 etot; Word16 exp_etot; Word32 *tmpptr; #ifndef ISSUE_1867_replace_overflow_libenc #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif ptR = &data[1]; /* first real */ Loading Loading @@ -949,7 +951,11 @@ static void find_enr( /* *ptE *= 4.0 / (L_FFT*L_FFT) */ /* normalization - corresponds to FFT normalization by 2/L_FFT */ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc *ptE = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE - 2 */ #else *ptE = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE - 2 */ #endif move32(); /* scaled by Q_new + QSCALE - 2 */ BASOP_SATURATE_WARNING_ON_EVS; /*band[i] += *ptE++;*/ Loading @@ -975,7 +981,11 @@ static void find_enr( exp_band = sub( exp_band, shift_to_norm ); exp_band = sub( diff_scaleP1, exp_band ); BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc band[i] = L_shl_sat( Ltmp1, exp_band ); /* Q15 + exp_band */ #else band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); /* Q15 + exp_band */ #endif move32(); /* band scaled by Q_new + QSCALE */ BASOP_SATURATE_WARNING_ON_EVS; Loading Loading @@ -1026,7 +1036,11 @@ static void find_enr( /* *ptE *= 4.0 / (L_FFT*L_FFT) */ /* normalization - corresponds to FFT normalization by 2/L_FFT */ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc *Bin_E = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE */ #else *Bin_E = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE */ #endif move32(); /* scaled by Q_new + QSCALE - 2 */ BASOP_SATURATE_WARNING_ON_EVS; Bin_E++; Loading @@ -1048,7 +1062,11 @@ static void find_enr( exp_band = sub( exp_band, shift_to_norm ); exp_band = sub( diff_scaleP1, exp_band ); BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */ #ifdef ISSUE_1867_replace_overflow_libenc band[i] = L_shl_sat( Ltmp1, exp_band ); #else band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); #endif move32(); /* band scaled by Q_new + QSCALE */ BASOP_SATURATE_WARNING_ON_EVS; Loading