From 79f3aeaea7cbde7cdf8f202cdd24e9e2a74e35fb Mon Sep 17 00:00:00 2001 From: rhb Date: Tue, 28 Nov 2023 14:37:17 +0100 Subject: [PATCH 1/2] fix bitrate mismatch in initial IGF config --- lib_com/options.h | 1 + lib_com/prot.h | 3 +++ lib_enc/core_enc_init.c | 7 +++++++ lib_enc/core_enc_switch.c | 4 ++++ lib_enc/init_enc.c | 4 ++++ 5 files changed, 19 insertions(+) mode change 100644 => 100755 lib_com/options.h mode change 100644 => 100755 lib_com/prot.h diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index 50743d32d7..4e4a0767d8 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,6 +154,7 @@ #define FIX_881_REMOVE_LFE_ADDITION_IN_ISM /* VA: issue 881: remove LFE addition in ISM format */ #define FIX_887_ARRAY_SIZE_DFT_MDCT_STEREO /* VA: Fix the definition of buffers/arrays in DFT and MDCT stereo to satisfy gcc v 11.4.0 */ #define FIX_891_PARAMUPMIX_CLEANUP /* Dlb: issue 891: remove unneeded code from ParamUpmix */ +#define FIX_920_IGF_INIT_ERROR /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot.h b/lib_com/prot.h old mode 100644 new mode 100755 index c795d97f2e..417a173e2d --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -6760,6 +6760,9 @@ float correlation_shift( void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state handle */ const int32_t last_total_brate, /* i : last total bitrate */ +#ifdef FIX_920_IGF_INIT_ERROR + const int32_t igf_brate, /* i : IGF configuration bitrate */ +#endif const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index b307e0361d..7e1f25de7d 100755 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -64,6 +64,9 @@ static void init_modes( Encoder_State *st, const int32_t last_total_brate ); void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state */ const int32_t last_total_brate, /* i : last total bitrate */ +#ifdef FIX_920_IGF_INIT_ERROR + const int32_t igf_brate, /* i : IGF configuration bitrate */ +#endif const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { @@ -154,7 +157,11 @@ void init_coder_ace_plus( if ( st->igf && st->hIGFEnc != NULL ) { +#ifdef FIX_920_IGF_INIT_ERROR + IGFEncSetMode( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode ); +#else IGFEncSetMode( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); +#endif } else if ( st->hIGFEnc != NULL ) { diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index 44952cc1da..df81980d81 100755 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -152,7 +152,11 @@ void core_coder_mode_switch( else { st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); +#ifdef FIX_920_IGF_INIT_ERROR + init_coder_ace_plus( st, last_total_brate, st->total_brate, MCT_flag ); +#else init_coder_ace_plus( st, last_total_brate, MCT_flag ); +#endif } if ( st->igf && st->hBWE_TD != NULL ) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index e722d83500..b441c2b07a 100755 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -825,7 +825,11 @@ ivas_error init_encoder( set_f( st->totalNoise_increase_hist, 0.f, TOTALNOISE_HIST_SIZE ); st->totalNoise_increase_len = 0; +#ifdef FIX_920_IGF_INIT_ERROR + init_coder_ace_plus( st, st->last_total_brate, igf_brate, 0 /* initialization value */ ); +#else init_coder_ace_plus( st, st->last_total_brate, 0 /* initialization value */ ); +#endif /*-----------------------------------------------------------------* * FD-CNG encoder -- GitLab From cf589fa5cfd9f5d8a6a96d69ddcda17e218db42a Mon Sep 17 00:00:00 2001 From: rhb Date: Tue, 28 Nov 2023 14:50:10 +0100 Subject: [PATCH 2/2] clang format --- lib_com/prot.h | 4 ++-- lib_enc/core_enc_init.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) mode change 100755 => 100644 lib_com/prot.h mode change 100755 => 100644 lib_enc/core_enc_init.c diff --git a/lib_com/prot.h b/lib_com/prot.h old mode 100755 new mode 100644 index 417a173e2d..a0a1d8b4a3 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -6761,9 +6761,9 @@ void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state handle */ const int32_t last_total_brate, /* i : last total bitrate */ #ifdef FIX_920_IGF_INIT_ERROR - const int32_t igf_brate, /* i : IGF configuration bitrate */ + const int32_t igf_brate, /* i : IGF configuration bitrate */ #endif - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void core_coder_reconfig( diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c old mode 100755 new mode 100644 index 7e1f25de7d..9d61013db7 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -65,9 +65,9 @@ void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state */ const int32_t last_total_brate, /* i : last total bitrate */ #ifdef FIX_920_IGF_INIT_ERROR - const int32_t igf_brate, /* i : IGF configuration bitrate */ + const int32_t igf_brate, /* i : IGF configuration bitrate */ #endif - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -- GitLab