Minor refactoring of specialized kernel size logic for convolution/correlation kernels

There is a significant amount of code duplicating the logic of

```
If kernel rows and columns are equal and in [3,4,...,13]:
  instantiate the kernel with the given dimensions
else
  instantiate the kernel with 0.
```

Thus, we can create a macro which encapsulates this logic.  I thought this refactoring slightly improves the readability of the code for the heavy duplication.  It also allows us to reduce the file size by ~30%.