Bug fixes for filter2D and associated tests.

Four small fixes for filter2D:

- Perf test uses Mat instead of UMat for filters (more efficient since they get tuned into pre-processor strings on the CPU.)
- Fixed bug in global size calculation.
- Fixed bug in CPU path for small images.
- Changed functional test to ensure that the input image and output image are the same size (as required by the documentation).