|
Download sdk/wasm-decoder/README.md from liu9178/watermark-eval: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/datasets/liu9178/watermark-eval/resolve/main/sdk/wasm-decoder/README.md
- Command line
-
hf download hf://datasets/liu9178/watermark-eval/sdk/wasm-decoder/README.md
-
curl -L -o README.md https://huggingface.co/datasets/liu9178/watermark-eval/resolve/main/sdk/wasm-decoder/README.md
1.95 kB
| # `@aegismark/wasm-decoder` | |
| 原生 **WebAssembly (`wasm32`)** 任意局部截图盲水印极速解码器 SDK,与前端防篡改覆盖层 SDK `@aegismark/overlay-guard` 配套使用。 | |
| --- | |
| ## 核心特性 | |
| 1. **纯 C 编译原生 WebAssembly 内核 (`14 KB`)**: | |
| - 由 `src/decoder_core.c` 经 `clang --target=wasm32 -O3 -ffast-math -nostdlib` 直接编译为 `aegismark_decoder.wasm`,零第三方依赖。 | |
| 2. **任意局部截图盲同步(无需原图、无需知道裁剪坐标 `(x0, y0)`)**: | |
| - 在环面商群 $\mathbb{Z}_{64S} \times \mathbb{Z}_{64S}$ 上执行多尺度像素折叠,并通过两阶段(粗搜 192 导频 $\to$ 精搜 1024 导频)二维循环互相关锁定任意截图起点 `(dy, dx)` 与亚晶格相位 `(subY, subX)`。 | |
| 3. **跨缩放 / 跨 Retina DPR 自适应搜索**: | |
| - 自动遍历 `chipSize ∈ {2, 4, 1, 3}` 及浏览器常见非整数缩放(`1.25x, 1.5x, 0.75x` 双线性重采样)。 | |
| 4. **代数级 GF(256) Reed-Solomon `RS(32, 20)` + OSD-2 软判决翻转纠错 + Keyed CRC-16 零误报校验**: | |
| - 内置完整 Berlekamp-Massey + Chien Search + Forney 代数译码器,支持任意 6 字节(48 bits)突发错误纠正及 2-bit 最不可靠位软翻转(OSD-2),并通过密钥绑定的 `CRC-16/CCITT` 杜绝假阳性误报。 | |
| --- | |
| ## 一行代码调用示例 | |
| ```js | |
| import { AegisMarkWasmDecoder } from "@aegismark/wasm-decoder"; | |
| const decoder = await AegisMarkWasmDecoder.create(); | |
| // 传入任意局部截图的 RGBA 像素数组 (例如 220x160 局部区域截图) | |
| const result = decoder.decodeRGBA(cropRgbaBytes, cropWidth, cropHeight, { | |
| secretKey: "enterprise-secret-2026", | |
| }); | |
| console.log(result); | |
| // { | |
| // verified: true, | |
| // text: "emp-9527|2026-10-23", | |
| // syncOffset: { dy: 37, dx: 19, subY: 1, subX: 0 }, | |
| // chipSize: 2, | |
| // rsErrorsCorrected: 0, | |
| // bitAgreement: 1.0, | |
| // confidence: 0.992, | |
| // pilotZScore: 28.4, | |
| // elapsedMs: 3.12 | |
| // } | |
| ``` | |