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
for (k = 0; k < changingEntriesLength; k++) {
[9500] Fix | Delete
i0 = i + changingTemplateY[k];
[9501] Fix | Delete
j0 = j + changingTemplateX[k];
[9502] Fix | Delete
bit = bitmap[i0][j0];
[9503] Fix | Delete
if (bit) {
[9504] Fix | Delete
bit = changingTemplateBit[k];
[9505] Fix | Delete
contextLabel |= bit;
[9506] Fix | Delete
}
[9507] Fix | Delete
}
[9508] Fix | Delete
} else {
[9509] Fix | Delete
contextLabel = 0;
[9510] Fix | Delete
shift = templateLength - 1;
[9511] Fix | Delete
for (k = 0; k < templateLength; k++, shift--) {
[9512] Fix | Delete
j0 = j + templateX[k];
[9513] Fix | Delete
if (j0 >= 0 && j0 < width) {
[9514] Fix | Delete
i0 = i + templateY[k];
[9515] Fix | Delete
if (i0 >= 0) {
[9516] Fix | Delete
bit = bitmap[i0][j0];
[9517] Fix | Delete
if (bit) {
[9518] Fix | Delete
contextLabel |= bit << shift;
[9519] Fix | Delete
}
[9520] Fix | Delete
}
[9521] Fix | Delete
}
[9522] Fix | Delete
}
[9523] Fix | Delete
}
[9524] Fix | Delete
const pixel = decoder.readBit(contexts, contextLabel);
[9525] Fix | Delete
row[j] = pixel;
[9526] Fix | Delete
}
[9527] Fix | Delete
}
[9528] Fix | Delete
return bitmap;
[9529] Fix | Delete
}
[9530] Fix | Delete
function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
[9531] Fix | Delete
let codingTemplate = RefinementTemplates[templateIndex].coding;
[9532] Fix | Delete
if (templateIndex === 0) {
[9533] Fix | Delete
codingTemplate = codingTemplate.concat([at[0]]);
[9534] Fix | Delete
}
[9535] Fix | Delete
const codingTemplateLength = codingTemplate.length;
[9536] Fix | Delete
const codingTemplateX = new Int32Array(codingTemplateLength);
[9537] Fix | Delete
const codingTemplateY = new Int32Array(codingTemplateLength);
[9538] Fix | Delete
let k;
[9539] Fix | Delete
for (k = 0; k < codingTemplateLength; k++) {
[9540] Fix | Delete
codingTemplateX[k] = codingTemplate[k].x;
[9541] Fix | Delete
codingTemplateY[k] = codingTemplate[k].y;
[9542] Fix | Delete
}
[9543] Fix | Delete
let referenceTemplate = RefinementTemplates[templateIndex].reference;
[9544] Fix | Delete
if (templateIndex === 0) {
[9545] Fix | Delete
referenceTemplate = referenceTemplate.concat([at[1]]);
[9546] Fix | Delete
}
[9547] Fix | Delete
const referenceTemplateLength = referenceTemplate.length;
[9548] Fix | Delete
const referenceTemplateX = new Int32Array(referenceTemplateLength);
[9549] Fix | Delete
const referenceTemplateY = new Int32Array(referenceTemplateLength);
[9550] Fix | Delete
for (k = 0; k < referenceTemplateLength; k++) {
[9551] Fix | Delete
referenceTemplateX[k] = referenceTemplate[k].x;
[9552] Fix | Delete
referenceTemplateY[k] = referenceTemplate[k].y;
[9553] Fix | Delete
}
[9554] Fix | Delete
const referenceWidth = referenceBitmap[0].length;
[9555] Fix | Delete
const referenceHeight = referenceBitmap.length;
[9556] Fix | Delete
const pseudoPixelContext = RefinementReusedContexts[templateIndex];
[9557] Fix | Delete
const bitmap = [];
[9558] Fix | Delete
const decoder = decodingContext.decoder;
[9559] Fix | Delete
const contexts = decodingContext.contextCache.getContexts("GR");
[9560] Fix | Delete
let ltp = 0;
[9561] Fix | Delete
for (let i = 0; i < height; i++) {
[9562] Fix | Delete
if (prediction) {
[9563] Fix | Delete
const sltp = decoder.readBit(contexts, pseudoPixelContext);
[9564] Fix | Delete
ltp ^= sltp;
[9565] Fix | Delete
if (ltp) {
[9566] Fix | Delete
throw new Jbig2Error("prediction is not supported");
[9567] Fix | Delete
}
[9568] Fix | Delete
}
[9569] Fix | Delete
const row = new Uint8Array(width);
[9570] Fix | Delete
bitmap.push(row);
[9571] Fix | Delete
for (let j = 0; j < width; j++) {
[9572] Fix | Delete
let i0, j0;
[9573] Fix | Delete
let contextLabel = 0;
[9574] Fix | Delete
for (k = 0; k < codingTemplateLength; k++) {
[9575] Fix | Delete
i0 = i + codingTemplateY[k];
[9576] Fix | Delete
j0 = j + codingTemplateX[k];
[9577] Fix | Delete
if (i0 < 0 || j0 < 0 || j0 >= width) {
[9578] Fix | Delete
contextLabel <<= 1;
[9579] Fix | Delete
} else {
[9580] Fix | Delete
contextLabel = contextLabel << 1 | bitmap[i0][j0];
[9581] Fix | Delete
}
[9582] Fix | Delete
}
[9583] Fix | Delete
for (k = 0; k < referenceTemplateLength; k++) {
[9584] Fix | Delete
i0 = i + referenceTemplateY[k] - offsetY;
[9585] Fix | Delete
j0 = j + referenceTemplateX[k] - offsetX;
[9586] Fix | Delete
if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
[9587] Fix | Delete
contextLabel <<= 1;
[9588] Fix | Delete
} else {
[9589] Fix | Delete
contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
[9590] Fix | Delete
}
[9591] Fix | Delete
}
[9592] Fix | Delete
const pixel = decoder.readBit(contexts, contextLabel);
[9593] Fix | Delete
row[j] = pixel;
[9594] Fix | Delete
}
[9595] Fix | Delete
}
[9596] Fix | Delete
return bitmap;
[9597] Fix | Delete
}
[9598] Fix | Delete
function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
[9599] Fix | Delete
if (huffman && refinement) {
[9600] Fix | Delete
throw new Jbig2Error("symbol refinement with Huffman is not supported");
[9601] Fix | Delete
}
[9602] Fix | Delete
const newSymbols = [];
[9603] Fix | Delete
let currentHeight = 0;
[9604] Fix | Delete
let symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
[9605] Fix | Delete
const decoder = decodingContext.decoder;
[9606] Fix | Delete
const contextCache = decodingContext.contextCache;
[9607] Fix | Delete
let tableB1, symbolWidths;
[9608] Fix | Delete
if (huffman) {
[9609] Fix | Delete
tableB1 = getStandardTable(1);
[9610] Fix | Delete
symbolWidths = [];
[9611] Fix | Delete
symbolCodeLength = Math.max(symbolCodeLength, 1);
[9612] Fix | Delete
}
[9613] Fix | Delete
while (newSymbols.length < numberOfNewSymbols) {
[9614] Fix | Delete
const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
[9615] Fix | Delete
currentHeight += deltaHeight;
[9616] Fix | Delete
let currentWidth = 0,
[9617] Fix | Delete
totalWidth = 0;
[9618] Fix | Delete
const firstSymbol = huffman ? symbolWidths.length : 0;
[9619] Fix | Delete
while (true) {
[9620] Fix | Delete
const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
[9621] Fix | Delete
if (deltaWidth === null) {
[9622] Fix | Delete
break;
[9623] Fix | Delete
}
[9624] Fix | Delete
currentWidth += deltaWidth;
[9625] Fix | Delete
totalWidth += currentWidth;
[9626] Fix | Delete
let bitmap;
[9627] Fix | Delete
if (refinement) {
[9628] Fix | Delete
const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
[9629] Fix | Delete
if (numberOfInstances > 1) {
[9630] Fix | Delete
bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
[9631] Fix | Delete
} else {
[9632] Fix | Delete
const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
[9633] Fix | Delete
const rdx = decodeInteger(contextCache, "IARDX", decoder);
[9634] Fix | Delete
const rdy = decodeInteger(contextCache, "IARDY", decoder);
[9635] Fix | Delete
const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
[9636] Fix | Delete
bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
[9637] Fix | Delete
}
[9638] Fix | Delete
newSymbols.push(bitmap);
[9639] Fix | Delete
} else if (huffman) {
[9640] Fix | Delete
symbolWidths.push(currentWidth);
[9641] Fix | Delete
} else {
[9642] Fix | Delete
bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
[9643] Fix | Delete
newSymbols.push(bitmap);
[9644] Fix | Delete
}
[9645] Fix | Delete
}
[9646] Fix | Delete
if (huffman && !refinement) {
[9647] Fix | Delete
const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
[9648] Fix | Delete
huffmanInput.byteAlign();
[9649] Fix | Delete
let collectiveBitmap;
[9650] Fix | Delete
if (bitmapSize === 0) {
[9651] Fix | Delete
collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
[9652] Fix | Delete
} else {
[9653] Fix | Delete
const originalEnd = huffmanInput.end;
[9654] Fix | Delete
const bitmapEnd = huffmanInput.position + bitmapSize;
[9655] Fix | Delete
huffmanInput.end = bitmapEnd;
[9656] Fix | Delete
collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
[9657] Fix | Delete
huffmanInput.end = originalEnd;
[9658] Fix | Delete
huffmanInput.position = bitmapEnd;
[9659] Fix | Delete
}
[9660] Fix | Delete
const numberOfSymbolsDecoded = symbolWidths.length;
[9661] Fix | Delete
if (firstSymbol === numberOfSymbolsDecoded - 1) {
[9662] Fix | Delete
newSymbols.push(collectiveBitmap);
[9663] Fix | Delete
} else {
[9664] Fix | Delete
let i,
[9665] Fix | Delete
y,
[9666] Fix | Delete
xMin = 0,
[9667] Fix | Delete
xMax,
[9668] Fix | Delete
bitmapWidth,
[9669] Fix | Delete
symbolBitmap;
[9670] Fix | Delete
for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
[9671] Fix | Delete
bitmapWidth = symbolWidths[i];
[9672] Fix | Delete
xMax = xMin + bitmapWidth;
[9673] Fix | Delete
symbolBitmap = [];
[9674] Fix | Delete
for (y = 0; y < currentHeight; y++) {
[9675] Fix | Delete
symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
[9676] Fix | Delete
}
[9677] Fix | Delete
newSymbols.push(symbolBitmap);
[9678] Fix | Delete
xMin = xMax;
[9679] Fix | Delete
}
[9680] Fix | Delete
}
[9681] Fix | Delete
}
[9682] Fix | Delete
}
[9683] Fix | Delete
const exportedSymbols = [],
[9684] Fix | Delete
flags = [];
[9685] Fix | Delete
let currentFlag = false,
[9686] Fix | Delete
i,
[9687] Fix | Delete
ii;
[9688] Fix | Delete
const totalSymbolsLength = symbols.length + numberOfNewSymbols;
[9689] Fix | Delete
while (flags.length < totalSymbolsLength) {
[9690] Fix | Delete
let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
[9691] Fix | Delete
while (runLength--) {
[9692] Fix | Delete
flags.push(currentFlag);
[9693] Fix | Delete
}
[9694] Fix | Delete
currentFlag = !currentFlag;
[9695] Fix | Delete
}
[9696] Fix | Delete
for (i = 0, ii = symbols.length; i < ii; i++) {
[9697] Fix | Delete
if (flags[i]) {
[9698] Fix | Delete
exportedSymbols.push(symbols[i]);
[9699] Fix | Delete
}
[9700] Fix | Delete
}
[9701] Fix | Delete
for (let j = 0; j < numberOfNewSymbols; i++, j++) {
[9702] Fix | Delete
if (flags[i]) {
[9703] Fix | Delete
exportedSymbols.push(newSymbols[j]);
[9704] Fix | Delete
}
[9705] Fix | Delete
}
[9706] Fix | Delete
return exportedSymbols;
[9707] Fix | Delete
}
[9708] Fix | Delete
function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
[9709] Fix | Delete
if (huffman && refinement) {
[9710] Fix | Delete
throw new Jbig2Error("refinement with Huffman is not supported");
[9711] Fix | Delete
}
[9712] Fix | Delete
const bitmap = [];
[9713] Fix | Delete
let i, row;
[9714] Fix | Delete
for (i = 0; i < height; i++) {
[9715] Fix | Delete
row = new Uint8Array(width);
[9716] Fix | Delete
if (defaultPixelValue) {
[9717] Fix | Delete
for (let j = 0; j < width; j++) {
[9718] Fix | Delete
row[j] = defaultPixelValue;
[9719] Fix | Delete
}
[9720] Fix | Delete
}
[9721] Fix | Delete
bitmap.push(row);
[9722] Fix | Delete
}
[9723] Fix | Delete
const decoder = decodingContext.decoder;
[9724] Fix | Delete
const contextCache = decodingContext.contextCache;
[9725] Fix | Delete
let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
[9726] Fix | Delete
let firstS = 0;
[9727] Fix | Delete
i = 0;
[9728] Fix | Delete
while (i < numberOfSymbolInstances) {
[9729] Fix | Delete
const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
[9730] Fix | Delete
stripT += deltaT;
[9731] Fix | Delete
const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
[9732] Fix | Delete
firstS += deltaFirstS;
[9733] Fix | Delete
let currentS = firstS;
[9734] Fix | Delete
do {
[9735] Fix | Delete
let currentT = 0;
[9736] Fix | Delete
if (stripSize > 1) {
[9737] Fix | Delete
currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
[9738] Fix | Delete
}
[9739] Fix | Delete
const t = stripSize * stripT + currentT;
[9740] Fix | Delete
const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
[9741] Fix | Delete
const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
[9742] Fix | Delete
let symbolBitmap = inputSymbols[symbolId];
[9743] Fix | Delete
let symbolWidth = symbolBitmap[0].length;
[9744] Fix | Delete
let symbolHeight = symbolBitmap.length;
[9745] Fix | Delete
if (applyRefinement) {
[9746] Fix | Delete
const rdw = decodeInteger(contextCache, "IARDW", decoder);
[9747] Fix | Delete
const rdh = decodeInteger(contextCache, "IARDH", decoder);
[9748] Fix | Delete
const rdx = decodeInteger(contextCache, "IARDX", decoder);
[9749] Fix | Delete
const rdy = decodeInteger(contextCache, "IARDY", decoder);
[9750] Fix | Delete
symbolWidth += rdw;
[9751] Fix | Delete
symbolHeight += rdh;
[9752] Fix | Delete
symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
[9753] Fix | Delete
}
[9754] Fix | Delete
let increment = 0;
[9755] Fix | Delete
if (!transposed) {
[9756] Fix | Delete
if (referenceCorner > 1) {
[9757] Fix | Delete
currentS += symbolWidth - 1;
[9758] Fix | Delete
} else {
[9759] Fix | Delete
increment = symbolWidth - 1;
[9760] Fix | Delete
}
[9761] Fix | Delete
} else if (!(referenceCorner & 1)) {
[9762] Fix | Delete
currentS += symbolHeight - 1;
[9763] Fix | Delete
} else {
[9764] Fix | Delete
increment = symbolHeight - 1;
[9765] Fix | Delete
}
[9766] Fix | Delete
const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
[9767] Fix | Delete
const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
[9768] Fix | Delete
let s2, t2, symbolRow;
[9769] Fix | Delete
if (transposed) {
[9770] Fix | Delete
for (s2 = 0; s2 < symbolHeight; s2++) {
[9771] Fix | Delete
row = bitmap[offsetS + s2];
[9772] Fix | Delete
if (!row) {
[9773] Fix | Delete
continue;
[9774] Fix | Delete
}
[9775] Fix | Delete
symbolRow = symbolBitmap[s2];
[9776] Fix | Delete
const maxWidth = Math.min(width - offsetT, symbolWidth);
[9777] Fix | Delete
switch (combinationOperator) {
[9778] Fix | Delete
case 0:
[9779] Fix | Delete
for (t2 = 0; t2 < maxWidth; t2++) {
[9780] Fix | Delete
row[offsetT + t2] |= symbolRow[t2];
[9781] Fix | Delete
}
[9782] Fix | Delete
break;
[9783] Fix | Delete
case 2:
[9784] Fix | Delete
for (t2 = 0; t2 < maxWidth; t2++) {
[9785] Fix | Delete
row[offsetT + t2] ^= symbolRow[t2];
[9786] Fix | Delete
}
[9787] Fix | Delete
break;
[9788] Fix | Delete
default:
[9789] Fix | Delete
throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
[9790] Fix | Delete
}
[9791] Fix | Delete
}
[9792] Fix | Delete
} else {
[9793] Fix | Delete
for (t2 = 0; t2 < symbolHeight; t2++) {
[9794] Fix | Delete
row = bitmap[offsetT + t2];
[9795] Fix | Delete
if (!row) {
[9796] Fix | Delete
continue;
[9797] Fix | Delete
}
[9798] Fix | Delete
symbolRow = symbolBitmap[t2];
[9799] Fix | Delete
switch (combinationOperator) {
[9800] Fix | Delete
case 0:
[9801] Fix | Delete
for (s2 = 0; s2 < symbolWidth; s2++) {
[9802] Fix | Delete
row[offsetS + s2] |= symbolRow[s2];
[9803] Fix | Delete
}
[9804] Fix | Delete
break;
[9805] Fix | Delete
case 2:
[9806] Fix | Delete
for (s2 = 0; s2 < symbolWidth; s2++) {
[9807] Fix | Delete
row[offsetS + s2] ^= symbolRow[s2];
[9808] Fix | Delete
}
[9809] Fix | Delete
break;
[9810] Fix | Delete
default:
[9811] Fix | Delete
throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
[9812] Fix | Delete
}
[9813] Fix | Delete
}
[9814] Fix | Delete
}
[9815] Fix | Delete
i++;
[9816] Fix | Delete
const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
[9817] Fix | Delete
if (deltaS === null) {
[9818] Fix | Delete
break;
[9819] Fix | Delete
}
[9820] Fix | Delete
currentS += increment + deltaS + dsOffset;
[9821] Fix | Delete
} while (true);
[9822] Fix | Delete
}
[9823] Fix | Delete
return bitmap;
[9824] Fix | Delete
}
[9825] Fix | Delete
function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
[9826] Fix | Delete
const at = [];
[9827] Fix | Delete
if (!mmr) {
[9828] Fix | Delete
at.push({
[9829] Fix | Delete
x: -patternWidth,
[9830] Fix | Delete
y: 0
[9831] Fix | Delete
});
[9832] Fix | Delete
if (template === 0) {
[9833] Fix | Delete
at.push({
[9834] Fix | Delete
x: -3,
[9835] Fix | Delete
y: -1
[9836] Fix | Delete
}, {
[9837] Fix | Delete
x: 2,
[9838] Fix | Delete
y: -2
[9839] Fix | Delete
}, {
[9840] Fix | Delete
x: -2,
[9841] Fix | Delete
y: -2
[9842] Fix | Delete
});
[9843] Fix | Delete
}
[9844] Fix | Delete
}
[9845] Fix | Delete
const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
[9846] Fix | Delete
const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
[9847] Fix | Delete
const patterns = [];
[9848] Fix | Delete
for (let i = 0; i <= maxPatternIndex; i++) {
[9849] Fix | Delete
const patternBitmap = [];
[9850] Fix | Delete
const xMin = patternWidth * i;
[9851] Fix | Delete
const xMax = xMin + patternWidth;
[9852] Fix | Delete
for (let y = 0; y < patternHeight; y++) {
[9853] Fix | Delete
patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
[9854] Fix | Delete
}
[9855] Fix | Delete
patterns.push(patternBitmap);
[9856] Fix | Delete
}
[9857] Fix | Delete
return patterns;
[9858] Fix | Delete
}
[9859] Fix | Delete
function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
[9860] Fix | Delete
const skip = null;
[9861] Fix | Delete
if (enableSkip) {
[9862] Fix | Delete
throw new Jbig2Error("skip is not supported");
[9863] Fix | Delete
}
[9864] Fix | Delete
if (combinationOperator !== 0) {
[9865] Fix | Delete
throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
[9866] Fix | Delete
}
[9867] Fix | Delete
const regionBitmap = [];
[9868] Fix | Delete
let i, j, row;
[9869] Fix | Delete
for (i = 0; i < regionHeight; i++) {
[9870] Fix | Delete
row = new Uint8Array(regionWidth);
[9871] Fix | Delete
if (defaultPixelValue) {
[9872] Fix | Delete
for (j = 0; j < regionWidth; j++) {
[9873] Fix | Delete
row[j] = defaultPixelValue;
[9874] Fix | Delete
}
[9875] Fix | Delete
}
[9876] Fix | Delete
regionBitmap.push(row);
[9877] Fix | Delete
}
[9878] Fix | Delete
const numberOfPatterns = patterns.length;
[9879] Fix | Delete
const pattern0 = patterns[0];
[9880] Fix | Delete
const patternWidth = pattern0[0].length,
[9881] Fix | Delete
patternHeight = pattern0.length;
[9882] Fix | Delete
const bitsPerValue = log2(numberOfPatterns);
[9883] Fix | Delete
const at = [];
[9884] Fix | Delete
if (!mmr) {
[9885] Fix | Delete
at.push({
[9886] Fix | Delete
x: template <= 1 ? 3 : 2,
[9887] Fix | Delete
y: -1
[9888] Fix | Delete
});
[9889] Fix | Delete
if (template === 0) {
[9890] Fix | Delete
at.push({
[9891] Fix | Delete
x: -3,
[9892] Fix | Delete
y: -1
[9893] Fix | Delete
}, {
[9894] Fix | Delete
x: 2,
[9895] Fix | Delete
y: -2
[9896] Fix | Delete
}, {
[9897] Fix | Delete
x: -2,
[9898] Fix | Delete
y: -2
[9899] Fix | Delete
});
[9900] Fix | Delete
}
[9901] Fix | Delete
}
[9902] Fix | Delete
const grayScaleBitPlanes = [];
[9903] Fix | Delete
let mmrInput, bitmap;
[9904] Fix | Delete
if (mmr) {
[9905] Fix | Delete
mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
[9906] Fix | Delete
}
[9907] Fix | Delete
for (i = bitsPerValue - 1; i >= 0; i--) {
[9908] Fix | Delete
if (mmr) {
[9909] Fix | Delete
bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
[9910] Fix | Delete
} else {
[9911] Fix | Delete
bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
[9912] Fix | Delete
}
[9913] Fix | Delete
grayScaleBitPlanes[i] = bitmap;
[9914] Fix | Delete
}
[9915] Fix | Delete
let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
[9916] Fix | Delete
for (mg = 0; mg < gridHeight; mg++) {
[9917] Fix | Delete
for (ng = 0; ng < gridWidth; ng++) {
[9918] Fix | Delete
bit = 0;
[9919] Fix | Delete
patternIndex = 0;
[9920] Fix | Delete
for (j = bitsPerValue - 1; j >= 0; j--) {
[9921] Fix | Delete
bit ^= grayScaleBitPlanes[j][mg][ng];
[9922] Fix | Delete
patternIndex |= bit << j;
[9923] Fix | Delete
}
[9924] Fix | Delete
patternBitmap = patterns[patternIndex];
[9925] Fix | Delete
x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
[9926] Fix | Delete
y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
[9927] Fix | Delete
if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
[9928] Fix | Delete
for (i = 0; i < patternHeight; i++) {
[9929] Fix | Delete
regionRow = regionBitmap[y + i];
[9930] Fix | Delete
patternRow = patternBitmap[i];
[9931] Fix | Delete
for (j = 0; j < patternWidth; j++) {
[9932] Fix | Delete
regionRow[x + j] |= patternRow[j];
[9933] Fix | Delete
}
[9934] Fix | Delete
}
[9935] Fix | Delete
} else {
[9936] Fix | Delete
let regionX, regionY;
[9937] Fix | Delete
for (i = 0; i < patternHeight; i++) {
[9938] Fix | Delete
regionY = y + i;
[9939] Fix | Delete
if (regionY < 0 || regionY >= regionHeight) {
[9940] Fix | Delete
continue;
[9941] Fix | Delete
}
[9942] Fix | Delete
regionRow = regionBitmap[regionY];
[9943] Fix | Delete
patternRow = patternBitmap[i];
[9944] Fix | Delete
for (j = 0; j < patternWidth; j++) {
[9945] Fix | Delete
regionX = x + j;
[9946] Fix | Delete
if (regionX >= 0 && regionX < regionWidth) {
[9947] Fix | Delete
regionRow[regionX] |= patternRow[j];
[9948] Fix | Delete
}
[9949] Fix | Delete
}
[9950] Fix | Delete
}
[9951] Fix | Delete
}
[9952] Fix | Delete
}
[9953] Fix | Delete
}
[9954] Fix | Delete
return regionBitmap;
[9955] Fix | Delete
}
[9956] Fix | Delete
function readSegmentHeader(data, start) {
[9957] Fix | Delete
const segmentHeader = {};
[9958] Fix | Delete
segmentHeader.number = readUint32(data, start);
[9959] Fix | Delete
const flags = data[start + 4];
[9960] Fix | Delete
const segmentType = flags & 0x3f;
[9961] Fix | Delete
if (!SegmentTypes[segmentType]) {
[9962] Fix | Delete
throw new Jbig2Error("invalid segment type: " + segmentType);
[9963] Fix | Delete
}
[9964] Fix | Delete
segmentHeader.type = segmentType;
[9965] Fix | Delete
segmentHeader.typeName = SegmentTypes[segmentType];
[9966] Fix | Delete
segmentHeader.deferredNonRetain = !!(flags & 0x80);
[9967] Fix | Delete
const pageAssociationFieldSize = !!(flags & 0x40);
[9968] Fix | Delete
const referredFlags = data[start + 5];
[9969] Fix | Delete
let referredToCount = referredFlags >> 5 & 7;
[9970] Fix | Delete
const retainBits = [referredFlags & 31];
[9971] Fix | Delete
let position = start + 6;
[9972] Fix | Delete
if (referredFlags === 7) {
[9973] Fix | Delete
referredToCount = readUint32(data, position - 1) & 0x1fffffff;
[9974] Fix | Delete
position += 3;
[9975] Fix | Delete
let bytes = referredToCount + 7 >> 3;
[9976] Fix | Delete
retainBits[0] = data[position++];
[9977] Fix | Delete
while (--bytes > 0) {
[9978] Fix | Delete
retainBits.push(data[position++]);
[9979] Fix | Delete
}
[9980] Fix | Delete
} else if (referredFlags === 5 || referredFlags === 6) {
[9981] Fix | Delete
throw new Jbig2Error("invalid referred-to flags");
[9982] Fix | Delete
}
[9983] Fix | Delete
segmentHeader.retainBits = retainBits;
[9984] Fix | Delete
let referredToSegmentNumberSize = 4;
[9985] Fix | Delete
if (segmentHeader.number <= 256) {
[9986] Fix | Delete
referredToSegmentNumberSize = 1;
[9987] Fix | Delete
} else if (segmentHeader.number <= 65536) {
[9988] Fix | Delete
referredToSegmentNumberSize = 2;
[9989] Fix | Delete
}
[9990] Fix | Delete
const referredTo = [];
[9991] Fix | Delete
let i, ii;
[9992] Fix | Delete
for (i = 0; i < referredToCount; i++) {
[9993] Fix | Delete
let number;
[9994] Fix | Delete
if (referredToSegmentNumberSize === 1) {
[9995] Fix | Delete
number = data[position];
[9996] Fix | Delete
} else if (referredToSegmentNumberSize === 2) {
[9997] Fix | Delete
number = readUint16(data, position);
[9998] Fix | Delete
} else {
[9999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function