diff --git a/lib_com/options.h b/lib_com/options.h index 5dca1a6a4a36781e06864446ccb936205bc6ec6d..208ca7b72508eded11569ead998020c559429aea 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -103,6 +103,7 @@ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_BASOP_2351_EXTREND_SCALE /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */ #define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE /* FhG: Fix issue 2331: Uninitialized variable */ +#define FIX_2362_TOTAL_BRATE_CALCULATION /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index ca73c275259dbfc7eb07c5c977f628a9730b34ca..6e7455d638a3ce3a16aef14950e5274e80ce177c 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -630,7 +630,17 @@ ivas_error ivas_cpe_enc_fx( { sts[n]->bits_frame_nominal = extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); /* Q0 */ sts[n]->bits_frame_channel = idiv1616( extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ), n_CoreChannels ); /* Q0 */ - sts[n]->total_brate = L_shl( div_l( hCPE->element_brate, n_CoreChannels ), 1 ); /* Q0 */ +#ifdef FIX_2362_TOTAL_BRATE_CALCULATION + /* sts[n]->total_brate = hCPE->element_brate / n_CoreChannels; */ + assert( n_CoreChannels == 1 || n_CoreChannels == 2 ); + sts[n]->total_brate = hCPE->element_brate; + if ( n_CoreChannels == 2 ) + { + sts[n]->total_brate = L_shr( hCPE->element_brate, 1 ); + } +#else + sts[n]->total_brate = L_shl( div_l( hCPE->element_brate, n_CoreChannels ), 1 ); /* Q0 */ +#endif move32(); move16(); move16();