Commit e5985295 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Updates for acelp_core_dec

nb_post_filt_ivas, deemph [disabled re-scaling required],
AGC_dec [disabled re-scaling required], Copy_Scale_sig,
formant_post_filt, Residu3, E_UTIL_synthesis, scale_st,
blend_subfr2 functions integarted to acelp call stack.
parent 8bb3cf45
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2481,6 +2481,16 @@ void calc_st_filt(
    const int16_t extl     /* i  : extension layer info                    */
);
#ifdef IVAS_FLOAT_FIXED
static void calc_st_filt_fx(
    Word16 * apond2,      /* i  : coefficients of numerator             */
    Word16 * apond1,      /* i  : coefficients of denominator           */
    Word16 * parcor0,     /* o  : 1st parcor calcul. on composed filter */
    Word16 * sig_ltp_ptr, /* i/o: i  of 1/A(gamma1) : scaled by 1/g0    */
    Word16 * mem_zero,     /* i  : All zero memory                       */
    const int16_t extl     /* i  : extension layer info                  */
);
#endif
void scale_st_ivas(
    const float *sig_in,   /* i  : postfilter input signal                 */
    float *sig_out,        /* i/o: postfilter output signal                */
+23 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ Word16 float_to_fix16( float number, Word16 Q );
// Word16 to Float
float fix16_to_float( Word16 number, Word16 Q );

Word16 float_to_fix16_thrld(float number, Word16 Q);

void floatToFixed_arrL( float * f, Word32* i, Word16 Q, Word16 l);
void floatToFixed_arr( float * f, Word16* i, Word16 Q, Word16 l);
void fixedToFloat_arrL( Word32 *i, float * f, Word16 Q, Word16 l);
@@ -5927,6 +5929,18 @@ void TonalMDCTConceal_Apply(
   const Word16 off_flag    /* i  : off flag                        */
 );

#ifdef IVAS_FLOAT_FIXED
 void formant_post_filt_fx(
     PFSTAT_HANDLE hPFstat,   /* i : core decoder parameters */
     Word16 *synth_in,        /* i  : 12k8 synthesis                    */
     Word16 *Aq,              /* i  : LP filter coefficient             */
     Word16 *synth_out,       /* i/o: i   signal                      */
     Word16 L_frame,
     Word32 lp_noise,         /* (i) : background noise energy (15Q16) */
     Word32 rate,             /* (i) : bit-rate */
     const Word16 off_flag    /* i  : off flag                        */
 );
#endif
 void Filt_mu(
   Word16 * sig_in,        /* i  : signal (beginning at sample -1)     */
   Word16 * sig_out,       /* o  : signal with tilt                    */
@@ -5934,6 +5948,15 @@ void TonalMDCTConceal_Apply(
   Word16 L_subfr          /* i  : the length of subframe              */
 );

#ifdef IVAS_FLOAT_FIXED
 void Filt_mu_fx(
     Word16 * sig_in,        /* i  : signal (beginning at sample -1)     */
     Word16 * sig_out,       /* o  : signal with tilt                    */
     Word16 parcor0,         /* i  : parcor0 (mu = parcor0 * gamma3)     */
     Word16 L_subfr,          /* i  : the length of subframe              */
     const Word16 extl
 );
#endif
 void scale_st(
   const Word16 * sig_in,    /* i  : postfilter i signal             */
   Word16 * sig_out,   /* i/o: postfilter o signal             */
+20 −0
Original line number Diff line number Diff line
@@ -83,6 +83,26 @@ Word16 float_to_fix16( float number, Word16 Q )
    return ret;
}

#ifdef IVAS_FLOAT_FIXED
Word16 float_to_fix16_thrld(float number, Word16 Q)
{
    assert(Q >= 0);
    if (number == 1.0f && Q == Q15)
        return MAX16B;
    float limit = (float)pow(2, 15 - Q);
    /*Add threshold*/
    if (number > MAX16B_FLT) {
        number = MAX16B_FLT;
    }
    else if (number < MIN16B_FLT) {
        number = MIN16B_FLT;
    }
    assert(number <= limit && number >= -limit);
    Word16 ret = (Word16)(number * ((UWord16)1 << Q));
    return ret;
}
#endif

float fix16_to_float( Word16 number, Word16 Q )
{
    assert( Q >= 0 );
+270 −10
Original line number Diff line number Diff line
@@ -36,11 +36,13 @@

#include <stdint.h>
#include <assert.h>
#include <math.h>
#include "options.h"
#include "cnst.h"
#include "rom_com.h"
#include "prot.h"
#include "prot_fx2.h"
#include "prot_fx1.h"
#include "ivas_cnst.h"
#include "ivas_prot.h"
#include "ivas_rom_com.h"
@@ -91,6 +93,7 @@ ivas_error acelp_core_dec(
    float mem_tmp[M];                                                            /* temporary synthesis filter memory     */
    float enr_q;                                                                 /* E information for FER protection      */
    float tmp_noise;                                                             /* Long term temporary noise energy      */

    float Es_pred;                                                               /* predicted scaled innov. energy        */
    float FEC_pitch;                                                             /* FEC pitch                             */
    float old_bwe_exc[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer                     */
@@ -128,6 +131,14 @@ ivas_error acelp_core_dec(
    float *p_tdm_Pri_pitch_buf;
    int16_t local_element_mode;
    ivas_error error;
#ifdef IVAS_FLOAT_FIXED
    Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *syn_fx;
    set_zero(Aq, NB_SUBFR16k * (M + 1));
    Word16 Aq_fx[NB_SUBFR16k * (M + 1)];
    set16_fx(Aq_fx, 0, NB_SUBFR16k * (M + 1));
    Word16 tmp_noise_fx;
    set_zero(temp_buf, L_FRAME16k + L_SYN_MEM);
#endif

    error = IVAS_ERR_OK;

@@ -252,6 +263,11 @@ ivas_error acelp_core_dec(
    LSF_Q_prediction = -1;
    set_f( syn_tmp, 0, L_SUBFR );
    syn = syn_tmp + L_SUBFR;
#ifdef IVAS_FLOAT_FIXED
    set_f(syn_tmp, 0, L_FRAME16k + L_SUBFR);
    set16_fx(syn_tmp_fx, 0, L_SUBFR);
    syn_fx = syn_tmp_fx + L_SUBFR;
#endif
    syn1_tmp[0] = 0;
    syn1_tmp[1] = 0;
    syn1 = syn1_tmp + 2;
@@ -576,11 +592,15 @@ ivas_error acelp_core_dec(
                        st->hFdCngDec->hFdCngCom->sidNoiseEstLp_flt[i] = STEREO_DFT_FD_FILT * st->hFdCngDec->hFdCngCom->sidNoiseEstLp_flt[i] + ( 1 - STEREO_DFT_FD_FILT ) * st->hFdCngDec->hFdCngCom->sidNoiseEst_flt[i];
                    }
#ifdef IVAS_FLOAT_FIXED
                    Word16 syn_fx[L_FRAME16k + L_SUBFR] = { 0 };
                    //Word16 syn_fx[L_FRAME16k + L_SUBFR] = { 0 };
                    st->Q_syn = 0;
                    for ( int p = 0; p < L_FRAME16k; p++ )
                    /*for ( int p = 0; p < L_FRAME16k; p++ )
                    {
                        syn_fx[L_SUBFR + p] = (Word16) ( syn[p] * ( 1u << st->Q_syn ) );
                    }*/
                    for (int p = 0; p < L_FRAME16k; p++)
                    {
                        syn_fx[p] = (Word16)(syn[p] * (1u << st->Q_syn));
                    }
                    for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ )
                    {
@@ -593,7 +613,8 @@ ivas_error acelp_core_dec(
                        st->hFdCngDec->hFdCngCom->sidNoiseEst[p] = (Word32) ( st->hFdCngDec->hFdCngCom->sidNoiseEst_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ) );
                    }

                    ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer, imagBuffer, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                    //ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer, imagBuffer, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                    ApplyFdCng_fx(syn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech));

                    for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ )
                    {
@@ -1116,6 +1137,21 @@ ivas_error acelp_core_dec(
        }
    }

#ifdef IVAS_FLOAT_FIXED
    floatToFixed_arr( Aq, Aq_fx, Q12, NB_SUBFR16k * ( M + 1 ) );
    IF( st->hBWE_TD != NULL )
    {
        IF( EQ_16( st->L_frame, L_FRAME ) )
        {
            Copy( Aq_fx + 2 * ( M + 1 ), st->hBWE_TD->cur_sub_Aq_fx, ( M + 1 ) );
        }
        ELSE
        {
            Copy( Aq_fx + 3 * ( M + 1 ), st->hBWE_TD->cur_sub_Aq_fx, ( M + 1 ) );
        }
        fixedToFloat_arr( st->hBWE_TD->cur_sub_Aq_fx, st->hBWE_TD->cur_sub_Aq, Q12, M + 1 );
    }
#else
    if ( st->hBWE_TD != NULL )
    {
        if ( st->L_frame == L_FRAME )
@@ -1127,11 +1163,86 @@ ivas_error acelp_core_dec(
            mvr2r( Aq + 3 * ( M + 1 ), st->hBWE_TD->cur_sub_Aq, ( M + 1 ) );
        }
    }
#endif

    /*--------------------------------------------------------*
     * Apply NB postfilter in case of 8kHz output
     *--------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED
    Word16 pitch_buf_tmp[NB_SUBFR16k];
    /*----ftf conversions---*/
    st->Q_syn = 0;
    floatToFixed_arr( syn, syn_fx, st->Q_syn, L_FRAME16k );
    tmp_noise_fx = (Word16) floatToFixed( tmp_noise, 0 );
    if ( st->last_bwidth == NB && st->hPFstat != NULL )
    {
        floatToFixed_arr( pitch_buf, pitch_buf_tmp, Q6, NB_SUBFR16k );
        st->psf_lp_noise_fx = (Word16) floatToFixed( st->psf_lp_noise, Q8 );
    }
    st->lp_noise = floatToFixed( st->lp_noise_float, Q23 );
    /*---------------------*/
    test();
    IF( EQ_16( st->last_bwidth, NB ) && st->hPFstat != NULL )
    {
        IF( EQ_16( st->bwidth, NB ) )
        {
            st->hPFstat->on = 1;
#ifdef IVAS_FLOAT_FIXED
            Word16 prev_reset = st->hPFstat->reset;
            move16();
            nb_post_filt( st->L_frame, st->hPFstat, &st->psf_lp_noise_fx, tmp_noise_fx, syn_fx, Aq_fx, pitch_buf_tmp, st->coder_type_fx, st->BER_detect, 0 );
            /*----ftf conversions---*/
            if ( !st->BER_detect )
            {
                if ( st->coder_type_fx == INACTIVE )
                {
                    st->psf_lp_noise = fixedToFloat( st->psf_lp_noise_fx, Q8 );
                }
            }

            if ( prev_reset == 1 )
            {
                st->hPFstat->gain_prec_flt = fixedToFloat( st->hPFstat->gain_prec, Q14 );
                fixedToFloat_arr( st->hPFstat->mem_pf_in, st->hPFstat->mem_pf_in_flt, st->Q_syn, L_SYN_MEM );
                fixedToFloat_arr( st->hPFstat->mem_stp, st->hPFstat->mem_stp_flt, st->Q_syn, L_SYN_MEM );
            }
            /*---------------------*/
#else
            nb_post_filt_ivas( st->L_frame, L_SUBFR, st->hPFstat, &st->psf_lp_noise, tmp_noise, syn, Aq, pitch_buf, st->coder_type, st->BER_detect, 0 );
#endif
        }
        ELSE
        {
            st->hPFstat->on = 0;
#ifdef IVAS_FLOAT_FIXED
            Word16 prev_reset = st->hPFstat->reset;
            nb_post_filt( st->L_frame, st->hPFstat, &st->psf_lp_noise_fx, tmp_noise_fx, syn_fx, Aq_fx, pitch_buf_tmp, AUDIO, st->BER_detect, 0 );

            /*----ftf conversions---*/
            if ( prev_reset == 1 )
            {
                st->hPFstat->gain_prec_flt = fixedToFloat( st->hPFstat->gain_prec, Q14 );
                fixedToFloat_arr( st->hPFstat->mem_pf_in, st->hPFstat->mem_pf_in_flt, st->Q_syn, L_SYN_MEM );
                fixedToFloat_arr( st->hPFstat->mem_stp, st->hPFstat->mem_stp_flt, st->Q_syn, L_SYN_MEM );
            }
            /*---------------------*/
#else
            nb_post_filt_ivas( st->L_frame, L_SUBFR, st->hPFstat, &st->psf_lp_noise, tmp_noise, syn, Aq, pitch_buf, AUDIO, st->BER_detect, 0 );
#endif
        }
    }
    else
    {
#ifdef IVAS_FLOAT_FIXED
        st->psf_lp_noise_fx = round_fx( L_shl( st->lp_noise, 1 ) );
        /*----ftf conversions---*/
        st->psf_lp_noise = fix16_to_float( st->psf_lp_noise_fx, Q8 );
        /*---------------------*/
#else
        st->psf_lp_noise = st->lp_noise_float;
#endif
    }
#else
    if ( st->last_bwidth == NB && st->hPFstat != NULL )
    {
        if ( st->bwidth == NB )
@@ -1149,12 +1260,67 @@ ivas_error acelp_core_dec(
    {
        st->psf_lp_noise = st->lp_noise_float;
    }
#endif

    /*------------------------------------------------------------------*
     * Perform fixed deemphasis through 1/(1 - g*z^-1)
     *-----------------------------------------------------------------*/

    /* update old synthesis buffer - needed for ACELP internal sampling rate switching */
#ifdef IVAS_FLOAT_FIXED
#ifdef IVAS_FLOAT_FIXED
    floatToFixed_arr( syn, syn_fx, st->Q_syn, L_FRAME16k );
    Copy( syn_fx + st->L_frame - L_SYN_MEM, st->mem_syn_r, L_SYN_MEM );
    fixedToFloat_arr( st->mem_syn_r, st->mem_syn_r_float, st->Q_syn, L_SYN_MEM );
#else
    mvr2r( syn + st->L_frame - L_SYN_MEM, st->mem_syn_r_float, L_SYN_MEM );
#endif

#ifdef IVAS_FLOAT_FIXED_S
    floatToFixed_arr( syn, syn_fx, st->Q_syn, L_FRAME16k );
    st->mem_deemph_fx = float_to_fix16_thrld( st->mem_deemph, st->Q_syn );
    st->preemph_fac = float_to_fix16( st->preemph_fac_float, Q15 );

    deemph_fx( syn_fx, st->preemph_fac, st->L_frame, &( st->mem_deemph_fx ) );

    st->mem_deemph = fix16_to_float( st->mem_deemph_fx, st->Q_syn );
    fixedToFloat_arr( syn_fx, syn, st->Q_syn, st->L_frame );
#else
    deemph( syn, st->preemph_fac_float, st->L_frame, &( st->mem_deemph ) );
#endif
#ifdef IVAS_FLOAT_FIXED_S
    Word16 syn_fx_tmp2[L_FRAME_16k];
    unscale_AGC( syn_fx, st->Q_syn, syn_fx_tmp2, st->agc_mem_fx, st->L_frame ); // re-check : removed right shift inside
    Copy( syn_fx_tmp2, syn_fx, st->L_frame );
    for ( i = 0; i < st->L_frame; i++ )
    {
        syn[i] = fix16_to_float( syn_fx[i], st->Q_syn );
    }

    st->agc_mem2[0] = me2f_16( st->agc_mem_fx[0], st->Q_syn - 1 );
    st->agc_mem2[1] = me2f_16( st->agc_mem_fx[1], st->Q_syn - 1 );
#else
    AGC_dec( syn, st->agc_mem2, st->L_frame );
#endif

#ifdef IVAS_FLOAT_FIXED
    floatToFixed_arr( syn, syn_fx, st->Q_syn, L_FRAME16k );

    IF( st->hTcxDec != NULL )
    {
        Copy_Scale_sig( syn_fx + st->L_frame / 2, st->hTcxDec->old_syn_Overl, st->L_frame / 2, sub( -1, st->Q_syn ) ); /*Q-1*/
        fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->Q_syn - 1, st->L_frame / 2 );
    }
    Copy_Scale_sig( syn_fx + st->L_frame - M - 1, st->syn, M + 1, sub( 0, st->Q_syn ) ); /*Q0*/
    fixedToFloat_arr( st->syn, st->syn_float, st->Q_syn, M + 1 );
#else
    if ( st->hTcxDec != NULL )
    {
        mvr2r( syn + st->L_frame / 2, st->hTcxDec->old_syn_Overl_float, st->L_frame / 2 );
    }
    mvr2r( syn + st->L_frame - M - 1, st->syn_float, M + 1 );
#endif
#else
    mvr2r(syn + st->L_frame - L_SYN_MEM, st->mem_syn_r_float, L_SYN_MEM);
    deemph(syn, st->preemph_fac_float, st->L_frame, &(st->mem_deemph));

@@ -1165,11 +1331,100 @@ ivas_error acelp_core_dec(
        mvr2r(syn + st->L_frame / 2, st->hTcxDec->old_syn_Overl_float, st->L_frame / 2);
    }
    mvr2r(syn + st->L_frame - M - 1, st->syn_float, M + 1);
#endif

    /*------------------------------------------------------------------*
     * Formant post-filter
     *-----------------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED
    Word16 temp_buf_fx[L_FRAME16k + L_SYN_MEM];
    test();
    test();
    test();
    IF( st->hPFstat != NULL && GE_16( st->last_bwidth, WB ) && ( GT_32( st->core_brate, ACELP_24k40 ) || GT_16( st->element_mode, EVS_MONO ) ) && LE_32( st->core_brate, ACELP_32k ) )
    {
        st->hPFstat->on = 1;
#ifdef IVAS_FLOAT_FIXED
        /*----ftf conversions---*/
        floatToFixed_arr( syn, syn_fx, st->Q_syn, st->L_frame );
        Copy( syn_fx, temp_buf_fx + L_SYN_MEM, L_FRAME16k );

        for ( i = 0; i < L_SYN_MEM; i++ )
        {
            temp_buf_fx[i] = float_to_fix16_thrld( temp_buf[i], st->Q_syn );
        }
        set16_fx( st->hPFstat->mem_zero, 0, M );
        if ( st->hPFstat )
        {
            floatToFixed_arr( st->hPFstat->mem_pf_in_flt, st->hPFstat->mem_pf_in, st->Q_syn, L_SUBFR );
            floatToFixed_arr( st->hPFstat->mem_stp_flt, st->hPFstat->mem_stp, st->Q_syn, L_SUBFR );
            floatToFixed_arr( st->hPFstat->mem_res2_flt, st->hPFstat->mem_res2, st->Q_syn, DECMEM_RES2 );
            floatToFixed_arr( st->hPFstat->mem_res2_flt, st->hPFstat->mem_res2, st->Q_syn, M );
            st->hPFstat->gain_prec = float_to_fix16( st->hPFstat->gain_prec_flt, Q14 );
        }
        /*---------------------*/

        formant_post_filt_fx( st->hPFstat, temp_buf_fx + L_SYN_MEM, Aq_fx, syn_fx, st->L_frame, st->lp_noise, st->total_brate, 0 );

        /*----ftf conversions---*/
        if ( st->hPFstat )
        {
            fixedToFloat_arr( st->hPFstat->mem_pf_in, st->hPFstat->mem_pf_in_flt, st->Q_syn, L_SUBFR );
            fixedToFloat_arr( st->hPFstat->mem_stp, st->hPFstat->mem_stp_flt, st->Q_syn, L_SUBFR );
            fixedToFloat_arr( st->hPFstat->mem_res2, st->hPFstat->mem_res2_flt, st->Q_syn, DECMEM_RES2 );
            fixedToFloat_arr( st->hPFstat->mem_res2, st->hPFstat->mem_res2_flt, st->Q_syn, M );
            st->hPFstat->gain_prec_flt = fixedToFloat( st->hPFstat->gain_prec, Q14 );
        }
        fixedToFloat_arr( syn_fx, syn, st->Q_syn, st->L_frame );
        /*---------------------*/
#else
        mvr2r( syn, temp_buf + L_SYN_MEM, L_FRAME16k );
        formant_post_filt_ivas( st->hPFstat, temp_buf + L_SYN_MEM, Aq, syn, st->L_frame, L_SUBFR, st->lp_noise_float, st->total_brate, 0 );
#endif
    }
    ELSE IF( st->hPFstat != NULL && GE_16( st->last_bwidth, WB ) )
    {
        IF( st->hPFstat->on )
        {
#ifdef IVAS_FLOAT_FIXED
            /*----ftf conversions---*/
            floatToFixed_arr( st->hPFstat->mem_pf_in_flt, st->hPFstat->mem_pf_in, st->Q_syn, L_SUBFR );
            floatToFixed_arr( syn, syn_fx, st->Q_syn, L_SUBFR );
            floatToFixed_arr( Aq, Aq_fx, Q12, NB_SUBFR16k * ( M + 1 ) );
            /*---------------------*/

            Copy( st->hPFstat->mem_pf_in + L_SYN_MEM - M, temp_buf_fx, M );
            Copy( syn_fx, temp_buf_fx + M, L_SUBFR );

            Residu3_fx( Aq_fx, temp_buf_fx + M, temp_buf_fx + M + L_SUBFR, L_SUBFR, 1 );
            E_UTIL_synthesis( 1, Aq_fx, temp_buf_fx + M + L_SUBFR, temp_buf_fx, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M );
            scale_st( syn_fx, temp_buf_fx, &st->hPFstat->gain_prec, L_SUBFR );
            Copy( temp_buf_fx, syn_fx, L_SUBFR / 2 );
            blend_subfr2( temp_buf_fx + L_SUBFR / 2, syn_fx + L_SUBFR / 2, syn_fx + L_SUBFR / 2 );

            /*----ftf conversions---*/
            if ( st->hPFstat )
            {
                fixedToFloat_arr( st->hPFstat->mem_stp, st->hPFstat->mem_stp_flt, st->Q_syn, L_SUBFR );
                st->hPFstat->gain_prec_flt = fixedToFloat( st->hPFstat->gain_prec, Q14 );
            }

            fixedToFloat_arr( temp_buf_fx, temp_buf, st->Q_syn, L_FRAME16k + L_SYN_MEM );
            fixedToFloat_arr( syn_fx, syn, st->Q_syn, L_SUBFR );
            /*---------------------*/
#else
            mvr2r( st->hPFstat->mem_pf_in_flt + L_SYN_MEM - M, temp_buf, M );
            mvr2r( syn, temp_buf + M, L_SUBFR );
            residu( Aq, M, temp_buf + M, temp_buf + M + L_SUBFR, L_SUBFR );
            syn_filt( Aq, M, temp_buf + M + L_SUBFR, temp_buf, L_SUBFR, st->hPFstat->mem_stp_flt + L_SYN_MEM - M, 0 );
            scale_st_ivas( syn, temp_buf, &st->hPFstat->gain_prec_flt, L_SUBFR, -1 );
            mvr2r( temp_buf, syn, L_SUBFR / 2 );
            blend_subfr2_flt( temp_buf + L_SUBFR / 2, syn + L_SUBFR / 2, syn + L_SUBFR / 2 );
#endif
        }
        st->hPFstat->on = 0;
    }
#else
    if ( st->hPFstat != NULL && st->last_bwidth >= WB && ( st->core_brate > ACELP_24k40 || st->element_mode > EVS_MONO ) && st->core_brate <= ACELP_32k )
    {
        mvr2r( syn, temp_buf + L_SYN_MEM, L_FRAME16k );
@@ -1191,7 +1446,7 @@ ivas_error acelp_core_dec(
        }
        st->hPFstat->on = 0;
    }

#endif
    /*----------------------------------------------------------------*
     * Comfort noise addition
     *----------------------------------------------------------------*/
@@ -1224,11 +1479,15 @@ ivas_error acelp_core_dec(
            {
                /*Noise estimate*/
#ifdef IVAS_FLOAT_FIXED
                Word16 syn_fx[L_FRAME16k + L_SUBFR] = { 0 };
                //Word16 syn_fx[L_FRAME16k + L_SUBFR] = { 0 };
                st->Q_syn = 0;
                for ( int p = 0; p < L_FRAME16k; p++ )
                /*for ( int p = 0; p < L_FRAME16k; p++ )
                {
                    syn_fx[L_SUBFR + p] = (Word16) ( syn[p] * ( 1u << st->Q_syn ) );
                }*/
                for (int p = 0; p < L_FRAME16k; p++)
                {
                    syn_fx[p] = (Word16)(syn[p] * (1u << st->Q_syn));
                }
                for ( int p = 0; p < st->L_frame; p++ )
                {
@@ -1253,7 +1512,8 @@ ivas_error acelp_core_dec(
                }

/*==========================================================*/
                ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                //ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                ApplyFdCng_fx(syn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech));
/*==========================================================*/

                if ( ( ( st->m_frame_type == ACTIVE_FRAME ) && ( ( st->bfi == 0 &&
@@ -1447,11 +1707,11 @@ ivas_error acelp_core_dec(
                    if ( st->idchan == 0 && ( nchan_out == 2 || ( st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40 ) ) )
                    {
#ifdef IVAS_FLOAT_FIXED
                        Word16 syn_fx[L_FRAME16k + L_SUBFR] = { 0 };
                        //Word16 syn_fx[L_FRAME16k + L_SUBFR] = { 0 };
                        st->Q_syn = 0;
                        for ( int p = 0; p < L_FRAME16k; p++ )
                        {
                            syn_fx[L_SUBFR + p] = (Word16) ( syn[p] * ( 1u << st->Q_syn ) );
                            syn_fx[p] = (Word16) ( syn[p] * ( 1u << st->Q_syn ) );
                        }
                        for ( int p = 0; p < st->L_frame; p++ )
                        {
@@ -1475,7 +1735,7 @@ ivas_error acelp_core_dec(
                            st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) );
                        }

                        ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer, imagBuffer, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                        ApplyFdCng_fx( syn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );

                        if ( ( ( st->m_frame_type == ACTIVE_FRAME ) && ( ( st->bfi == 0 &&
                                                                           ( syn_fx == NULL ||
+365 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading