Commit Graph
2 Commits
Author SHA1 Message Date
bflatastic 82e50e93fd OCR worker checks the page's pixel count without overflowing
width * height * 4 could wrap for sides near u32::MAX and let a short buffer
through as the right size; the product is now checked.
2026-11-08 23:38:59 +07:00
bmh129 a10906e991 M10: Recognize Text in the browser, read in Web Workers (ocr.ocr-web)
The web build downloads the OCR models the first time Recognize Text (or
Edit on a scanned page) needs them, installs the engine, and reads pages
in up to two Web Workers (apps/pdfcraft-ocr-worker) built with WebAssembly
SIMD, so the page keeps responding. The page prepares each page and sends
its image to an idle worker, which runs ocrs and sends the lines back.
Where no worker can start, the page reads with the installed engine.
Answers go back to the run that sent the page (ocr_route), so a single
run and a batch can overlap.

Recognize Text in Multiple Files on the web keeps main's skipped-files
bucket, low-confidence notes and cancel between files. Files chosen
before the models are in wait for them. A scan Edit finds while no engine
can read it waits for the models instead of counting as no scan.

Trunk builds the worker beside the app; `cargo xtask web-worker-link`
hashes its files and names it in index.html. The web zip ships the
models in models/.
2026-11-07 21:35:50 -06:00