Fix the remaining no-var
failures, which couldn't be handled automatically, in the src/core/jbig2.js
file
This commit is contained in:
parent
7ca3a34e1f
commit
d59c9ab3ab
@ -281,14 +281,8 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
function decodeBitmapTemplate0(width, height, decodingContext) {
|
function decodeBitmapTemplate0(width, height, decodingContext) {
|
||||||
const decoder = decodingContext.decoder;
|
const decoder = decodingContext.decoder;
|
||||||
const contexts = decodingContext.contextCache.getContexts("GB");
|
const contexts = decodingContext.contextCache.getContexts("GB");
|
||||||
let contextLabel,
|
const bitmap = [];
|
||||||
i,
|
let contextLabel, i, j, pixel, row, row1, row2;
|
||||||
j,
|
|
||||||
pixel,
|
|
||||||
row,
|
|
||||||
row1,
|
|
||||||
row2,
|
|
||||||
bitmap = [];
|
|
||||||
|
|
||||||
// ...ooooo....
|
// ...ooooo....
|
||||||
// ..ooooooo... Context template for current pixel (X)
|
// ..ooooooo... Context template for current pixel (X)
|
||||||
@ -547,7 +541,7 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
const row = new Uint8Array(width);
|
const row = new Uint8Array(width);
|
||||||
bitmap.push(row);
|
bitmap.push(row);
|
||||||
for (let j = 0; j < width; j++) {
|
for (let j = 0; j < width; j++) {
|
||||||
var i0, j0;
|
let i0, j0;
|
||||||
let contextLabel = 0;
|
let contextLabel = 0;
|
||||||
for (k = 0; k < codingTemplateLength; k++) {
|
for (k = 0; k < codingTemplateLength; k++) {
|
||||||
i0 = i + codingTemplateY[k];
|
i0 = i + codingTemplateY[k];
|
||||||
@ -629,7 +623,7 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
currentWidth += deltaWidth;
|
currentWidth += deltaWidth;
|
||||||
totalWidth += currentWidth;
|
totalWidth += currentWidth;
|
||||||
var bitmap;
|
let bitmap;
|
||||||
if (refinement) {
|
if (refinement) {
|
||||||
// 6.5.8.2 Refinement/aggregate-coded symbol bitmap
|
// 6.5.8.2 Refinement/aggregate-coded symbol bitmap
|
||||||
const numberOfInstances = decodeInteger(
|
const numberOfInstances = decodeInteger(
|
||||||
@ -756,9 +750,11 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 6.5.10 Exported symbols
|
// 6.5.10 Exported symbols
|
||||||
const exportedSymbols = [];
|
const exportedSymbols = [],
|
||||||
let flags = [],
|
flags = [];
|
||||||
currentFlag = false;
|
let currentFlag = false,
|
||||||
|
i,
|
||||||
|
ii;
|
||||||
const totalSymbolsLength = symbols.length + numberOfNewSymbols;
|
const totalSymbolsLength = symbols.length + numberOfNewSymbols;
|
||||||
while (flags.length < totalSymbolsLength) {
|
while (flags.length < totalSymbolsLength) {
|
||||||
let runLength = huffman
|
let runLength = huffman
|
||||||
@ -769,7 +765,7 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
currentFlag = !currentFlag;
|
currentFlag = !currentFlag;
|
||||||
}
|
}
|
||||||
for (var i = 0, ii = symbols.length; i < ii; i++) {
|
for (i = 0, ii = symbols.length; i < ii; i++) {
|
||||||
if (flags[i]) {
|
if (flags[i]) {
|
||||||
exportedSymbols.push(symbols[i]);
|
exportedSymbols.push(symbols[i]);
|
||||||
}
|
}
|
||||||
@ -879,7 +875,7 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
|
const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
|
||||||
const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
|
const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
|
||||||
var s2, t2, symbolRow;
|
let s2, t2, symbolRow;
|
||||||
if (transposed) {
|
if (transposed) {
|
||||||
// Place Symbol Bitmap from T1,S1
|
// Place Symbol Bitmap from T1,S1
|
||||||
for (s2 = 0; s2 < symbolHeight; s2++) {
|
for (s2 = 0; s2 < symbolHeight; s2++) {
|
||||||
@ -1289,20 +1285,20 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
combinationOperator: data[start + 16] & 7,
|
combinationOperator: data[start + 16] & 7,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var RegionSegmentInformationFieldLength = 17;
|
const RegionSegmentInformationFieldLength = 17;
|
||||||
|
|
||||||
function processSegment(segment, visitor) {
|
function processSegment(segment, visitor) {
|
||||||
const header = segment.header;
|
const header = segment.header;
|
||||||
|
|
||||||
let data = segment.data,
|
const data = segment.data,
|
||||||
position = segment.start,
|
|
||||||
end = segment.end;
|
end = segment.end;
|
||||||
|
let position = segment.start;
|
||||||
let args, at, i, atLength;
|
let args, at, i, atLength;
|
||||||
switch (header.type) {
|
switch (header.type) {
|
||||||
case 0: // SymbolDictionary
|
case 0: // SymbolDictionary
|
||||||
// 7.4.2 Symbol dictionary segment syntax
|
// 7.4.2 Symbol dictionary segment syntax
|
||||||
var dictionary = {};
|
const dictionary = {};
|
||||||
var dictionaryFlags = readUint16(data, position); // 7.4.2.1.1
|
const dictionaryFlags = readUint16(data, position); // 7.4.2.1.1
|
||||||
dictionary.huffman = !!(dictionaryFlags & 1);
|
dictionary.huffman = !!(dictionaryFlags & 1);
|
||||||
dictionary.refinement = !!(dictionaryFlags & 2);
|
dictionary.refinement = !!(dictionaryFlags & 2);
|
||||||
dictionary.huffmanDHSelector = (dictionaryFlags >> 2) & 3;
|
dictionary.huffmanDHSelector = (dictionaryFlags >> 2) & 3;
|
||||||
@ -1352,10 +1348,10 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
break;
|
break;
|
||||||
case 6: // ImmediateTextRegion
|
case 6: // ImmediateTextRegion
|
||||||
case 7: // ImmediateLosslessTextRegion
|
case 7: // ImmediateLosslessTextRegion
|
||||||
var textRegion = {};
|
const textRegion = {};
|
||||||
textRegion.info = readRegionSegmentInformation(data, position);
|
textRegion.info = readRegionSegmentInformation(data, position);
|
||||||
position += RegionSegmentInformationFieldLength;
|
position += RegionSegmentInformationFieldLength;
|
||||||
var textRegionSegmentFlags = readUint16(data, position);
|
const textRegionSegmentFlags = readUint16(data, position);
|
||||||
position += 2;
|
position += 2;
|
||||||
textRegion.huffman = !!(textRegionSegmentFlags & 1);
|
textRegion.huffman = !!(textRegionSegmentFlags & 1);
|
||||||
textRegion.refinement = !!(textRegionSegmentFlags & 2);
|
textRegion.refinement = !!(textRegionSegmentFlags & 2);
|
||||||
@ -1436,10 +1432,10 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
break;
|
break;
|
||||||
case 38: // ImmediateGenericRegion
|
case 38: // ImmediateGenericRegion
|
||||||
case 39: // ImmediateLosslessGenericRegion
|
case 39: // ImmediateLosslessGenericRegion
|
||||||
var genericRegion = {};
|
const genericRegion = {};
|
||||||
genericRegion.info = readRegionSegmentInformation(data, position);
|
genericRegion.info = readRegionSegmentInformation(data, position);
|
||||||
position += RegionSegmentInformationFieldLength;
|
position += RegionSegmentInformationFieldLength;
|
||||||
var genericRegionSegmentFlags = data[position++];
|
const genericRegionSegmentFlags = data[position++];
|
||||||
genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
|
genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
|
||||||
genericRegion.template = (genericRegionSegmentFlags >> 1) & 3;
|
genericRegion.template = (genericRegionSegmentFlags >> 1) & 3;
|
||||||
genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
|
genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
|
||||||
@ -1458,7 +1454,7 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
args = [genericRegion, data, position, end];
|
args = [genericRegion, data, position, end];
|
||||||
break;
|
break;
|
||||||
case 48: // PageInformation
|
case 48: // PageInformation
|
||||||
var pageInfo = {
|
const pageInfo = {
|
||||||
width: readUint32(data, position),
|
width: readUint32(data, position),
|
||||||
height: readUint32(data, position + 4),
|
height: readUint32(data, position + 4),
|
||||||
resolutionX: readUint32(data, position + 8),
|
resolutionX: readUint32(data, position + 8),
|
||||||
@ -1467,7 +1463,7 @@ const Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
if (pageInfo.height === 0xffffffff) {
|
if (pageInfo.height === 0xffffffff) {
|
||||||
delete pageInfo.height;
|
delete pageInfo.height;
|
||||||
}
|
}
|
||||||
var pageSegmentFlags = data[position + 16];
|
const pageSegmentFlags = data[position + 16];
|
||||||
readUint16(data, position + 17); // pageStripingInformation
|
readUint16(data, position + 17); // pageStripingInformation
|
||||||
pageInfo.lossless = !!(pageSegmentFlags & 1);
|
pageInfo.lossless = !!(pageSegmentFlags & 1);
|
||||||
pageInfo.refinement = !!(pageSegmentFlags & 2);
|
pageInfo.refinement = !!(pageSegmentFlags & 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user