Loading lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -137,8 +137,9 @@ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2493_CHECK_EXTRACT_L /* FhG: Verify that extract_l, W_extract_l etc. do not encounter an overflow. */ #define NONBE_FIX_2493_CHECK_EXTRACT_L_estDownmixGain_fx /* FhG: Fix extract_l overflow inside estDownmixGain_fx() */ #define FIX_2493_CHECK_EXTRACT_L_swb_pre_proc_fx_BE_EVS /* FhG: Keep EVS bitexact within the fix in swb_pre_proc_fx() */ #define NONBE_FIX_2493_CHECK_EXTRACT_L_swb_pre_proc_fx /* FhG: Fix extract_l overflow inside swb_pre_proc_fx() */ #define NONBE_FIX_2493_EXTRACT_L_spectral_balancer_fx16 /* FhG: Fix extract_l overflow inside spectral_balancer_fx16() */ #define NONBE_FIX_2493_EXTRACT_L_IGF_CalculateStereoEnvelope_fx /* FhG: Fix extract_l overflow inside IGF_CalculateStereoEnvelope_fx() */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ Loading lib_enc/analy_sp_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -148,7 +148,11 @@ void analy_sp_fx( Ltmp = Mpy_32( exp_etot, frac_etot, LG10, 0 ); /*Q8 Averaged the total energy over both half-frames in log10 */ #ifdef FIX_2493_CHECK_EXTRACT_L *Etot = extract_l2( L_shr( Ltmp, 14 - 8 ) ); /* Q8 */ #else *Etot = extract_l( L_shr( Ltmp, 14 - 8 ) ); /* Q8 */ #endif Bin_E[L_FFT / 2 - 1] = Bin_E[L_FFT / 2 - 2]; move32(); Loading lib_enc/avq_cod_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -119,7 +119,11 @@ void AVQ_cod_fx( /* estimated gain (when offset=0, estimated gain=1) */ f_tmp = L_Extract_lc( Ltmp, &e_tmp ); #ifdef FIX_2493_CHECK_EXTRACT_L tmp16 = extract_l2( Pow2( 14, f_tmp ) ); #else tmp16 = extract_l( Pow2( 14, f_tmp ) ); #endif Lgain = L_shl_sat( tmp16, e_tmp ); /* gain_inv = 1.0f / gain */ e_tmp = norm_l( Lgain ); Loading lib_enc/bw_detect_fx.c +22 −1 Original line number Diff line number Diff line Loading @@ -413,11 +413,17 @@ void bw_detect_fx( cldfb_ener_offset_32 = L_deposit_l( cldfb_ener_offset ); /* Q14 in 32bit var */ cldfb_ener_offset_32 = L_shl( cldfb_ener_offset_32, 25 - 14 ); /* Q14 -> Q25 */ #ifdef FIX_2493_CHECK_EXTRACT_L mean_NB = extract_l2( L_shr( L_add( mean_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_NB = extract_l2( L_shr( L_add( max_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ mean_WB = extract_l2( L_shr( L_add( mean_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_WB = extract_l2( L_shr( L_add( max_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_NB = extract_l( L_shr( L_add( mean_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_NB = extract_l( L_shr( L_add( max_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ mean_WB = extract_l( L_shr( L_add( mean_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_WB = extract_l( L_shr( L_add( max_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif /*if WB */ IF( EQ_32( st->input_Fs, 16000 ) ) Loading Loading @@ -453,8 +459,13 @@ void bw_detect_fx( L_tmp = L_add( L_tmp, L_shr( *pt32++, 2 ) ); mean_SWB32 = L_add( L_tmp, L_shr( *pt32++, 2 ) ); #ifdef FIX_2493_CHECK_EXTRACT_L mean_SWB = extract_l2( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l2( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_SWB = extract_l( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif } ELSE { /* FB */ Loading @@ -467,8 +478,13 @@ void bw_detect_fx( L_tmp = L_add( L_tmp, L_shr( *pt32++, 2 ) ); mean_SWB32 = L_add( L_tmp, L_shr( *pt32++, 2 ) ); #ifdef FIX_2493_CHECK_EXTRACT_L mean_SWB = extract_l2( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l2( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_SWB = extract_l( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif /* FB: 16,4 - 19,6 kHz, 8 cldfb-bands (2 bins) */ Loading @@ -478,8 +494,13 @@ void bw_detect_fx( L_tmp = L_shr( *pt32++, 1 ); mean_FB32 = L_add( L_tmp, L_shr( *pt32++, 1 ) ); #ifdef FIX_2493_CHECK_EXTRACT_L mean_FB = extract_l2( L_shr( L_add( mean_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_FB = extract_l2( L_shr( L_add( max_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_FB = extract_l( L_shr( L_add( mean_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_FB = extract_l( L_shr( L_add( max_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif } } } Loading lib_enc/cng_enc_fx.c +30 −6 Original line number Diff line number Diff line Loading @@ -349,7 +349,11 @@ void CNG_enc_fx( L_tmp = L_sub( L_tmp, L_add( L_deposit_l( hTdCngEnc->cng_lsp_hist_fx[max_idx[0] * M + i] ), L_deposit_l( hTdCngEnc->cng_lsp_hist_fx[max_idx[1] * M + i] ) ) ); /*Q15 */ tmpv = div_s( 1, sub( hDtxEnc->cng_hist_size, 2 ) ); /*Q15 */ L_tmp = Mpy_32_16_1( L_tmp, tmpv ); /*Q15 */ #ifdef FIX_2493_CHECK_EXTRACT_L lsp_new[i] = extract_l2( L_tmp ); /*Q15 */ #else lsp_new[i] = extract_l( L_tmp ); /*Q15 */ #endif move16(); } max_idx1[0] = max_idx[0]; Loading Loading @@ -696,7 +700,11 @@ void CNG_enc_fx( L_tmp = L_sub( L_tmp, L_deposit_l( tmp[max_idx[0] * M + i] ) ); tmpv = div_s( 1, sub( m, 1 ) ); /*Q15 */ L_tmp = Mpy_32_16_1( L_tmp, tmpv ); /*Q15 */ #ifdef FIX_2493_CHECK_EXTRACT_L lsp_tmp[i] = extract_l2( L_tmp ); /*Q15 */ #else lsp_tmp[i] = extract_l( L_tmp ); /*Q15 */ #endif move16(); } } Loading @@ -713,7 +721,11 @@ void CNG_enc_fx( L_tmp = L_sub( L_tmp, L_add( L_deposit_l( tmp[max_idx[0] * M + i] ), L_deposit_l( tmp[max_idx[1] * M + i] ) ) ); /*Q15 */ tmpv = div_s( 1, sub( m, 2 ) ); /*Q15 */ /*Q15 */ L_tmp = Mpy_32_16_1( L_tmp, tmpv ); /*Q15 */ /*Q15 */ #ifdef FIX_2493_CHECK_EXTRACT_L lsp_tmp[i] = extract_l2( L_tmp ); /*Q15 */ /*Q15 */ #else lsp_tmp[i] = extract_l( L_tmp ); /*Q15 */ /*Q15 */ #endif move16(); } } Loading Loading @@ -861,7 +873,11 @@ void CNG_enc_fx( att = mult( ftmp_fx, 5461 ); /* Q15 */ L_tmp = L_mult( att, 8 ); /* Q16 */ #ifdef FIX_2493_CHECK_EXTRACT_L tmp1 = extract_l2( L_shr( L_tmp, 2 ) ); /* Q14 */ #else tmp1 = extract_l( L_shr( L_tmp, 2 ) ); /* Q14 */ #endif tmp1 = add( 16384, tmp1 ); att = div_s( 16374, tmp1 ); /* Q15 */ Loading Loading @@ -1152,7 +1168,11 @@ void CNG_enc_fx( /* calculate the energy quantization index */ enr_index = add( enr, 512 /* Q8(2.0) */ ); /* enr + 2.0 */ #ifdef FIX_2493_CHECK_EXTRACT_L enr_index = extract_l2( L_shr( L_mult0( enr_index, step ), 12 + 8 ) ); /* Q0 (8+12-(8+12)) */ #else enr_index = extract_l( L_shr( L_mult0( enr_index, step ), 12 + 8 ) ); /* Q0 (8+12-(8+12)) */ #endif /* limit the energy quantization index */ enr_index = s_min( enr_index, maxl ); Loading Loading @@ -1736,7 +1756,11 @@ static Word16 shb_DTX_fx( apply_scale( &att_fx32, st->hFdCngEnc->hFdCngCom->CngBandwidth, st->hFdCngEnc->hFdCngCom->CngBitrate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); // Q23; #ifdef FIX_2493_CHECK_EXTRACT_L att_fx = extract_l2( L_shr( att_fx32, 15 ) ); // Q8 #else att_fx = extract_l( L_shr( att_fx32, 15 ) ); // Q8 #endif } ELSE { Loading Loading
lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -137,8 +137,9 @@ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2493_CHECK_EXTRACT_L /* FhG: Verify that extract_l, W_extract_l etc. do not encounter an overflow. */ #define NONBE_FIX_2493_CHECK_EXTRACT_L_estDownmixGain_fx /* FhG: Fix extract_l overflow inside estDownmixGain_fx() */ #define FIX_2493_CHECK_EXTRACT_L_swb_pre_proc_fx_BE_EVS /* FhG: Keep EVS bitexact within the fix in swb_pre_proc_fx() */ #define NONBE_FIX_2493_CHECK_EXTRACT_L_swb_pre_proc_fx /* FhG: Fix extract_l overflow inside swb_pre_proc_fx() */ #define NONBE_FIX_2493_EXTRACT_L_spectral_balancer_fx16 /* FhG: Fix extract_l overflow inside spectral_balancer_fx16() */ #define NONBE_FIX_2493_EXTRACT_L_IGF_CalculateStereoEnvelope_fx /* FhG: Fix extract_l overflow inside IGF_CalculateStereoEnvelope_fx() */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ Loading
lib_enc/analy_sp_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -148,7 +148,11 @@ void analy_sp_fx( Ltmp = Mpy_32( exp_etot, frac_etot, LG10, 0 ); /*Q8 Averaged the total energy over both half-frames in log10 */ #ifdef FIX_2493_CHECK_EXTRACT_L *Etot = extract_l2( L_shr( Ltmp, 14 - 8 ) ); /* Q8 */ #else *Etot = extract_l( L_shr( Ltmp, 14 - 8 ) ); /* Q8 */ #endif Bin_E[L_FFT / 2 - 1] = Bin_E[L_FFT / 2 - 2]; move32(); Loading
lib_enc/avq_cod_fx.c +4 −0 Original line number Diff line number Diff line Loading @@ -119,7 +119,11 @@ void AVQ_cod_fx( /* estimated gain (when offset=0, estimated gain=1) */ f_tmp = L_Extract_lc( Ltmp, &e_tmp ); #ifdef FIX_2493_CHECK_EXTRACT_L tmp16 = extract_l2( Pow2( 14, f_tmp ) ); #else tmp16 = extract_l( Pow2( 14, f_tmp ) ); #endif Lgain = L_shl_sat( tmp16, e_tmp ); /* gain_inv = 1.0f / gain */ e_tmp = norm_l( Lgain ); Loading
lib_enc/bw_detect_fx.c +22 −1 Original line number Diff line number Diff line Loading @@ -413,11 +413,17 @@ void bw_detect_fx( cldfb_ener_offset_32 = L_deposit_l( cldfb_ener_offset ); /* Q14 in 32bit var */ cldfb_ener_offset_32 = L_shl( cldfb_ener_offset_32, 25 - 14 ); /* Q14 -> Q25 */ #ifdef FIX_2493_CHECK_EXTRACT_L mean_NB = extract_l2( L_shr( L_add( mean_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_NB = extract_l2( L_shr( L_add( max_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ mean_WB = extract_l2( L_shr( L_add( mean_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_WB = extract_l2( L_shr( L_add( max_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_NB = extract_l( L_shr( L_add( mean_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_NB = extract_l( L_shr( L_add( max_NB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ mean_WB = extract_l( L_shr( L_add( mean_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_WB = extract_l( L_shr( L_add( max_WB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif /*if WB */ IF( EQ_32( st->input_Fs, 16000 ) ) Loading Loading @@ -453,8 +459,13 @@ void bw_detect_fx( L_tmp = L_add( L_tmp, L_shr( *pt32++, 2 ) ); mean_SWB32 = L_add( L_tmp, L_shr( *pt32++, 2 ) ); #ifdef FIX_2493_CHECK_EXTRACT_L mean_SWB = extract_l2( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l2( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_SWB = extract_l( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif } ELSE { /* FB */ Loading @@ -467,8 +478,13 @@ void bw_detect_fx( L_tmp = L_add( L_tmp, L_shr( *pt32++, 2 ) ); mean_SWB32 = L_add( L_tmp, L_shr( *pt32++, 2 ) ); #ifdef FIX_2493_CHECK_EXTRACT_L mean_SWB = extract_l2( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l2( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_SWB = extract_l( L_shr( L_add( mean_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_SWB = extract_l( L_shr( L_add( max_SWB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif /* FB: 16,4 - 19,6 kHz, 8 cldfb-bands (2 bins) */ Loading @@ -478,8 +494,13 @@ void bw_detect_fx( L_tmp = L_shr( *pt32++, 1 ); mean_FB32 = L_add( L_tmp, L_shr( *pt32++, 1 ) ); #ifdef FIX_2493_CHECK_EXTRACT_L mean_FB = extract_l2( L_shr( L_add( mean_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_FB = extract_l2( L_shr( L_add( max_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #else mean_FB = extract_l( L_shr( L_add( mean_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ max_FB = extract_l( L_shr( L_add( max_FB32, cldfb_ener_offset_32 ), 25 - 11 ) ); /* (Q25 + Q25) -> Q11 */ #endif } } } Loading
lib_enc/cng_enc_fx.c +30 −6 Original line number Diff line number Diff line Loading @@ -349,7 +349,11 @@ void CNG_enc_fx( L_tmp = L_sub( L_tmp, L_add( L_deposit_l( hTdCngEnc->cng_lsp_hist_fx[max_idx[0] * M + i] ), L_deposit_l( hTdCngEnc->cng_lsp_hist_fx[max_idx[1] * M + i] ) ) ); /*Q15 */ tmpv = div_s( 1, sub( hDtxEnc->cng_hist_size, 2 ) ); /*Q15 */ L_tmp = Mpy_32_16_1( L_tmp, tmpv ); /*Q15 */ #ifdef FIX_2493_CHECK_EXTRACT_L lsp_new[i] = extract_l2( L_tmp ); /*Q15 */ #else lsp_new[i] = extract_l( L_tmp ); /*Q15 */ #endif move16(); } max_idx1[0] = max_idx[0]; Loading Loading @@ -696,7 +700,11 @@ void CNG_enc_fx( L_tmp = L_sub( L_tmp, L_deposit_l( tmp[max_idx[0] * M + i] ) ); tmpv = div_s( 1, sub( m, 1 ) ); /*Q15 */ L_tmp = Mpy_32_16_1( L_tmp, tmpv ); /*Q15 */ #ifdef FIX_2493_CHECK_EXTRACT_L lsp_tmp[i] = extract_l2( L_tmp ); /*Q15 */ #else lsp_tmp[i] = extract_l( L_tmp ); /*Q15 */ #endif move16(); } } Loading @@ -713,7 +721,11 @@ void CNG_enc_fx( L_tmp = L_sub( L_tmp, L_add( L_deposit_l( tmp[max_idx[0] * M + i] ), L_deposit_l( tmp[max_idx[1] * M + i] ) ) ); /*Q15 */ tmpv = div_s( 1, sub( m, 2 ) ); /*Q15 */ /*Q15 */ L_tmp = Mpy_32_16_1( L_tmp, tmpv ); /*Q15 */ /*Q15 */ #ifdef FIX_2493_CHECK_EXTRACT_L lsp_tmp[i] = extract_l2( L_tmp ); /*Q15 */ /*Q15 */ #else lsp_tmp[i] = extract_l( L_tmp ); /*Q15 */ /*Q15 */ #endif move16(); } } Loading Loading @@ -861,7 +873,11 @@ void CNG_enc_fx( att = mult( ftmp_fx, 5461 ); /* Q15 */ L_tmp = L_mult( att, 8 ); /* Q16 */ #ifdef FIX_2493_CHECK_EXTRACT_L tmp1 = extract_l2( L_shr( L_tmp, 2 ) ); /* Q14 */ #else tmp1 = extract_l( L_shr( L_tmp, 2 ) ); /* Q14 */ #endif tmp1 = add( 16384, tmp1 ); att = div_s( 16374, tmp1 ); /* Q15 */ Loading Loading @@ -1152,7 +1168,11 @@ void CNG_enc_fx( /* calculate the energy quantization index */ enr_index = add( enr, 512 /* Q8(2.0) */ ); /* enr + 2.0 */ #ifdef FIX_2493_CHECK_EXTRACT_L enr_index = extract_l2( L_shr( L_mult0( enr_index, step ), 12 + 8 ) ); /* Q0 (8+12-(8+12)) */ #else enr_index = extract_l( L_shr( L_mult0( enr_index, step ), 12 + 8 ) ); /* Q0 (8+12-(8+12)) */ #endif /* limit the energy quantization index */ enr_index = s_min( enr_index, maxl ); Loading Loading @@ -1736,7 +1756,11 @@ static Word16 shb_DTX_fx( apply_scale( &att_fx32, st->hFdCngEnc->hFdCngCom->CngBandwidth, st->hFdCngEnc->hFdCngCom->CngBitrate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); // Q23; #ifdef FIX_2493_CHECK_EXTRACT_L att_fx = extract_l2( L_shr( att_fx32, 15 ) ); // Q8 #else att_fx = extract_l( L_shr( att_fx32, 15 ) ); // Q8 #endif } ELSE { Loading