first implementation of 2d transform