Commit cb45335f authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2531-review-integer-divisions-in-ivas_mct_enc_fx' into 'main'

Resolve "Review integer divisions in ivas_mct_enc_fx()"

Closes #2531

See merge request !2945
parents b25497ac 5e484c13
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 ########################### */

+11 −0
Original line number Diff line number Diff line
@@ -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 )