Scanner: gpu canvases (cpu ones copied whole frames in software), back to 1080p with a 720p fallback on slow phones; lab frame save works on android

This commit is contained in:
2026-11-17 14:06:03 +01:00
parent 7765f22f61
commit 70d09b1008
5 changed files with 35 additions and 17 deletions
+5 -2
View File
@@ -6,8 +6,11 @@ const WIDE = 960, CROP = 360;
export function makeRingScanner(opts = {}) {
const reader = makeReader(opts);
const wide = document.createElement("canvas"), wctx = wide.getContext("2d", { willReadFrequently: true });
const crop = document.createElement("canvas"), cctx = crop.getContext("2d", { willReadFrequently: true });
// no willReadFrequently: it moves the canvas to the cpu, and drawing a video frame into it then copies and
// scales the whole frame in software (2 s per frame for a 4k stream on a mid-range android). on the gpu the
// scaling is free and only these small canvases are read back
const wide = document.createElement("canvas"), wctx = wide.getContext("2d");
const crop = document.createElement("canvas"), cctx = crop.getContext("2d");
let track = null;
// source px of the square around a code of the given unit