From d1e1e639599ea7f221ca891ae8614c52470d6c9c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 14 Apr 2025 09:40:35 +0200 Subject: [PATCH] port MR 1291 from float switch order of setting the BW for MDCT-St and IGF reconfig --- lib_com/options.h | 1 + lib_enc/ivas_cpe_enc.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 1be21d8c9..db7d9d999 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -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 ############################ */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index e6ed38c70..fbd3402c6 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -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++ ) { -- GitLab