Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../assets/pdf/build
File: pdf.worker.js
number = readUint32(data, position);
[10000] Fix | Delete
}
[10001] Fix | Delete
referredTo.push(number);
[10002] Fix | Delete
position += referredToSegmentNumberSize;
[10003] Fix | Delete
}
[10004] Fix | Delete
segmentHeader.referredTo = referredTo;
[10005] Fix | Delete
if (!pageAssociationFieldSize) {
[10006] Fix | Delete
segmentHeader.pageAssociation = data[position++];
[10007] Fix | Delete
} else {
[10008] Fix | Delete
segmentHeader.pageAssociation = readUint32(data, position);
[10009] Fix | Delete
position += 4;
[10010] Fix | Delete
}
[10011] Fix | Delete
segmentHeader.length = readUint32(data, position);
[10012] Fix | Delete
position += 4;
[10013] Fix | Delete
if (segmentHeader.length === 0xffffffff) {
[10014] Fix | Delete
if (segmentType === 38) {
[10015] Fix | Delete
const genericRegionInfo = readRegionSegmentInformation(data, position);
[10016] Fix | Delete
const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
[10017] Fix | Delete
const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
[10018] Fix | Delete
const searchPatternLength = 6;
[10019] Fix | Delete
const searchPattern = new Uint8Array(searchPatternLength);
[10020] Fix | Delete
if (!genericRegionMmr) {
[10021] Fix | Delete
searchPattern[0] = 0xff;
[10022] Fix | Delete
searchPattern[1] = 0xac;
[10023] Fix | Delete
}
[10024] Fix | Delete
searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
[10025] Fix | Delete
searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
[10026] Fix | Delete
searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
[10027] Fix | Delete
searchPattern[5] = genericRegionInfo.height & 0xff;
[10028] Fix | Delete
for (i = position, ii = data.length; i < ii; i++) {
[10029] Fix | Delete
let j = 0;
[10030] Fix | Delete
while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
[10031] Fix | Delete
j++;
[10032] Fix | Delete
}
[10033] Fix | Delete
if (j === searchPatternLength) {
[10034] Fix | Delete
segmentHeader.length = i + searchPatternLength;
[10035] Fix | Delete
break;
[10036] Fix | Delete
}
[10037] Fix | Delete
}
[10038] Fix | Delete
if (segmentHeader.length === 0xffffffff) {
[10039] Fix | Delete
throw new Jbig2Error("segment end was not found");
[10040] Fix | Delete
}
[10041] Fix | Delete
} else {
[10042] Fix | Delete
throw new Jbig2Error("invalid unknown segment length");
[10043] Fix | Delete
}
[10044] Fix | Delete
}
[10045] Fix | Delete
segmentHeader.headerEnd = position;
[10046] Fix | Delete
return segmentHeader;
[10047] Fix | Delete
}
[10048] Fix | Delete
function readSegments(header, data, start, end) {
[10049] Fix | Delete
const segments = [];
[10050] Fix | Delete
let position = start;
[10051] Fix | Delete
while (position < end) {
[10052] Fix | Delete
const segmentHeader = readSegmentHeader(data, position);
[10053] Fix | Delete
position = segmentHeader.headerEnd;
[10054] Fix | Delete
const segment = {
[10055] Fix | Delete
header: segmentHeader,
[10056] Fix | Delete
data
[10057] Fix | Delete
};
[10058] Fix | Delete
if (!header.randomAccess) {
[10059] Fix | Delete
segment.start = position;
[10060] Fix | Delete
position += segmentHeader.length;
[10061] Fix | Delete
segment.end = position;
[10062] Fix | Delete
}
[10063] Fix | Delete
segments.push(segment);
[10064] Fix | Delete
if (segmentHeader.type === 51) {
[10065] Fix | Delete
break;
[10066] Fix | Delete
}
[10067] Fix | Delete
}
[10068] Fix | Delete
if (header.randomAccess) {
[10069] Fix | Delete
for (let i = 0, ii = segments.length; i < ii; i++) {
[10070] Fix | Delete
segments[i].start = position;
[10071] Fix | Delete
position += segments[i].header.length;
[10072] Fix | Delete
segments[i].end = position;
[10073] Fix | Delete
}
[10074] Fix | Delete
}
[10075] Fix | Delete
return segments;
[10076] Fix | Delete
}
[10077] Fix | Delete
function readRegionSegmentInformation(data, start) {
[10078] Fix | Delete
return {
[10079] Fix | Delete
width: readUint32(data, start),
[10080] Fix | Delete
height: readUint32(data, start + 4),
[10081] Fix | Delete
x: readUint32(data, start + 8),
[10082] Fix | Delete
y: readUint32(data, start + 12),
[10083] Fix | Delete
combinationOperator: data[start + 16] & 7
[10084] Fix | Delete
};
[10085] Fix | Delete
}
[10086] Fix | Delete
const RegionSegmentInformationFieldLength = 17;
[10087] Fix | Delete
function processSegment(segment, visitor) {
[10088] Fix | Delete
const header = segment.header;
[10089] Fix | Delete
const data = segment.data,
[10090] Fix | Delete
end = segment.end;
[10091] Fix | Delete
let position = segment.start;
[10092] Fix | Delete
let args, at, i, atLength;
[10093] Fix | Delete
switch (header.type) {
[10094] Fix | Delete
case 0:
[10095] Fix | Delete
const dictionary = {};
[10096] Fix | Delete
const dictionaryFlags = readUint16(data, position);
[10097] Fix | Delete
dictionary.huffman = !!(dictionaryFlags & 1);
[10098] Fix | Delete
dictionary.refinement = !!(dictionaryFlags & 2);
[10099] Fix | Delete
dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
[10100] Fix | Delete
dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
[10101] Fix | Delete
dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
[10102] Fix | Delete
dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
[10103] Fix | Delete
dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
[10104] Fix | Delete
dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
[10105] Fix | Delete
dictionary.template = dictionaryFlags >> 10 & 3;
[10106] Fix | Delete
dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
[10107] Fix | Delete
position += 2;
[10108] Fix | Delete
if (!dictionary.huffman) {
[10109] Fix | Delete
atLength = dictionary.template === 0 ? 4 : 1;
[10110] Fix | Delete
at = [];
[10111] Fix | Delete
for (i = 0; i < atLength; i++) {
[10112] Fix | Delete
at.push({
[10113] Fix | Delete
x: readInt8(data, position),
[10114] Fix | Delete
y: readInt8(data, position + 1)
[10115] Fix | Delete
});
[10116] Fix | Delete
position += 2;
[10117] Fix | Delete
}
[10118] Fix | Delete
dictionary.at = at;
[10119] Fix | Delete
}
[10120] Fix | Delete
if (dictionary.refinement && !dictionary.refinementTemplate) {
[10121] Fix | Delete
at = [];
[10122] Fix | Delete
for (i = 0; i < 2; i++) {
[10123] Fix | Delete
at.push({
[10124] Fix | Delete
x: readInt8(data, position),
[10125] Fix | Delete
y: readInt8(data, position + 1)
[10126] Fix | Delete
});
[10127] Fix | Delete
position += 2;
[10128] Fix | Delete
}
[10129] Fix | Delete
dictionary.refinementAt = at;
[10130] Fix | Delete
}
[10131] Fix | Delete
dictionary.numberOfExportedSymbols = readUint32(data, position);
[10132] Fix | Delete
position += 4;
[10133] Fix | Delete
dictionary.numberOfNewSymbols = readUint32(data, position);
[10134] Fix | Delete
position += 4;
[10135] Fix | Delete
args = [dictionary, header.number, header.referredTo, data, position, end];
[10136] Fix | Delete
break;
[10137] Fix | Delete
case 6:
[10138] Fix | Delete
case 7:
[10139] Fix | Delete
const textRegion = {};
[10140] Fix | Delete
textRegion.info = readRegionSegmentInformation(data, position);
[10141] Fix | Delete
position += RegionSegmentInformationFieldLength;
[10142] Fix | Delete
const textRegionSegmentFlags = readUint16(data, position);
[10143] Fix | Delete
position += 2;
[10144] Fix | Delete
textRegion.huffman = !!(textRegionSegmentFlags & 1);
[10145] Fix | Delete
textRegion.refinement = !!(textRegionSegmentFlags & 2);
[10146] Fix | Delete
textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
[10147] Fix | Delete
textRegion.stripSize = 1 << textRegion.logStripSize;
[10148] Fix | Delete
textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
[10149] Fix | Delete
textRegion.transposed = !!(textRegionSegmentFlags & 64);
[10150] Fix | Delete
textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
[10151] Fix | Delete
textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
[10152] Fix | Delete
textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
[10153] Fix | Delete
textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
[10154] Fix | Delete
if (textRegion.huffman) {
[10155] Fix | Delete
const textRegionHuffmanFlags = readUint16(data, position);
[10156] Fix | Delete
position += 2;
[10157] Fix | Delete
textRegion.huffmanFS = textRegionHuffmanFlags & 3;
[10158] Fix | Delete
textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
[10159] Fix | Delete
textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
[10160] Fix | Delete
textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
[10161] Fix | Delete
textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
[10162] Fix | Delete
textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
[10163] Fix | Delete
textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
[10164] Fix | Delete
textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
[10165] Fix | Delete
}
[10166] Fix | Delete
if (textRegion.refinement && !textRegion.refinementTemplate) {
[10167] Fix | Delete
at = [];
[10168] Fix | Delete
for (i = 0; i < 2; i++) {
[10169] Fix | Delete
at.push({
[10170] Fix | Delete
x: readInt8(data, position),
[10171] Fix | Delete
y: readInt8(data, position + 1)
[10172] Fix | Delete
});
[10173] Fix | Delete
position += 2;
[10174] Fix | Delete
}
[10175] Fix | Delete
textRegion.refinementAt = at;
[10176] Fix | Delete
}
[10177] Fix | Delete
textRegion.numberOfSymbolInstances = readUint32(data, position);
[10178] Fix | Delete
position += 4;
[10179] Fix | Delete
args = [textRegion, header.referredTo, data, position, end];
[10180] Fix | Delete
break;
[10181] Fix | Delete
case 16:
[10182] Fix | Delete
const patternDictionary = {};
[10183] Fix | Delete
const patternDictionaryFlags = data[position++];
[10184] Fix | Delete
patternDictionary.mmr = !!(patternDictionaryFlags & 1);
[10185] Fix | Delete
patternDictionary.template = patternDictionaryFlags >> 1 & 3;
[10186] Fix | Delete
patternDictionary.patternWidth = data[position++];
[10187] Fix | Delete
patternDictionary.patternHeight = data[position++];
[10188] Fix | Delete
patternDictionary.maxPatternIndex = readUint32(data, position);
[10189] Fix | Delete
position += 4;
[10190] Fix | Delete
args = [patternDictionary, header.number, data, position, end];
[10191] Fix | Delete
break;
[10192] Fix | Delete
case 22:
[10193] Fix | Delete
case 23:
[10194] Fix | Delete
const halftoneRegion = {};
[10195] Fix | Delete
halftoneRegion.info = readRegionSegmentInformation(data, position);
[10196] Fix | Delete
position += RegionSegmentInformationFieldLength;
[10197] Fix | Delete
const halftoneRegionFlags = data[position++];
[10198] Fix | Delete
halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
[10199] Fix | Delete
halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
[10200] Fix | Delete
halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
[10201] Fix | Delete
halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
[10202] Fix | Delete
halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
[10203] Fix | Delete
halftoneRegion.gridWidth = readUint32(data, position);
[10204] Fix | Delete
position += 4;
[10205] Fix | Delete
halftoneRegion.gridHeight = readUint32(data, position);
[10206] Fix | Delete
position += 4;
[10207] Fix | Delete
halftoneRegion.gridOffsetX = readUint32(data, position) & 0xffffffff;
[10208] Fix | Delete
position += 4;
[10209] Fix | Delete
halftoneRegion.gridOffsetY = readUint32(data, position) & 0xffffffff;
[10210] Fix | Delete
position += 4;
[10211] Fix | Delete
halftoneRegion.gridVectorX = readUint16(data, position);
[10212] Fix | Delete
position += 2;
[10213] Fix | Delete
halftoneRegion.gridVectorY = readUint16(data, position);
[10214] Fix | Delete
position += 2;
[10215] Fix | Delete
args = [halftoneRegion, header.referredTo, data, position, end];
[10216] Fix | Delete
break;
[10217] Fix | Delete
case 38:
[10218] Fix | Delete
case 39:
[10219] Fix | Delete
const genericRegion = {};
[10220] Fix | Delete
genericRegion.info = readRegionSegmentInformation(data, position);
[10221] Fix | Delete
position += RegionSegmentInformationFieldLength;
[10222] Fix | Delete
const genericRegionSegmentFlags = data[position++];
[10223] Fix | Delete
genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
[10224] Fix | Delete
genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
[10225] Fix | Delete
genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
[10226] Fix | Delete
if (!genericRegion.mmr) {
[10227] Fix | Delete
atLength = genericRegion.template === 0 ? 4 : 1;
[10228] Fix | Delete
at = [];
[10229] Fix | Delete
for (i = 0; i < atLength; i++) {
[10230] Fix | Delete
at.push({
[10231] Fix | Delete
x: readInt8(data, position),
[10232] Fix | Delete
y: readInt8(data, position + 1)
[10233] Fix | Delete
});
[10234] Fix | Delete
position += 2;
[10235] Fix | Delete
}
[10236] Fix | Delete
genericRegion.at = at;
[10237] Fix | Delete
}
[10238] Fix | Delete
args = [genericRegion, data, position, end];
[10239] Fix | Delete
break;
[10240] Fix | Delete
case 48:
[10241] Fix | Delete
const pageInfo = {
[10242] Fix | Delete
width: readUint32(data, position),
[10243] Fix | Delete
height: readUint32(data, position + 4),
[10244] Fix | Delete
resolutionX: readUint32(data, position + 8),
[10245] Fix | Delete
resolutionY: readUint32(data, position + 12)
[10246] Fix | Delete
};
[10247] Fix | Delete
if (pageInfo.height === 0xffffffff) {
[10248] Fix | Delete
delete pageInfo.height;
[10249] Fix | Delete
}
[10250] Fix | Delete
const pageSegmentFlags = data[position + 16];
[10251] Fix | Delete
readUint16(data, position + 17);
[10252] Fix | Delete
pageInfo.lossless = !!(pageSegmentFlags & 1);
[10253] Fix | Delete
pageInfo.refinement = !!(pageSegmentFlags & 2);
[10254] Fix | Delete
pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
[10255] Fix | Delete
pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
[10256] Fix | Delete
pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
[10257] Fix | Delete
pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
[10258] Fix | Delete
args = [pageInfo];
[10259] Fix | Delete
break;
[10260] Fix | Delete
case 49:
[10261] Fix | Delete
break;
[10262] Fix | Delete
case 50:
[10263] Fix | Delete
break;
[10264] Fix | Delete
case 51:
[10265] Fix | Delete
break;
[10266] Fix | Delete
case 53:
[10267] Fix | Delete
args = [header.number, data, position, end];
[10268] Fix | Delete
break;
[10269] Fix | Delete
case 62:
[10270] Fix | Delete
break;
[10271] Fix | Delete
default:
[10272] Fix | Delete
throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
[10273] Fix | Delete
}
[10274] Fix | Delete
const callbackName = "on" + header.typeName;
[10275] Fix | Delete
if (callbackName in visitor) {
[10276] Fix | Delete
visitor[callbackName].apply(visitor, args);
[10277] Fix | Delete
}
[10278] Fix | Delete
}
[10279] Fix | Delete
function processSegments(segments, visitor) {
[10280] Fix | Delete
for (let i = 0, ii = segments.length; i < ii; i++) {
[10281] Fix | Delete
processSegment(segments[i], visitor);
[10282] Fix | Delete
}
[10283] Fix | Delete
}
[10284] Fix | Delete
function parseJbig2Chunks(chunks) {
[10285] Fix | Delete
const visitor = new SimpleSegmentVisitor();
[10286] Fix | Delete
for (let i = 0, ii = chunks.length; i < ii; i++) {
[10287] Fix | Delete
const chunk = chunks[i];
[10288] Fix | Delete
const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
[10289] Fix | Delete
processSegments(segments, visitor);
[10290] Fix | Delete
}
[10291] Fix | Delete
return visitor.buffer;
[10292] Fix | Delete
}
[10293] Fix | Delete
function parseJbig2(data) {
[10294] Fix | Delete
throw new Error("Not implemented: parseJbig2");
[10295] Fix | Delete
}
[10296] Fix | Delete
class SimpleSegmentVisitor {
[10297] Fix | Delete
onPageInformation(info) {
[10298] Fix | Delete
this.currentPageInfo = info;
[10299] Fix | Delete
const rowSize = info.width + 7 >> 3;
[10300] Fix | Delete
const buffer = new Uint8ClampedArray(rowSize * info.height);
[10301] Fix | Delete
if (info.defaultPixelValue) {
[10302] Fix | Delete
buffer.fill(0xff);
[10303] Fix | Delete
}
[10304] Fix | Delete
this.buffer = buffer;
[10305] Fix | Delete
}
[10306] Fix | Delete
drawBitmap(regionInfo, bitmap) {
[10307] Fix | Delete
const pageInfo = this.currentPageInfo;
[10308] Fix | Delete
const width = regionInfo.width,
[10309] Fix | Delete
height = regionInfo.height;
[10310] Fix | Delete
const rowSize = pageInfo.width + 7 >> 3;
[10311] Fix | Delete
const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
[10312] Fix | Delete
const buffer = this.buffer;
[10313] Fix | Delete
const mask0 = 128 >> (regionInfo.x & 7);
[10314] Fix | Delete
let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
[10315] Fix | Delete
let i, j, mask, offset;
[10316] Fix | Delete
switch (combinationOperator) {
[10317] Fix | Delete
case 0:
[10318] Fix | Delete
for (i = 0; i < height; i++) {
[10319] Fix | Delete
mask = mask0;
[10320] Fix | Delete
offset = offset0;
[10321] Fix | Delete
for (j = 0; j < width; j++) {
[10322] Fix | Delete
if (bitmap[i][j]) {
[10323] Fix | Delete
buffer[offset] |= mask;
[10324] Fix | Delete
}
[10325] Fix | Delete
mask >>= 1;
[10326] Fix | Delete
if (!mask) {
[10327] Fix | Delete
mask = 128;
[10328] Fix | Delete
offset++;
[10329] Fix | Delete
}
[10330] Fix | Delete
}
[10331] Fix | Delete
offset0 += rowSize;
[10332] Fix | Delete
}
[10333] Fix | Delete
break;
[10334] Fix | Delete
case 2:
[10335] Fix | Delete
for (i = 0; i < height; i++) {
[10336] Fix | Delete
mask = mask0;
[10337] Fix | Delete
offset = offset0;
[10338] Fix | Delete
for (j = 0; j < width; j++) {
[10339] Fix | Delete
if (bitmap[i][j]) {
[10340] Fix | Delete
buffer[offset] ^= mask;
[10341] Fix | Delete
}
[10342] Fix | Delete
mask >>= 1;
[10343] Fix | Delete
if (!mask) {
[10344] Fix | Delete
mask = 128;
[10345] Fix | Delete
offset++;
[10346] Fix | Delete
}
[10347] Fix | Delete
}
[10348] Fix | Delete
offset0 += rowSize;
[10349] Fix | Delete
}
[10350] Fix | Delete
break;
[10351] Fix | Delete
default:
[10352] Fix | Delete
throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
[10353] Fix | Delete
}
[10354] Fix | Delete
}
[10355] Fix | Delete
onImmediateGenericRegion(region, data, start, end) {
[10356] Fix | Delete
const regionInfo = region.info;
[10357] Fix | Delete
const decodingContext = new DecodingContext(data, start, end);
[10358] Fix | Delete
const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
[10359] Fix | Delete
this.drawBitmap(regionInfo, bitmap);
[10360] Fix | Delete
}
[10361] Fix | Delete
onImmediateLosslessGenericRegion() {
[10362] Fix | Delete
this.onImmediateGenericRegion(...arguments);
[10363] Fix | Delete
}
[10364] Fix | Delete
onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
[10365] Fix | Delete
let huffmanTables, huffmanInput;
[10366] Fix | Delete
if (dictionary.huffman) {
[10367] Fix | Delete
huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
[10368] Fix | Delete
huffmanInput = new Reader(data, start, end);
[10369] Fix | Delete
}
[10370] Fix | Delete
let symbols = this.symbols;
[10371] Fix | Delete
if (!symbols) {
[10372] Fix | Delete
this.symbols = symbols = {};
[10373] Fix | Delete
}
[10374] Fix | Delete
const inputSymbols = [];
[10375] Fix | Delete
for (const referredSegment of referredSegments) {
[10376] Fix | Delete
const referredSymbols = symbols[referredSegment];
[10377] Fix | Delete
if (referredSymbols) {
[10378] Fix | Delete
inputSymbols.push(...referredSymbols);
[10379] Fix | Delete
}
[10380] Fix | Delete
}
[10381] Fix | Delete
const decodingContext = new DecodingContext(data, start, end);
[10382] Fix | Delete
symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
[10383] Fix | Delete
}
[10384] Fix | Delete
onImmediateTextRegion(region, referredSegments, data, start, end) {
[10385] Fix | Delete
const regionInfo = region.info;
[10386] Fix | Delete
let huffmanTables, huffmanInput;
[10387] Fix | Delete
const symbols = this.symbols;
[10388] Fix | Delete
const inputSymbols = [];
[10389] Fix | Delete
for (const referredSegment of referredSegments) {
[10390] Fix | Delete
const referredSymbols = symbols[referredSegment];
[10391] Fix | Delete
if (referredSymbols) {
[10392] Fix | Delete
inputSymbols.push(...referredSymbols);
[10393] Fix | Delete
}
[10394] Fix | Delete
}
[10395] Fix | Delete
const symbolCodeLength = log2(inputSymbols.length);
[10396] Fix | Delete
if (region.huffman) {
[10397] Fix | Delete
huffmanInput = new Reader(data, start, end);
[10398] Fix | Delete
huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
[10399] Fix | Delete
}
[10400] Fix | Delete
const decodingContext = new DecodingContext(data, start, end);
[10401] Fix | Delete
const bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
[10402] Fix | Delete
this.drawBitmap(regionInfo, bitmap);
[10403] Fix | Delete
}
[10404] Fix | Delete
onImmediateLosslessTextRegion() {
[10405] Fix | Delete
this.onImmediateTextRegion(...arguments);
[10406] Fix | Delete
}
[10407] Fix | Delete
onPatternDictionary(dictionary, currentSegment, data, start, end) {
[10408] Fix | Delete
let patterns = this.patterns;
[10409] Fix | Delete
if (!patterns) {
[10410] Fix | Delete
this.patterns = patterns = {};
[10411] Fix | Delete
}
[10412] Fix | Delete
const decodingContext = new DecodingContext(data, start, end);
[10413] Fix | Delete
patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
[10414] Fix | Delete
}
[10415] Fix | Delete
onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
[10416] Fix | Delete
const patterns = this.patterns[referredSegments[0]];
[10417] Fix | Delete
const regionInfo = region.info;
[10418] Fix | Delete
const decodingContext = new DecodingContext(data, start, end);
[10419] Fix | Delete
const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
[10420] Fix | Delete
this.drawBitmap(regionInfo, bitmap);
[10421] Fix | Delete
}
[10422] Fix | Delete
onImmediateLosslessHalftoneRegion() {
[10423] Fix | Delete
this.onImmediateHalftoneRegion(...arguments);
[10424] Fix | Delete
}
[10425] Fix | Delete
onTables(currentSegment, data, start, end) {
[10426] Fix | Delete
let customTables = this.customTables;
[10427] Fix | Delete
if (!customTables) {
[10428] Fix | Delete
this.customTables = customTables = {};
[10429] Fix | Delete
}
[10430] Fix | Delete
customTables[currentSegment] = decodeTablesSegment(data, start, end);
[10431] Fix | Delete
}
[10432] Fix | Delete
}
[10433] Fix | Delete
class HuffmanLine {
[10434] Fix | Delete
constructor(lineData) {
[10435] Fix | Delete
if (lineData.length === 2) {
[10436] Fix | Delete
this.isOOB = true;
[10437] Fix | Delete
this.rangeLow = 0;
[10438] Fix | Delete
this.prefixLength = lineData[0];
[10439] Fix | Delete
this.rangeLength = 0;
[10440] Fix | Delete
this.prefixCode = lineData[1];
[10441] Fix | Delete
this.isLowerRange = false;
[10442] Fix | Delete
} else {
[10443] Fix | Delete
this.isOOB = false;
[10444] Fix | Delete
this.rangeLow = lineData[0];
[10445] Fix | Delete
this.prefixLength = lineData[1];
[10446] Fix | Delete
this.rangeLength = lineData[2];
[10447] Fix | Delete
this.prefixCode = lineData[3];
[10448] Fix | Delete
this.isLowerRange = lineData[4] === "lower";
[10449] Fix | Delete
}
[10450] Fix | Delete
}
[10451] Fix | Delete
}
[10452] Fix | Delete
class HuffmanTreeNode {
[10453] Fix | Delete
constructor(line) {
[10454] Fix | Delete
this.children = [];
[10455] Fix | Delete
if (line) {
[10456] Fix | Delete
this.isLeaf = true;
[10457] Fix | Delete
this.rangeLength = line.rangeLength;
[10458] Fix | Delete
this.rangeLow = line.rangeLow;
[10459] Fix | Delete
this.isLowerRange = line.isLowerRange;
[10460] Fix | Delete
this.isOOB = line.isOOB;
[10461] Fix | Delete
} else {
[10462] Fix | Delete
this.isLeaf = false;
[10463] Fix | Delete
}
[10464] Fix | Delete
}
[10465] Fix | Delete
buildTree(line, shift) {
[10466] Fix | Delete
const bit = line.prefixCode >> shift & 1;
[10467] Fix | Delete
if (shift <= 0) {
[10468] Fix | Delete
this.children[bit] = new HuffmanTreeNode(line);
[10469] Fix | Delete
} else {
[10470] Fix | Delete
let node = this.children[bit];
[10471] Fix | Delete
if (!node) {
[10472] Fix | Delete
this.children[bit] = node = new HuffmanTreeNode(null);
[10473] Fix | Delete
}
[10474] Fix | Delete
node.buildTree(line, shift - 1);
[10475] Fix | Delete
}
[10476] Fix | Delete
}
[10477] Fix | Delete
decodeNode(reader) {
[10478] Fix | Delete
if (this.isLeaf) {
[10479] Fix | Delete
if (this.isOOB) {
[10480] Fix | Delete
return null;
[10481] Fix | Delete
}
[10482] Fix | Delete
const htOffset = reader.readBits(this.rangeLength);
[10483] Fix | Delete
return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
[10484] Fix | Delete
}
[10485] Fix | Delete
const node = this.children[reader.readBit()];
[10486] Fix | Delete
if (!node) {
[10487] Fix | Delete
throw new Jbig2Error("invalid Huffman data");
[10488] Fix | Delete
}
[10489] Fix | Delete
return node.decodeNode(reader);
[10490] Fix | Delete
}
[10491] Fix | Delete
}
[10492] Fix | Delete
class HuffmanTable {
[10493] Fix | Delete
constructor(lines, prefixCodesDone) {
[10494] Fix | Delete
if (!prefixCodesDone) {
[10495] Fix | Delete
this.assignPrefixCodes(lines);
[10496] Fix | Delete
}
[10497] Fix | Delete
this.rootNode = new HuffmanTreeNode(null);
[10498] Fix | Delete
for (let i = 0, ii = lines.length; i < ii; i++) {
[10499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function