The fastest general two-dimensional convolution algorithm should first perform FFT on the source, then adjust, then FFT back to get the result (which is conv2 in matlab), so your multi-loop approach is probably not the best.
GSL will give you a standard and fast implementation of FFT if you want to use it.
In addition, if the kernel is separable , you can perform the convolution of the two-dimensional convolution.
OpenCV works great, if it works too, it should be widely accepted as a quick implementation.
source
share