I came across an example of a simple convolution of two signals using cuFFT.
https://github.com/NVIDIA/cuda-samples/blob/master/Samples/simpleCUFFT/simpleCUFFT.cu
It performs zero-padding of both signals so that their sizes are matched together. But when I printed the padded output, It showed that the padding was done in the middle of the signal which I don't understand because usually it is done at the start or end. Check the padData function.
Why the padding is done in the middle?
If two signals are of the same length, Is padding required?
I am not really familiar with signal processing techniques. I would appreciate it if someone could explain this to me.
If you want to phase result of a complex FFT to stay the same, then any zero padding needs to be circularly symmetric around beginning of the input. If you just pad at the beginning or end, the phase result would likely change.
If you want the complex IFFT of a spectrum to produce a strictly real result, then any zero padding has to maintain conjugate symmetry (which means the padding needs to be centered or symmetric, not just all at the start or end).