diff --git a/lib_com/options.h b/lib_com/options.h index c8a0c19c939df01ddc21f323e5566254ee24cba8..ff2a6f5fed4f6c12e473191f0f3b73f079f32950 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,6 +169,7 @@ #define FIX_854_HILBERT_SCALING /* VA: reduce lost of precision due to unnecessary scaling, reduce a lot the 2 kHz tone */ +#define FIX_856_EXTRACT_L /* VA: Fix undesirable wrap-around */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 181bc2e1ad0826e4c18549a2456b96467347e6de..a308d15596b74e9168d564093a36dab1b17518ff 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -838,8 +838,11 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */ L_temp = L_shl( L_temp, sub( exp2, 4 ) ); // Output is expected in Q11 } BASOP_SATURATE_WARNING_ON_EVS - +#ifdef FIX_856_EXTRACT_L + return extract_h( L_shl_sat( L_temp, 16 ) ); +#else return extract_l( L_temp ); +#endif } #endif diff --git a/lib_dec/FEC_HQ_core.c b/lib_dec/FEC_HQ_core.c index 14aa62ef609fd81a8c214989c13ea8a3972ddb7b..17fe13469f79f9f2b974cf23dc4365c003f8b7ee 100644 --- a/lib_dec/FEC_HQ_core.c +++ b/lib_dec/FEC_HQ_core.c @@ -1584,7 +1584,11 @@ void save_synthesis_hq_fec_fx( Copy( st->hTcxDec->synth_history_fx + output_frame, st->hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ) ); FOR( Word16 i = 0; i < output_frame; i++ ) { +#ifdef FIX_856_EXTRACT_L + st->hTcxDec->old_synthFB_fx[sub( add( i, output_frame ), post_hq_delay )] = extract_h( L_shl_sat( output_fx[i], 16 ) ); +#else st->hTcxDec->old_synthFB_fx[sub( add( i, output_frame ), post_hq_delay )] = extract_l( output_fx[i] ); +#endif move16(); } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index e6e9482a65185f60f18bac1eb9cfc660ce604162..5c1d9c5832778871fb5a845f00c0a3a4b9f66526 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -1121,8 +1121,11 @@ void ivas_swb_tbe_dec_fx( /* find tilt */ calc_tilt_bwe_fx_loc( old_syn_12k8_16k_fx, &tilt_swb_fec_32_fx, &tilt_swb_fec_fx_q, L_FRAME ); +#ifdef FIX_856_EXTRACT_L + tilt_swb_fec_fx = round_fx_sat( L_shl_sat( tilt_swb_fec_32_fx, sub( 11 + 16, tilt_swb_fec_fx_q ) ) ); +#else tilt_swb_fec_fx = extract_l( L_shr( tilt_swb_fec_32_fx, sub( tilt_swb_fec_fx_q, 11 ) ) ); - +#endif test(); if ( st->bfi && st->clas_dec != UNVOICED_CLAS ) {