Move to raw binary#1
Conversation
| @@ -519,6 +525,7 @@ <h3 style="font-size:0.95em;margin-bottom:8px;">Files in archive <span class="ba | |||
| for (var i = 0; i < barcodes.length; i++) { | |||
| if (barcodes[i].rawValue) camProcessQR(barcodes[i].rawValue); | |||
There was a problem hiding this comment.
Does the browser BarcodeDetector browser API expose QR byte-mode payloads as raw bytes anywhere, or only as rawValue/DOMString text? For v3 arbitrary binary frames, is correct decoding therefore dependent on jsQR.binaryData rather than BarcodeDetector?
Or is it impossible to use BarcodeDetector API for arbitrary binary data(for those we use jsQR only?), and we can transfer only UTF8 text with BarcodeDetector?
| - Adjustable QR version and QR error correction level (L/M/Q/H) | ||
|
|
||
| **Decoding:** | ||
| - Live camera scan with native `BarcodeDetector` (hardware-accelerated) + jsQR fallback |
There was a problem hiding this comment.
But for arbitrary binary data(not just UTF8 text that carries over base64 payload) that BarcodeDetector claim is still valid? Can BarcodeDetector do arbitrary binary data also?
There was a problem hiding this comment.
No. jsQR is not a fallback for V3; it is required. It would probably be a good idea to remove the BarcodeDetector code from running each frame since it cannot recover binary data correctly, and just use jsQR.
If you want to see the difference, here is a link to V3 https://odyhibit.github.io/code-to-qr-code/
Try the same file in both versions.
|
updated the README, and removed the unused BarcodeDetector code. |
…lose as we can (507) since we do not waste space with padding, but fill the entire QR code with data
removed the call to calcFixedSize every frame, since we now define the Version. btnGif handler is now async: with a live progress update decoder is now async with updates while decoding.
|
Changed the default size to version 17, which is close to Version 2's block size of 500 (507 in my example file). Optimized the inner loop. |
|
Added color channel mode. |
Summary
This PR improves the QR transfer format and encoder controls to make generated QR frames smaller, more predictable, and easier to tune.
The main change is a new v3 binary frame format. Instead of wrapping every QR frame in JSON and base64-encoding the payload, v3 stores the frame header and payload as raw bytes in QR byte mode. This removes JSON overhead, avoids base64 expansion, and keeps repeated metadata out of every frame.
What Changed
Uint8ArrayQR byte-mode payloads.jsQR.binaryDatawhere available.Motivation
The previous format repeated a JSON header in every QR frame and stored data as base64 text. That made each QR carry significantly less actual file data than its nominal chunk size. For example, a 500-character base64 chunk only represents about 375 bytes of file data, before also accounting for JSON header overhead.
The v3 format reduces that overhead by using the QR code’s byte mode directly: