Fix sampling in JPEG XR encoder, patch from Microsoft.