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:
srowen 2008-03-31 19:04:38 +00:00
parent 5cfa58629c
commit 93db610970
3 changed files with 9 additions and 9 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}