Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convolution with FFT, how does this work?

Tags:

c++

math

cuda

fft

I know that in time domain convolution is a pretty expensive operation between two matrices and you can perform it in frequency domain by transforming them in the complex plane and use multiplication (and then back in the time domain)

Anyway I don't understand how this is performed in the CUDA SDK where the data and the kernel are padded and put into two buffers (m_PaddedKernel and m_PaddedData), this should be to accelerate Cooley-Tuckey method, then the function cufftExecC2C is called to transform first the Kernel (and why C2C? complex-to-complex, why not real-to-complex?) into the complex plane and then the entire data into the same plane

The defined kernel spProcess2D_kernel then kicks in and seems like normalize and executes the multiplication between data and kernel in the frequency domain (how to do the multiplication of two functions? I think they mean composing the two functions) and back with the C2C transformation (still wondering why C2C and not C2R)

like image 683
Marco A. Avatar asked Nov 05 '22 23:11

Marco A.


1 Answers

As to why this can be done with the FFT, you need to read about the convolution theorem.

In general, your input data may be complex. So that is why C2C is used.

like image 116
Oliver Charlesworth Avatar answered Nov 09 '22 06:11

Oliver Charlesworth