diff --git a/lib_com/options.h b/lib_com/options.h index 1ecb07333a4821f7ade5b1824198e506eacbaac6..111fe7f2ccfa6342b6f2d284f1e29a6fa770ae89 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -124,6 +124,7 @@ #define HARMONIZE_DoRTFTn /* VA: harmonize functions DoRTFTn_fx() and DoRTFTn_fx_ivas() */ #define FIX_1574_EFAP_CODE_LINT /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */ #define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ +#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 091b8c6b28f56579288fe4690ed858b4702897f8..3f70a806c404163bdd887aa9a227ea571b9fea15 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 )