I am wondering what kind of optimization is implemented in filter2d. After briefly checking out the source code I can tell there are a lot of SIMD optimizations but I couldn't really tell what is going on in there. Are techniques like Integral Image implemented? This can make it run in constant time regardless of how large the filter is. It's easy to implement but I am wondering do I have to implement it myself or can I simply call filter2d and get the desired performance.