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

Function IsEndOfStream

czxing/src/main/cpp/zxing/src/qrcode/QRDecoder.cpp:217–222  ·  view source on GitHub ↗

* QR codes encode mode indicators and terminator codes into a constant bit length of 4. * Micro QR codes have terminator codes that vary in bit length but are always longer than * the mode indicators. * M1 - 0 length mode code, 3 bits terminator code * M2 - 1 bit mode code, 5 bits terminator code * M3 - 2 bit mode code, 7 bits terminator code * M4 - 3 bit mode code, 9 bits terminator code *

Source from the content-addressed store, hash-verified

215 * @param version the QR or micro QR code version
216 */
217bool IsEndOfStream(const BitSource& bits, const Version& version)
218{
219 const int bitsRequired = TerminatorBitsLength(version);
220 const int bitsAvailable = std::min(bits.available(), bitsRequired);
221 return bitsAvailable == 0 || bits.peakBits(bitsAvailable) == 0;
222}
223
224/**
225* <p>QR Codes can encode text as bits in one of several modes, and can use multiple modes

Callers 1

Calls 4

TerminatorBitsLengthFunction · 0.85
availableMethod · 0.80
minFunction · 0.50
peakBitsMethod · 0.45

Tested by

no test coverage detected