From 0eb72f45d2a89bccf734839c6a833d5c117bd2bc Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 13 Apr 2026 21:10:03 +0200 Subject: [PATCH] fix for wrong calculation of cp_bitrate --- lib_com/options.h | 1 + lib_enc/ivas_mct_enc_fx.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c274abb89..d1703c68a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -108,6 +108,7 @@ #define FIX_BASOP_2513_EXTRA_RETURN_REND_OPEN /* Nokia: BASOP issue 2513: Removes extra return block */ #define FIX_BASOP_2514_EFAP_PORTING_ERROR /* Nokia: BASOP issue 2514: Fix wrongly ported line */ #define FIX_BASOP_2516_REND_CUSTOM_LAYOUT_PORT_BUG /* Nokia: BASOP issue 2516: Fix porting bug in setting planar state for custom layout in renderer */ +#define FIX_BASOP_2531_MCT_CP_BITRATE /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index 091b8c6b2..3f70a806c 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -234,13 +234,24 @@ ivas_error ivas_mct_enc_fx( IF( NE_32( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate ) ) { Word32 cp_bitrate; +#ifdef FIX_BASOP_2531_MCT_CP_BITRATE + Word32 L_tmp; +#endif // cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; +#ifdef FIX_BASOP_2531_MCT_CP_BITRATE + iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), hMCT->nchan_out_woLFE, &cp_bitrate, &L_tmp, 0 ); +#else cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, hMCT->nchan_out_woLFE ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b)) +#endif IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { // cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; +#ifdef FIX_BASOP_2531_MCT_CP_BITRATE + iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), st_ivas->nchan_transport, &cp_bitrate, &L_tmp, 0 ); +#else cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, st_ivas->nchan_transport ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b)) +#endif } IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) -- GitLab