From e779586745cbe9d1941f2a1dd3b76d1db92d20e2 Mon Sep 17 00:00:00 2001 From: dswitkin Date: Sun, 13 Dec 2009 21:36:38 +0000 Subject: [PATCH] Made a small performance tweak (about 1% faster). git-svn-id: https://zxing.googlecode.com/svn/trunk@1158 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- core/src/com/google/zxing/common/HybridBinarizer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/com/google/zxing/common/HybridBinarizer.java b/core/src/com/google/zxing/common/HybridBinarizer.java index 06eb729c3..d8681483a 100644 --- a/core/src/com/google/zxing/common/HybridBinarizer.java +++ b/core/src/com/google/zxing/common/HybridBinarizer.java @@ -95,11 +95,12 @@ public final class HybridBinarizer extends GlobalHistogramBinarizer { top = (top < subHeight - 2) ? top : subHeight - 3; int sum = 0; for (int z = -2; z <= 2; z++) { - sum += blackPoints[top + z][left - 2]; - sum += blackPoints[top + z][left - 1]; - sum += blackPoints[top + z][left]; - sum += blackPoints[top + z][left + 1]; - sum += blackPoints[top + z][left + 2]; + int[] blackRow = blackPoints[top + z]; + sum += blackRow[left - 2]; + sum += blackRow[left - 1]; + sum += blackRow[left]; + sum += blackRow[left + 1]; + sum += blackRow[left + 2]; } int average = sum / 25; threshold8x8Block(luminances, x << 3, y << 3, average, stride, matrix);