diff --git a/lib_com/options.h b/lib_com/options.h index 499a45afcaccdbf438b8eba5bbfc75c275211997..d0aff82d43330b8cae4cd12ccb9befeecc396584 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -126,6 +126,7 @@ #define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ #define FIX_BASOP_2531_MCT_CP_BITRATE /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */ #define FIX_BASOP_2541_OMASA_ENC_FIXES /* Nokia: BASOP issue 2541: Fix function ivas_encode_masaism_metadata_fx */ +#define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 964f90f78de82af2fdfeee9136cf7385669552c6..9869b1c69fae265483149cdfc08b29d4f6113be9 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -666,7 +666,23 @@ ivas_error acelp_core_enc_fx( * Calculation of LP residual (filtering through A[z] filter) *---------------------------------------------------------------*/ +#ifdef FIX_BASOP_2517_CLICK_IN_OMASA_LTV + Word16 scf = sub( norm_arr( inp - M, add( st->L_frame, M ) ), 2 ); + test(); + IF( NE_16( st->element_mode, EVS_MONO ) && GT_16( scf, 0 ) ) + { + Word16 inp_local_acelp[L_FRAME16k + M]; + Copy_Scale_sig( inp - M, inp_local_acelp, add( st->L_frame, M ), scf ); + calc_residu_fx( st, inp_local_acelp + M, res_fx, Aq ); + scale_sig( res_fx, st->L_frame, negate( scf ) ); + } + ELSE + { + calc_residu_fx( st, inp, res_fx, Aq ); + } +#else calc_residu_fx( st, inp, res_fx, Aq ); +#endif calculate_hangover_attenuation_gain_fx( st, &att_fx, vad_hover_flag ); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 80116aa5b5d6df23dd155ca6fec2ae8ad2addc7b..54cc3f443dafc84b9f122237b7cc5e5155871004 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1153,7 +1153,25 @@ void pre_proc_front_ivas_fx( move16(); } +#ifdef FIX_BASOP_2517_CLICK_IN_OMASA_LTV + Word16 inp_local[L_INP_12k8]; + Word16 Q_local; + Word16 offset = (Word16) ( inp_12k8_fx - old_inp_12k8_fx ); + Word16 norm_inp = norm_arr( old_inp_12k8_fx, L_INP_12k8 ); + + IF( GT_16( norm_inp, 0 ) ) + { + Copy_Scale_sig( old_inp_12k8_fx, inp_local, L_INP_12k8, norm_inp ); + Q_local = add( *Q_new, norm_inp ); + analy_lp_fx( inp_local + offset, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, INT_FS_12k8, element_mode, i, Q_local, Q_r ); + } + ELSE + { + analy_lp_fx( inp_12k8_fx, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, INT_FS_12k8, element_mode, i, *Q_new, Q_r ); + } +#else analy_lp_fx( inp_12k8_fx, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, INT_FS_12k8, element_mode, i, *Q_new, Q_r ); +#endif FOR( Word16 idx = 0; idx < M + 1; idx++ ) { diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 019ccca6e5b8f84e64f8d5c7f2936212d60ff338..3033c04184d15ce941de68b2cc1d4ca25d05ef9f 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -932,7 +932,6 @@ void ivas_compute_core_buffers_fx( size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #ifdef NONBE_FIX_ISSUE_2206 scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ - // Scale_sig( st->mem_decim16k_fx, 2 * L_FILT_MAX, sub( -1, Q_old_inp_16k ) ); /* Q(-1) */ Q_tmp = norm_arr( st->mem_decim16k_fx, mem_decim16k_size ); scale_sig( st->mem_decim16k_fx, mem_decim16k_size, Q_tmp );