Added rounding code to getRow() as well and updated the tests accordingly.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1564 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin@google.com 2010-08-26 14:06:44 +00:00
parent 0f431db54d
commit 226bf1a1a6
7 changed files with 11 additions and 10 deletions

View file

@ -27,7 +27,7 @@ public final class Code128BlackBox2TestCase extends AbstractBlackBoxTestCase {
public Code128BlackBox2TestCase() {
super("test/data/blackbox/code128-2", new MultiFormatReader(), BarcodeFormat.CODE_128);
addTest(35, 39, 0.0f);
addTest(36, 39, 0.0f);
addTest(36, 39, 180.0f);
}

View file

@ -27,8 +27,8 @@ public final class EAN13BlackBox1TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox1TestCase() {
super("test/data/blackbox/ean13-1", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(29, 31, 0.0f);
addTest(27, 31, 180.0f);
addTest(30, 32, 0.0f);
addTest(27, 32, 180.0f);
}
}

View file

@ -27,8 +27,8 @@ public final class ITFBlackBox1TestCase extends AbstractBlackBoxTestCase {
public ITFBlackBox1TestCase() {
super("test/data/blackbox/itf-1", new MultiFormatReader(), BarcodeFormat.ITF);
addTest(9, 12, 0.0f);
addTest(12, 12, 180.0f);
addTest(8, 12, 0.0f);
addTest(11, 12, 180.0f);
}
}

View file

@ -27,8 +27,8 @@ public final class UPCABlackBox1TestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox1TestCase() {
super("test/data/blackbox/upca-1", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(16, 18, 0.0f);
addTest(17, 18, 180.0f);
addTest(14, 18, 0.0f);
addTest(16, 18, 180.0f);
}
}

View file

@ -28,7 +28,7 @@ public final class UPCABlackBox3ReflectiveTestCase extends AbstractBlackBoxTestC
public UPCABlackBox3ReflectiveTestCase() {
super("test/data/blackbox/upca-3", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(7, 8, 0.0f);
addTest(7, 9, 180.0f);
addTest(8, 9, 180.0f);
}
}

View file

@ -27,7 +27,7 @@ public final class UPCABlackBox4TestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox4TestCase() {
super("test/data/blackbox/upca-4", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(8, 11, 0.0f);
addTest(9, 11, 0.0f);
addTest(9, 11, 180.0f);
}

View file

@ -74,7 +74,8 @@ public final class BufferedImageLuminanceSource extends LuminanceSource {
int pixel = rgbData[x];
int luminance = (306 * ((pixel >> 16) & 0xFF) +
601 * ((pixel >> 8) & 0xFF) +
117 * (pixel & 0xFF)) >> 10;
117 * (pixel & 0xFF) +
(0x200)) >> 10; // 0x200 = 1<<9, half an lsb of the result to force rounding
row[x] = (byte) luminance;
}
return row;