jpeg codec mode optimization