MCPcopy Create free account
hub / github.com/devilsen/CZXing / DecodeNextTriple

Function DecodeNextTriple

czxing/src/main/cpp/zxing/src/datamatrix/DMDecoder.cpp:119–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119std::optional<std::array<int, 3>> DecodeNextTriple(BitSource& bits)
120{
121 // Values are encoded in a 16-bit value as (1600 * C1) + (40 * C2) + C3 + 1
122 // If there is less than 2 bytes left or the next byte is the unlatch codeword then the current segment has ended
123 if (bits.available() < 16)
124 return {};
125 int firstByte = bits.readBits(8);
126 if (firstByte == 254) // Unlatch codeword
127 return {};
128
129 int fullBitValue = (firstByte << 8) + bits.readBits(8) - 1;
130 int a = fullBitValue / 1600;
131 fullBitValue -= a * 1600;
132 int b = fullBitValue / 40;
133 int c = fullBitValue - b * 40;
134
135 return {{a, b, c}};
136}
137
138enum class Mode {C40, TEXT};
139

Callers 2

DecodeC40OrTextSegmentFunction · 0.85
DecodeAnsiX12SegmentFunction · 0.85

Calls 2

availableMethod · 0.80
readBitsMethod · 0.45

Tested by

no test coverage detected