Audio: Optimize and fix TDFB direction calculation
This check-in refines the TDFB direction calculation, addressing both performance and correctness:
- Fixes:
- Correct infinite loop in
max_mic_distanceby fixing loop conditions. - Optimizations:
- Fix off-by-one error in
line_array_mode_checkensuring all checks for co-linearity among microphone locations are performed.
It's not clear if you want to keep #9160, or want to include the previous change into this PR (and close #9160). I think separate PR is better, so you should keep #9160 and remove the first commit from this PR.
Lets wait for @singalsu to return before we merge.
We don't have CI validation for these features and @ShriramShastry is without DUTs to run tests. So bear with me, I need to test this manually before approve. Right now there is higher priority work for a new platform.
Adding that this PR saves when sound angle tracking is enabled in TGL 4 mic case from 134 MCPS average to 120 MPCS average. Also test tools/test/audio/tdfb_direction_test.m is passed.
Failures in https://sof-ci.01.org/sofpr/PR9169/build5921/devicetest/index.html , but the TDFB not part of these topologies, so can' be related. Proceeding with merge, thanks @ShriramShastry !