Pull more code out of the inner loop in CJPX_Decoder::Decode().

The check for `comps.sgnd` will have the same result in every loop
iteration. In a Linux release build, this results in a 2% speedup,
as measured by:
testing/tools/safetynet_measure.py --profiler perfstat bug_1698.pdf,
where bug_1698.pdf is the PDF attached to https://crbug.com/pdfium/1698.

Change-Id: I9d30f65636f72670cd86df82b8baa0b298a88d2c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82770
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
index ba7a19f..270dabd 100644
--- a/core/fxcodec/jpx/cjpx_decoder.cpp
+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -539,13 +539,13 @@
     if (!comps.data)
       continue;
 
+    const uint32_t src_offset = comps.sgnd ? 1 << (comps.prec - 1) : 0;
     if (adjust < 0) {
       for (uint32_t row = 0; row < height; ++row) {
         uint8_t* pScanline = pChannel + row * pitch;
         for (uint32_t col = 0; col < width; ++col) {
           uint8_t* pPixel = pScanline + col * m_Image->numcomps;
-          int src = comps.data[row * width + col];
-          src += comps.sgnd ? 1 << (comps.prec - 1) : 0;
+          int src = comps.data[row * width + col] + src_offset;
           *pPixel = static_cast<uint8_t>(src << -adjust);
         }
       }
@@ -554,8 +554,7 @@
         uint8_t* pScanline = pChannel + row * pitch;
         for (uint32_t col = 0; col < width; ++col) {
           uint8_t* pPixel = pScanline + col * m_Image->numcomps;
-          int src = comps.data[row * width + col];
-          src += comps.sgnd ? 1 << (comps.prec - 1) : 0;
+          int src = comps.data[row * width + col] + src_offset;
           if (adjust == 0) {
             *pPixel = static_cast<uint8_t>(src);
           } else {