Commit d1e1e639 authored by Jan Kiene's avatar Jan Kiene
Browse files

port MR 1291 from float

switch order of setting the BW for MDCT-St and IGF reconfig
parent 61d20540
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@
#define FIX_940_DEBUGGING_VARIABLE                      /* Nokia: issue #940: remove debugging variable */
#define NONBE_FIX_931_IGF_STEREO_DEC_NOISE	                  /* FhG: issue #931: fix noise substitution in the stereo IGF decoder      */
#define FIX_CRASH_LONG_BRIR                             /* Orange : Fix crash when long BRIR is set */
#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 BASOP porting switches ############################ */

+18 −0
Original line number Diff line number Diff line
@@ -555,6 +555,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++ )
    {
@@ -569,6 +570,7 @@ ivas_error ivas_cpe_enc(
        }
    }

#endif
    if ( hCPE->element_mode == IVAS_CPE_MDCT && st_ivas->hMCT == NULL )
    {
        /* set coded BW for MDCT stereo */
@@ -590,6 +592,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++ )
    {