diff --git a/src/aztec/detector.rs b/src/aztec/detector.rs
index 9e86ca1..acd4578 100644
--- a/src/aztec/detector.rs
+++ b/src/aztec/detector.rs
@@ -85,7 +85,7 @@ impl Detector {
let mut bulls_eye_corners = self.get_bulls_eye_corners(p_center)?;
if is_mirror {
- bulls_eye_corners.swap(0,2);
+ bulls_eye_corners.swap(0, 2);
}
// 3. Get the size of the matrix and other parameters from the bull's eye
diff --git a/src/common/global_histogram_binarizer.rs b/src/common/global_histogram_binarizer.rs
index 01e91a7..1a78afa 100644
--- a/src/common/global_histogram_binarizer.rs
+++ b/src/common/global_histogram_binarizer.rs
@@ -214,7 +214,6 @@ impl GlobalHistogramBinarizer {
// Make sure firstPeak corresponds to the black peak.
if firstPeak > secondPeak {
-
std::mem::swap(&mut firstPeak, &mut secondPeak);
}
diff --git a/src/common/reedsolomon/generic_gf_poly.rs b/src/common/reedsolomon/generic_gf_poly.rs
index dfce085..de63ff0 100644
--- a/src/common/reedsolomon/generic_gf_poly.rs
+++ b/src/common/reedsolomon/generic_gf_poly.rs
@@ -154,7 +154,7 @@ impl GenericGFPoly {
let mut smallerCoefficients = self.coefficients.clone();
let mut largerCoefficients = other.coefficients.clone();
if smallerCoefficients.len() > largerCoefficients.len() {
- std::mem::swap(&mut smallerCoefficients,&mut largerCoefficients)
+ std::mem::swap(&mut smallerCoefficients, &mut largerCoefficients)
}
let mut sumDiff = vec![0; largerCoefficients.len()];
diff --git a/src/oned/rss/rss_14_reader.rs b/src/oned/rss/rss_14_reader.rs
index e77c43b..d613b61 100644
--- a/src/oned/rss/rss_14_reader.rs
+++ b/src/oned/rss/rss_14_reader.rs
@@ -307,8 +307,8 @@ impl RSS14Reader {
let mut j = counters.len() - 1;
while i < j {
// for (int i = 0, j = counters.length - 1; i < j; i++, j--) {
-
- counters.swap(i,j);
+
+ counters.swap(i, j);
i += 1;
j -= 1;
diff --git a/src/pdf417/decoder/DetectionResult.java b/src/pdf417/decoder/DetectionResult.java
deleted file mode 100644
index 33179d2..0000000
--- a/src/pdf417/decoder/DetectionResult.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.zxing.pdf417.decoder;
-
-import com.google.zxing.pdf417.PDF417Common;
-
-import java.util.Formatter;
-
-/**
- * @author Guenther Grau
- */
-final class DetectionRXingResult {
-
- private static final int ADJUST_ROW_NUMBER_SKIP = 2;
-
- private final BarcodeMetadata barcodeMetadata;
- private final DetectionRXingResultColumn[] detectionRXingResultColumns;
- private BoundingBox boundingBox;
- private final int barcodeColumnCount;
-
- DetectionRXingResult(BarcodeMetadata barcodeMetadata, BoundingBox boundingBox) {
- this.barcodeMetadata = barcodeMetadata;
- this.barcodeColumnCount = barcodeMetadata.getColumnCount();
- this.boundingBox = boundingBox;
- detectionRXingResultColumns = new DetectionRXingResultColumn[barcodeColumnCount + 2];
- }
-
- DetectionRXingResultColumn[] getDetectionRXingResultColumns() {
- adjustIndicatorColumnRowNumbers(detectionRXingResultColumns[0]);
- adjustIndicatorColumnRowNumbers(detectionRXingResultColumns[barcodeColumnCount + 1]);
- int unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;
- int previousUnadjustedCount;
- do {
- previousUnadjustedCount = unadjustedCodewordCount;
- unadjustedCodewordCount = adjustRowNumbers();
- } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
- return detectionRXingResultColumns;
- }
-
- private void adjustIndicatorColumnRowNumbers(DetectionRXingResultColumn detectionRXingResultColumn) {
- if (detectionRXingResultColumn != null) {
- ((DetectionRXingResultRowIndicatorColumn) detectionRXingResultColumn)
- .adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata);
- }
- }
-
- // TODO ensure that no detected codewords with unknown row number are left
- // we should be able to estimate the row height and use it as a hint for the row number
- // we should also fill the rows top to bottom and bottom to top
- /**
- * @return number of codewords which don't have a valid row number. Note that the count is not accurate as codewords
- * will be counted several times. It just serves as an indicator to see when we can stop adjusting row numbers
- */
- private int adjustRowNumbers() {
- int unadjustedCount = adjustRowNumbersByRow();
- if (unadjustedCount == 0) {
- return 0;
- }
- for (int barcodeColumn = 1; barcodeColumn < barcodeColumnCount + 1; barcodeColumn++) {
- Codeword[] codewords = detectionRXingResultColumns[barcodeColumn].getCodewords();
- for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- if (!codewords[codewordsRow].hasValidRowNumber()) {
- adjustRowNumbers(barcodeColumn, codewordsRow, codewords);
- }
- }
- }
- return unadjustedCount;
- }
-
- private int adjustRowNumbersByRow() {
- adjustRowNumbersFromBothRI();
- // TODO we should only do full row adjustments if row numbers of left and right row indicator column match.
- // Maybe it's even better to calculated the height (in codeword rows) and divide it by the number of barcode
- // rows. This, together with the LRI and RRI row numbers should allow us to get a good estimate where a row
- // number starts and ends.
- int unadjustedCount = adjustRowNumbersFromLRI();
- return unadjustedCount + adjustRowNumbersFromRRI();
- }
-
- private void adjustRowNumbersFromBothRI() {
- if (detectionRXingResultColumns[0] == null || detectionRXingResultColumns[barcodeColumnCount + 1] == null) {
- return;
- }
- Codeword[] LRIcodewords = detectionRXingResultColumns[0].getCodewords();
- Codeword[] RRIcodewords = detectionRXingResultColumns[barcodeColumnCount + 1].getCodewords();
- for (int codewordsRow = 0; codewordsRow < LRIcodewords.length; codewordsRow++) {
- if (LRIcodewords[codewordsRow] != null &&
- RRIcodewords[codewordsRow] != null &&
- LRIcodewords[codewordsRow].getRowNumber() == RRIcodewords[codewordsRow].getRowNumber()) {
- for (int barcodeColumn = 1; barcodeColumn <= barcodeColumnCount; barcodeColumn++) {
- Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword == null) {
- continue;
- }
- codeword.setRowNumber(LRIcodewords[codewordsRow].getRowNumber());
- if (!codeword.hasValidRowNumber()) {
- detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;
- }
- }
- }
- }
- }
-
- private int adjustRowNumbersFromRRI() {
- if (detectionRXingResultColumns[barcodeColumnCount + 1] == null) {
- return 0;
- }
- int unadjustedCount = 0;
- Codeword[] codewords = detectionRXingResultColumns[barcodeColumnCount + 1].getCodewords();
- for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- int rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
- int invalidRowCounts = 0;
- for (int barcodeColumn = barcodeColumnCount + 1;
- barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP;
- barcodeColumn--) {
- Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword != null) {
- invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
- if (!codeword.hasValidRowNumber()) {
- unadjustedCount++;
- }
- }
- }
- }
- return unadjustedCount;
- }
-
- private int adjustRowNumbersFromLRI() {
- if (detectionRXingResultColumns[0] == null) {
- return 0;
- }
- int unadjustedCount = 0;
- Codeword[] codewords = detectionRXingResultColumns[0].getCodewords();
- for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- int rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
- int invalidRowCounts = 0;
- for (int barcodeColumn = 1;
- barcodeColumn < barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP;
- barcodeColumn++) {
- Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword != null) {
- invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
- if (!codeword.hasValidRowNumber()) {
- unadjustedCount++;
- }
- }
- }
- }
- return unadjustedCount;
- }
-
- private static int adjustRowNumberIfValid(int rowIndicatorRowNumber, int invalidRowCounts, Codeword codeword) {
- if (codeword == null) {
- return invalidRowCounts;
- }
- if (!codeword.hasValidRowNumber()) {
- if (codeword.isValidRowNumber(rowIndicatorRowNumber)) {
- codeword.setRowNumber(rowIndicatorRowNumber);
- invalidRowCounts = 0;
- } else {
- ++invalidRowCounts;
- }
- }
- return invalidRowCounts;
- }
-
- private void adjustRowNumbers(int barcodeColumn, int codewordsRow, Codeword[] codewords) {
- Codeword codeword = codewords[codewordsRow];
- Codeword[] previousColumnCodewords = detectionRXingResultColumns[barcodeColumn - 1].getCodewords();
- Codeword[] nextColumnCodewords = previousColumnCodewords;
- if (detectionRXingResultColumns[barcodeColumn + 1] != null) {
- nextColumnCodewords = detectionRXingResultColumns[barcodeColumn + 1].getCodewords();
- }
-
- Codeword[] otherCodewords = new Codeword[14];
-
- otherCodewords[2] = previousColumnCodewords[codewordsRow];
- otherCodewords[3] = nextColumnCodewords[codewordsRow];
-
- if (codewordsRow > 0) {
- otherCodewords[0] = codewords[codewordsRow - 1];
- otherCodewords[4] = previousColumnCodewords[codewordsRow - 1];
- otherCodewords[5] = nextColumnCodewords[codewordsRow - 1];
- }
- if (codewordsRow > 1) {
- otherCodewords[8] = codewords[codewordsRow - 2];
- otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];
- otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];
- }
- if (codewordsRow < codewords.length - 1) {
- otherCodewords[1] = codewords[codewordsRow + 1];
- otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];
- otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];
- }
- if (codewordsRow < codewords.length - 2) {
- otherCodewords[9] = codewords[codewordsRow + 2];
- otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];
- otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];
- }
- for (Codeword otherCodeword : otherCodewords) {
- if (adjustRowNumber(codeword, otherCodeword)) {
- return;
- }
- }
- }
-
- /**
- * @return true, if row number was adjusted, false otherwise
- */
- private static boolean adjustRowNumber(Codeword codeword, Codeword otherCodeword) {
- if (otherCodeword == null) {
- return false;
- }
- if (otherCodeword.hasValidRowNumber() && otherCodeword.getBucket() == codeword.getBucket()) {
- codeword.setRowNumber(otherCodeword.getRowNumber());
- return true;
- }
- return false;
- }
-
- int getBarcodeColumnCount() {
- return barcodeColumnCount;
- }
-
- int getBarcodeRowCount() {
- return barcodeMetadata.getRowCount();
- }
-
- int getBarcodeECLevel() {
- return barcodeMetadata.getErrorCorrectionLevel();
- }
-
- void setBoundingBox(BoundingBox boundingBox) {
- this.boundingBox = boundingBox;
- }
-
- BoundingBox getBoundingBox() {
- return boundingBox;
- }
-
- void setDetectionRXingResultColumn(int barcodeColumn, DetectionRXingResultColumn detectionRXingResultColumn) {
- detectionRXingResultColumns[barcodeColumn] = detectionRXingResultColumn;
- }
-
- DetectionRXingResultColumn getDetectionRXingResultColumn(int barcodeColumn) {
- return detectionRXingResultColumns[barcodeColumn];
- }
-
- @Override
- public String toString() {
- DetectionRXingResultColumn rowIndicatorColumn = detectionRXingResultColumns[0];
- if (rowIndicatorColumn == null) {
- rowIndicatorColumn = detectionRXingResultColumns[barcodeColumnCount + 1];
- }
- try (Formatter formatter = new Formatter()) {
- for (int codewordsRow = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {
- formatter.format("CW %3d:", codewordsRow);
- for (int barcodeColumn = 0; barcodeColumn < barcodeColumnCount + 2; barcodeColumn++) {
- if (detectionRXingResultColumns[barcodeColumn] == null) {
- formatter.format(" | ");
- continue;
- }
- Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword == null) {
- formatter.format(" | ");
- continue;
- }
- formatter.format(" %3d|%3d", codeword.getRowNumber(), codeword.getValue());
- }
- formatter.format("%n");
- }
- return formatter.toString();
- }
- }
-
-}
diff --git a/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java b/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java
deleted file mode 100644
index 002d75c..0000000
--- a/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.zxing.pdf417.decoder;
-
-import com.google.zxing.RXingResultPoint;
-import com.google.zxing.pdf417.PDF417Common;
-
-/**
- * @author Guenther Grau
- */
-final class DetectionRXingResultRowIndicatorColumn extends DetectionRXingResultColumn {
-
- private final boolean isLeft;
-
- DetectionRXingResultRowIndicatorColumn(BoundingBox boundingBox, boolean isLeft) {
- super(boundingBox);
- this.isLeft = isLeft;
- }
-
- private void setRowNumbers() {
- for (Codeword codeword : getCodewords()) {
- if (codeword != null) {
- codeword.setRowNumberAsRowIndicatorColumn();
- }
- }
- }
-
- // TODO implement properly
- // TODO maybe we should add missing codewords to store the correct row number to make
- // finding row numbers for other columns easier
- // use row height count to make detection of invalid row numbers more reliable
- void adjustCompleteIndicatorColumnRowNumbers(BarcodeMetadata barcodeMetadata) {
- Codeword[] codewords = getCodewords();
- setRowNumbers();
- removeIncorrectCodewords(codewords, barcodeMetadata);
- BoundingBox boundingBox = getBoundingBox();
- RXingResultPoint top = isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
- RXingResultPoint bottom = isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
- int firstRow = imageRowToCodewordIndex((int) top.getY());
- int lastRow = imageRowToCodewordIndex((int) bottom.getY());
- // We need to be careful using the average row height. Barcode could be skewed so that we have smaller and
- // taller rows
- //float averageRowHeight = (lastRow - firstRow) / (float) barcodeMetadata.getRowCount();
- int barcodeRow = -1;
- int maxRowHeight = 1;
- int currentRowHeight = 0;
- for (int codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- Codeword codeword = codewords[codewordsRow];
-
- int rowDifference = codeword.getRowNumber() - barcodeRow;
-
- // TODO improve handling with case where first row indicator doesn't start with 0
-
- if (rowDifference == 0) {
- currentRowHeight++;
- } else if (rowDifference == 1) {
- maxRowHeight = Math.max(maxRowHeight, currentRowHeight);
- currentRowHeight = 1;
- barcodeRow = codeword.getRowNumber();
- } else if (rowDifference < 0 ||
- codeword.getRowNumber() >= barcodeMetadata.getRowCount() ||
- rowDifference > codewordsRow) {
- codewords[codewordsRow] = null;
- } else {
- int checkedRows;
- if (maxRowHeight > 2) {
- checkedRows = (maxRowHeight - 2) * rowDifference;
- } else {
- checkedRows = rowDifference;
- }
- boolean closePreviousCodewordFound = checkedRows >= codewordsRow;
- for (int i = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {
- // there must be (height * rowDifference) number of codewords missing. For now we assume height = 1.
- // This should hopefully get rid of most problems already.
- closePreviousCodewordFound = codewords[codewordsRow - i] != null;
- }
- if (closePreviousCodewordFound) {
- codewords[codewordsRow] = null;
- } else {
- barcodeRow = codeword.getRowNumber();
- currentRowHeight = 1;
- }
- }
- }
- //return (int) (averageRowHeight + 0.5);
- }
-
- int[] getRowHeights() {
- BarcodeMetadata barcodeMetadata = getBarcodeMetadata();
- if (barcodeMetadata == null) {
- return null;
- }
- adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata);
- int[] result = new int[barcodeMetadata.getRowCount()];
- for (Codeword codeword : getCodewords()) {
- if (codeword != null) {
- int rowNumber = codeword.getRowNumber();
- if (rowNumber >= result.length) {
- // We have more rows than the barcode metadata allows for, ignore them.
- continue;
- }
- result[rowNumber]++;
- } // else throw exception?
- }
- return result;
- }
-
- // TODO maybe we should add missing codewords to store the correct row number to make
- // finding row numbers for other columns easier
- // use row height count to make detection of invalid row numbers more reliable
- private void adjustIncompleteIndicatorColumnRowNumbers(BarcodeMetadata barcodeMetadata) {
- BoundingBox boundingBox = getBoundingBox();
- RXingResultPoint top = isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
- RXingResultPoint bottom = isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
- int firstRow = imageRowToCodewordIndex((int) top.getY());
- int lastRow = imageRowToCodewordIndex((int) bottom.getY());
- //float averageRowHeight = (lastRow - firstRow) / (float) barcodeMetadata.getRowCount();
- Codeword[] codewords = getCodewords();
- int barcodeRow = -1;
- int maxRowHeight = 1;
- int currentRowHeight = 0;
- for (int codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- Codeword codeword = codewords[codewordsRow];
-
- codeword.setRowNumberAsRowIndicatorColumn();
-
- int rowDifference = codeword.getRowNumber() - barcodeRow;
-
- // TODO improve handling with case where first row indicator doesn't start with 0
-
- if (rowDifference == 0) {
- currentRowHeight++;
- } else if (rowDifference == 1) {
- maxRowHeight = Math.max(maxRowHeight, currentRowHeight);
- currentRowHeight = 1;
- barcodeRow = codeword.getRowNumber();
- } else if (codeword.getRowNumber() >= barcodeMetadata.getRowCount()) {
- codewords[codewordsRow] = null;
- } else {
- barcodeRow = codeword.getRowNumber();
- currentRowHeight = 1;
- }
- }
- //return (int) (averageRowHeight + 0.5);
- }
-
- BarcodeMetadata getBarcodeMetadata() {
- Codeword[] codewords = getCodewords();
- BarcodeValue barcodeColumnCount = new BarcodeValue();
- BarcodeValue barcodeRowCountUpperPart = new BarcodeValue();
- BarcodeValue barcodeRowCountLowerPart = new BarcodeValue();
- BarcodeValue barcodeECLevel = new BarcodeValue();
- for (Codeword codeword : codewords) {
- if (codeword == null) {
- continue;
- }
- codeword.setRowNumberAsRowIndicatorColumn();
- int rowIndicatorValue = codeword.getValue() % 30;
- int codewordRowNumber = codeword.getRowNumber();
- if (!isLeft) {
- codewordRowNumber += 2;
- }
- switch (codewordRowNumber % 3) {
- case 0:
- barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
- break;
- case 1:
- barcodeECLevel.setValue(rowIndicatorValue / 3);
- barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
- break;
- case 2:
- barcodeColumnCount.setValue(rowIndicatorValue + 1);
- break;
- }
- }
- // Maybe we should check if we have ambiguous values?
- if ((barcodeColumnCount.getValue().length == 0) ||
- (barcodeRowCountUpperPart.getValue().length == 0) ||
- (barcodeRowCountLowerPart.getValue().length == 0) ||
- (barcodeECLevel.getValue().length == 0) ||
- barcodeColumnCount.getValue()[0] < 1 ||
- barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] <
- PDF417Common.MIN_ROWS_IN_BARCODE ||
- barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] >
- PDF417Common.MAX_ROWS_IN_BARCODE) {
- return null;
- }
- BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],
- barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
- removeIncorrectCodewords(codewords, barcodeMetadata);
- return barcodeMetadata;
- }
-
- private void removeIncorrectCodewords(Codeword[] codewords, BarcodeMetadata barcodeMetadata) {
- // Remove codewords which do not match the metadata
- // TODO Maybe we should keep the incorrect codewords for the start and end positions?
- for (int codewordRow = 0; codewordRow < codewords.length; codewordRow++) {
- Codeword codeword = codewords[codewordRow];
- if (codewords[codewordRow] == null) {
- continue;
- }
- int rowIndicatorValue = codeword.getValue() % 30;
- int codewordRowNumber = codeword.getRowNumber();
- if (codewordRowNumber > barcodeMetadata.getRowCount()) {
- codewords[codewordRow] = null;
- continue;
- }
- if (!isLeft) {
- codewordRowNumber += 2;
- }
- switch (codewordRowNumber % 3) {
- case 0:
- if (rowIndicatorValue * 3 + 1 != barcodeMetadata.getRowCountUpperPart()) {
- codewords[codewordRow] = null;
- }
- break;
- case 1:
- if (rowIndicatorValue / 3 != barcodeMetadata.getErrorCorrectionLevel() ||
- rowIndicatorValue % 3 != barcodeMetadata.getRowCountLowerPart()) {
- codewords[codewordRow] = null;
- }
- break;
- case 2:
- if (rowIndicatorValue + 1 != barcodeMetadata.getColumnCount()) {
- codewords[codewordRow] = null;
- }
- break;
- }
- }
- }
-
- boolean isLeft() {
- return isLeft;
- }
-
- @Override
- public String toString() {
- return "IsLeft: " + isLeft + '\n' + super.toString();
- }
-
-}
diff --git a/src/pdf417/decoder/barcode_metadata.rs b/src/pdf417/decoder/barcode_metadata.rs
index 4b03d9b..f718877 100644
--- a/src/pdf417/decoder/barcode_metadata.rs
+++ b/src/pdf417/decoder/barcode_metadata.rs
@@ -17,6 +17,7 @@
/**
* @author Guenther Grau
*/
+#[derive(Clone, Copy)]
pub struct BarcodeMetadata {
columnCount: u32,
errorCorrectionLevel: u32,
diff --git a/src/pdf417/decoder/detection_result.rs b/src/pdf417/decoder/detection_result.rs
new file mode 100644
index 0000000..bbef729
--- /dev/null
+++ b/src/pdf417/decoder/detection_result.rs
@@ -0,0 +1,564 @@
+/*
+ * Copyright 2013 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+use std::fmt::Display;
+
+use crate::pdf417::pdf_417_common;
+
+use super::{BarcodeMetadata, BoundingBox, Codeword, DetectionRXingResultColumn};
+
+const ADJUST_ROW_NUMBER_SKIP: u32 = 2;
+
+/**
+ * @author Guenther Grau
+ */
+pub struct DetectionRXingResult<'a> {
+ barcodeMetadata: BarcodeMetadata,
+ detectionRXingResultColumns: Vec