mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
support tiff predictor for 16bit
(for issue #6289) This does the same for 16 bit as the existing 8 bit tiff predictor code, an addition of the last word to this word. The last two "& 0xFF" may or may not be needed, I see this isn't done in the 8 bit code, but I'm not a JS developer.
This commit is contained in:
parent
c84c23c4cb
commit
d75a497a6b
3 changed files with 22 additions and 0 deletions
|
@ -735,6 +735,19 @@ var PredictorStream = (function PredictorStreamClosure() {
|
|||
buffer[pos] = buffer[pos - colors] + rawBytes[i];
|
||||
pos++;
|
||||
}
|
||||
} else if (bits === 16) {
|
||||
var bytesPerPixel = colors * 2;
|
||||
for (i = 0; i < bytesPerPixel; ++i) {
|
||||
buffer[pos++] = rawBytes[i];
|
||||
}
|
||||
for (; i < rowBytes; i += 2) {
|
||||
var sum = ((rawBytes[i] & 0xFF) << 8) +
|
||||
(rawBytes[i + 1] & 0xFF) +
|
||||
((buffer[pos - bytesPerPixel] & 0xFF) << 8) +
|
||||
(buffer[pos - bytesPerPixel + 1] & 0xFF);
|
||||
buffer[pos++] = ((sum >> 8) & 0xFF);
|
||||
buffer[pos++] = (sum & 0xFF);
|
||||
}
|
||||
} else {
|
||||
var compArray = new Uint8Array(colors + 1);
|
||||
var bitMask = (1 << bits) - 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue