summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc')
-rw-r--r--Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc
index 5ed1890a1d3..a1f7395dd57 100644
--- a/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc
+++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc
@@ -8,6 +8,10 @@
#include <aconf.h>
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
#include <limits.h>
#include "gmem.h"
#include "gmempp.h"
@@ -1113,7 +1117,6 @@ JPXDecodeResult JPXStream::readCodestream(Guint len) {
"JPX COC marker segment before COD segment");
return jpxDecodeFatalError;
}
- comp = 0;
if ((img.nComps > 256 && !readUWord(&comp)) ||
(img.nComps <= 256 && !readUByte(&comp)) ||
comp >= img.nComps ||
@@ -1266,7 +1269,6 @@ JPXDecodeResult JPXStream::readCodestream(Guint len) {
"JPX QCC marker segment before QCD segment");
return jpxDecodeFatalError;
}
- comp = 0;
if ((img.nComps > 256 && !readUWord(&comp)) ||
(img.nComps <= 256 && !readUByte(&comp)) ||
comp >= img.nComps ||
@@ -1639,7 +1641,6 @@ GBool JPXStream::readTilePart() {
error(errSyntaxError, getPos(), "Extraneous JPX COC marker segment");
return gFalse;
}
- comp = 0;
if ((img.nComps > 256 && !readUWord(&comp)) ||
(img.nComps <= 256 && !readUByte(&comp)) ||
comp >= img.nComps ||
@@ -1773,7 +1774,6 @@ GBool JPXStream::readTilePart() {
error(errSyntaxError, getPos(), "Extraneous JPX QCC marker segment");
return gFalse;
}
- comp = 0;
if ((img.nComps > 256 && !readUWord(&comp)) ||
(img.nComps <= 256 && !readUByte(&comp)) ||
comp >= img.nComps ||
@@ -2619,12 +2619,7 @@ GBool JPXStream::readCodeBlockData(JPXTileComp *tileComp,
if (cb->arithDecoder) {
cover(63);
- if (tileComp->codeBlockStyle & 0x04) {
- cb->arithDecoder->setStream(bufStr, cb->dataLen[0]);
- cb->arithDecoder->start();
- } else {
- cb->arithDecoder->restart(cb->dataLen[0]);
- }
+ cb->arithDecoder->restart(cb->dataLen[0]);
} else {
cover(64);
cb->arithDecoder = new JArithmeticDecoder();
@@ -3324,7 +3319,7 @@ void JPXStream::inverseTransform1D(JPXTileComp *tileComp, int *data,
// converts fixed point samples back to integers.
GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) {
JPXTileComp *tileComp;
- int coeff, d0, d1, d2, t, minVal, maxVal, zeroVal, shift, rounding;
+ int coeff, d0, d1, d2, t, minVal, maxVal, zeroVal;
int *dataPtr;
Guint j, comp, x, y;
@@ -3409,14 +3404,12 @@ GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) {
maxVal = (1 << tileComp->prec) - 1;
zeroVal = 1 << (tileComp->prec - 1);
dataPtr = tileComp->data;
- shift = fracBits - tileComp->prec;
- rounding = 1 << (shift - 1);
for (y = 0; y < tileComp->h; ++y) {
for (x = 0; x < tileComp->w; ++x) {
coeff = *dataPtr;
if (tileComp->transform == 0) {
cover(112);
- coeff = (coeff + rounding) >> shift;
+ coeff >>= fracBits - tileComp->prec;
}
coeff += zeroVal;
if (coeff < 0) {