Stream FFT and iFFT

DSP related issues, mathematics, processing and techniques
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Stream FFT and iFFT

Post by trogluddite »

Cheers Tronic - that looks very useful. :D
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Stream FFT and iFFT

Post by MyCo »

I had a go at the code. After I descrambled it :mrgreen:

I just replaced the inner loop with a real SSE. It basically calculates the real and the imaginary part simultanously. This reduced the CPU usage down to 1/3 !!!

I guess this can be improved a lot more. Especially the bit reordering part can get reduced. As it is a fixed FFT, you could save the reordering pattern in stage 0 into an array and when a sample comes in, you put it to the right spot using this array.
Attachments
Stream FFT v001 Build 8 +MyCo.fsm
(157.23 KiB) Downloaded 1626 times
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Stream FFT and iFFT

Post by MyCo »

I've done a little bit more cleaning. The main FFT processing part is now ready for variable FFT sizes.
Attachments
Stream FFT v2 (trogluddite, MyCo).fsm
(156.61 KiB) Downloaded 1589 times
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Stream FFT and iFFT

Post by MyCo »

Done!

This is now a flexible version, it has no hard code FFT Size anymore... although I haven't tested it yet. For absoulte flexibility, we have to move some code from stage0 into stage1, haven't done this yet.

I've also changed the bit reversal method. Instead of rearranging the buffer once, it does it every sample now. This doesn't make a huge difference on large audio buffer sizes. But when the buffer is smaller then the FFT size, this should give a performance boost.

I've removed the sine table creation stuff. Instead it uses the wavetable that FS already has. Saves a little bit memory... the performance isn't better.
Attachments
Stream FFT v3 (trogluddite, MyCo).fsm
(153.76 KiB) Downloaded 1655 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Stream FFT and iFFT

Post by trogluddite »

Wow, MyCo, you really hit the turbo fuel-injection there - even my little Atom netbook now runs it at sensible CPU loads!
Fantastic work, many thanks! :D
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Stream FFT and iFFT

Post by MyCo »

Would be cool to benchmark this code against pure C/C++ code. It's surely not the fastest code around, but I think it beats pure C/C++ versions.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Stream FFT and iFFT

Post by tester »

v3 is around 2x slower than v2, is this correct? (looks like on my both C2D)
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Stream FFT and iFFT

Post by trogluddite »

About 50% more for v2 on my systems - that tallies quite well with the results I got when I traded "one shot" for "continuous" bit-reversal, though that could just be a coincidence. A lot will depend on CPU cache size/performance, so results will likely vary quite a bit between systems. Still WAY faster than my original port, though!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
digitalwhitebyte
Posts: 106
Joined: Sat Jul 31, 2010 10:20 am

Re: Stream FFT and iFFT

Post by digitalwhitebyte »

great job guys.
is coming, a stable version of a MEMin and MEMout in ASM code.
finally found a way, without using any primitive hidden.
will post as soon as ready, I'm working on, testing it, to make it easily understandable and usable.
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Stream FFT and iFFT

Post by MyCo »

trogluddite wrote:About 50% more for v2 on my systems - that tallies quite well with the results I got when I traded "one shot" for "continuous" bit-reversal, though that could just be a coincidence.


In v3 is the output connected to DirectSound, in v2 it is not. v3 is even without disconnection faster here. I have an my AMD, though.
Post Reply