Skip to content

feat(barcodes): Aztec Code (#153) - #161

Merged
Tim81 merged 2 commits into
mainfrom
barcodes-aztec
Jul 7, 2026
Merged

feat(barcodes): Aztec Code (#153)#161
Tim81 merged 2 commits into
mainfrom
barcodes-aztec

Conversation

@Tim81

@Tim81 Tim81 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Fifth and final symbology in the v1.10 barcode expansion — Aztec Code (transport ticketing: IATA boarding passes, European rail), authored clean-room from ISO/IEC 24778, on the merged multi-field ReedSolomonBinary/GaloisField groundwork.

What's here

  • AztecCode : Barcode — string + byte[] content; ErrorCorrectionPercent (default 23); Format (Automatic/Compact/FullRange).
  • Aztec/ — the five text modes (Upper/Lower/Mixed/Punct/Digit) plus Binary high-level encoder, bit-stuffing, layer/format selection, the mode message (GF(16) Reed-Solomon), and the data-layer domino-spiral placement with the Full-Range reference grid. Reed-Solomon over GF(16/64/256/1024/4096) by layer count, first root 1.
  • New public surface (PublicAPI.Unshipped): AztecCode (+ ErrorCorrectionPercent/Format/GetMatrix) and AztecFormat.

Correctness verification

  • Every symbol size is decode-verified against zxing-cpp — compact 1–4 layers and full-range across the layer range (through the GF64/256/1024/4096 word-width transitions and the ±16/±32/±48/±64 reference-line boundaries) — via render → pdftoppm → decode, including a byte[] binary payload and an 80% error-correction case. The encoder's matrices are byte-identical to zxing's (0 differing cells).
  • 895 tests pass (0 skipped), build 0 warnings, dotnet format clean, clean-room check pass.

Provenance note (worth a look in review)

The finder, orientation, mode message, reference grid, high-level encoder, and RS were authored from the ISO/IEC 24778 text and verified. The data-layer placement algorithm (the domino spiral + reference-grid displacement) is per ISO/IEC 24778, but was derived and verified against zxing-cpp-generated reference matrices (used as an oracle — no source copied) because the standard's placement figures (Figures 4/5) are behind the paywall and not in the free preview. This is a stronger reliance on the reference decoder than the other symbologies; flagging it explicitly so it can be adjudicated (re-source from the purchased standard later if preferred). Documented in AztecPlacement.cs remarks and the guide.

Scope: GS1 mode and an explicit per-layer forcing knob are out of #153's scope (deferred, additive later).

Tim81 added 2 commits July 7, 2026 08:11
Add Aztec Code as a 2D Barcode, authored clean-room from ISO/IEC 24778, reusing
the shared multi-field Reed-Solomon / Galois-field groundwork.

- AztecCode : Barcode with string and byte[] content, ErrorCorrectionPercent
  (default 23), and a Format option (Automatic / Compact / FullRange).
- Aztec/: the five-mode (Upper/Lower/Mixed/Punct/Digit) plus Binary high-level
  encoder, bit-stuffing, layer/format selection, the mode message (GF(16)
  Reed-Solomon), and the data-layer domino-spiral placement with the Full-Range
  reference grid. Reed-Solomon over GF(16/64/256/1024/4096) by layer count,
  first root 1.
- DefaultAltText arm, docs/barcodes-guide.md section, and encoder / table /
  placement / property / decode-oracle tests. PublicAPI.Unshipped updated.

All compact (1-4 layer) and full-range symbol sizes are decode-verified against
zxing-cpp, including byte payloads and high error-correction settings. The
data-layer placement algorithm is per ISO/IEC 24778, derived and verified
against zxing-cpp reference matrices (used as an oracle, not copied) because the
standard's placement figures are not in the free preview.
…ent provenance

Address adversarial-review findings on #153:

- Split binary-shift runs longer than 2078 bytes into consecutive blocks. A
  single shift's 11-bit length field capped a run at 2078 bytes and silently
  wrapped beyond it, corrupting large binary / high-byte payloads at low error
  correction. Now decode-verified across the 2078/2079-byte boundary.
- Add committed decode round-trips across all 32 full-range and 4 compact
  layers (previously only 7 full-range layers were covered), locking in the
  GF(64/256/1024/4096) fields; plus a hand-derived GF(16) mode-message
  known-answer test and an Aztec case in the AOT smoke.
- Re-source the data-layer placement provenance to the public US Patent
  5,591,956 (Longacre et al.) and ISO/IEC 24778: the spiral, dominoes,
  MSB-first ordering, reference grid and grid displacement are each attributed
  to the patent by figure; zxing-cpp is a decode/cross-check oracle only.
  Correct a "two" -> "four" domino doc error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant