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

Function DoDecode

czxing/src/main/cpp/zxing/src/pdf417/PDFReader.cpp:66–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66static Results DoDecode(const BinaryBitmap& image, bool multiple, bool tryRotate, bool returnErrors)
67{
68 Detector::Result detectorResult = Detector::Detect(image, multiple, tryRotate);
69 if (detectorResult.points.empty())
70 return {};
71
72 auto rotate = [res = detectorResult](PointI p) {
73 switch(res.rotation) {
74 case 90: return PointI(res.bits->height() - p.y - 1, p.x);
75 case 180: return PointI(res.bits->width() - p.x - 1, res.bits->height() - p.y - 1);
76 case 270: return PointI(p.y, res.bits->width() - p.x - 1);
77 }
78 return p;
79 };
80
81 Results results;
82 for (const auto& points : detectorResult.points) {
83 DecoderResult decoderResult =
84 ScanningDecoder::Decode(*detectorResult.bits, points[4], points[5], points[6], points[7],
85 GetMinCodewordWidth(points), GetMaxCodewordWidth(points));
86 if (decoderResult.isValid(returnErrors)) {
87 auto point = [&](int i) { return rotate(PointI(points[i].value())); };
88 Result result(std::move(decoderResult), {point(0), point(2), point(3), point(1)}, BarcodeFormat::PDF417);
89 results.push_back(result);
90 if (!multiple)
91 return results;
92 }
93 }
94 return results;
95}
96
97// new implementation (only for isPure use case atm.)
98

Callers 1

decodeMethod · 0.70

Calls 11

GetMinCodewordWidthFunction · 0.85
GetMaxCodewordWidthFunction · 0.85
moveFunction · 0.85
DetectFunction · 0.50
DecodeFunction · 0.50
emptyMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
isValidMethod · 0.45
valueMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected