Processing a block of pixel from a texture

I have a black and white texture ( full HD ) and I want to break it into custom number of rows and columns.
After that I want to calculate the average amount of pixel values per each block.
Since the texture is big it uses a lot of time for C++ to do it and I thought maybe there is a way to do it via GPU (ue4 metrials).

My question is that : how do you break a texture to for example 16 columns and blocks using materials ?
additionally I don’t know how to make an average of a group of pixel. lets say you have 200 pixels and you want to get the average of their alpha channel.

Not a full answer but thought i would chime in on an approach.

So averaging an area is just shifting the texture around by a number of pixels and averaging it together. You just need to only sample each shifted area in the range you need each time. This could be possible in nodes but i think would lead to a lot of nested Material Functions and large node networks and result in a very set number of rows/columns.

You may want to set this up in the Custom Node where you can do loops, etc in pure shader code but this itself has limitations especially for multiplatform.

The problem is that even if I shift the texture ( e.g using a panner ) then still will remain the question of how to add them together.
however I found out that if I divide a textcoord by 1 and then assign it to a texture it will mix the value of the pixel mixed. e,g : if half the texture is blue and half is red then the result is a texture of purple. but I cannot be sure if it actually sum the values together ? do you know anything about this solution ?