fix debug build

Change-Id: I651c495d21f4c6869bb0ecb01a7b6f02f3dcbf3f
cells are not always saved in L->R T->B order

As an additional bonus, this simplifies the output loop.

Change-Id: I2ae1eab52d3681c02e790af950c82a7f01d3aa11