diff --git a/lib_com/options.h b/lib_com/options.h index 8a960be74c8eabf6ed3bf9ddfcd4e7bae2d7716b..7e8d91b52e88297911762785a056dde4a46f13a3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -135,6 +135,7 @@ #define FIX_736_BWE_SECT_C // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE #define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP #define FIX_747_TDBWE_ENERGY_BURST +#define FIX_770_DISCONTINUITIES_SW_TCX2ACELP // Fix discontinuities when switching from TCX to ACELP /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index a1c1db2946b2a566ede99d83f563b34e6a2e02ce..ffe9f5a69a84d42614f03c93b276b5208c0d5f31 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -85,6 +85,7 @@ ivas_error core_switching_pre_dec_ivas_fx( /* Codec mode switching */ IF( EQ_16( st->last_codec_mode, MODE2 ) || ( ( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) ) && GT_16( st->element_mode, EVS_MONO ) ) ) { +#ifndef FIX_770_DISCONTINUITIES_SW_TCX2ACELP Copy( st->mem_syn2_fx, st->mem_syn1_fx, M ); set16_fx( st->agc_mem_fx, 0, 2 ); st->mem_deemph_fx = st->syn[M]; @@ -97,7 +98,30 @@ ivas_error core_switching_pre_dec_ivas_fx( st->hBPF->pst_mem_deemp_err_fx = 0; move32(); } - st->psf_lp_noise_fx = round_fx(L_shl(st->lp_noise, 1)); +#else + st->mem_deemph_fx = st->syn[M]; + move16(); + set16_fx( st->agc_mem_fx, 0, 2 ); + Scale_sig( &( st->mem_deemph_fx ), 1, st->Q_syn ); /* Brings mem_deemph to Qsyn */ + + Copy_Scale_sig( st->mem_syn2_fx, st->mem_syn1_fx, M, sub( -1, st->Q_syn ) ); /*Q-1*/ + + st->bpf_off = 1; + move16(); + IF( st->hPFstat != NULL ) + { + Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, st->Q_syn ); /* Post_filter mem */ + Scale_sig( st->hPFstat->mem_res2, DECMEM_RES2, st->Q_syn ); /* NB post_filter mem */ + Scale_sig( st->hPFstat->mem_stp, L_SUBFR, st->Q_syn ); /* Post_filter mem */ + set16_fx( st->hBPF->pst_old_syn_fx, 0, NBPSF_PIT_MAX ); /* BPF mem*/ + } + IF( st->hBPF != NULL ) + { + st->hBPF->pst_lp_ener_fx = round_fx( L_shl( Mpy_32_16_1( st->lp_error_ener, 0x6054 ), 2 + 8 ) ); /* convert from 15Q16, log2 -> 7Q8 10*log10 */ + st->hBPF->pst_mem_deemp_err_fx = 0; + } +#endif + st->psf_lp_noise_fx = round_fx( L_shl( st->lp_noise, 1 ) ); move16(); /* reset old HB synthesis buffer */