diff --git a/lib_com/options.h b/lib_com/options.h index 5cb264d3579b46f327521a9c77cb3bc78c583f83..475df11b7327d7919108a408d28efcc1d90b44bc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,6 +163,7 @@ #define FIX_844_Q_SYN_INIT /* VA : proposed fix to 844, initializing q_old_synth when switching to MDCT*/ #define FIX_839_FB_CONTENT_SOMETIME_MISSING /* VA : Fix scaling error for FB TB BWE */ #define FIX_846_TILT_BWE /* VA : Proposed fix to 846, to solve saturation */ +#define FIX_843_LOW_RATE_BWE /* VA : Proposed fix to 843 to solve mid band noise */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index db5a5176991239fc2bc4f0f42142630dd0fb62b6..8eb83ce1ab41d7043a5116ab9dee5b43c9ad4287 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1187,7 +1187,11 @@ ivas_error acelp_core_dec_ivas_fx( /* Core synthesis at 12.8kHz or 16kHz */ i = 1; move16(); +#ifdef FIX_843_LOW_RATE_BWE + if ( st->coder_type == INACTIVE && st->element_mode == EVS_MONO ) +#else if ( st->coder_type == INACTIVE ) +#endif { i = 0; move16(); @@ -2121,9 +2125,15 @@ ivas_error acelp_core_dec_ivas_fx( Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); #endif #ifdef FIX_774_ENERGY_BURST +#ifdef FIX_843_LOW_RATE_BWE + hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, + psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1, + st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode ); +#else hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1, st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode ); +#endif #else hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp, diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 0d1e8b9d7b79fa3501bb0792fea954ccb213cf91..bf3b6da3435be349ddac66cfb3ac33a1331cb5e2 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -315,6 +315,10 @@ void tdm_low_rate_dec_fx( edct_16fx( exc_wo_nf_fx, exc_wo_nf_fx, L_FRAME, find_guarded_bits_fx( L_FRAME ), IVAS_CPE_TD ); +#ifdef FIX_843_LOW_RATE_BWE + Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx, + L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type ); +#endif /*----------------------------------------------------------------------* * Remove potential pre-echo in case an onset has been detected *----------------------------------------------------------------------*/ diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index f72e89398f26795e589c932348ad949ab175f7f6..765458a90a9f76db61b11812ca0590152c810b99 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -368,7 +368,9 @@ Word16 ivas_wb_bwe_dec_fx( Word16 scl, new_input_fx_exp; Word16 i; FD_BWE_DEC_HANDLE hBWE_FD; - +#ifdef FIX_843_LOW_RATE_BWE + Word16 ysynth_frame_size; +#endif Word16 coder_type = st_fx->coder_type; move16(); @@ -389,6 +391,9 @@ Word16 ivas_wb_bwe_dec_fx( *Qpost = sub( new_input_fx_exp, 15 ); move16(); direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, /*st->L_frame*/ L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); +#ifdef FIX_843_LOW_RATE_BWE + ysynth_frame_size = L_FRAME16k; +#endif } ELSE { @@ -398,10 +403,15 @@ Word16 ivas_wb_bwe_dec_fx( *Qpost = sub( new_input_fx_exp, 15 ); move16(); /* DCT of the ACELP core synthesis */ +#ifdef FIX_843_LOW_RATE_BWE + direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode ); + ysynth_frame_size = output_frame; +#else #ifdef MSAN_FIX direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); #else direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode ); +#endif #endif } /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */ @@ -411,18 +421,26 @@ Word16 ivas_wb_bwe_dec_fx( { /* Yes */ /* Calc Room to Upscale */ +#ifdef FIX_843_LOW_RATE_BWE + Q_syn = Find_Max_Norm32( ysynth_32, ysynth_frame_size ); +#else #ifdef MSAN_FIX Q_syn = Find_Max_Norm32( ysynth_32, L_FRAME16k ); #else Q_syn = Find_Max_Norm32( ysynth_32, output_frame ); +#endif #endif /* Stay within MAX_Q_NEW_INPUT */ scl = s_min( Q_syn, scl ); } +#ifdef FIX_843_LOW_RATE_BWE + Copy_Scale_sig32_16( ysynth_32, ysynth_fx, ysynth_frame_size, scl ); +#else #ifdef MSAN_FIX Copy_Scale_sig32_16( ysynth_32, ysynth_fx, L_FRAME16k, scl ); #else Copy_Scale_sig32_16( ysynth_32, ysynth_fx, output_frame, scl ); +#endif #endif Q_syn = add( sub( new_input_fx_exp, 16 ), scl ); IF( !st_fx->bfi )