Hi.
I'm trying to understand how the new FFT functions work. Here's my sample code:
void testFFT() { uint8_t FASTCV_ALIGN128(x[]) = {1, 2, 3, 4}; size_t length = sizeof(x) / sizeof(x[0]); uint8_t FASTCV_ALIGN128(y[length]); float32_t FASTCV_ALIGN128(f[2 * length]); fcvFFTu8(x, length, 1, length, f, 2 * length * sizeof(float32_t)); for (size_t i = 0; i < length; ++i) { IPRINTF("FFT %d: %f + %fj", i, f[2 * i], f[2 * i + 1]); } fcvIFFTf32(f, length * 2, 1, length * 2 * sizeof(float32_t), y, length); for (size_t i = 0; i < length; ++i) { IPRINTF("IFFT %d: %f", i, y[i]); } }
The output I get is:
FFT 0: 20.000000 + 0.000000j FFT 1: -4.000000 + 0.000000j FFT 2: -4.000000 + 0.000000j FFT 3: -4.000000 + 0.000000j IFFT 0: 0.000000 IFFT 1: 0.000000 IFFT 2: 0.000000 IFFT 3: 0.000000
Now, my questions are: (1) why does the FFT output "round" the complex values? Second, why does the IFFT look like all zeros? Am I doing something wrong here?
Thanks.
Hi,
Currently FFT/IFFT works on sequence of length 8 or larger. In next release it will be enhanced to handle shorter sequence like the one in your example.
Cheers,
-Jeff
Thanks Jeff, but that doesn't seem to do it for me. For example:
This gives me this output:
What am I doing wrong?
Thanks.
Oh, and even this gives me the same output:
The output of IFFT is u8 type, and you should use %d to print.
Hi,
Is it possible to run this algorithm in Hexagon?
Is there any other implemetation for using FFT?
Thanks,
Yes FFT has Hexagon implementation. Obviously it can only run on Snapdragon platform and the platform must have FastCV 1.5.0 or later version pre-installed.
Cheers,
-Jeff