Commit 3b169b01 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

update as per latest main

parents e2bf1c22 eebddcf6
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -161,6 +161,8 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1285_RENDER_CONFIG_PTR_COMPARE              /* Philips: Warning about pointer comparison in the render config reader */
#define FIX_1298_MEMORY_OPT_IVAS_CORE_ENC               /* VA: issue 1298: Memory saving in ivas_core_enc() */
#define SIMPLIFY_IVAS_CORE                              /* VA: simplify ivas core coder functions */

/* #################### End BE switches ################################## */

@@ -172,6 +174,7 @@
#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ 
#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING           /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms  in PhECU-PLC  */
#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN                 /*Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer*/  
#define NONBE_1289_STEREO_SW_TO_MONO                    /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */

/* ##################### End NON-BE switches ########################### */

+7 −5
Original line number Diff line number Diff line
@@ -5909,7 +5909,9 @@ ivas_error core_switching_post_dec(
    float *synth,       /* i/o: output synthesis                        */
    float *output,      /* i/o: LB synth/upsampled LB synth             */
    float output_mem[], /* i  : OLA memory from last TCX/HQ frame       */
#ifndef SIMPLIFY_IVAS_CORE
    const IVAS_FORMAT ivas_format, /* i  : IVAS format                             */
#endif
    const int16_t use_cldfb_for_dft,     /* i  : flag to use of CLDFB for DFT Stereo     */
    const int16_t output_frame,          /* i  : frame length                            */
    const int16_t core_switching_flag,   /* i  : ACELP->HQ switching frame flag          */
+11 −5
Original line number Diff line number Diff line
@@ -557,7 +557,9 @@ ivas_error core_switching_post_dec(
    float *synth,       /* i/o: output synthesis                    */
    float *output,      /* i/o: LB synth/upsampled LB synth         */
    float output_mem[], /* i  : OLA memory from last TCX/HQ frame   */
#ifndef SIMPLIFY_IVAS_CORE
    const IVAS_FORMAT ivas_format, /* i  : IVAS format                         */
#endif
    const int16_t use_cldfb_for_dft,     /* i  : flag to use of CLDFB for DFT Stereo */
    const int16_t output_frame,          /* i  : frame length                        */
    const int16_t core_switching_flag,   /* i  : ACELP->HQ switching flag            */
@@ -679,7 +681,11 @@ ivas_error core_switching_post_dec(
                    synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta;
                }

#ifdef SIMPLIFY_IVAS_CORE
                if ( ( st->element_mode == IVAS_CPE_MDCT || ( st->is_ism_format && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 )
#else
                if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 )
#endif
                {
                    /* smooth transitions to avoid pops in car noise items */
                    smoothTransitionDtxToTcx( synth, output_frame, delay_comp );
+4 −1
Original line number Diff line number Diff line
@@ -274,12 +274,15 @@ ivas_error evs_dec(
         * Postprocessing for ACELP/MDCT core switching
         *---------------------------------------------------------------------*/

#ifdef SIMPLIFY_IVAS_CORE
        if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK )
#else
        if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, MONO_FORMAT, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }


        /*---------------------------------------------------------------------*
         * Pre-processing for bandwidth switching
         *---------------------------------------------------------------------*/
+53 −5
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@ ivas_error ivas_core_dec(
    Decoder_State **sts, *st;
    STEREO_ICBWE_DEC_HANDLE hStereoICBWE;
    STEREO_TD_DEC_DATA_HANDLE hStereoTD;
#ifdef SIMPLIFY_IVAS_CORE
    STEREO_CNG_DEC_HANDLE hStereoCng;
#endif
    int16_t sharpFlag[CPE_CHANNELS];
    float synth[CPE_CHANNELS][L_FRAME48k];
    float tmp_buffer[L_FRAME48k];
@@ -115,6 +118,9 @@ ivas_error ivas_core_dec(
        last_element_brate = hSCE->last_element_brate; /* note: this parameter is unused */
        last_element_mode = IVAS_SCE;
        hStereoTD = NULL;
#ifdef SIMPLIFY_IVAS_CORE
        hStereoCng = NULL;
#endif
        p_output_mem = NULL;
        nchan_out = 1;
        if ( st_ivas != NULL && st_ivas->ivas_format == ISM_FORMAT )
@@ -133,6 +139,9 @@ ivas_error ivas_core_dec(
        last_element_mode = hCPE->last_element_mode;
        hStereoICBWE = hCPE->hStereoICBWE;
        hStereoTD = hCPE->hStereoTD;
#ifdef SIMPLIFY_IVAS_CORE
        hStereoCng = hCPE->hStereoCng;
#endif
        p_output_mem = hCPE->output_mem[1];
        nchan_out = hCPE->nchan_out;

@@ -226,7 +235,11 @@ ivas_error ivas_core_dec(
    } /* n_channels loop */

    /* MDCT stereo -> DFT stereo switching */
#ifdef SIMPLIFY_IVAS_CORE
    if ( last_element_mode == IVAS_CPE_MDCT && sts[0]->element_mode == IVAS_CPE_DFT )
#else
    if ( hCPE != NULL && hCPE->last_element_mode == IVAS_CPE_MDCT && hCPE->element_mode == IVAS_CPE_DFT )
#endif
    {
        int16_t ovl, fade_len;
        if ( sts[0]->L_frame != sts[0]->last_L_frame )
@@ -243,19 +256,23 @@ ivas_error ivas_core_dec(
        }
    }

#ifdef SIMPLIFY_IVAS_CORE
    if ( hStereoCng != NULL )
    {
        hStereoCng->flag_cna_fade = 0;
    }
#else
    if ( hCPE != NULL && hCPE->hStereoCng != NULL )
    {
        hCPE->hStereoCng->flag_cna_fade = 0;
    }
#endif

    save_hb_synth = NULL;
    if ( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG )
    {
        save_hb_synth = hSCE->save_hb_synth;
    }
    else
    {
        save_hb_synth = NULL;
    }

    /*------------------------------------------------------------------*
     * Decode SID for MDCT-Stereo DTX mode
@@ -279,7 +296,11 @@ ivas_error ivas_core_dec(

    if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 )
    {
#ifdef SIMPLIFY_IVAS_CORE
        ivas_combined_format_brate_sanity( element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps );
#else
        ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps );
#endif
    }

    /*------------------------------------------------------------------*
@@ -348,7 +369,11 @@ ivas_error ivas_core_dec(
        if ( st->core == ACELP_CORE )
        {
            /* ACELP core decoder */
#ifdef SIMPLIFY_IVAS_CORE
            if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ) != IVAS_ERR_OK )
#else
            if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -356,7 +381,7 @@ ivas_error ivas_core_dec(

        if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT )
        {
            /* TCX decoder */
            /* TCX core decoder */
            stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format );
        }

@@ -420,10 +445,17 @@ ivas_error ivas_core_dec(
     * Stereo CNG updates
     *---------------------------------------------------------------------*/

#ifdef SIMPLIFY_IVAS_CORE
    if ( sts[0]->element_mode == IVAS_CPE_TD && hStereoCng != NULL )
    {
        stereo_cng_compute_PScorr( output, &hStereoCng->c_PS_LT, sts[0]->L_frame, sts[1]->L_frame );
    }
#else
    if ( sts[0]->element_mode == IVAS_CPE_TD && hCPE->hStereoCng != NULL )
    {
        stereo_cng_compute_PScorr( output, &hCPE->hStereoCng->c_PS_LT, sts[0]->L_frame, sts[1]->L_frame );
    }
#endif

    /*---------------------------------------------------------------------*
     * Postprocessing, BWEs and updates
@@ -462,7 +494,11 @@ ivas_error ivas_core_dec(
            mvr2r( synth[n], hSCE->save_synth, output_frame );
        }

#ifdef SIMPLIFY_IVAS_CORE
        if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode ) ) != IVAS_ERR_OK )
#else
        if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -474,7 +510,11 @@ ivas_error ivas_core_dec(
        }

        /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */
#ifdef SIMPLIFY_IVAS_CORE
        if ( n == 0 && st->element_mode == IVAS_CPE_MDCT && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( nchan_out == 1 || last_element_mode == IVAS_CPE_DFT ) )
#else
        if ( n == 0 && st->element_mode == IVAS_CPE_MDCT && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( nchan_out == 1 || ( hCPE != NULL && hCPE->last_element_mode == IVAS_CPE_DFT ) ) )
#endif
        {
            mvr2r( sts[0]->previoussynth, sts[1]->previoussynth, st->hTcxDec->L_frameTCX );
        }
@@ -649,7 +689,11 @@ ivas_error ivas_core_dec(
                mvr2r( tmp_buffer, st->hb_prev_synth_buffer, tmps );
            }

#ifdef SIMPLIFY_IVAS_CORE
            if ( ( st->element_mode != IVAS_CPE_TD && !use_cldfb_for_dft ) || ( st->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) )
#else
            if ( ( st->element_mode != IVAS_CPE_TD && !use_cldfb_for_dft ) || ( hCPE->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) )
#endif
            {
                /* Delay hb_synth */
                delay_signal( hb_synth[n], output_frame, st->hb_prev_synth_buffer, tmps );
@@ -702,7 +746,11 @@ ivas_error ivas_core_dec(
        }
        else /* IVAS_CPE_DFT */
        {
#ifdef SIMPLIFY_IVAS_CORE
            if ( last_element_mode == IVAS_CPE_MDCT )
#else
            if ( hCPE->last_element_mode == IVAS_CPE_MDCT )
#endif
            {
                stereo_mdct2dft_update( hCPE, output[0], synth[0] );
            }
Loading