Efficient and Faster way to do 2x2 binning of a matrix
-
Hello, I am trying to implement a faster way to do 2x2 binning of a 1024x1024 matrix of byte (char) databyte in MFC. The end result will be in a 512x512 matrix. I can do this using two for loops, but I am looking for a faster and efficient way to implement this. Any suggestions? thanks
PKNT
-
Hello, I am trying to implement a faster way to do 2x2 binning of a 1024x1024 matrix of byte (char) databyte in MFC. The end result will be in a 512x512 matrix. I can do this using two for loops, but I am looking for a faster and efficient way to implement this. Any suggestions? thanks
PKNT
Presumably you are using a byte lookup rather than a mask operation. You can try indexing from end to end and then using two indexes one for the first row (say position X) and then one one for the second (X+1024). However that would then require an if test each time to skip the second row once you reached 1024.