Updates from sanfordsquires to fix RS decoding for Datamatrix

git-svn-id: https://zxing.googlecode.com/svn/trunk@689 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-11-12 13:47:45 +00:00
parent d56fb38427
commit 977c2e38ca
2 changed files with 6 additions and 4 deletions

View file

@ -26,7 +26,8 @@ public final class ReedSolomonDecoderDataMatrixTestCase extends AbstractReedSolo
private static final int[] DM_CODE_TEST = { 142, 164, 186 };
private static final int[] DM_CODE_TEST_WITH_EC = { 142, 164, 186, 114, 25, 5, 88, 102 };
private static final int DM_CODE_CORRECTABLE = (DM_CODE_TEST_WITH_EC.length - DM_CODE_TEST.length) / 2;
private static final int DM_CODE_ECC_BYTES = DM_CODE_TEST_WITH_EC.length - DM_CODE_TEST.length;
private static final int DM_CODE_CORRECTABLE = DM_CODE_ECC_BYTES / 2;
private final ReedSolomonDecoder dmRSDecoder = new ReedSolomonDecoder(GF256.DATA_MATRIX_FIELD);
@ -71,7 +72,7 @@ public final class ReedSolomonDecoderDataMatrixTestCase extends AbstractReedSolo
}
private void checkQRRSDecode(int[] received) throws ReedSolomonException {
dmRSDecoder.decode(received, 2 * DM_CODE_CORRECTABLE);
dmRSDecoder.decode(received, DM_CODE_ECC_BYTES);
for (int i = 0; i < DM_CODE_TEST.length; i++) {
assertEquals(received[i], DM_CODE_TEST[i]);
}

View file

@ -31,7 +31,8 @@ public final class ReedSolomonDecoderQRCodeTestCase extends AbstractReedSolomonT
{ 0x10, 0x20, 0x0C, 0x56, 0x61, 0x80, 0xEC, 0x11, 0xEC,
0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xA5, 0x24,
0xD4, 0xC1, 0xED, 0x36, 0xC7, 0x87, 0x2C, 0x55 };
private static final int QR_CODE_CORRECTABLE = (QR_CODE_TEST_WITH_EC.length - QR_CODE_TEST.length) / 2;
private static final int QR_CODE_ECC_BYTES = QR_CODE_TEST_WITH_EC.length - QR_CODE_TEST.length;
private static final int QR_CODE_CORRECTABLE = QR_CODE_ECC_BYTES / 2;
private final ReedSolomonDecoder qrRSDecoder = new ReedSolomonDecoder(GF256.QR_CODE_FIELD);
@ -76,7 +77,7 @@ public final class ReedSolomonDecoderQRCodeTestCase extends AbstractReedSolomonT
}
private void checkQRRSDecode(int[] received) throws ReedSolomonException {
qrRSDecoder.decode(received, 2*QR_CODE_CORRECTABLE);
qrRSDecoder.decode(received, QR_CODE_ECC_BYTES);
for (int i = 0; i < QR_CODE_TEST.length; i++) {
assertEquals(received[i], QR_CODE_TEST[i]);
}