mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
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:
parent
465753afe6
commit
2dd6cb43dd
|
@ -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]) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
BIN
core/src/test/resources/blackbox/rssexpandedstacked-1/65.png
Normal file
BIN
core/src/test/resources/blackbox/rssexpandedstacked-1/65.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1 @@
|
|||
(8110))2345672(1*813
|
Loading…
Reference in a new issue