Improved JPEG encoder.