From 41970fb67a97fe70ae55895fe2b1fd8c39c52123 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 5 Oct 2023 14:39:01 +0200 Subject: [PATCH 1/2] fix crashes for unified stereo and MASA 2TC at 24.4 kbps due to missing IGF (re-)allocation --- lib_com/options.h | 1 + lib_enc/ivas_cpe_enc.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) mode change 100644 => 100755 lib_com/options.h mode change 100644 => 100755 lib_enc/ivas_cpe_enc.c diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index ae0fc10140..57819d6260 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,6 +179,7 @@ #define NONBE_FIX_841_MC_RS_TDOBJ_RENDERER /* FhG: Issue #841: [Non-BE] Resolve "MC RS HRFT handle not set to NULL" */ #define NONBE_FIX_840_PARAMMC_RS /* FhG: Issue #840: Resolve "MC RS ParamMC hoa encoder wrongly set to zero" */ #define NONBE_FIX_826_JBM_MASA_CNA_CNG /* FhG: issue #826: Resolve "JBM MASA: CNA and CNG not in sync with non-JBM decoding" */ +#define NONBE_FIX_838_CRASH_24_4_WB /* FhG: Issue 838: fix encoder crashes for Unified Stereo and MASA 2 TC at 24.4 kbps WB due to missing IGF (re-) allocation */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c old mode 100644 new mode 100755 index 3ce250c3de..4d2d47f3e6 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -110,6 +110,9 @@ ivas_error ivas_cpe_enc( ivas_error error; int32_t cpe_brate; int32_t element_brate_ref; +#ifdef NONBE_FIX_838_CRASH_24_4_WB + int16_t last_bits_frame_nominal; +#endif error = IVAS_ERR_OK; @@ -123,6 +126,9 @@ ivas_error ivas_cpe_enc( input_Fs = hEncoderConfig->input_Fs; ivas_total_brate = hEncoderConfig->ivas_total_brate; element_brate_ref = hCPE->element_brate; +#ifdef NONBE_FIX_838_CRASH_24_4_WB + last_bits_frame_nominal = sts[0]->bits_frame_nominal; +#endif /*------------------------------------------------------------------* * Initialization - general @@ -521,7 +527,15 @@ ivas_error ivas_cpe_enc( /* IGF reconfiguration */ for ( n = 0; n < n_CoreChannels; n++ ) { +#ifdef NONBE_FIX_838_CRASH_24_4_WB + 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 ) ) +#else if ( ( hCPE->last_element_brate != hCPE->element_brate || sts[n]->last_bwidth != sts[n]->bwidth ) && ( n == 0 || hCPE->element_mode == IVAS_CPE_MDCT ) ) +#endif { 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 ); -- GitLab From d65269ec03314233345d004c5901d136d77cf7fe Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 5 Oct 2023 15:12:35 +0200 Subject: [PATCH 2/2] clang format --- lib_enc/ivas_cpe_enc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) mode change 100755 => 100644 lib_enc/ivas_cpe_enc.c diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c old mode 100755 new mode 100644 index 4d2d47f3e6..b5d9d3cc6b --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -528,11 +528,7 @@ ivas_error ivas_cpe_enc( for ( n = 0; n < n_CoreChannels; n++ ) { #ifdef NONBE_FIX_838_CRASH_24_4_WB - 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 ) ) + 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 ) ) #else if ( ( hCPE->last_element_brate != hCPE->element_brate || sts[n]->last_bwidth != sts[n]->bwidth ) && ( n == 0 || hCPE->element_mode == IVAS_CPE_MDCT ) ) #endif -- GitLab