Commit 52db5e8c authored by vaillancour's avatar vaillancour
Browse files

Proposed fix to 770, fix discontinuities when going from TCX to ACELP

parent 4edf911f
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 */
+25 −1
Original line number Diff line number Diff line
@@ -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,6 +98,29 @@ ivas_error core_switching_pre_dec_ivas_fx(
            st->hBPF->pst_mem_deemp_err_fx = 0;
            move32();
        }
#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();