mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Made the RGB to luminance approximation/optimization a little faster -- one less shift
git-svn-id: https://zxing.googlecode.com/svn/trunk@327 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
5cfa58629c
commit
93db610970
|
@ -140,9 +140,9 @@ final class RGBMonochromeBitmapSource implements MonochromeBitmapSource {
|
|||
// corrupts the conversion. Not significant for our purposes.
|
||||
//
|
||||
// But we can get even cleverer and eliminate a few shifts:
|
||||
return (((pixel & 0x00FF0000) >> 8) +
|
||||
((pixel & 0x0000FF00) << 1) +
|
||||
((pixel & 0x000000FF) << 8)) >> 10;
|
||||
return (((pixel & 0x00FF0000) >> 16) +
|
||||
((pixel & 0x0000FF00) >> 7) +
|
||||
( pixel & 0x000000FF )) >> 2;
|
||||
}
|
||||
|
||||
}
|
|
@ -140,9 +140,9 @@ final class RGBMonochromeBitmapSource implements MonochromeBitmapSource {
|
|||
// corrupts the conversion. Not significant for our purposes.
|
||||
//
|
||||
// But we can get even cleverer and eliminate a few shifts:
|
||||
return (((pixel & 0x00FF0000) >> 8) +
|
||||
((pixel & 0x0000FF00) << 1) +
|
||||
((pixel & 0x000000FF) << 8)) >> 10;
|
||||
return (((pixel & 0x00FF0000) >> 16) +
|
||||
((pixel & 0x0000FF00) >> 7) +
|
||||
( pixel & 0x000000FF )) >> 2;
|
||||
}
|
||||
|
||||
}
|
|
@ -134,9 +134,9 @@ public final class LCDUIImageMonochromeBitmapSource implements MonochromeBitmapS
|
|||
// corrupts the conversion. Not significant for our purposes.
|
||||
//
|
||||
// But we can get even cleverer and eliminate a few shifts:
|
||||
return (((pixel & 0x00FF0000) >> 8) +
|
||||
((pixel & 0x0000FF00) << 1) +
|
||||
((pixel & 0x000000FF) << 8)) >> 10;
|
||||
return (((pixel & 0x00FF0000) >> 16) +
|
||||
((pixel & 0x0000FF00) >> 7) +
|
||||
( pixel & 0x000000FF )) >> 2;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue