Added sampleformat, writetile
Added writeencodedtile