I am using xCORE Array Microphone Kits which is having 7 mics. I am trying to perform cross-correlation of signals on adjacent mics. I am using basic formula:
where * denotes complex conjugate. Now since I couldn't find any straightforward api for complex conjugate calculation, complex vector multiplication without splitting into real and imaginary parts, vector square, absolute of complex vector we need to perform lot of operations. Below are the steps I am following and its taking around 6400us for 512 samples.Corrxy = [F(x)]*.[F(y)]
I think there should be some simpler and efficient way to do this.
Steps:
1. Fill buffer with samples in time domain (512 samples) to create array dsp_complex_t mic_data[8][512]
2. Perform forward dft on this.
3. Iterate over sample length and extract mic_data into separate real and imaginary parts array.
4. Repeat 2 & 3 for other adjacent mic.
5. Apply dsp_vector_mulv_complex on these new array.
6. Simply create copy of result real and imag parts (for performing square operation in calculation of magnitude of complex vector from 5)
7. Multiply by these copies to calculate Real and Imaginary vectors square.
8. Add Real2 and Imag2 to get Corr2.
9. Get vector means of Corr of adjacent mics like of 1&2, 2&3, 3&4...6&1 (centre 0 omitted).
10. Find index of max mean corr to see which signals are most correlated.
Ohh...This is too much calculation :-( if there are efficient hardware accelerated apis for above bold mentioned, then I guess this would have been much more faster and clean. How can I optimize this or is there any other library?
Thanks,
Shailesh