Below, you are trying to do some matrix evaluations with incompatible sized matrices. I’m not sure what you’re trying to do here, so I’ll leave that problem for someone else.
One more thing, Mathematica has a built in function called FourierDCTFilter. If you’d rather use your own implementation (you seem to want 88 matrices rather than the 1616 matrices used there), the documentation page provides some guidance about how it is implemented:
Local DCT thresholding is applied to all overlapping 16*16 partitions of image. The value of each output pixel is the average of the corresponding pixel in all partitions that include the pixel.