MCPcopy Create free account
hub / github.com/creatale/node-dv / decode

Method decode

deps/zxing/core/src/zxing/pdf417/decoder/3Decoder.cpp:43–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41const int Decoder::MAX_EC_CODEWORDS = 512;
42
43Ref<DecoderResult> Decoder::decode(Ref<BitMatrix> bits, DecodeHints const& hints) {
44 (void)hints;
45 // Construct a parser to read the data codewords and error-correction level
46 BitMatrixParser parser(bits);
47 ArrayRef<int> codewords(parser.readCodewords());
48 if (codewords->size() == 0) {
49 throw FormatException("PDF:Decoder:decode: cannot read codewords");
50 }
51
52 int ecLevel = parser.getECLevel();
53 int numECCodewords = 1 << (ecLevel + 1);
54 ArrayRef<int> erasures = parser.getErasures();
55
56 correctErrors(codewords, erasures, numECCodewords);
57 verifyCodewordCount(codewords, numECCodewords);
58
59 // Decode the codewords
60 return DecodedBitStreamParser::decode(codewords);
61}
62
63/**
64 * Verify that all is OK with the codeword array.

Callers 1

correctErrorsMethod · 0.45

Calls 6

FormatExceptionClass · 0.85
decodeFunction · 0.85
getECLevelMethod · 0.80
getErasuresMethod · 0.80
readCodewordsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected