added corrected formula for libjpeg turbo