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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user