Skip to main content

Module optimize

Module optimize 

Source
Expand description

Data mode segmentation optimizer.

QR codes support four data modes (Numeric, Alphanumeric, Byte, Kanji), each with different efficiency for different character types. This module finds the optimal sequence of mode switches to minimize the total number of bits required to encode the input data.

The optimizer uses dynamic programming to explore all possible mode transitions and selects the segmentation that produces the shortest bit stream for the target QR code version.

Structs§

Optimizer
Iterator that greedily merges consecutive segments to minimize the total encoded length for a given Version. Created via Parser::optimize.
Parser
QR code data parser to classify the input into distinct segments.
Segment
A segment of data committed to an encoding mode.

Functions§

total_encoded_len
Computes the total encoded length of all segments.