MCPcopy Create free account
hub / github.com/cozmo/jsQR / decode

Function decode

src/decoder/decoder.ts:327–345  ·  view source on GitHub ↗
(matrix: BitMatrix)

Source from the content-addressed store, hash-verified

325}
326
327export function decode(matrix: BitMatrix): DecodedQR {
328 if (matrix == null) {
329 return null;
330 }
331 const result = decodeMatrix(matrix);
332 if (result) {
333 return result;
334 }
335 // Decoding didn't work, try mirroring the QR across the topLeft -> bottomRight line.
336 for (let x = 0; x < matrix.width; x++) {
337 for (let y = x + 1; y < matrix.height; y++) {
338 if (matrix.get(x, y) !== matrix.get(y, x)) {
339 matrix.set(x, y, !matrix.get(x, y));
340 matrix.set(y, x, !matrix.get(y, x));
341 }
342 }
343 }
344 return decodeMatrix(matrix);
345}

Callers 2

scanFunction · 0.90
test.tsFile · 0.90

Calls 3

decodeMatrixFunction · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…