Faster JPEG transform

This PR doubles the speed of the inverse JPEG transform and so saves one second when decoding #3809.