JPEG optimizations