UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

953 lines 37.6 kB
import { LibError } from '../../error/lib-error.js'; export class TiffFaxDecoder { get width() { return this._width; } get height() { return this._height; } get fillOrder() { return this._fillOrder; } constructor(opt) { this._changingElemSize = 0; this._bitPointer = 0; this._bytePointer = 0; this._lastChangingElement = 0; this._compression = 2; this._uncompressedMode = 0; this._fillBits = 0; this._oneD = 0; this._fillOrder = opt.fillOrder; this._width = opt.width; this._height = opt.height; this._prevChangingElements = new Array(this._width); this._prevChangingElements.fill(0); this._currChangingElements = new Array(this._width); this._currChangingElements.fill(0); } nextNBits(bitsToGet) { let b = 0; let next = 0; let next2next = 0; const l = this._data.length - 1; const bp = this._bytePointer; if (this._fillOrder === 1) { b = this._data.get(bp); if (bp === l) { next = 0x00; next2next = 0x00; } else if (bp + 1 === l) { next = this._data.get(bp + 1); next2next = 0x00; } else { next = this._data.get(bp + 1); next2next = this._data.get(bp + 2); } } else if (this._fillOrder === 2) { b = TiffFaxDecoder._flipTable[this._data.get(bp) & 0xff]; if (bp === l) { next = 0x00; next2next = 0x00; } else if (bp + 1 === l) { next = TiffFaxDecoder._flipTable[this._data.get(bp + 1) & 0xff]; next2next = 0x00; } else { next = TiffFaxDecoder._flipTable[this._data.get(bp + 1) & 0xff]; next2next = TiffFaxDecoder._flipTable[this._data.get(bp + 2) & 0xff]; } } else { throw new LibError('TIFFFaxDecoder7'); } const bitsLeft = 8 - this._bitPointer; let bitsFromNextByte = bitsToGet - bitsLeft; let bitsFromNext2NextByte = 0; if (bitsFromNextByte > 8) { bitsFromNext2NextByte = bitsFromNextByte - 8; bitsFromNextByte = 8; } this._bytePointer = this._bytePointer + 1; const i1 = (b & TiffFaxDecoder._table1[bitsLeft]) << (bitsToGet - bitsLeft); let i2 = (next & TiffFaxDecoder._table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte); let i3 = 0; if (bitsFromNext2NextByte !== 0) { i2 <<= bitsFromNext2NextByte; i3 = (next2next & TiffFaxDecoder._table2[bitsFromNext2NextByte]) >>> (8 - bitsFromNext2NextByte); i2 |= i3; this._bytePointer += 1; this._bitPointer = bitsFromNext2NextByte; } else { if (bitsFromNextByte === 8) { this._bitPointer = 0; this._bytePointer += 1; } else { this._bitPointer = bitsFromNextByte; } } return i1 | i2; } nextLesserThan8Bits(bitsToGet) { let b = 0; let next = 0; const l = this._data.length - 1; const bp = this._bytePointer; if (this._fillOrder === 1) { b = this._data.get(bp); if (bp === l) { next = 0x00; } else { next = this._data.get(bp + 1); } } else if (this._fillOrder === 2) { b = TiffFaxDecoder._flipTable[this._data.get(bp) & 0xff]; if (bp === l) { next = 0x00; } else { next = TiffFaxDecoder._flipTable[this._data.get(bp + 1) & 0xff]; } } else { throw new LibError('TIFFFaxDecoder7'); } const bitsLeft = 8 - this._bitPointer; const bitsFromNextByte = bitsToGet - bitsLeft; const shift = bitsLeft - bitsToGet; let i1 = 0; let i2 = 0; if (shift >= 0) { i1 = (b & TiffFaxDecoder._table1[bitsLeft]) >>> shift; this._bitPointer += bitsToGet; if (this._bitPointer === 8) { this._bitPointer = 0; this._bytePointer += 1; } } else { i1 = (b & TiffFaxDecoder._table1[bitsLeft]) << -shift; i2 = (next & TiffFaxDecoder._table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte); i1 |= i2; this._bytePointer += 1; this._bitPointer = bitsFromNextByte; } return i1; } updatePointer(bitsToMoveBack) { const i = this._bitPointer - bitsToMoveBack; if (i < 0) { this._bytePointer -= 1; this._bitPointer = 8 + i; } else { this._bitPointer = i; } } advancePointer() { if (this._bitPointer !== 0) { this._bytePointer += 1; this._bitPointer = 0; } return true; } setToBlack(buffer, lineOffset, bitOffset, numBits) { let bitNum = 8 * lineOffset + bitOffset; const lastBit = bitNum + numBits; let byteNum = bitNum >>> 3; const shift = bitNum & 0x7; if (shift > 0) { let maskVal = 1 << (7 - shift); let val = buffer.get(byteNum); while (maskVal > 0 && bitNum < lastBit) { val |= maskVal; maskVal >>>= 1; ++bitNum; } buffer.set(byteNum, val); } byteNum = bitNum >>> 3; while (bitNum < lastBit - 7) { buffer.set(byteNum++, 255); bitNum += 8; } while (bitNum < lastBit) { byteNum = bitNum >>> 3; buffer.set(byteNum, buffer.get(byteNum) | (1 << (7 - (bitNum & 0x7)))); ++bitNum; } } decodeNextScanline(buffer, lineOffset, bitOffset) { let offset = bitOffset; let bits = 0; let code = 0; let isT = 0; let current = 0; let entry = 0; let twoBits = 0; let isWhite = true; this._changingElemSize = 0; while (offset < this._width) { while (isWhite) { current = this.nextNBits(10); entry = TiffFaxDecoder._white[current]; isT = entry & 0x0001; bits = (entry >>> 1) & 0x0f; if (bits === 12) { twoBits = this.nextLesserThan8Bits(2); current = ((current << 2) & 0x000c) | twoBits; entry = TiffFaxDecoder._additionalMakeup[current]; bits = (entry >>> 1) & 0x07; code = (entry >>> 4) & 0x0fff; offset += code; this.updatePointer(4 - bits); } else if (bits === 0) { throw new LibError('TIFFFaxDecoder0'); } else if (bits === 15) { throw new LibError('TIFFFaxDecoder1'); } else { code = (entry >>> 5) & 0x07ff; offset += code; this.updatePointer(10 - bits); if (isT === 0) { isWhite = false; this._currChangingElements[this._changingElemSize++] = offset; } } } if (offset === this._width) { if (this._compression === 2) { this.advancePointer(); } break; } while (isWhite === false) { current = this.nextLesserThan8Bits(4); entry = TiffFaxDecoder._initBlack[current]; isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code === 100) { current = this.nextNBits(9); entry = TiffFaxDecoder._black[current]; isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits === 12) { this.updatePointer(5); current = this.nextLesserThan8Bits(4); entry = TiffFaxDecoder._additionalMakeup[current]; bits = (entry >>> 1) & 0x07; code = (entry >>> 4) & 0x0fff; this.setToBlack(buffer, lineOffset, offset, code); offset += code; this.updatePointer(4 - bits); } else if (bits === 15) { throw new LibError('TIFFFaxDecoder2'); } else { this.setToBlack(buffer, lineOffset, offset, code); offset += code; this.updatePointer(9 - bits); if (isT === 0) { isWhite = true; this._currChangingElements[this._changingElemSize++] = offset; } } } else if (code === 200) { current = this.nextLesserThan8Bits(2); entry = TiffFaxDecoder._twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; bits = (entry >>> 1) & 0x0f; this.setToBlack(buffer, lineOffset, offset, code); offset += code; this.updatePointer(2 - bits); isWhite = true; this._currChangingElements[this._changingElemSize++] = offset; } else { this.setToBlack(buffer, lineOffset, offset, code); offset += code; this.updatePointer(4 - bits); isWhite = true; this._currChangingElements[this._changingElemSize++] = offset; } } if (offset === this._width) { if (this._compression === 2) { this.advancePointer(); } break; } } this._currChangingElements[this._changingElemSize++] = offset; } readEOL() { if (this._fillBits === 0) { if (this.nextNBits(12) !== 1) { throw new LibError('TIFFFaxDecoder6'); } } else if (this._fillBits === 1) { const bitsLeft = 8 - this._bitPointer; if (this.nextNBits(bitsLeft) !== 0) { throw new LibError('TIFFFaxDecoder8'); } if (bitsLeft < 4) { if (this.nextNBits(8) !== 0) { throw new LibError('TIFFFaxDecoder8'); } } let n = 0; while ((n = this.nextNBits(8)) !== 1) { if (n !== 0) { throw new LibError('TIFFFaxDecoder8'); } } } if (this._oneD === 0) { return 1; } else { return this.nextLesserThan8Bits(1); } } getNextChangingElement(a0, isWhite, ret) { const pce = this._prevChangingElements; const ces = this._changingElemSize; let start = this._lastChangingElement > 0 ? this._lastChangingElement - 1 : 0; if (isWhite) { start &= ~0x1; } else { start |= 0x1; } let i = start; for (; i < ces; i += 2) { const temp = pce[i]; if (temp > a0) { this._lastChangingElement = i; ret[0] = temp; break; } } if (i + 1 < ces) { ret[1] = pce[i + 1]; } } decodeWhiteCodeWord() { let current = 0; let entry = 0; let bits = 0; let isT = 0; let twoBits = 0; let code = -1; let runLength = 0; let isWhite = true; while (isWhite) { current = this.nextNBits(10); entry = TiffFaxDecoder._white[current]; isT = entry & 0x0001; bits = (entry >>> 1) & 0x0f; if (bits === 12) { twoBits = this.nextLesserThan8Bits(2); current = ((current << 2) & 0x000c) | twoBits; entry = TiffFaxDecoder._additionalMakeup[current]; bits = (entry >>> 1) & 0x07; code = (entry >>> 4) & 0x0fff; runLength += code; this.updatePointer(4 - bits); } else if (bits === 0) { throw new LibError('TIFFFaxDecoder0'); } else if (bits === 15) { throw new LibError('TIFFFaxDecoder1'); } else { code = (entry >>> 5) & 0x07ff; runLength += code; this.updatePointer(10 - bits); if (isT === 0) { isWhite = false; } } } return runLength; } decodeBlackCodeWord() { let current = 0; let entry = 0; let bits = 0; let isT = 0; let code = -1; let runLength = 0; let isWhite = false; while (!isWhite) { current = this.nextLesserThan8Bits(4); entry = TiffFaxDecoder._initBlack[current]; isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code === 100) { current = this.nextNBits(9); entry = TiffFaxDecoder._black[current]; isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits === 12) { this.updatePointer(5); current = this.nextLesserThan8Bits(4); entry = TiffFaxDecoder._additionalMakeup[current]; bits = (entry >>> 1) & 0x07; code = (entry >>> 4) & 0x0fff; runLength += code; this.updatePointer(4 - bits); } else if (bits === 15) { throw new LibError('TIFFFaxDecoder2'); } else { runLength += code; this.updatePointer(9 - bits); if (isT === 0) { isWhite = true; } } } else if (code === 200) { current = this.nextLesserThan8Bits(2); entry = TiffFaxDecoder._twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; runLength += code; bits = (entry >>> 1) & 0x0f; this.updatePointer(2 - bits); isWhite = true; } else { runLength += code; this.updatePointer(4 - bits); isWhite = true; } } return runLength; } decode1D(out, compData, startX, height) { this._data = compData; this._bitPointer = 0; this._bytePointer = 0; let lineOffset = 0; const scanlineStride = Math.trunc((this._width + 7) / 8); for (let i = 0; i < height; i++) { this.decodeNextScanline(out, lineOffset, startX); lineOffset += scanlineStride; } } decode2D(out, compData, startX, height, tiffT4Options) { this._data = compData; this._compression = 3; this._bitPointer = 0; this._bytePointer = 0; const scanlineStride = Math.trunc((this._width + 7) / 8); let a0 = 0; let a1 = 0; let entry = 0; let code = 0; let bits = 0; let isWhite = false; let currIndex = 0; let temp = undefined; const b = new Array(2); b.fill(0); this._oneD = tiffT4Options & 0x01; this._uncompressedMode = (tiffT4Options & 0x02) >>> 1; this._fillBits = (tiffT4Options & 0x04) >>> 2; if (this.readEOL() !== 1) { throw new LibError('TIFFFaxDecoder3'); } let lineOffset = 0; let bitOffset = 0; this.decodeNextScanline(out, lineOffset, startX); lineOffset += scanlineStride; for (let lines = 1; lines < height; lines++) { if (this.readEOL() === 0) { temp = this._prevChangingElements; this._prevChangingElements = this._currChangingElements; this._currChangingElements = temp; currIndex = 0; a0 = -1; isWhite = true; bitOffset = startX; this._lastChangingElement = 0; while (bitOffset < this._width) { this.getNextChangingElement(a0, isWhite, b); const b1 = b[0]; const b2 = b[1]; entry = this.nextLesserThan8Bits(7); entry = TiffFaxDecoder._twoDCodes[entry] & 0xff; code = (entry & 0x78) >>> 3; bits = entry & 0x07; if (code === 0) { if (!isWhite) { this.setToBlack(out, lineOffset, bitOffset, b2 - bitOffset); } a0 = b2; bitOffset = a0; this.updatePointer(7 - bits); } else if (code === 1) { this.updatePointer(7 - bits); let number = 0; if (isWhite) { number = this.decodeWhiteCodeWord(); bitOffset += number; this._currChangingElements[currIndex++] = bitOffset; number = this.decodeBlackCodeWord(); this.setToBlack(out, lineOffset, bitOffset, number); bitOffset += number; this._currChangingElements[currIndex++] = bitOffset; } else { number = this.decodeBlackCodeWord(); this.setToBlack(out, lineOffset, bitOffset, number); bitOffset += number; this._currChangingElements[currIndex++] = bitOffset; number = this.decodeWhiteCodeWord(); bitOffset += number; this._currChangingElements[currIndex++] = bitOffset; } a0 = bitOffset; } else if (code <= 8) { a1 = b1 + (code - 5); this._currChangingElements[currIndex++] = a1; if (!isWhite) { this.setToBlack(out, lineOffset, bitOffset, a1 - bitOffset); } a0 = a1; bitOffset = a0; isWhite = !isWhite; this.updatePointer(7 - bits); } else { throw new LibError('TIFFFaxDecoder4'); } } this._currChangingElements[currIndex++] = bitOffset; this._changingElemSize = currIndex; } else { this.decodeNextScanline(out, lineOffset, startX); } lineOffset += scanlineStride; } } decodeT6(out, compData, startX, height, tiffT6Options) { this._data = compData; this._compression = 4; this._bitPointer = 0; this._bytePointer = 0; const scanlineStride = Math.trunc((this._width + 7) / 8); let a0 = 0; let a1 = 0; let b1 = 0; let b2 = 0; let entry = 0; let code = 0; let bits = 0; let isWhite = false; let currIndex = 0; let temp = undefined; const b = new Array(2); b.fill(0); this._uncompressedMode = (tiffT6Options & 0x02) >>> 1; let cce = this._currChangingElements; this._changingElemSize = 0; cce[this._changingElemSize++] = this._width; cce[this._changingElemSize++] = this._width; let lineOffset = 0; let bitOffset = 0; for (let lines = 0; lines < height; lines++) { a0 = -1; isWhite = true; temp = this._prevChangingElements; this._prevChangingElements = this._currChangingElements; cce = (this._currChangingElements = temp); currIndex = 0; bitOffset = startX; this._lastChangingElement = 0; while (bitOffset < this._width) { this.getNextChangingElement(a0, isWhite, b); b1 = b[0]; b2 = b[1]; entry = this.nextLesserThan8Bits(7); entry = TiffFaxDecoder._twoDCodes[entry] & 0xff; code = (entry & 0x78) >>> 3; bits = entry & 0x07; if (code === 0) { if (!isWhite) { this.setToBlack(out, lineOffset, bitOffset, b2 - bitOffset); } a0 = b2; bitOffset = a0; this.updatePointer(7 - bits); } else if (code === 1) { this.updatePointer(7 - bits); let number = 0; if (isWhite) { number = this.decodeWhiteCodeWord(); bitOffset += number; cce[currIndex++] = bitOffset; number = this.decodeBlackCodeWord(); this.setToBlack(out, lineOffset, bitOffset, number); bitOffset += number; cce[currIndex++] = bitOffset; } else { number = this.decodeBlackCodeWord(); this.setToBlack(out, lineOffset, bitOffset, number); bitOffset += number; cce[currIndex++] = bitOffset; number = this.decodeWhiteCodeWord(); bitOffset += number; cce[currIndex++] = bitOffset; } a0 = bitOffset; } else if (code <= 8) { a1 = b1 + (code - 5); cce[currIndex++] = a1; if (!isWhite) { this.setToBlack(out, lineOffset, bitOffset, a1 - bitOffset); } a0 = a1; bitOffset = a0; isWhite = !isWhite; this.updatePointer(7 - bits); } else if (code === 11) { if (this.nextLesserThan8Bits(3) !== 7) { throw new LibError('TIFFFaxDecoder5'); } let zeros = 0; let exit = false; while (!exit) { while (this.nextLesserThan8Bits(1) !== 1) { zeros++; } if (zeros > 5) { zeros -= 6; if (!isWhite && zeros > 0) { cce[currIndex++] = bitOffset; } bitOffset += zeros; if (zeros > 0) { isWhite = true; } if (this.nextLesserThan8Bits(1) === 0) { if (!isWhite) { cce[currIndex++] = bitOffset; } isWhite = true; } else { if (isWhite) { cce[currIndex++] = bitOffset; } isWhite = false; } exit = true; } if (zeros === 5) { if (!isWhite) { cce[currIndex++] = bitOffset; } bitOffset += zeros; isWhite = true; } else { bitOffset += zeros; cce[currIndex++] = bitOffset; this.setToBlack(out, lineOffset, bitOffset, 1); ++bitOffset; isWhite = false; } } } else { throw new LibError(`TIFFFaxDecoder5 ${code}`); } } cce[currIndex++] = bitOffset; this._changingElemSize = currIndex; lineOffset += scanlineStride; } } } TiffFaxDecoder._table1 = [ 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, ]; TiffFaxDecoder._table2 = [ 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, ]; TiffFaxDecoder._flipTable = [ 0, -128, 64, -64, 32, -96, 96, -32, 16, -112, 80, -48, 48, -80, 112, -16, 8, -120, 72, -56, 40, -88, 104, -24, 24, -104, 88, -40, 56, -72, 120, -8, 4, -124, 68, -60, 36, -92, 100, -28, 20, -108, 84, -44, 52, -76, 116, -12, 12, -116, 76, -52, 44, -84, 108, -20, 28, -100, 92, -36, 60, -68, 124, -4, 2, -126, 66, -62, 34, -94, 98, -30, 18, -110, 82, -46, 50, -78, 114, -14, 10, -118, 74, -54, 42, -86, 106, -22, 26, -102, 90, -38, 58, -70, 122, -6, 6, -122, 70, -58, 38, -90, 102, -26, 22, -106, 86, -42, 54, -74, 118, -10, 14, -114, 78, -50, 46, -82, 110, -18, 30, -98, 94, -34, 62, -66, 126, -2, 1, -127, 65, -63, 33, -95, 97, -31, 17, -111, 81, -47, 49, -79, 113, -15, 9, -119, 73, -55, 41, -87, 105, -23, 25, -103, 89, -39, 57, -71, 121, -7, 5, -123, 69, -59, 37, -91, 101, -27, 21, -107, 85, -43, 53, -75, 117, -11, 13, -115, 77, -51, 45, -83, 109, -19, 29, -99, 93, -35, 61, -67, 125, -3, 3, -125, 67, -61, 35, -93, 99, -29, 19, -109, 83, -45, 51, -77, 115, -13, 11, -117, 75, -53, 43, -85, 107, -21, 27, -101, 91, -37, 59, -69, 123, -5, 7, -121, 71, -57, 39, -89, 103, -25, 23, -105, 87, -41, 55, -73, 119, -9, 15, -113, 79, -49, 47, -81, 111, -17, 31, -97, 95, -33, 63, -65, 127, -1, ]; TiffFaxDecoder._white = [ 6430, 6400, 6400, 6400, 3225, 3225, 3225, 3225, 944, 944, 944, 944, 976, 976, 976, 976, 1456, 1456, 1456, 1456, 1488, 1488, 1488, 1488, 718, 718, 718, 718, 718, 718, 718, 718, 750, 750, 750, 750, 750, 750, 750, 750, 1520, 1520, 1520, 1520, 1552, 1552, 1552, 1552, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, 654, 654, 654, 654, 654, 654, 654, 654, 1072, 1072, 1072, 1072, 1104, 1104, 1104, 1104, 1136, 1136, 1136, 1136, 1168, 1168, 1168, 1168, 1200, 1200, 1200, 1200, 1232, 1232, 1232, 1232, 622, 622, 622, 622, 622, 622, 622, 622, 1008, 1008, 1008, 1008, 1040, 1040, 1040, 1040, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 1712, 1712, 1712, 1712, 1744, 1744, 1744, 1744, 846, 846, 846, 846, 846, 846, 846, 846, 1264, 1264, 1264, 1264, 1296, 1296, 1296, 1296, 1328, 1328, 1328, 1328, 1360, 1360, 1360, 1360, 1392, 1392, 1392, 1392, 1424, 1424, 1424, 1424, 686, 686, 686, 686, 686, 686, 686, 686, 910, 910, 910, 910, 910, 910, 910, 910, 1968, 1968, 1968, 1968, 2000, 2000, 2000, 2000, 2032, 2032, 2032, 2032, 16, 16, 16, 16, 10257, 10257, 10257, 10257, 12305, 12305, 12305, 12305, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 878, 878, 878, 878, 878, 878, 878, 878, 1904, 1904, 1904, 1904, 1936, 1936, 1936, 1936, -18413, -18413, -16365, -16365, -14317, -14317, -10221, -10221, 590, 590, 590, 590, 590, 590, 590, 590, 782, 782, 782, 782, 782, 782, 782, 782, 1584, 1584, 1584, 1584, 1616, 1616, 1616, 1616, 1648, 1648, 1648, 1648, 1680, 1680, 1680, 1680, 814, 814, 814, 814, 814, 814, 814, 814, 1776, 1776, 1776, 1776, 1808, 1808, 1808, 1808, 1840, 1840, 1840, 1840, 1872, 1872, 1872, 1872, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275, 14353, 14353, 14353, 14353, 16401, 16401, 16401, 16401, 22547, 22547, 24595, 24595, 20497, 20497, 20497, 20497, 18449, 18449, 18449, 18449, 26643, 26643, 28691, 28691, 30739, 30739, -32749, -32749, -30701, -30701, -28653, -28653, -26605, -26605, -24557, -24557, -22509, -22509, -20461, -20461, 8207, 8207, 8207, 8207, 8207, 8207, 8207, 8207, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, ]; TiffFaxDecoder._additionalMakeup = [ 28679, 28679, 31752, -32759, -31735, -30711, -29687, -28663, 29703, 29703, 30727, 30727, -27639, -26615, -25591, -24567, ]; TiffFaxDecoder._initBlack = [ 3226, 6412, 200, 168, 38, 38, 134, 134, 100, 100, 100, 100, 68, 68, 68, 68, ]; TiffFaxDecoder._twoBitBlack = [292, 260, 226, 226]; TiffFaxDecoder._black = [ 62, 62, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225, 588, 588, 588, 588, 588, 588, 588, 588, 1680, 1680, 20499, 22547, 24595, 26643, 1776, 1776, 1808, 1808, -24557, -22509, -20461, -18413, 1904, 1904, 1936, 1936, -16365, -14317, 782, 782, 782, 782, 814, 814, 814, 814, -12269, -10221, 10257, 10257, 12305, 12305, 14353, 14353, 16403, 18451, 1712, 1712, 1744, 1744, 28691, 30739, -32749, -30701, -28653, -26605, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 750, 750, 750, 750, 1616, 1616, 1648, 1648, 1424, 1424, 1456, 1456, 1488, 1488, 1520, 1520, 1840, 1840, 1872, 1872, 1968, 1968, 8209, 8209, 524, 524, 524, 524, 524, 524, 524, 524, 556, 556, 556, 556, 556, 556, 556, 556, 1552, 1552, 1584, 1584, 2000, 2000, 2032, 2032, 976, 976, 1008, 1008, 1040, 1040, 1072, 1072, 1296, 1296, 1328, 1328, 718, 718, 718, 718, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 4113, 4113, 6161, 6161, 848, 848, 880, 880, 912, 912, 944, 944, 622, 622, 622, 622, 654, 654, 654, 654, 1104, 1104, 1136, 1136, 1168, 1168, 1200, 1200, 1232, 1232, 1264, 1264, 686, 686, 686, 686, 1360, 1360, 1392, 1392, 12, 12, 12, 12, 12, 12, 12, 12, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, ]; TiffFaxDecoder._twoDCodes = [ 80, 88, 23, 71, 30, 30, 62, 62, 4, 4, 4, 4, 4, 4, 4, 4, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ]; //# sourceMappingURL=tiff-fax-decoder.js.map