From 977c2e38cad83372584d0f68b32cb266469e18e5 Mon Sep 17 00:00:00 2001 From: srowen Date: Wed, 12 Nov 2008 13:47:45 +0000 Subject: [PATCH] Updates from sanfordsquires to fix RS decoding for Datamatrix git-svn-id: https://zxing.googlecode.com/svn/trunk@689 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../reedsolomon/ReedSolomonDecoderDataMatrixTestCase.java | 5 +++-- .../common/reedsolomon/ReedSolomonDecoderQRCodeTestCase.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderDataMatrixTestCase.java b/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderDataMatrixTestCase.java index a9bbd8cd2..98e582df6 100644 --- a/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderDataMatrixTestCase.java +++ b/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderDataMatrixTestCase.java @@ -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]); } diff --git a/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderQRCodeTestCase.java b/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderQRCodeTestCase.java index 18a5b4cb0..108dbaea0 100644 --- a/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderQRCodeTestCase.java +++ b/core/test/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoderQRCodeTestCase.java @@ -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]); }