fix for tiff decompression on PlanarConfigContig

This ugly patch fixes decompression for 16bit tiffs. It is only works for contiguous images, not plane separated ones. Changes are localized to this one place. Some refactoring is needed, but I didn't want to change anything else right now. Plane separated images probably still don't work (no tests for those) and they use the same functions.

The tests I have looked at seem to pass, including the two compression test images (no plane separated images there), except for flower-minisblack-12.tif which didn't work before either.