lib_com/ivas_rotation_com.c : MLD sensitive ISAR_ENC path due to precision differences in sinf()
Precision difference of up to 2-bits in sinf due to pre-optimized math libraries in Cadence tools is resulting in MLD difference of 27.3 w.r.t. reference clang/GCC platform. **Steps to reproduce** : ``` ./IVAS_cod -mc 7_1_4 128000 48 ./scripts/testv/stv714MC48c_cut.wav 7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20.192 ./IVAS_dec -T ./scripts/trajectories/rotate_euler_quaternion_30s_delayed.csv -render_config ./tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lcld.txt -fr 20 BINAURAL_SPLIT_CODED 48 ./7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20.192 ./7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20.splt.bit ./ISAR_post_rend -fs 48 -i ./7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20.splt.bit -if BINAURAL_SPLIT_CODED -o ./7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20.wav -T ./scripts/trajectories/rotate_euler_quaternion_30s.csv -fr 20 # compare ./scripts/tools/Linux/wav-diff 7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20_ref.wav 7_1_4_128000_SPLIT_CODED_full_cfg_split_renderer_config_3dof_384k_lcld_fr_pre_20_post_20.wav ``` In the listening test, we clearly see the difference between reference and Xtensa output - ![mld_27_3](/uploads/1853b28abd9e2000aa948e6456150d8c/mld_27_3.jpg){width=797 height=600} **Affected Function** : `Euler2Quat()` **Associated code** ``` float cr = cosf( roll * 0.5f ); float sr = sinf( roll * 0.5f ); float cp = cosf( pitch * 0.5f ); float sp = sinf( pitch * 0.5f ); float cy = cosf( yaw * 0.5f ); float sy = sinf( yaw * 0.5f ); quat->w = cr * cp * cy + sr * sp * sy; quat->x = sr * cp * cy - cr * sp * sy; quat->y = sr * cp * sy + cr * sp * cy; quat->z = cr * cp * sy - sr * sp * cy; ``` Due to up to 2-bit differences in sinf(), the error in quat->z variable grows over the frames and in 56th frame, we see sign flip leaning to difference of ~0.79 between GCC and XTENSA. - GCC: 0xBDBD0E06(-0.092311) - Xtensa: 0x3F3347D9 (+0.700315) Following is the error propagation chain : 1. sinf(angle × 0.5f): 1–2 ULP error in sr, sp, sy 2. All 4 quat components (w,x,y,z) affected via cross-multiplication of `sr/sp/sy` with `cosf` values 3. Quaternion passed to `QuatToRotMat()` → 9 entries of 3×3 rotation matrix goes wrong 4. `rotateAziEle()` applies wrong matrix to DirAC azi/ele for EVERY frequency band EVERY frame 5. Wrong azimuth/elevation → wrong HRTF lookup → binaural filter coefficients deviate 6. Repeats 16xtimes/frame ( 4 poses * 4 subframe) 7. At Frame 56 MLD spike to 27.3 If we call double precision variants of sin in this function, then Maximum MLD score drops down from 27.3->0.2
issue