@blazediff/core-native 7.0.0 → 8.1.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.
Files changed (3) hide show
  1. package/README.md +17 -15
  2. package/dist/index.js +1 -1
  3. package/package.json +8 -8
package/README.md CHANGED
@@ -8,12 +8,12 @@
8
8
 
9
9
  </div>
10
10
 
11
- The fastest single-threaded image diff in the world. Native Rust implementation with SIMD optimization, **4.4-4.9x faster** and **3x smaller** than [odiff](https://github.com/dmtrKovalenko/odiff).
11
+ The fastest single-threaded image diff in the world. Native Rust implementation with SIMD optimization, **5.1-5.9x faster** and **3x smaller** than [odiff](https://github.com/dmtrKovalenko/odiff).
12
12
 
13
13
  **Features:**
14
14
  - **PNG, JPEG & QOI support** - auto-detected by file extension or encoded bytes
15
- - SIMD-accelerated (NEON on ARM, SSE4.1 on x86)
16
- - Block-based two-pass optimization
15
+ - SIMD-accelerated (NEON on ARM, AVX2 or SSE4.1 on x86)
16
+ - Block-band scan: the perceptual diff runs only on blocks with a pixel over the threshold
17
17
  - YIQ perceptual color difference
18
18
  - Anti-aliasing detection
19
19
  - Cross-platform pre-built binaries (~700KB-900KB, no compilation required)
@@ -25,9 +25,10 @@ The fastest single-threaded image diff in the world. Native Rust implementation
25
25
 
26
26
  > **Experimental PNG codec:** the binaries also bundle an in-house Rust PNG codec
27
27
  > ([`blazediff-png`](https://github.com/teimurjan/blazediff/tree/main/crates/blazediff-png)),
28
- > faster than spng on every fixture with byte-exact decode parity. It's opt-in:
29
- > set `BLAZEDIFF_PNG_ENABLED=1` to route PNG decode and stored-block (level 0) encode
30
- > through it. spng stays the default.
28
+ > faster than spng on every fixture with byte-exact decode parity. It writes every
29
+ > diff PNG, as a palette PNG when the image has at most 256 colors (same pixels,
30
+ > about 4x smaller file). Decode through it is opt-in: set `BLAZEDIFF_PNG_ENABLED=1`.
31
+ > spng stays the default decoder.
31
32
 
32
33
  > **Note:** This package was previously published as [`@blazediff/bin`](https://www.npmjs.com/package/@blazediff/bin), which is now deprecated. Please use `@blazediff/core-native` instead.
33
34
 
@@ -276,13 +277,13 @@ Input images can be mixed formats (e.g., compare PNG to JPEG). Output format is
276
277
 
277
278
  ## Performance
278
279
 
279
- Benchmarked on Apple M1 Max (25 runs, 5 warmup, image IO included) against `odiff` on 5600×3200 4K PNG images via `hyperfine`. Full numbers in the root [BENCHMARKS.md](https://github.com/teimurjan/blazediff/blob/main/BENCHMARKS.md).
280
+ Benchmarked on Apple M1 Max (25 runs, 5 warmup, image IO included) against `odiff` on 5600×3200 4K PNG images via `tinybench`. Full numbers in the root [BENCHMARKS.md](https://github.com/teimurjan/blazediff/blob/main/BENCHMARKS.md).
280
281
 
281
282
  | Tool | 4k/1 | 4k/2 | 4k/3 | vs blazediff |
282
283
  |------|-----:|-----:|-----:|-------------|
283
- | **blazediff** | ~275ms | ~342ms | ~347ms | - |
284
- | **blazediff** (encoded buffer input) | ~203ms | ~256ms | ~270ms | - |
285
- | odiff | ~1266ms | ~1538ms | ~1799ms | 4.5-5.2x slower |
284
+ | **blazediff** | ~233ms | ~300ms | ~295ms | - |
285
+ | **blazediff** (`BLAZEDIFF_PNG_ENABLED=1`) | ~175ms | ~222ms | ~233ms | - |
286
+ | odiff | ~1185ms | ~1561ms | ~1740ms | 5.1-5.9x slower |
286
287
 
287
288
  Binary sizes (stripped, LTO optimized) - **~3x smaller than odiff**:
288
289
 
@@ -297,12 +298,13 @@ Binary sizes (stripped, LTO optimized) - **~3x smaller than odiff**:
297
298
 
298
299
  ## Algorithm
299
300
 
300
- BlazeDiff uses a two-pass block-based approach with SIMD acceleration:
301
+ BlazeDiff walks the image one band at a time. A band is one row of blocks. The block size grows with the image area, from 8 to 128 pixels.
301
302
 
302
- 1. **Cold Pass**: Scans image in 8x8 blocks using 32-bit integer comparison to identify changed regions
303
- 2. **Hot Pass**: Only processes blocks marked as changed, applying YIQ perceptual color difference
304
- 3. **SIMD**: Uses NEON (ARM) or SSE4.1 (x86) for parallel pixel processing
305
- 4. **Anti-aliasing**: Implements Vysniauskas (2009) algorithm to detect AA artifacts
303
+ 1. **Cold pass**: A SIMD scan reads the band in pixel-row order and flags each block that holds a pixel over the threshold. An integer bound from the YIQ metric rejects most sub-threshold pixels before any float work.
304
+ 2. **Hot pass**: The YIQ perceptual color difference runs on the flagged blocks only, while the band is still in the CPU cache. The other blocks get the gray background in one vectorized write.
305
+ 3. **SIMD**: NEON (ARM), AVX2 or SSE4.1 (x86) for parallel pixel processing.
306
+ 4. **Anti-aliasing**: The Vysniauskas (2009) algorithm detects AA artifacts on the pixels over the threshold.
307
+ 5. **Zero copy**: The N-API binding diffs raw RGBA input in place and draws into your output buffer.
306
308
 
307
309
  ## References
308
310
 
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ __export(index_exports, {
37
37
  });
38
38
  module.exports = __toCommonJS(index_exports);
39
39
 
40
- // ../../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.0_postcss@8.5.15_tsx@4.20.6_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
40
+ // ../../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.0_postcss@8.5.23_tsx@4.20.6_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
41
41
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
42
42
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
43
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazediff/core-native",
3
- "version": "7.0.0",
3
+ "version": "8.1.0",
4
4
  "description": "Native Rust binaries for blazediff - the fastest image diff in the world",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -20,15 +20,15 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@blazediff/core": "2.0.0"
23
+ "@blazediff/core": "2.0.1"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@blazediff/core-native-darwin-arm64": "7.0.0",
27
- "@blazediff/core-native-darwin-x64": "7.0.0",
28
- "@blazediff/core-native-linux-arm64": "7.0.0",
29
- "@blazediff/core-native-linux-x64": "7.0.0",
30
- "@blazediff/core-native-win32-arm64": "7.0.0",
31
- "@blazediff/core-native-win32-x64": "7.0.0"
26
+ "@blazediff/core-native-darwin-arm64": "8.1.0",
27
+ "@blazediff/core-native-darwin-x64": "8.1.0",
28
+ "@blazediff/core-native-linux-arm64": "8.1.0",
29
+ "@blazediff/core-native-linux-x64": "8.1.0",
30
+ "@blazediff/core-native-win32-arm64": "8.1.0",
31
+ "@blazediff/core-native-win32-x64": "8.1.0"
32
32
  },
33
33
  "keywords": [
34
34
  "image",