Sum of absolute transformed differences over a block.
w and h can be at most 128, the size of the largest block.
Use the sum of 4x4 and 8x8 hadamard transforms for the transform, but
revert to sad on edges when these transforms do not fit into w and h.
4x4 transforms instead of 8x8 transforms when width or height < 8.