Admin message

WARNING! Gitlab maintenance operation scheduled for Monday, 20 April between 12:00 and 14:00 (CET). During this time window, short service interruptions (less than 5 minutes) may occur. Thank you in advance for your understanding.

Review integer divisions in ivas_mct_enc_fx()

Bug description

In ivas_mct_enc_fx() there are two integer divisions implemented via div_l():

Word32 cp_bitrate;
// cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;
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))

div_l() returns only a 16 bit result, which might be problematic for high bitrates (i.e., the result is > 32767).

In create_mct_enc_fx(), instead of div_l() the function iDiv_and_mod_32() is used, which seem to do proper 32 bit arithmetic.

Word32 L_tmp;
iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), hMCT->nchan_out_woLFE, &cp_bitrate, &L_tmp, 0 );
// cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;
Assignee Loading
Time tracking Loading