Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid decoding stacked row 1 of N independently #1693

Merged
merged 2 commits into from Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -167,8 +167,7 @@ List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundE
}
}

// TODO: verify sequence of finder patterns as in checkPairSequence()
if (checkChecksum()) {
if (checkChecksum() && isValidSequence(this.pairs, true)) {
return this.pairs;
}

Expand Down Expand Up @@ -229,7 +228,7 @@ private List<ExpandedPair> checkRows(List<ExpandedRow> collectedRows, int curren
}
this.pairs.addAll(row.getPairs());

if (isValidSequence(this.pairs)) {
if (isValidSequence(this.pairs, false)) {
if (checkChecksum()) {
return this.pairs;
}
Expand All @@ -249,10 +248,11 @@ private List<ExpandedPair> checkRows(List<ExpandedRow> collectedRows, int curren
}

// Whether the pairs form a valid finder pattern sequence, either complete or a prefix
private static boolean isValidSequence(List<ExpandedPair> pairs) {
private static boolean isValidSequence(List<ExpandedPair> pairs, boolean complete) {

for (int[] sequence : FINDER_PATTERN_SEQUENCES) {
if (pairs.size() <= sequence.length) {
boolean sizeOk = (complete ? pairs.size() == sequence.length : pairs.size() <= sequence.length);
gredler marked this conversation as resolved.
Show resolved Hide resolved
if (sizeOk) {
boolean stop = true;
for (int j = 0; j < pairs.size(); j++) {
if (pairs.get(j).getFinderPattern().getValue() != sequence[j]) {
Expand Down
Expand Up @@ -35,12 +35,11 @@
* stacked RSS barcodes.
*/
public final class RSSExpandedStackedBlackBox1TestCase extends AbstractBlackBoxTestCase {

public RSSExpandedStackedBlackBox1TestCase() {
super("src/test/resources/blackbox/rssexpandedstacked-1", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(59, 64, 0.0f);
addTest(59, 64, 180.0f);
addTest(60, 65, 0.0f);
addTest(60, 65, 180.0f);
}

}

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1 @@
(8110))2345672(1*813