Avoid decoding stacked row 1 of N independently (#1693)

* Avoid decoding stacked row 1 of N independently

* Avoid decoding stacked row 1 of N independently
This commit is contained in:
Daniel Gredler 2023-09-16 09:15:21 -04:00 committed by GitHub
parent 465753afe6
commit 2dd6cb43dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View file

@ -167,8 +167,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
}
}
// TODO: verify sequence of finder patterns as in checkPairSequence()
if (checkChecksum()) {
if (checkChecksum() && isValidSequence(this.pairs, true)) {
return this.pairs;
}
@ -229,7 +228,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
}
this.pairs.addAll(row.getPairs());
if (isValidSequence(this.pairs)) {
if (isValidSequence(this.pairs, false)) {
if (checkChecksum()) {
return this.pairs;
}
@ -249,10 +248,11 @@ public final class RSSExpandedReader extends AbstractRSSReader {
}
// 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);
if (sizeOk) {
boolean stop = true;
for (int j = 0; j < pairs.size(); j++) {
if (pairs.get(j).getFinderPattern().getValue() != sequence[j]) {

View file

@ -35,12 +35,11 @@ import com.google.zxing.common.AbstractBlackBoxTestCase;
* 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);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1 @@
(8110))2345672(1*813