Optimized loops in JPG conversion.

This change makes the 4 conversion loops look the same.
It optimizes access of the array length and access of the property
numComponents, which is known to be constant.
Merge pull request #4889 from CodingFabian/optimize-jpg-loops

Optimized loops in JPG conversion.