[Optimization] Calculation of preDelay in ivas_binaural_reverb_init() unnecessarily complex (division of constant enumerator / denominator)
# Basic info <!--- Add commit SHA used to reproduce--> - Float reference: - Encoder (float): n/a - Decoder (float): 2266639d595269071a942bcf5aa67ad98f9cee79 - Fixed point: - Encoder (fixed): n/a - Decoder (fixed): dd4728fed0752d8d64e735f44e2cb7a3b4c1fd83 # Bug description This is a follow-up to #1831: The calculation of `preDelay` in ivas_binaural_reverb_init() is unnecessarily complex. More specifically, the following expression (floating point code) ``` preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); ``` is implemented using a 32 by 16 division in BASOP using constants for both, enumerator and denominator: ``` temp16 = BASOP_Util_Divide3216_Scale( 48000, CLDFB_NO_CHANNELS_MAX, &s ); temp16 = shl( temp16, s ); // Q0 temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, temp16 ); // Q11 preDelay = extract_l( L_shr( L_add( temp32, L_shl( 1, 10 ) ), 11 ) ); // Q0 ``` At least the `BASOP_Util_Divide3216_Scale()` should be avoided. Possibly, there is also a more elegant way of implementing the rounding function...
issue