mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #7869 from PedroPachecoInf/master
Fixes issue #6071 - TIFF with 1 bit-depth
This commit is contained in:
commit
393740e2ae
3 changed files with 17 additions and 8 deletions
|
@ -739,15 +739,16 @@ var PredictorStream = (function PredictorStreamClosure() {
|
|||
var pos = bufferLength;
|
||||
var i;
|
||||
|
||||
if (bits === 1) {
|
||||
if (bits === 1 && colors === 1) {
|
||||
// Optimized version of the loop in the "else"-branch
|
||||
// for 1 bit-per-component and 1 color TIFF images.
|
||||
for (i = 0; i < rowBytes; ++i) {
|
||||
var c = rawBytes[i];
|
||||
inbuf = (inbuf << 8) | c;
|
||||
// bitwise addition is exclusive or
|
||||
// first shift inbuf and then add
|
||||
buffer[pos++] = (c ^ (inbuf >> colors)) & 0xFF;
|
||||
// truncate inbuf (assumes colors < 16)
|
||||
inbuf &= 0xFFFF;
|
||||
var c = rawBytes[i] ^ inbuf;
|
||||
c ^= c >> 1;
|
||||
c ^= c >> 2;
|
||||
c ^= c >> 4;
|
||||
inbuf = (c & 1) << 7;
|
||||
buffer[pos++] = c;
|
||||
}
|
||||
} else if (bits === 8) {
|
||||
for (i = 0; i < colors; ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue