pdf-parser.js 5.2.26 → 5.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{afm-widths-BYiX2L9D.cjs → afm-widths-BHD2HZIL.cjs} +553 -642
- package/dist/{afm-widths-blUDDjlI.js → afm-widths-B_IGbGky.js} +553 -642
- package/dist/afm-widths.cjs +1 -1
- package/dist/afm-widths.js +1 -1
- package/dist/annotations.cjs +5 -3
- package/dist/annotations.d.cts +2 -2
- package/dist/annotations.d.ts +2 -2
- package/dist/annotations.js +5 -3
- package/dist/attachments.d.cts +2 -2
- package/dist/attachments.d.ts +2 -2
- package/dist/builtin-encoding.cjs +17 -6
- package/dist/builtin-encoding.js +17 -6
- package/dist/bytes/crc32.cjs +5 -3
- package/dist/bytes/crc32.js +5 -3
- package/dist/bytes/flate.cjs +0 -1
- package/dist/bytes/flate.js +0 -1
- package/dist/cff-bounds.cjs +73 -45
- package/dist/cff-bounds.js +73 -45
- package/dist/cff.cjs +13 -6
- package/dist/cff.js +13 -6
- package/dist/cmap-table.cjs +54 -26
- package/dist/cmap-table.js +54 -26
- package/dist/cmap.cjs +5 -3
- package/dist/cmap.js +5 -3
- package/dist/content-read.d.cts +1 -1
- package/dist/content-read.d.ts +1 -1
- package/dist/content-write.cjs +21 -14
- package/dist/content-write.d.cts +2 -2
- package/dist/content-write.d.ts +2 -2
- package/dist/content-write.js +21 -14
- package/dist/crypto/aes.cjs +76 -55
- package/dist/crypto/aes.js +76 -55
- package/dist/crypto/md5.cjs +345 -149
- package/dist/crypto/md5.js +345 -149
- package/dist/crypto/rc4.cjs +5 -4
- package/dist/crypto/rc4.js +5 -4
- package/dist/crypto/sha2.cjs +92 -43
- package/dist/crypto/sha2.js +92 -43
- package/dist/document.cjs +17 -11
- package/dist/document.d.cts +1 -1
- package/dist/document.d.ts +1 -1
- package/dist/document.js +17 -11
- package/dist/{embedded-font-Bnhh4juV.d.ts → embedded-font-ByD7ZiQS.d.ts} +1 -1
- package/dist/{embedded-font-CEf-zBCA.d.cts → embedded-font-DgVBedw6.d.cts} +1 -1
- package/dist/embedded-font-write.d.cts +2 -2
- package/dist/embedded-font-write.d.ts +2 -2
- package/dist/embedded-font.cjs +4 -2
- package/dist/embedded-font.d.cts +1 -1
- package/dist/embedded-font.d.ts +1 -1
- package/dist/embedded-font.js +4 -2
- package/dist/encoding.cjs +1 -1
- package/dist/encoding.js +1 -1
- package/dist/encrypt-write.cjs +25 -21
- package/dist/encrypt-write.d.cts +1 -1
- package/dist/encrypt-write.d.ts +1 -1
- package/dist/encrypt-write.js +25 -21
- package/dist/encrypt.cjs +43 -64
- package/dist/encrypt.d.cts +1 -1
- package/dist/encrypt.d.ts +1 -1
- package/dist/encrypt.js +43 -64
- package/dist/filters.cjs +46 -26
- package/dist/filters.d.cts +1 -1
- package/dist/filters.d.ts +1 -1
- package/dist/filters.js +46 -26
- package/dist/font-face.cjs +2 -1
- package/dist/font-face.js +2 -1
- package/dist/font-read.cjs +12 -6
- package/dist/font-read.d.cts +1 -1
- package/dist/font-read.d.ts +1 -1
- package/dist/font-read.js +12 -6
- package/dist/font-registry.d.cts +3 -3
- package/dist/font-registry.d.ts +3 -3
- package/dist/font-tables.cjs +55 -28
- package/dist/font-tables.js +55 -28
- package/dist/form.cjs +13 -8
- package/dist/form.d.cts +2 -2
- package/dist/form.d.ts +2 -2
- package/dist/form.js +13 -8
- package/dist/gdef-table.cjs +6 -3
- package/dist/gdef-table.js +6 -3
- package/dist/{glyf-contours-C0epBNqP.d.ts → glyf-contours-B1PsI9oA.d.ts} +1 -1
- package/dist/{glyf-contours-BRpvd0rt.d.cts → glyf-contours-NHBpgks-.d.cts} +1 -1
- package/dist/glyf-contours.cjs +3 -1
- package/dist/glyf-contours.d.cts +1 -1
- package/dist/glyf-contours.d.ts +1 -1
- package/dist/glyf-contours.js +3 -1
- package/dist/glyf.cjs +22 -11
- package/dist/glyf.js +22 -11
- package/dist/gpos-table.cjs +37 -19
- package/dist/gpos-table.js +37 -19
- package/dist/gsub-table.cjs +40 -25
- package/dist/gsub-table.js +40 -25
- package/dist/hmtx-table.cjs +5 -3
- package/dist/hmtx-table.js +5 -3
- package/dist/image/ccitt-encode.cjs +8 -5
- package/dist/image/ccitt-encode.js +8 -5
- package/dist/image/ccitt.cjs +801 -209
- package/dist/image/ccitt.js +801 -209
- package/dist/image/jbig2-arith.cjs +340 -306
- package/dist/image/jbig2-arith.js +340 -306
- package/dist/image/jbig2-bitmap.cjs +8 -5
- package/dist/image/jbig2-bitmap.js +8 -5
- package/dist/image/jbig2-generic.cjs +240 -69
- package/dist/image/jbig2-generic.js +240 -69
- package/dist/image/jbig2-text.cjs +4 -2
- package/dist/image/jbig2-text.js +4 -2
- package/dist/image/jbig2.cjs +69 -31
- package/dist/image/jbig2.js +69 -31
- package/dist/image/jp2-boxes.cjs +52 -27
- package/dist/image/jp2-boxes.js +52 -27
- package/dist/image/jpeg-info.cjs +29 -24
- package/dist/image/jpeg-info.js +29 -24
- package/dist/image/jpeg2000-codestream.cjs +61 -32
- package/dist/image/jpeg2000-codestream.js +61 -32
- package/dist/image/jpeg2000-dwt.cjs +2 -1
- package/dist/image/jpeg2000-dwt.js +2 -1
- package/dist/image/jpeg2000-t1.cjs +21 -11
- package/dist/image/jpeg2000-t1.js +21 -11
- package/dist/image/jpeg2000-t2.cjs +12 -5
- package/dist/image/jpeg2000-t2.js +12 -5
- package/dist/image/jpeg2000-tagtree.cjs +8 -4
- package/dist/image/jpeg2000-tagtree.js +8 -4
- package/dist/image/jpeg2000.cjs +11 -6
- package/dist/image/jpeg2000.js +11 -6
- package/dist/image/png-decode.cjs +62 -39
- package/dist/image/png-decode.d.cts +3 -2
- package/dist/image/png-decode.d.ts +3 -2
- package/dist/image/png-decode.js +62 -39
- package/dist/image/png-filter.cjs +23 -15
- package/dist/image/png-filter.js +23 -15
- package/dist/images-read.cjs +41 -36
- package/dist/images-read.d.cts +2 -2
- package/dist/images-read.d.ts +2 -2
- package/dist/images-read.js +41 -36
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interpret.cjs +68 -40
- package/dist/interpret.d.cts +1 -1
- package/dist/interpret.d.ts +1 -1
- package/dist/interpret.js +68 -40
- package/dist/lexer.cjs +86 -51
- package/dist/lexer.js +86 -51
- package/dist/math-content-write.cjs +9 -5
- package/dist/math-content-write.js +9 -5
- package/dist/math-font-write.cjs +2 -1
- package/dist/math-font-write.d.cts +1 -1
- package/dist/math-font-write.d.ts +1 -1
- package/dist/math-font-write.js +2 -1
- package/dist/math-font.cjs +16 -7
- package/dist/math-font.js +16 -7
- package/dist/math-table.cjs +25 -13
- package/dist/math-table.js +25 -13
- package/dist/matrix.cjs +3 -2
- package/dist/matrix.js +3 -2
- package/dist/measure.cjs +1 -1
- package/dist/measure.js +1 -1
- package/dist/names.cjs +7 -7
- package/dist/names.d.cts +2 -2
- package/dist/names.d.ts +2 -2
- package/dist/names.js +7 -7
- package/dist/navigation.cjs +16 -12
- package/dist/navigation.d.cts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.js +16 -12
- package/dist/{objects-B7HdMeWS.d.cts → objects-e2RS3-yT.d.cts} +3 -3
- package/dist/{objects-B7HdMeWS.d.ts → objects-e2RS3-yT.d.ts} +3 -3
- package/dist/objects.d.cts +1 -1
- package/dist/objects.d.ts +1 -1
- package/dist/optional-content.d.cts +2 -2
- package/dist/optional-content.d.ts +2 -2
- package/dist/ot-layout-common.cjs +22 -15
- package/dist/ot-layout-common.js +22 -15
- package/dist/parse.cjs +7 -5
- package/dist/parse.d.cts +1 -1
- package/dist/parse.d.ts +1 -1
- package/dist/parse.js +7 -5
- package/dist/pdf-text.cjs +5 -2
- package/dist/pdf-text.js +5 -2
- package/dist/predictors.cjs +14 -9
- package/dist/predictors.d.cts +1 -1
- package/dist/predictors.d.ts +1 -1
- package/dist/predictors.js +14 -9
- package/dist/raster.cjs +30 -19
- package/dist/raster.d.cts +8 -8
- package/dist/raster.d.ts +8 -8
- package/dist/raster.js +30 -19
- package/dist/read.cjs +29 -16
- package/dist/read.js +29 -16
- package/dist/serialize.cjs +6 -2
- package/dist/serialize.d.cts +1 -1
- package/dist/serialize.d.ts +1 -1
- package/dist/serialize.js +6 -2
- package/dist/sfnt-subset.cjs +25 -13
- package/dist/sfnt-subset.d.cts +1 -1
- package/dist/sfnt-subset.d.ts +1 -1
- package/dist/sfnt-subset.js +25 -13
- package/dist/sfnt.cjs +20 -10
- package/dist/sfnt.js +20 -10
- package/dist/structure.d.cts +2 -2
- package/dist/structure.d.ts +2 -2
- package/dist/text-group.cjs +0 -1
- package/dist/text-group.js +0 -1
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/dist/tounicode.cjs +4 -2
- package/dist/tounicode.d.cts +1 -1
- package/dist/tounicode.d.ts +1 -1
- package/dist/tounicode.js +4 -2
- package/dist/winansi.cjs +1 -1
- package/dist/winansi.js +1 -1
- package/dist/write.cjs +20 -12
- package/dist/write.d.cts +1 -1
- package/dist/write.d.ts +1 -1
- package/dist/write.js +20 -12
- package/dist/xref.cjs +5 -2
- package/dist/xref.d.cts +1 -1
- package/dist/xref.d.ts +1 -1
- package/dist/xref.js +5 -2
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_image_jbig2_errors = require("./jbig2-errors.cjs");
|
|
3
|
-
//#region src/image/jbig2-bitmap.ts
|
|
4
3
|
const MAX_JBIG2_BITMAP_PIXELS = 1 << 26;
|
|
5
4
|
var Jbig2BitmapTooLargeError = class extends require_image_jbig2_errors.Jbig2ParseError {
|
|
6
5
|
constructor(width, height) {
|
|
@@ -51,21 +50,25 @@ function combineBitmap(destination, source, x, y, operator) {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
}
|
|
53
|
+
const BITS_PER_BYTE = 8;
|
|
54
|
+
const BYTE_INDEX_SHIFT = 3;
|
|
55
|
+
const BYTE_BIT_MASK = 7;
|
|
56
|
+
const MSB_FIRST_BIT_MASK = 128;
|
|
54
57
|
function packBitmapRows(bitmap, width, height) {
|
|
55
|
-
const bytesPerRow = Math.ceil(width /
|
|
58
|
+
const bytesPerRow = Math.ceil(width / BITS_PER_BYTE);
|
|
56
59
|
const out = new Uint8Array(bytesPerRow * height);
|
|
57
60
|
for (let y = 0; y < height; y++) {
|
|
58
61
|
const rowStart = y * bytesPerRow;
|
|
59
|
-
for (let x = 0; x < width; x++) if (getPixel(bitmap, x, y) === 1) out[rowStart + (x >>
|
|
62
|
+
for (let x = 0; x < width; x++) if (getPixel(bitmap, x, y) === 1) out[rowStart + (x >> BYTE_INDEX_SHIFT)] = (out[rowStart + (x >> BYTE_INDEX_SHIFT)] ?? 0) | MSB_FIRST_BIT_MASK >> (x & BYTE_BIT_MASK);
|
|
60
63
|
}
|
|
61
64
|
return out;
|
|
62
65
|
}
|
|
63
66
|
function unpackBitmapRows(packed, width, height) {
|
|
64
67
|
const bitmap = createBitmap(width, height);
|
|
65
|
-
const bytesPerRow = Math.ceil(width /
|
|
68
|
+
const bytesPerRow = Math.ceil(width / BITS_PER_BYTE);
|
|
66
69
|
for (let y = 0; y < height; y++) {
|
|
67
70
|
const rowStart = y * bytesPerRow;
|
|
68
|
-
for (let x = 0; x < width; x++) bitmap.data[y * width + x] = (packed[rowStart + (x >>
|
|
71
|
+
for (let x = 0; x < width; x++) bitmap.data[y * width + x] = (packed[rowStart + (x >> BYTE_INDEX_SHIFT)] ?? 0) >> BYTE_BIT_MASK - (x & BYTE_BIT_MASK) & 1;
|
|
69
72
|
}
|
|
70
73
|
return bitmap;
|
|
71
74
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Jbig2ParseError } from "./jbig2-errors.js";
|
|
2
|
-
//#region src/image/jbig2-bitmap.ts
|
|
3
2
|
const MAX_JBIG2_BITMAP_PIXELS = 1 << 26;
|
|
4
3
|
var Jbig2BitmapTooLargeError = class extends Jbig2ParseError {
|
|
5
4
|
constructor(width, height) {
|
|
@@ -50,21 +49,25 @@ function combineBitmap(destination, source, x, y, operator) {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
}
|
|
52
|
+
const BITS_PER_BYTE = 8;
|
|
53
|
+
const BYTE_INDEX_SHIFT = 3;
|
|
54
|
+
const BYTE_BIT_MASK = 7;
|
|
55
|
+
const MSB_FIRST_BIT_MASK = 128;
|
|
53
56
|
function packBitmapRows(bitmap, width, height) {
|
|
54
|
-
const bytesPerRow = Math.ceil(width /
|
|
57
|
+
const bytesPerRow = Math.ceil(width / BITS_PER_BYTE);
|
|
55
58
|
const out = new Uint8Array(bytesPerRow * height);
|
|
56
59
|
for (let y = 0; y < height; y++) {
|
|
57
60
|
const rowStart = y * bytesPerRow;
|
|
58
|
-
for (let x = 0; x < width; x++) if (getPixel(bitmap, x, y) === 1) out[rowStart + (x >>
|
|
61
|
+
for (let x = 0; x < width; x++) if (getPixel(bitmap, x, y) === 1) out[rowStart + (x >> BYTE_INDEX_SHIFT)] = (out[rowStart + (x >> BYTE_INDEX_SHIFT)] ?? 0) | MSB_FIRST_BIT_MASK >> (x & BYTE_BIT_MASK);
|
|
59
62
|
}
|
|
60
63
|
return out;
|
|
61
64
|
}
|
|
62
65
|
function unpackBitmapRows(packed, width, height) {
|
|
63
66
|
const bitmap = createBitmap(width, height);
|
|
64
|
-
const bytesPerRow = Math.ceil(width /
|
|
67
|
+
const bytesPerRow = Math.ceil(width / BITS_PER_BYTE);
|
|
65
68
|
for (let y = 0; y < height; y++) {
|
|
66
69
|
const rowStart = y * bytesPerRow;
|
|
67
|
-
for (let x = 0; x < width; x++) bitmap.data[y * width + x] = (packed[rowStart + (x >>
|
|
70
|
+
for (let x = 0; x < width; x++) bitmap.data[y * width + x] = (packed[rowStart + (x >> BYTE_INDEX_SHIFT)] ?? 0) >> BYTE_BIT_MASK - (x & BYTE_BIT_MASK) & 1;
|
|
68
71
|
}
|
|
69
72
|
return bitmap;
|
|
70
73
|
}
|
|
@@ -2,76 +2,252 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_image_jbig2_errors = require("./jbig2-errors.cjs");
|
|
3
3
|
const require_image_jbig2_bitmap = require("./jbig2-bitmap.cjs");
|
|
4
4
|
//#region src/image/jbig2-generic.ts
|
|
5
|
-
function fixed(dx, dy) {
|
|
6
|
-
return {
|
|
7
|
-
kind: "fixed",
|
|
8
|
-
dx,
|
|
9
|
-
dy
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function at(index) {
|
|
13
|
-
return {
|
|
14
|
-
kind: "at",
|
|
15
|
-
index
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
5
|
const GENERIC_TEMPLATES = [
|
|
19
6
|
[
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
{
|
|
8
|
+
kind: "at",
|
|
9
|
+
index: 3
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
kind: "fixed",
|
|
13
|
+
dx: -1,
|
|
14
|
+
dy: -2
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
kind: "fixed",
|
|
18
|
+
dx: 0,
|
|
19
|
+
dy: -2
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
kind: "fixed",
|
|
23
|
+
dx: 1,
|
|
24
|
+
dy: -2
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
kind: "at",
|
|
28
|
+
index: 2
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
kind: "at",
|
|
32
|
+
index: 1
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
kind: "fixed",
|
|
36
|
+
dx: -2,
|
|
37
|
+
dy: -1
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: "fixed",
|
|
41
|
+
dx: -1,
|
|
42
|
+
dy: -1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
kind: "fixed",
|
|
46
|
+
dx: 0,
|
|
47
|
+
dy: -1
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
kind: "fixed",
|
|
51
|
+
dx: 1,
|
|
52
|
+
dy: -1
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
kind: "fixed",
|
|
56
|
+
dx: 2,
|
|
57
|
+
dy: -1
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
kind: "at",
|
|
61
|
+
index: 0
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
kind: "fixed",
|
|
65
|
+
dx: -4,
|
|
66
|
+
dy: 0
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
kind: "fixed",
|
|
70
|
+
dx: -3,
|
|
71
|
+
dy: 0
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
kind: "fixed",
|
|
75
|
+
dx: -2,
|
|
76
|
+
dy: 0
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
kind: "fixed",
|
|
80
|
+
dx: -1,
|
|
81
|
+
dy: 0
|
|
82
|
+
}
|
|
36
83
|
],
|
|
37
84
|
[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
85
|
+
{
|
|
86
|
+
kind: "fixed",
|
|
87
|
+
dx: -1,
|
|
88
|
+
dy: -2
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
kind: "fixed",
|
|
92
|
+
dx: 0,
|
|
93
|
+
dy: -2
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
kind: "fixed",
|
|
97
|
+
dx: 1,
|
|
98
|
+
dy: -2
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
kind: "fixed",
|
|
102
|
+
dx: 2,
|
|
103
|
+
dy: -2
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
kind: "fixed",
|
|
107
|
+
dx: -2,
|
|
108
|
+
dy: -1
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
kind: "fixed",
|
|
112
|
+
dx: -1,
|
|
113
|
+
dy: -1
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
kind: "fixed",
|
|
117
|
+
dx: 0,
|
|
118
|
+
dy: -1
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
kind: "fixed",
|
|
122
|
+
dx: 1,
|
|
123
|
+
dy: -1
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
kind: "fixed",
|
|
127
|
+
dx: 2,
|
|
128
|
+
dy: -1
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
kind: "at",
|
|
132
|
+
index: 0
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
kind: "fixed",
|
|
136
|
+
dx: -3,
|
|
137
|
+
dy: 0
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
kind: "fixed",
|
|
141
|
+
dx: -2,
|
|
142
|
+
dy: 0
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
kind: "fixed",
|
|
146
|
+
dx: -1,
|
|
147
|
+
dy: 0
|
|
148
|
+
}
|
|
51
149
|
],
|
|
52
150
|
[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
151
|
+
{
|
|
152
|
+
kind: "fixed",
|
|
153
|
+
dx: -1,
|
|
154
|
+
dy: -2
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
kind: "fixed",
|
|
158
|
+
dx: 0,
|
|
159
|
+
dy: -2
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
kind: "fixed",
|
|
163
|
+
dx: 1,
|
|
164
|
+
dy: -2
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
kind: "fixed",
|
|
168
|
+
dx: -2,
|
|
169
|
+
dy: -1
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
kind: "fixed",
|
|
173
|
+
dx: -1,
|
|
174
|
+
dy: -1
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
kind: "fixed",
|
|
178
|
+
dx: 0,
|
|
179
|
+
dy: -1
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
kind: "fixed",
|
|
183
|
+
dx: 1,
|
|
184
|
+
dy: -1
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
kind: "at",
|
|
188
|
+
index: 0
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
kind: "fixed",
|
|
192
|
+
dx: -2,
|
|
193
|
+
dy: 0
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
kind: "fixed",
|
|
197
|
+
dx: -1,
|
|
198
|
+
dy: 0
|
|
199
|
+
}
|
|
63
200
|
],
|
|
64
201
|
[
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
202
|
+
{
|
|
203
|
+
kind: "fixed",
|
|
204
|
+
dx: -3,
|
|
205
|
+
dy: -1
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
kind: "fixed",
|
|
209
|
+
dx: -2,
|
|
210
|
+
dy: -1
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
kind: "fixed",
|
|
214
|
+
dx: -1,
|
|
215
|
+
dy: -1
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
kind: "fixed",
|
|
219
|
+
dx: 0,
|
|
220
|
+
dy: -1
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
kind: "fixed",
|
|
224
|
+
dx: 1,
|
|
225
|
+
dy: -1
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
kind: "at",
|
|
229
|
+
index: 0
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
kind: "fixed",
|
|
233
|
+
dx: -4,
|
|
234
|
+
dy: 0
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
kind: "fixed",
|
|
238
|
+
dx: -3,
|
|
239
|
+
dy: 0
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
kind: "fixed",
|
|
243
|
+
dx: -2,
|
|
244
|
+
dy: 0
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
kind: "fixed",
|
|
248
|
+
dx: -1,
|
|
249
|
+
dy: 0
|
|
250
|
+
}
|
|
75
251
|
]
|
|
76
252
|
];
|
|
77
253
|
const GENERIC_SLTP_CONTEXT = [
|
|
@@ -80,12 +256,7 @@ const GENERIC_SLTP_CONTEXT = [
|
|
|
80
256
|
229,
|
|
81
257
|
405
|
|
82
258
|
];
|
|
83
|
-
const GENERIC_CONTEXT_BITS =
|
|
84
|
-
16,
|
|
85
|
-
13,
|
|
86
|
-
10,
|
|
87
|
-
10
|
|
88
|
-
];
|
|
259
|
+
const GENERIC_CONTEXT_BITS = GENERIC_TEMPLATES.map((positions) => positions.length);
|
|
89
260
|
function resolveTemplate(template) {
|
|
90
261
|
const positions = GENERIC_TEMPLATES[template];
|
|
91
262
|
if (positions === void 0) throw new require_image_jbig2_errors.Jbig2UnsupportedError(`generic region declares GBTEMPLATE ${String(template)}, which is outside the 0-3 range T.88 6.2.5.3 defines`);
|
|
@@ -200,7 +371,7 @@ const REFINEMENT_TEMPLATES = [[
|
|
|
200
371
|
reference(1, 1)
|
|
201
372
|
]];
|
|
202
373
|
const TPGRON_UNSUPPORTED = "JBIG2 refinement region sets TPGRON (typical prediction, T.88 6.3.5.6), whose per-template pseudo-context constants this decoder has no way to verify against a real encoder; refusing rather than risking a silently wrong bitmap";
|
|
203
|
-
const REFINEMENT_CONTEXT_BITS =
|
|
374
|
+
const REFINEMENT_CONTEXT_BITS = REFINEMENT_TEMPLATES.map((positions) => positions.length);
|
|
204
375
|
const NOMINAL_REFINEMENT_AT = [{
|
|
205
376
|
x: -1,
|
|
206
377
|
y: -1
|