projects
/
zxing.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added rounding code to getRow() as well and updated the tests accordingly.
[zxing.git]
/
javase
/
src
/
com
/
google
/
zxing
/
client
/
j2se
/
BufferedImageLuminanceSource.java
diff --git
a/javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java
b/javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java
index
28b0129
..
1d44564
100644
(file)
--- a/
javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java
+++ b/
javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java
@@
-74,7
+74,8
@@
public final class BufferedImageLuminanceSource extends LuminanceSource {
int pixel = rgbData[x];
int luminance = (306 * ((pixel >> 16) & 0xFF) +
601 * ((pixel >> 8) & 0xFF) +
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;
row[x] = (byte) luminance;
}
return row;