Update DMRE versions to ISO/IEC 21471:2020 (#1369)

This commit is contained in:
gitlost 2021-03-17 23:12:40 +00:00 committed by GitHub
parent 4426711598
commit a7c3516826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 88 additions and 29 deletions

View file

@ -159,7 +159,7 @@ public final class BitMatrix implements Cloneable {
*/
public boolean get(int x, int y) {
int offset = y * rowSize + (x / 32);
return offset < bits.length && ((bits[offset] >>> (x & 0x1f)) & 1) != 0;
return ((bits[offset] >>> (x & 0x1f)) & 1) != 0;
}
/**
@ -170,16 +170,12 @@ public final class BitMatrix implements Cloneable {
*/
public void set(int x, int y) {
int offset = y * rowSize + (x / 32);
if (offset < bits.length) {
bits[offset] |= 1 << (x & 0x1f);
}
bits[offset] |= 1 << (x & 0x1f);
}
public void unset(int x, int y) {
int offset = y * rowSize + (x / 32);
if (offset < bits.length) {
bits[offset] &= ~(1 << (x & 0x1f));
}
bits[offset] &= ~(1 << (x & 0x1f));
}
/**
@ -190,9 +186,7 @@ public final class BitMatrix implements Cloneable {
*/
public void flip(int x, int y) {
int offset = y * rowSize + (x / 32);
if (offset < bits.length) {
bits[offset] ^= 1 << (x & 0x1f);
}
bits[offset] ^= 1 << (x & 0x1f);
}
/**

View file

@ -136,8 +136,7 @@ final class BitMatrixParser {
}
} while ((row < numRows) || (column < numColumns));
if (resultOffset != version.getTotalCodewords() &&
resultOffset != version.getTotalCodewords() - 1) {
if (resultOffset != version.getTotalCodewords()) {
throw FormatException.getFormatInstance();
}
return result;
@ -162,6 +161,9 @@ final class BitMatrixParser {
column += numColumns;
row += 4 - ((numColumns + 4) & 0x07);
}
if (row >= numRows) {
row -= numRows;
}
readMappingMatrix.set(column, row);
return mappingBitMatrix.get(column, row);
}

View file

@ -233,33 +233,42 @@ public final class Version {
new ECBlocks(28, new ECB(1, 49))),
// extended forms as specified in
// AIM-D - Symbology Specification Data Matrix Rectangular Extension (DMRE)
// Revision 1.0 September 22, 2014
// ISO 21471:2020 (DMRE) 5.5.1 Table 7
new Version(31, 8, 48, 6, 22,
new ECBlocks(15, new ECB(1, 18))),
new Version(32, 8, 64, 6, 14,
new ECBlocks(18, new ECB(1, 24))),
new Version(33, 12, 48, 10, 22,
new ECBlocks(23, new ECB(1, 32))),
new Version(34, 12, 64, 10, 14,
new Version(33, 8, 80, 6, 18,
new ECBlocks(22, new ECB(1, 32))),
new Version(34, 8, 96, 6, 22,
new ECBlocks(28, new ECB(1, 38))),
new Version(35, 8, 120, 6, 18,
new ECBlocks(32, new ECB(1, 49))),
new Version(36, 8, 144, 6, 22,
new ECBlocks(36, new ECB(1, 63))),
new Version(37, 12, 64, 10, 14,
new ECBlocks(27, new ECB(1, 43))),
new Version(35, 16, 64, 14, 14,
new Version(38, 12, 88, 10, 20,
new ECBlocks(36, new ECB(1, 64))),
new Version(39, 16, 64, 14, 14,
new ECBlocks(36, new ECB(1, 62))),
new Version(36, 24, 32, 22, 14,
new ECBlocks(28, new ECB(1, 49))),
new Version(37, 24, 36, 22, 16,
new ECBlocks(33, new ECB(1, 55))),
new Version(38, 24, 48, 22, 22,
new Version(40, 20, 36, 18, 16,
new ECBlocks(28, new ECB(1, 44))),
new Version(41, 20, 44, 18, 20,
new ECBlocks(34, new ECB(1, 56))),
new Version(42, 20, 64, 18, 14,
new ECBlocks(42, new ECB(1, 84))),
new Version(43, 22, 48, 20, 22,
new ECBlocks(38, new ECB(1, 72))),
new Version(44, 24, 48, 22, 22,
new ECBlocks(41, new ECB(1, 80))),
new Version(39, 24, 64, 22, 14,
new Version(45, 24, 64, 22, 14,
new ECBlocks(46, new ECB(1, 108))),
new Version(40, 26, 32, 24, 14,
new ECBlocks(32, new ECB(1, 52))),
new Version(41, 26, 40, 24, 18,
new Version(46, 26, 40, 24, 18,
new ECBlocks(38, new ECB(1, 70))),
new Version(42, 26, 48, 24, 22,
new Version(47, 26, 48, 24, 22,
new ECBlocks(42, new ECB(1, 90))),
new Version(43, 26, 64, 24, 14,
new Version(48, 26, 64, 24, 14,
new ECBlocks(50, new ECB(1, 118)))
};
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2008 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.datamatrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author gitlost
*/
public final class DataMatrixBlackBox3TestCase extends AbstractBlackBoxTestCase {
public DataMatrixBlackBox3TestCase() {
super("src/test/resources/blackbox/datamatrix-3", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
addTest(18, 18, 0.0f);
addTest(17, 17, 90.0f);
addTest(18, 18, 180.0f);
addTest(18, 18, 270.0f);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxy

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefgh

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View file

@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc