FFTW vs. OpenCV cvDFT
Asked Answered
T

2

8

Can I expect a speedup when using FFTW (http://www.fftw.org/) instead of OpenCV's cvDFT (http://goo.gl/YCHj0)?

My program's runtime is heavily determined by the application of inverse and forward DFT and I am thinking about using FFTW instead of OpenCV cvDFT.

IIRC FFTW does some kind of "runtime compilation" whereas cvDFT is a simple FFT implementation, so I guess it could speed up my processing a bit.

So before I am trying it out by myself, I thought to ask in here in case anyone stumbled over the same question and solved it before.

Thanks in advance

Thoria answered 3/5, 2012 at 17:45 Comment(0)
R
17

I have used both (OpenCV and FFTW) and you can expect FFTW to be faster than the simpler implementation in OpenCV (how much depends a lot on your processor and image sizes of course). However, if you plan on using your software commercially FFTW has a rather expensive license ($7500.00). In the commercial case, I would recommend Intel's IPP over FFTW as the performance is similar with a much more affordable license ($199.00) + you get way more functionality in IPP than you do with FFTW (i.e., only an FFT library).

Here are several benchmarks between FFTW and various competitor libraries. The results are kind of old, but are useful for comparison. I'm not sure why the IPP 2D transforms are not included (maybe when these benchmarks were done they didn't exist yet).

If you go the IPP route, you can build OpenCV with IPP support and it will swap out the native cvDFT implementation with the IPP equivalent. This will give you a nice performance boost (particularly on Intel chips), and you don't have to change your code.

Resa answered 3/5, 2012 at 18:20 Comment(2)
Thanks a lot! I will try the IPP recompilation first. Need to check those licensing issues, though.Thoria
No problem! Hope you find IPP is fast enough for your needs! It will most likely perform best on the latest Intel Core-i7 chips.Resa
O
0

A more up to date and pretty well done comparison between several FFT options, there are pretty fast and free options:

https://github.com/project-gemmi/benchmarking-fft

Otology answered 15/9, 2020 at 21:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.