Documentation
¶
Overview ¶
Package jabcode is a pure-Go port of the JAB Code (Just Another Bar Code) reference library, a high-capacity 2D color matrix symbology standardized as ISO/IEC 23634:2022.
The default encoder targets the ISO/IEC 23634 wire format. The dependency-light encoder subpackage provides the authoritative public write path for applications that do not need the reader; this root package keeps a facade over it, including fixed byte-mode plans with exact capacity. An untagged decoder accepts the ISO variant; optional build tags add high-color, BSI, and historical C-reference decoder capabilities without replacing ISO. Decode automatically uses every compiled capability; DecodeMessage returns raw data and reader transmission from the same read. Forced single-variant decoding remains internal for CLI oracle and test work. The jabcode_non_iso_encode tag adds public ISO high-color and BSI encoder profiles without changing the untagged ISO default.
Index ¶
Constants ¶
const ( ControlECI = jabenc.ControlECI ControlFNC1Start = jabenc.ControlFNC1Start ControlFNC1Separator = jabenc.ControlFNC1Separator ControlFNC1End = jabenc.ControlFNC1End )
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes the data of a JAB Code from img: the primary symbol and any docked secondary symbols. The untagged build accepts ISO/IEC 23634; optional decoder build tags add their wire families to the same automatic read. They never replace the ISO decoder. Reading a JAB Code from a file is stdlib decoding (e.g. png.Decode) followed by Decode.
When the ISO variant succeeds, Decode returns the ECI-capable reader transmission rather than the raw encoded payload: every message starts with ]j1, ]j4 or ]j5, literal data backslashes are doubled, ECI assignments are escaped, and the JAB ISO/IEC 15434 switch expands its message envelope. That expansion validates the JAB macro controls, not the application data inside the format envelope. The ISO variant rejects reserved color modes. Its Annex F range reduction has not been independently validated.
Types ¶
type ControlKind ¶
type ControlKind = jabenc.ControlKind
ControlKind identifies a structured encoder control.
type Encoder ¶
Encoder encodes data into a JAB Code. Configure it with the With* options; NewEncoder defaults to the ISO/IEC 23634 format, 8 colors, module size 12 and the default ECC level.
func NewEncoder ¶
NewEncoder returns an Encoder configured by opts.
type Message ¶
type Message struct {
Data []byte
ReaderTransmission []byte
Controls []MessageControl
}
Message contains raw decoded data and the standards-facing reader transmission produced from the same corrected message bits. Data excludes symbology identifiers and ECI escape fields and restores literal backslashes. Controls preserves the non-data structure.
type MessageControl ¶
type MessageControl struct {
Kind MessageControlKind
Offset int
Assignment int
}
MessageControl records a control at an offset in Message.Data. Assignment is set only for MessageControlECI. A FNC1 separator's offset points at the GS byte inserted into Data.
type MessageControlKind ¶
type MessageControlKind uint8
MessageControlKind identifies a structured message control that is not a literal byte in Message.Data.
const ( MessageControlECI MessageControlKind = iota + 1 MessageControlFNC1Start MessageControlFNC1Separator MessageControlFNC1End MessageControlISO15434Start MessageControlISO15434End )
type OpaquePlan ¶
type OpaquePlan = jabenc.OpaquePlan
OpaquePlan is an immutable fixed-symbol byte-mode encoder plan.
func NewOpaquePlan ¶
func NewOpaquePlan(version image.Point, opts ...Option) (*OpaquePlan, error)
NewOpaquePlan creates a fixed single-symbol plan whose reported capacity is exact for arbitrary byte values.
type Option ¶
Option configures an Encoder.
func WithColors ¶
WithColors sets the number of module colors.
The default ISO encoder accepts 4 or 8 colors. More-than-8-color output requires jabcode_non_iso_encode and a non-ISO profile. Those denser modes have materially lower physical capture robustness; see jabenc.WithColors for the measured limits.
func WithControls ¶
WithControls adds structured ECI and FNC1 controls to the encoded message.
func WithECCLevel ¶
WithECCLevel sets the error-correction level (0..10); 0 selects the default.
func WithModuleSize ¶
WithModuleSize sets the side length, in pixels, of each module.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream decodes successive images from one coherent frame sequence. Frames may come from a live camera, network video, or a decoded recording. Each frame has a fixed route and correction budget: recent geometry is replayed first, unused search hypotheses carry forward, and the exhaustive single-image ladder is never entered implicitly. Four- and eight-colour primary-only symbols may also combine bounded, compatible module evidence across frames when no individual frame is sufficient. Consequently one frame can return a decode error even when the exhaustive Decode function would succeed; later frames can complete the bounded search or add the missing evidence.
Stream automatically accepts every decoder capability compiled into the build. Optional finder signatures are classified inside the same image traversal, compatible wire variants share the physical-family sample, and the scheduler chooses at most one irreducible wire correction per frame. Disabled capabilities add no stream route.
The zero value is ready to use. A Stream is not safe for concurrent use; decode one coherent frame sequence in order. Results are deterministic for a given frame sequence. For isolated images or an exhaustive attempt use Decode.
func (*Stream) Decode ¶
Decode reads one frame within the stream's fixed work budget, reusing geometry and compatible evidence retained from earlier frames.
func (*Stream) DecodeMessage ¶
DecodeMessage reads one frame once and returns raw application data alongside its standards-facing reader transmission.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
jabcode
command
Command jabcode encodes and decodes JAB Code symbols.
|
Command jabcode encodes and decodes JAB Code symbols. |
|
internal
|
|
|
core
Package core holds the types shared by the detection and decoding stages: the pixel Bitmap, floating-point geometry (PointF, Perspective), the decoded-symbol result types, the shared status codes, and small per-pixel colour statistics.
|
Package core holds the types shared by the detection and decoding stages: the pixel Bitmap, floating-point geometry (PointF, Perspective), the decoded-symbol result types, the shared status codes, and small per-pixel colour statistics. |
|
decode
Package decode turns a sampled symbol matrix into message bits: metadata and palette decoding, module colour classification, and the LDPC/demask/deinterleave message decode, for primary and docked secondary symbols.
|
Package decode turns a sampled symbol matrix into message bits: metadata and palette decoding, module colour classification, and the LDPC/demask/deinterleave message decode, for primary and docked secondary symbols. |
|
detect
Package detect locates JAB Code symbols in an image: channel balancing and binarization (with descreen retries sized from the image's own lattice pitch), finder- and alignment-pattern detection, side-size estimation, perspective sampling of the module grid, and the region-of-interest proposer.
|
Package detect locates JAB Code symbols in an image: channel balancing and binarization (with descreen retries sized from the image's own lattice pitch), finder- and alignment-pattern detection, side-size estimation, perspective sampling of the module grid, and the region-of-interest proposer. |
|
diag
Package diag renders the observation trace produced by the authoritative decoder behind jabcode decode --diag.
|
Package diag renders the observation trace produced by the authoritative decoder behind jabcode decode --diag. |
|
ecc
Package ecc implements the JAB Code forward-error-correction stage: systematic LDPC coding (hard- and soft-decision), the fixed byte (de)interleaving permutation, and the seeded PRNG they share.
|
Package ecc implements the JAB Code forward-error-correction stage: systematic LDPC coding (hard- and soft-decision), the fixed byte (de)interleaving permutation, and the seeded PRNG they share. |
|
encode
Package encode implements the JAB Code encoding pipeline: data analysis and bit-stream generation, LDPC and interleaving, module placement, masking, and bitmap rendering, for single- and multi-symbol codes.
|
Package encode implements the JAB Code encoding pipeline: data analysis and bit-stream generation, LDPC and interleaving, module placement, masking, and bitmap rendering, for single- and multi-symbol codes. |
|
ldpccatalog
Package ldpccatalog carries the precomputed pivot transcripts of every message parity-check code the decoder can select.
|
Package ldpccatalog carries the precomputed pivot transcripts of every message parity-check code the decoder can select. |
|
ldpccatalog/gen
command
Command gen writes the precomputed pivot transcripts a jabcode_ldpc_catalog_blob build embeds.
|
Command gen writes the precomputed pivot transcripts a jabcode_ldpc_catalog_blob build embeds. |
|
palette
Package palette holds the JAB Code module color palettes shared by the encoder and decoder.
|
Package palette holds the JAB Code module color palettes shared by the encoder and decoder. |
|
phaseprobe
Package phaseprobe provides opt-in process-timeline instrumentation for GPU route diagnostics.
|
Package phaseprobe provides opt-in process-timeline instrumentation for GPU route diagnostics. |
|
read
Package read coordinates detection and decoding into the full JAB Code reading pipeline: it owns the orientation and region-of-interest retries, the detect-then-decode handoff for the primary symbol (including the alignment-pattern fallback that needs the decoded side version), and the docked-secondary walk that derives each secondary's geometry from its decoded host metadata.
|
Package read coordinates detection and decoding into the full JAB Code reading pipeline: it owns the orientation and region-of-interest retries, the detect-then-decode handoff for the primary symbol (including the alignment-pattern fallback that needs the decoded side version), and the docked-secondary walk that derives each secondary's geometry from its decoded host metadata. |
|
spec
Package spec holds JAB Code symbol geometry, metadata layout, masking and finder core-color constants shared by the encoder and decoder.
|
Package spec holds JAB Code symbol geometry, metadata layout, masking and finder core-color constants shared by the encoder and decoder. |
|
tables
Package tables holds the JAB Code static lookup tables (encoding, alignment-pattern, and palette/finder geometry) shared by the encoder and decoder.
|
Package tables holds the JAB Code static lookup tables (encoding, alignment-pattern, and palette/finder geometry) shared by the encoder and decoder. |
|
testutil
Package testutil provides shared helpers for the test suites of jabcode's internal packages.
|
Package testutil provides shared helpers for the test suites of jabcode's internal packages. |
|
wasmgate
command
Command wasmgate executes the public fixed-plan and stream path.
|
Command wasmgate executes the public fixed-plan and stream path. |
|
wire
Package wire defines internal JAB Code wire variants, decoder capability sets and encoder format choices.
|
Package wire defines internal JAB Code wire variants, decoder capability sets and encoder format choices. |
|
Package jabenc provides the dependency-light public JAB Code write path.
|
Package jabenc provides the dependency-light public JAB Code write path. |