@blazediff/core-wasm 5.3.0 → 6.0.0
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/README.md +17 -38
- package/dist/index.d.ts +3 -99
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/wasm/blazediff.d.ts +3 -12
- package/wasm/blazediff.js +26 -102
- package/wasm/blazediff_bg.wasm +0 -0
- package/wasm/blazediff_bg.wasm.d.ts +3 -4
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
WebAssembly build of the BlazeDiff Rust algorithm for browsers, edge runtimes, and any wasm host. Same two-pass block algorithm as [`@blazediff/core-native`](https://www.npmjs.com/package/@blazediff/core-native), compiled to `wasm32` with `v128` SIMD (`+simd128`). **~
|
|
11
|
+
WebAssembly build of the BlazeDiff Rust algorithm for browsers, edge runtimes, and any wasm host. Same two-pass block algorithm as [`@blazediff/core-native`](https://www.npmjs.com/package/@blazediff/core-native), compiled to `wasm32` with `v128` SIMD (`+simd128`). **~51%** faster than [pixelmatch](https://github.com/mapbox/pixelmatch) on the same RGBA buffers (up to ~90% on 4K); diff counts agree with pixelmatch to within ~0.05%.
|
|
12
12
|
|
|
13
13
|
**Features:**
|
|
14
14
|
- Same Rust algorithm as `@blazediff/core-native` (YIQ perceptual delta + block-based cold/hot pass)
|
|
@@ -103,7 +103,7 @@ Initializes the wasm module. Safe to call multiple times; subsequent calls retur
|
|
|
103
103
|
|
|
104
104
|
### `diff(a, b, width, height, output?, options?)`
|
|
105
105
|
|
|
106
|
-
Compares two RGBA pixel buffers and returns the number of differing pixels.
|
|
106
|
+
Compares two RGBA pixel buffers and returns the number of differing pixels.
|
|
107
107
|
|
|
108
108
|
<table>
|
|
109
109
|
<tr>
|
|
@@ -138,12 +138,12 @@ Compares two RGBA pixel buffers and returns the number of differing pixels. Set
|
|
|
138
138
|
</tr>
|
|
139
139
|
<tr>
|
|
140
140
|
<td><code>options</code></td>
|
|
141
|
-
<td>DiffOptions
|
|
141
|
+
<td>DiffOptions</td>
|
|
142
142
|
<td>Comparison options (optional)</td>
|
|
143
143
|
</tr>
|
|
144
144
|
</table>
|
|
145
145
|
|
|
146
|
-
**Returns:** `Promise<number>`
|
|
146
|
+
**Returns:** `Promise<number>`
|
|
147
147
|
|
|
148
148
|
<table>
|
|
149
149
|
<tr>
|
|
@@ -176,40 +176,18 @@ Compares two RGBA pixel buffers and returns the number of differing pixels. Set
|
|
|
176
176
|
<td>diff color</td>
|
|
177
177
|
<td>Alternative RGB color for darkening differences</td>
|
|
178
178
|
</tr>
|
|
179
|
-
<tr>
|
|
180
|
-
<td><code>interpret</code></td>
|
|
181
|
-
<td>boolean</td>
|
|
182
|
-
<td>false</td>
|
|
183
|
-
<td>Return structured interpretation from the same diff pass</td>
|
|
184
|
-
</tr>
|
|
185
179
|
</table>
|
|
186
180
|
|
|
187
|
-
With `interpret: true`, `diff()` returns:
|
|
188
|
-
|
|
189
181
|
```typescript
|
|
190
|
-
|
|
191
|
-
| { match: true; interpretation: InterpretResult }
|
|
192
|
-
| {
|
|
193
|
-
match: false;
|
|
194
|
-
reason: 'pixel-diff';
|
|
195
|
-
diffCount: number;
|
|
196
|
-
diffPercentage: number;
|
|
197
|
-
interpretation: InterpretResult;
|
|
198
|
-
};
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
const result = await diff(a, b, width, height, output, {
|
|
182
|
+
const diffCount = await diff(a, b, width, height, output, {
|
|
203
183
|
diffColorAlt: [0, 128, 255],
|
|
204
|
-
interpret: true,
|
|
205
184
|
});
|
|
206
185
|
```
|
|
207
186
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
**Returns:** `Promise<InterpretResult>`
|
|
187
|
+
Region analysis — *what* changed rather than where — is no longer part of this
|
|
188
|
+
package. It lives in
|
|
189
|
+
[`@blazediff/interpret-native`](https://www.npmjs.com/package/@blazediff/interpret-native),
|
|
190
|
+
which is a Node N-API package and has no wasm build.
|
|
213
191
|
|
|
214
192
|
## Usage
|
|
215
193
|
|
|
@@ -271,13 +249,14 @@ vs `pixelmatch` on M1 Max, image I/O excluded (pre-decoded RGBA buffers):
|
|
|
271
249
|
|
|
272
250
|
| Fixture | pixelmatch | core-wasm | Improvement |
|
|
273
251
|
|---------------|------------|-----------|-------------|
|
|
274
|
-
| 4k/1 |
|
|
275
|
-
| 4k/3 |
|
|
276
|
-
| page/2 |
|
|
277
|
-
| blazediff/3 |
|
|
278
|
-
| pixelmatch/1 | 0.
|
|
279
|
-
|
|
280
|
-
Average **~
|
|
252
|
+
| 4k/1 | 338.53ms | 34.42ms | **89.8%** |
|
|
253
|
+
| 4k/3 | 415.01ms | 45.34ms | **89.1%** |
|
|
254
|
+
| page/2 | 511.88ms | 70.89ms | **86.2%** |
|
|
255
|
+
| blazediff/3 | 12.08ms | 5.76ms | **52.3%** |
|
|
256
|
+
| pixelmatch/1 | 0.57ms | 0.11ms | **80.5%** |
|
|
257
|
+
|
|
258
|
+
Average **~51%** faster across the full fixture set (~60% across differing pairs). Counts agree with pixelmatch within ~0.05% (e.g. `4k/1`: 69 932 vs 69 912 of 17 920 000 pixels).
|
|
259
|
+
Full benchmarks in [BENCHMARKS.md](https://github.com/teimurjan/blazediff/blob/main/BENCHMARKS.md).
|
|
281
260
|
|
|
282
261
|
## Algorithm
|
|
283
262
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,84 +8,6 @@ interface DiffOptions {
|
|
|
8
8
|
/** Alternative RGB color for darkening differences. Default: diff color */
|
|
9
9
|
diffColorAlt?: [number, number, number];
|
|
10
10
|
}
|
|
11
|
-
interface InterpretedDiffOptions extends DiffOptions {
|
|
12
|
-
/** Return structured interpretation from the same diff pass. */
|
|
13
|
-
interpret: true;
|
|
14
|
-
}
|
|
15
|
-
interface InterpretOptions {
|
|
16
|
-
/** Color difference threshold (0-1). Lower = stricter. Default: 0.1 */
|
|
17
|
-
threshold?: number;
|
|
18
|
-
/** Count anti-aliased pixels as differences. Default: false */
|
|
19
|
-
includeAA?: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface BoundingBox {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
}
|
|
27
|
-
interface ShapeStats {
|
|
28
|
-
fillRatio: number;
|
|
29
|
-
borderRatio: number;
|
|
30
|
-
innerFillRatio: number;
|
|
31
|
-
centerDensity: number;
|
|
32
|
-
rowOccupancy: number;
|
|
33
|
-
colOccupancy: number;
|
|
34
|
-
}
|
|
35
|
-
interface ColorDeltaStats {
|
|
36
|
-
meanDelta: number;
|
|
37
|
-
maxDelta: number;
|
|
38
|
-
deltaStddev: number;
|
|
39
|
-
}
|
|
40
|
-
interface GradientStats {
|
|
41
|
-
edgeScore: number;
|
|
42
|
-
edgeScoreImg2: number;
|
|
43
|
-
edgeCorrelation: number;
|
|
44
|
-
}
|
|
45
|
-
interface ClassificationSignals {
|
|
46
|
-
blendsWithBgInImg1: boolean;
|
|
47
|
-
blendsWithBgInImg2: boolean;
|
|
48
|
-
lowColorDelta: boolean;
|
|
49
|
-
lowEdgeChange: boolean;
|
|
50
|
-
denseFill: boolean;
|
|
51
|
-
sparseFill: boolean;
|
|
52
|
-
tinyRegion: boolean;
|
|
53
|
-
edgesCorrelated: boolean;
|
|
54
|
-
confidence: number;
|
|
55
|
-
}
|
|
56
|
-
interface ChangeRegion {
|
|
57
|
-
bbox: BoundingBox;
|
|
58
|
-
pixelCount: number;
|
|
59
|
-
percentage: number;
|
|
60
|
-
position: string;
|
|
61
|
-
shape: string;
|
|
62
|
-
shapeStats: ShapeStats;
|
|
63
|
-
changeType: string;
|
|
64
|
-
signals: ClassificationSignals;
|
|
65
|
-
confidence: number;
|
|
66
|
-
colorDelta: ColorDeltaStats;
|
|
67
|
-
gradient: GradientStats;
|
|
68
|
-
}
|
|
69
|
-
interface InterpretResult {
|
|
70
|
-
summary: string;
|
|
71
|
-
diffCount: number;
|
|
72
|
-
totalRegions: number;
|
|
73
|
-
regions: ChangeRegion[];
|
|
74
|
-
severity: string;
|
|
75
|
-
diffPercentage: number;
|
|
76
|
-
width: number;
|
|
77
|
-
height: number;
|
|
78
|
-
}
|
|
79
|
-
type DiffResult = {
|
|
80
|
-
match: true;
|
|
81
|
-
interpretation: InterpretResult;
|
|
82
|
-
} | {
|
|
83
|
-
match: false;
|
|
84
|
-
reason: "pixel-diff";
|
|
85
|
-
diffCount: number;
|
|
86
|
-
diffPercentage: number;
|
|
87
|
-
interpretation: InterpretResult;
|
|
88
|
-
};
|
|
89
11
|
type WasmInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
90
12
|
/**
|
|
91
13
|
* Initialize the wasm module. Safe to call multiple times - subsequent calls
|
|
@@ -102,26 +24,8 @@ declare function initBlazediff(input?: WasmInput): Promise<void>;
|
|
|
102
24
|
* the `ImageDecoder` API) and pass the resulting `Uint8Array` here.
|
|
103
25
|
*
|
|
104
26
|
* If `output` is provided it must be `width * height * 4` bytes long and the
|
|
105
|
-
* diff visualization is written into it in place.
|
|
106
|
-
* return structured interpretation from the same diff pass.
|
|
107
|
-
*/
|
|
108
|
-
declare function diff(a: Uint8Array, b: Uint8Array, width: number, height: number, output: Uint8Array | undefined, options: InterpretedDiffOptions): Promise<DiffResult>;
|
|
109
|
-
declare function diff(a: Uint8Array, b: Uint8Array, width: number, height: number, output?: Uint8Array, options?: DiffOptions & {
|
|
110
|
-
interpret?: false;
|
|
111
|
-
}): Promise<number>;
|
|
112
|
-
declare function diff(a: Uint8Array, b: Uint8Array, width: number, height: number, output?: Uint8Array, options?: DiffOptions & {
|
|
113
|
-
interpret?: boolean;
|
|
114
|
-
}): Promise<number | DiffResult>;
|
|
115
|
-
/**
|
|
116
|
-
* Interpret the diff between two RGBA pixel buffers into structured change
|
|
117
|
-
* regions - what changed, where, and how much. Returns the same shape as the
|
|
118
|
-
* native `@blazediff/core-native` `interpret`, with semantic change types,
|
|
119
|
-
* spatial positions, and severity.
|
|
120
|
-
*
|
|
121
|
-
* Both buffers must be `width * height * 4` bytes in RGBA8 order. Decode
|
|
122
|
-
* PNG/JPEG with `createImageBitmap` + `OffscreenCanvas.getImageData()` (or the
|
|
123
|
-
* `ImageDecoder` API) and pass the resulting `Uint8Array` here.
|
|
27
|
+
* diff visualization is written into it in place.
|
|
124
28
|
*/
|
|
125
|
-
declare function
|
|
29
|
+
declare function diff(a: Uint8Array, b: Uint8Array, width: number, height: number, output?: Uint8Array, options?: DiffOptions): Promise<number>;
|
|
126
30
|
|
|
127
|
-
export { type
|
|
31
|
+
export { type DiffOptions, type WasmInput, diff, initBlazediff };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a,{diffRgba}from'../wasm/blazediff.js';var i;function d(e){if(e){if(e.length!==3||e.some(n=>!Number.isInteger(n)||n<0||n>255))throw new RangeError("diffColorAlt must contain three integer RGB channels");return Uint8Array.from(e)}}function m(e){return i||(i=a(e===void 0?void 0:{module_or_path:e}).then(()=>{})),i}async function b(e,n,t,f,u,r={}){return await m(),diffRgba(e,n,t,f,r.threshold??.1,r.includeAA??false,r.diffMask??false,d(r.diffColorAlt),u)}export{b as diff,m as initBlazediff};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazediff/core-wasm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "WebAssembly build of blazediff for browsers, edge runtimes, and any wasm host. Same algorithm as @blazediff/core-native.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tsup": "8.5.0",
|
|
45
45
|
"typescript": "5.9.2",
|
|
46
46
|
"vitest": "^3.2.4",
|
|
47
|
-
"@blazediff/core-native": "
|
|
47
|
+
"@blazediff/core-native": "6.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"typecheck": "tsc --noEmit",
|
package/wasm/blazediff.d.ts
CHANGED
|
@@ -9,14 +9,6 @@ export function _start(): void;
|
|
|
9
9
|
* visualization and just get a count.
|
|
10
10
|
*/
|
|
11
11
|
export function diffRgba(rgba_a: Uint8Array, rgba_b: Uint8Array, width: number, height: number, threshold: number, include_aa: boolean, diff_mask: boolean, diff_color_alt?: Uint8Array | null, out_diff?: Uint8Array | null): number;
|
|
12
|
-
/**
|
|
13
|
-
* Interpret the diff between two RGBA buffers into structured change regions.
|
|
14
|
-
*
|
|
15
|
-
* Returns the `InterpretResult` (summary, regions with positions, change
|
|
16
|
-
* types, severity, etc.) serialized as a plain JS object - the same shape the
|
|
17
|
-
* native binding produces.
|
|
18
|
-
*/
|
|
19
|
-
export function interpretRgba(rgba_a: Uint8Array, rgba_b: Uint8Array, width: number, height: number, threshold: number, include_aa: boolean, diff_mask: boolean, diff_color_alt?: Uint8Array | null, out_diff?: Uint8Array | null): any;
|
|
20
12
|
|
|
21
13
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
22
14
|
|
|
@@ -24,10 +16,9 @@ export interface InitOutput {
|
|
|
24
16
|
readonly memory: WebAssembly.Memory;
|
|
25
17
|
readonly _start: () => void;
|
|
26
18
|
readonly diffRgba: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly __wbindgen_export_2: (a: number, b: number, c: number) => void;
|
|
19
|
+
readonly __wbindgen_export_0: (a: number, b: number, c: number) => void;
|
|
20
|
+
readonly __wbindgen_export_1: (a: number, b: number) => number;
|
|
21
|
+
readonly __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
|
|
31
22
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
32
23
|
readonly __wbindgen_start: () => void;
|
|
33
24
|
}
|
package/wasm/blazediff.js
CHANGED
|
@@ -6,7 +6,20 @@ heap.push(undefined, null, true, false);
|
|
|
6
6
|
|
|
7
7
|
function getObject(idx) { return heap[idx]; }
|
|
8
8
|
|
|
9
|
-
let
|
|
9
|
+
let heap_next = heap.length;
|
|
10
|
+
|
|
11
|
+
function addHeapObject(obj) {
|
|
12
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
13
|
+
const idx = heap_next;
|
|
14
|
+
heap_next = heap[idx];
|
|
15
|
+
|
|
16
|
+
heap[idx] = obj;
|
|
17
|
+
return idx;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
21
|
+
|
|
22
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
10
23
|
|
|
11
24
|
let cachedUint8ArrayMemory0 = null;
|
|
12
25
|
|
|
@@ -17,6 +30,13 @@ function getUint8ArrayMemory0() {
|
|
|
17
30
|
return cachedUint8ArrayMemory0;
|
|
18
31
|
}
|
|
19
32
|
|
|
33
|
+
function getStringFromWasm0(ptr, len) {
|
|
34
|
+
ptr = ptr >>> 0;
|
|
35
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let WASM_VECTOR_LEN = 0;
|
|
39
|
+
|
|
20
40
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
21
41
|
|
|
22
42
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -80,26 +100,6 @@ function getDataViewMemory0() {
|
|
|
80
100
|
return cachedDataViewMemory0;
|
|
81
101
|
}
|
|
82
102
|
|
|
83
|
-
let heap_next = heap.length;
|
|
84
|
-
|
|
85
|
-
function addHeapObject(obj) {
|
|
86
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
87
|
-
const idx = heap_next;
|
|
88
|
-
heap_next = heap[idx];
|
|
89
|
-
|
|
90
|
-
heap[idx] = obj;
|
|
91
|
-
return idx;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
95
|
-
|
|
96
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
97
|
-
|
|
98
|
-
function getStringFromWasm0(ptr, len) {
|
|
99
|
-
ptr = ptr >>> 0;
|
|
100
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
103
|
function dropObject(idx) {
|
|
104
104
|
if (idx < 132) return;
|
|
105
105
|
heap[idx] = heap_next;
|
|
@@ -146,11 +146,11 @@ function isLikeNone(x) {
|
|
|
146
146
|
export function diffRgba(rgba_a, rgba_b, width, height, threshold, include_aa, diff_mask, diff_color_alt, out_diff) {
|
|
147
147
|
try {
|
|
148
148
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
149
|
-
const ptr0 = passArray8ToWasm0(rgba_a, wasm.
|
|
149
|
+
const ptr0 = passArray8ToWasm0(rgba_a, wasm.__wbindgen_export_1);
|
|
150
150
|
const len0 = WASM_VECTOR_LEN;
|
|
151
|
-
const ptr1 = passArray8ToWasm0(rgba_b, wasm.
|
|
151
|
+
const ptr1 = passArray8ToWasm0(rgba_b, wasm.__wbindgen_export_1);
|
|
152
152
|
const len1 = WASM_VECTOR_LEN;
|
|
153
|
-
var ptr2 = isLikeNone(diff_color_alt) ? 0 : passArray8ToWasm0(diff_color_alt, wasm.
|
|
153
|
+
var ptr2 = isLikeNone(diff_color_alt) ? 0 : passArray8ToWasm0(diff_color_alt, wasm.__wbindgen_export_1);
|
|
154
154
|
var len2 = WASM_VECTOR_LEN;
|
|
155
155
|
wasm.diffRgba(retptr, ptr0, len0, ptr1, len1, width, height, threshold, include_aa, diff_mask, ptr2, len2, isLikeNone(out_diff) ? 0 : addHeapObject(out_diff));
|
|
156
156
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -165,45 +165,6 @@ export function diffRgba(rgba_a, rgba_b, width, height, threshold, include_aa, d
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
/**
|
|
169
|
-
* Interpret the diff between two RGBA buffers into structured change regions.
|
|
170
|
-
*
|
|
171
|
-
* Returns the `InterpretResult` (summary, regions with positions, change
|
|
172
|
-
* types, severity, etc.) serialized as a plain JS object - the same shape the
|
|
173
|
-
* native binding produces.
|
|
174
|
-
* @param {Uint8Array} rgba_a
|
|
175
|
-
* @param {Uint8Array} rgba_b
|
|
176
|
-
* @param {number} width
|
|
177
|
-
* @param {number} height
|
|
178
|
-
* @param {number} threshold
|
|
179
|
-
* @param {boolean} include_aa
|
|
180
|
-
* @param {boolean} diff_mask
|
|
181
|
-
* @param {Uint8Array | null} [diff_color_alt]
|
|
182
|
-
* @param {Uint8Array | null} [out_diff]
|
|
183
|
-
* @returns {any}
|
|
184
|
-
*/
|
|
185
|
-
export function interpretRgba(rgba_a, rgba_b, width, height, threshold, include_aa, diff_mask, diff_color_alt, out_diff) {
|
|
186
|
-
try {
|
|
187
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
188
|
-
const ptr0 = passArray8ToWasm0(rgba_a, wasm.__wbindgen_export_0);
|
|
189
|
-
const len0 = WASM_VECTOR_LEN;
|
|
190
|
-
const ptr1 = passArray8ToWasm0(rgba_b, wasm.__wbindgen_export_0);
|
|
191
|
-
const len1 = WASM_VECTOR_LEN;
|
|
192
|
-
var ptr2 = isLikeNone(diff_color_alt) ? 0 : passArray8ToWasm0(diff_color_alt, wasm.__wbindgen_export_0);
|
|
193
|
-
var len2 = WASM_VECTOR_LEN;
|
|
194
|
-
wasm.interpretRgba(retptr, ptr0, len0, ptr1, len1, width, height, threshold, include_aa, diff_mask, ptr2, len2, isLikeNone(out_diff) ? 0 : addHeapObject(out_diff));
|
|
195
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
196
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
197
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
198
|
-
if (r2) {
|
|
199
|
-
throw takeObject(r1);
|
|
200
|
-
}
|
|
201
|
-
return takeObject(r0);
|
|
202
|
-
} finally {
|
|
203
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
168
|
async function __wbg_load(module, imports) {
|
|
208
169
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
209
170
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -238,13 +199,6 @@ async function __wbg_load(module, imports) {
|
|
|
238
199
|
function __wbg_get_imports() {
|
|
239
200
|
const imports = {};
|
|
240
201
|
imports.wbg = {};
|
|
241
|
-
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
242
|
-
const ret = String(getObject(arg1));
|
|
243
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
244
|
-
const len1 = WASM_VECTOR_LEN;
|
|
245
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
246
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
247
|
-
};
|
|
248
202
|
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
249
203
|
const ret = getObject(arg0).buffer;
|
|
250
204
|
return addHeapObject(ret);
|
|
@@ -257,21 +211,13 @@ function __wbg_get_imports() {
|
|
|
257
211
|
deferred0_1 = arg1;
|
|
258
212
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
259
213
|
} finally {
|
|
260
|
-
wasm.
|
|
214
|
+
wasm.__wbindgen_export_0(deferred0_0, deferred0_1, 1);
|
|
261
215
|
}
|
|
262
216
|
};
|
|
263
217
|
imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
|
|
264
218
|
const ret = getObject(arg0).length;
|
|
265
219
|
return ret;
|
|
266
220
|
};
|
|
267
|
-
imports.wbg.__wbg_new_405e22f390576ce2 = function() {
|
|
268
|
-
const ret = new Object();
|
|
269
|
-
return addHeapObject(ret);
|
|
270
|
-
};
|
|
271
|
-
imports.wbg.__wbg_new_78feb108b6472713 = function() {
|
|
272
|
-
const ret = new Array();
|
|
273
|
-
return addHeapObject(ret);
|
|
274
|
-
};
|
|
275
221
|
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
276
222
|
const ret = new Error();
|
|
277
223
|
return addHeapObject(ret);
|
|
@@ -280,26 +226,16 @@ function __wbg_get_imports() {
|
|
|
280
226
|
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
281
227
|
return addHeapObject(ret);
|
|
282
228
|
};
|
|
283
|
-
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
284
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
285
|
-
};
|
|
286
|
-
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
287
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
288
|
-
};
|
|
289
229
|
imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
|
|
290
230
|
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
291
231
|
};
|
|
292
232
|
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
293
233
|
const ret = getObject(arg1).stack;
|
|
294
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
234
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
295
235
|
const len1 = WASM_VECTOR_LEN;
|
|
296
236
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
297
237
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
298
238
|
};
|
|
299
|
-
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
300
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
301
|
-
return addHeapObject(ret);
|
|
302
|
-
};
|
|
303
239
|
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
304
240
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
305
241
|
return addHeapObject(ret);
|
|
@@ -308,21 +244,9 @@ function __wbg_get_imports() {
|
|
|
308
244
|
const ret = wasm.memory;
|
|
309
245
|
return addHeapObject(ret);
|
|
310
246
|
};
|
|
311
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
312
|
-
const ret = arg0;
|
|
313
|
-
return addHeapObject(ret);
|
|
314
|
-
};
|
|
315
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
316
|
-
const ret = getObject(arg0);
|
|
317
|
-
return addHeapObject(ret);
|
|
318
|
-
};
|
|
319
247
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
320
248
|
takeObject(arg0);
|
|
321
249
|
};
|
|
322
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
323
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
324
|
-
return addHeapObject(ret);
|
|
325
|
-
};
|
|
326
250
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
327
251
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
328
252
|
};
|
package/wasm/blazediff_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const _start: () => void;
|
|
5
5
|
export const diffRgba: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const __wbindgen_export_2: (a: number, b: number, c: number) => void;
|
|
6
|
+
export const __wbindgen_export_0: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const __wbindgen_export_1: (a: number, b: number) => number;
|
|
8
|
+
export const __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
|
|
10
9
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
11
10
|
export const __wbindgen_start: () => void;
|