mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Issue 675 commit Lachezars great fix for large DM decoding
git-svn-id: https://zxing.googlecode.com/svn/trunk@1699 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
2cd75045fd
commit
e6d969b6f4
1
AUTHORS
1
AUTHORS
|
@ -33,6 +33,7 @@ Juho Mikkonen
|
|||
jwicks
|
||||
Kevin O'Sullivan (SITA)
|
||||
Kevin Xue (NetDragon Websoft Inc., China)
|
||||
Lachezar Dobrev
|
||||
Luiz Silva
|
||||
Luka Finžgar
|
||||
Marcelo
|
||||
|
|
|
@ -80,22 +80,24 @@ public final class Decoder {
|
|||
// Separate into data blocks
|
||||
DataBlock[] dataBlocks = DataBlock.getDataBlocks(codewords, version);
|
||||
|
||||
int dataBlocksCount = dataBlocks.length;
|
||||
|
||||
// Count total number of data bytes
|
||||
int totalBytes = 0;
|
||||
for (int i = 0; i < dataBlocks.length; i++) {
|
||||
for (int i = 0; i < dataBlocksCount; i++) {
|
||||
totalBytes += dataBlocks[i].getNumDataCodewords();
|
||||
}
|
||||
byte[] resultBytes = new byte[totalBytes];
|
||||
int resultOffset = 0;
|
||||
|
||||
// Error-correct and copy data blocks together into a stream of bytes
|
||||
for (int j = 0; j < dataBlocks.length; j++) {
|
||||
for (int j = 0; j < dataBlocksCount; j++) {
|
||||
DataBlock dataBlock = dataBlocks[j];
|
||||
byte[] codewordBytes = dataBlock.getCodewords();
|
||||
int numDataCodewords = dataBlock.getNumDataCodewords();
|
||||
correctErrors(codewordBytes, numDataCodewords);
|
||||
for (int i = 0; i < numDataCodewords; i++) {
|
||||
resultBytes[resultOffset++] = codewordBytes[i];
|
||||
// De-interlace data blocks.
|
||||
resultBytes[i * dataBlocksCount + j] = codewordBytes[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 801 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -17,6 +17,7 @@
|
|||
package com.google.zxing.datamatrix;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.common.AbstractBlackBoxTestCase;
|
||||
|
||||
/**
|
||||
|
@ -25,12 +26,11 @@ import com.google.zxing.common.AbstractBlackBoxTestCase;
|
|||
public final class DataMatrixBlackBox1TestCase extends AbstractBlackBoxTestCase {
|
||||
|
||||
public DataMatrixBlackBox1TestCase() {
|
||||
// TODO use MultiFormatReader here once Data Matrix decoder is done
|
||||
super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX);
|
||||
addTest(13, 13, 0.0f);
|
||||
addTest(13, 13, 90.0f);
|
||||
addTest(13, 13, 180.0f);
|
||||
addTest(13, 13, 270.0f);
|
||||
super("test/data/blackbox/datamatrix-1", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
|
||||
addTest(16, 16, 0.0f);
|
||||
addTest(16, 16, 90.0f);
|
||||
addTest(16, 16, 180.0f);
|
||||
addTest(16, 16, 270.0f);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,6 +17,7 @@
|
|||
package com.google.zxing.datamatrix;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.common.AbstractBlackBoxTestCase;
|
||||
|
||||
/**
|
||||
|
@ -25,8 +26,7 @@ import com.google.zxing.common.AbstractBlackBoxTestCase;
|
|||
public final class DataMatrixBlackBox2TestCase extends AbstractBlackBoxTestCase {
|
||||
|
||||
public DataMatrixBlackBox2TestCase() {
|
||||
// TODO use MultiFormatReader here once Data Matrix decoder is done
|
||||
super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX);
|
||||
super("test/data/blackbox/datamatrix-2", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
|
||||
addTest(10, 10, 0.0f);
|
||||
addTest(13, 13, 90.0f);
|
||||
addTest(16, 16, 180.0f);
|
||||
|
|
Loading…
Reference in a new issue