Merge pull request #7869 from PedroPachecoInf/master
Fixes issue #6071 - TIFF with 1 bit-depth
This commit is contained in:
commit
393740e2ae
@ -739,15 +739,16 @@ var PredictorStream = (function PredictorStreamClosure() {
|
|||||||
var pos = bufferLength;
|
var pos = bufferLength;
|
||||||
var i;
|
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) {
|
for (i = 0; i < rowBytes; ++i) {
|
||||||
var c = rawBytes[i];
|
var c = rawBytes[i] ^ inbuf;
|
||||||
inbuf = (inbuf << 8) | c;
|
c ^= c >> 1;
|
||||||
// bitwise addition is exclusive or
|
c ^= c >> 2;
|
||||||
// first shift inbuf and then add
|
c ^= c >> 4;
|
||||||
buffer[pos++] = (c ^ (inbuf >> colors)) & 0xFF;
|
inbuf = (c & 1) << 7;
|
||||||
// truncate inbuf (assumes colors < 16)
|
buffer[pos++] = c;
|
||||||
inbuf &= 0xFFFF;
|
|
||||||
}
|
}
|
||||||
} else if (bits === 8) {
|
} else if (bits === 8) {
|
||||||
for (i = 0; i < colors; ++i) {
|
for (i = 0; i < colors; ++i) {
|
||||||
|
1
test/pdfs/issue6071.pdf.link
Normal file
1
test/pdfs/issue6071.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://web.archive.org/web/20170107214304/https://www.pdf-archive.com/2017/01/07/issue6071/issue6071.pdf
|
@ -1146,6 +1146,13 @@
|
|||||||
"lastPage": 2,
|
"lastPage": 2,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue6071",
|
||||||
|
"file": "pdfs/issue6071.pdf",
|
||||||
|
"md5": "2e08526d8e7c9ba4269fc12ef488d3eb",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue1905",
|
{ "id": "issue1905",
|
||||||
"file": "pdfs/issue1905.pdf",
|
"file": "pdfs/issue1905.pdf",
|
||||||
"md5": "b1bbd72ca6522ae1502aa26320f81994",
|
"md5": "b1bbd72ca6522ae1502aa26320f81994",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user