split ljpeg encoder out of mjpeg.c