Commit 1f71cba1 authored by Jan Kiene's avatar Jan Kiene
Browse files

switch order of setting the BW for MDCT-St and IGF reconfig

parent 44277c75
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@
#define NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING                 /* Dlb: issue 907: fix for band mapping at VLBR */
#define NONBE_FIX_869_MASA_PREREND_MERGE                      /* Nokia: issue: #869: MASA pre-rend not updating energy */
#define NONBE_FIX_931_IGF_STEREO_DEC_NOISE	                  /* FhG: issue #931: fix noise substitution in the stereo IGF decoder      */
#define NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW           /* FhG: issue 943: fix crash in BW switchin from WB in MDCT-Stereo core encoder */

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

+18 −0
Original line number Diff line number Diff line
@@ -519,6 +519,7 @@ ivas_error ivas_cpe_enc(
     * Core codec configuration
     *----------------------------------------------------------------*/

#ifndef NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW
    /* IGF reconfiguration */
    for ( n = 0; n < n_CoreChannels; n++ )
    {
@@ -533,6 +534,7 @@ ivas_error ivas_cpe_enc(
        }
    }

#endif
    if ( hCPE->element_mode == IVAS_CPE_MDCT && st_ivas->hMCT == NULL )
    {
        /* set coded BW for MDCT stereo */
@@ -554,6 +556,22 @@ ivas_error ivas_cpe_enc(
        }
    }

#ifdef NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW
    /* IGF reconfiguration */
    for ( n = 0; n < n_CoreChannels; n++ )
    {
        if ( ( hCPE->last_element_brate != hCPE->element_brate || hCPE->element_mode != hCPE->last_element_mode || ( hCPE->element_mode == IVAS_CPE_TD && sts[0]->bits_frame_nominal != last_bits_frame_nominal ) || sts[n]->last_bwidth != sts[n]->bwidth ) && ( n == 0 || hCPE->element_mode == IVAS_CPE_MDCT ) )
        {
            int16_t igf;
            igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->rf_mode );
            if ( ( error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
#endif

    /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */
    for ( n = 0; n < n_CoreChannels; n++ )
    {