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

Function ReadCodeWords

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

Source from the content-addressed store, hash-verified

214
215template<typename POINT>
216std::vector<int> ReadCodeWords(BitMatrixCursor<POINT> topCur, SymbolInfo info)
217{
218 printf("rows: %d, cols: %d, rowHeight: %.1f, colWidth: %d, firstRow: %d, lastRow: %d, ecLevel: %d\n", info.nRows,
219 info.nCols, info.rowHeight, info.colWidth, info.firstRow, info.lastRow, info.ecLevel);
220 auto print = [](CodeWord c [[maybe_unused]]) { printf("%4d.%d ", c.code, c.cluster); };
221
222 auto rowSkip = topCur.right();
223 if (info.firstRow > info.lastRow) {
224 topCur.p += (info.height - 1) * rowSkip;
225 rowSkip = -rowSkip;
226 std::swap(info.firstRow, info.lastRow);
227 }
228
229 int maxColWidth = info.colWidth * 3 / 2;
230 std::vector<int> codeWords(info.nRows * info.nCols, -1);
231 for (int row = info.firstRow; row < std::min(info.nRows, info.lastRow + 1); ++row) {
232 int cluster = (row % 3) * 3;
233 auto cur = topCur.movedBy(int((row - info.firstRow + 0.5f) * info.rowHeight) * rowSkip);
234 // skip start pattern
235 cur.stepToEdge(8 + cur.isWhite(), maxColWidth);
236 // read off left row indicator column
237 auto cw [[maybe_unused]] = ReadCodeWord(cur, cluster);
238 printf("%3dx%3d:%2d: ", int(cur.p.x), int(cur.p.y), Row(cw));
239 print(cw);
240
241 for (int col = 0; col < info.nCols && cur.isIn(); ++col) {
242 auto cw = ReadCodeWord(cur, cluster);
243 codeWords[row * info.nCols + col] = cw.code;
244 print(cw);
245 }
246
247#ifdef PRINT_DEBUG
248 print(ReadCodeWord(cur));
249 printf("\n");
250 fflush(stdout);
251#endif
252 }
253
254 return codeWords;
255}
256
257// forward declaration from PDFScanningDecoder.cpp
258DecoderResult DecodeCodewords(std::vector<int>& codewords, int ecLevel, const std::vector<int>& erasures);

Callers 1

DecodePureFunction · 0.85

Calls 10

ReadCodeWordFunction · 0.85
RowFunction · 0.85
rightMethod · 0.80
movedByMethod · 0.80
stepToEdgeMethod · 0.80
swapFunction · 0.50
minFunction · 0.50
printFunction · 0.50
isWhiteMethod · 0.45
isInMethod · 0.45

Tested by

no test coverage detected