separate en/decoder specific parts from png.c