Q mismatch in ivas_param_ism_stereo_dmx_fx() function
Bug description
In ivas_param_ism_stereo_dmx_fx() the computation of the cardioids for the object signal downmix has a q mismatch.
this is float:
alpha = 0.5f;
// ...
cardioid_left[i] = alpha + ( 1 - alpha ) * cosf( tmp - tmp_1 );
this is BASOP:
alpha = ONE_IN_Q14 /* 0.5 in Q15 */;
//...
cardioid_left[i] = mac_r( L_mult( alpha, 16384 ), sub( ONE_IN_Q15 - 1, alpha ), getCosWord16( extract_l( tmp ) ) ); // Q14
The two terms accumulated by mac_r are in different Q formats:
- alpha is always 16384 here
- First term:
L_mult(alpha, 16384)Interpreting alpha as Q15 and 16384 as Q14 (1.0), this is Q30 representing 0.5. - Second term:
sub(ONE_IN_Q15 - 1, alpha)approx 16383 (Q15, approx. 0.5) x getCosWord16(...) (Q15) x 2 → Q31.
Logging some debug output of the actual values also showed the discrepancies in operation.
The second term should use Q14 to produce a result inside mac_r that matches with the Q30 of the first argument.