开发者

inverse FFT in shader language?

开发者 https://www.devze.com 2022-12-09 02:58 出处:网络
does anyone know an implementation of the inverse FFT in HLSL/GLSL/cg ... ?开发者_运维知识库 It would save me much work.

does anyone know an implementation of the inverse FFT in HLSL/GLSL/cg ... ?开发者_运维知识库

It would save me much work.

Best, heinrich


Do you already have a FFT implementation? You may already be aware, but the inverse can be computed by reversing the order of the N inputs, taking the FFT over those, and dividing the result by N.


DirectX11 comes with a FFT example for compute shaders (see DX11 August SDK Release Notes). As PereAllenWebb points out, this can be also used for inverse FFT.

Edit: If you just want a fast FFT, you could try the CUFFT, which runs on the GPU. It's part of the CUDA SDK. The AMCL from AMD also has a FFT, which is currently not GPU accelerated, but this will be likely added soon.


I implemented a 1D FFT on 7800GTX hardware back in 2005. This was before CUDA etc so I had to resort to using Cg and manually implementing the FFT.

I have two FFT implementations. One is a Radix2 Decimation in Time FFT and the other a Stockham Autosort FFT. The stockham would perform around 2-4x faster than a CPU (at the time 3GHz P4 single core) for larger sizes (> 8192) but for smaller sizes the CPU was faster as it doesn't have to shift data to/from the GPU.

If you're interested in the shader code feel free to contact me and I'll send it over by email. It was from a personal project so not covered by any commercial copyright. I would imagine that CUDA (and similar) implementations would massively outperform my implementation, however from a learning perspective you can't get better than to write or study the code yourself!


Maybe you could take a look at OpenCL which is a standard for general purpose computing on graphics (and other) hardware.
The wikipedia article contains a OpenCL example for a standard FFT:
http://en.wikipedia.org/wiki/OpenCL#Example

If you are on a Mac with OS X 10.6, you just need to install the developer tools to get started with OpenCL development. I also heard that hardware vendors already provide basic OpenCL driver support on Windows.

0

精彩评论

暂无评论...
验证码 换一张
取 消