Commit 4e43ae51 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix bugs in TD-PLC and whitening of noise shape

parent f033b217
Loading
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
    EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
  ====================================================================================*/

#include "cnst.h"
#include "ivas_cnst.h"
#include <assert.h>
#include <stdint.h>
#include "options.h"
@@ -279,7 +281,7 @@ void con_tcx(
        st->bpf_gain_param = 0;

        /* PLC: calculate damping factor */
        alpha = Damping_fact( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 );
        alpha = Damping_fact( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), ACELP_CORE );

        if ( st->nbLostCmpt == 1 )
        {
@@ -338,7 +340,7 @@ void con_tcx(
        set_f( pitch_buf, (float) L_SUBFR, st->nb_subfr );

        /* PLC: calculate damping factor */
        alpha = Damping_fact( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 );
        alpha = Damping_fact( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), ACELP_CORE );
    }

    /*-----------------------------------------------------------------*
@@ -548,17 +550,7 @@ void con_tcx(
#ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE
    if ( A_cng != NULL )
    {
        if ( ( st->nbLostCmpt == 1 && st->idchan == 0 ) || ( st->nbLostCmpt == 2 && st->idchan == 1 ) )
        {
            float lsp_cng[M];

            lpc_from_spectrum( st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->startBand, st->hFdCngDec->hFdCngCom->stopFFTbin, 0.f );

            a2lsp_stab( st->hFdCngDec->hFdCngCom->A_cng, lsp_cng, st->lspold_cng );
            mvr2r( lsp_cng, st->lspold_cng, M );
        }

        if ( alpha != 1.0f )
        if ( st->plcBackgroundNoiseUpdated && alpha != 1.0f )
        {
            float lsp_local[M], lsp_fade[M], alpha_inv;

+1 −1
Original line number Diff line number Diff line
@@ -519,7 +519,7 @@ void ApplyFdCng(
                    {
                        TonalMdctConceal_whiten_noise_shape( st, L_frame, ON_FIRST_LOST_FRAME );
                    }
                    else if ( st->element_mode != IVAS_CPE_MDCT )
                    else if ( st->element_mode != IVAS_CPE_MDCT || st->core == ACELP_CORE )
                    {
                        lpc_from_spectrum( hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, 0.f );
                        a2lsp_stab( hFdCngCom->A_cng, lsp_cng, st->lspold_cng );
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ ivas_error ivas_core_dec(
            /* On first good frame after frameloss undo the whitening of the bg noise shape */
            for ( n = 0; n < n_channels; ++n )
            {
                if ( sts[n]->last_core != ACELP_CORE )
                if ( sts[n]->last_core_bfi != ACELP_CORE )
                {
                    TonalMdctConceal_whiten_noise_shape( sts[n], L_FRAME16k, ON_FIRST_GOOD_FRAME );
                }