merged most of yuv2tiff functionality