static calculateThresholdForBlock(luminances, subWidth /*int*/, subHeight /*int*/, width /*int*/, height /*int*/, blackPoints, matrix) {
			const maxYOffset = height - HybridBinarizer.BLOCK_SIZE;
			const maxXOffset = width - HybridBinarizer.BLOCK_SIZE;
			for (let y = 0; y < subHeight; y++) {
				let yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;
				if (yoffset > maxYOffset) {
					yoffset = maxYOffset;
				}
				const top = HybridBinarizer.cap(y, 2, subHeight - 3);
				for (let x = 0; x < subWidth; x++) {
					let xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;
					if (xoffset > maxXOffset) {
						xoffset = maxXOffset;
					}
					const left = HybridBinarizer.cap(x, 2, subWidth - 3);
					let sum = 0;
					for (let z = -2; z <= 2; z++) {
						const blackRow = blackPoints[top + z];
						sum += blackRow[left - 2] + blackRow[left - 1] + blackRow[left] + blackRow[left + 1] + blackRow[left + 2];
					}
					const average = sum / 25;
					HybridBinarizer.thresholdBlock(luminances, xoffset, yoffset, average, width, matrix);
				}
			}
		}
For each block in the image, calculate the average black point using a 5x5 grid
of the blocks around it. Also handles the corner cases (fractional blocks are computed based
on the last pixels in the row/column which are also used in the previous block).