mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Remove obsolete unrolled loops
This commit is contained in:
parent
3ae6b336e1
commit
a3018f8768
|
@ -248,11 +248,7 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
|
|||
int[] stateCount = new int[5];
|
||||
for (int i = iSkip - 1; i < maxI; i += iSkip) {
|
||||
// Get a row of black/white values
|
||||
stateCount[0] = 0;
|
||||
stateCount[1] = 0;
|
||||
stateCount[2] = 0;
|
||||
stateCount[3] = 0;
|
||||
stateCount[4] = 0;
|
||||
clearCounts(stateCount);
|
||||
int currentState = 0;
|
||||
for (int j = 0; j < maxJ; j++) {
|
||||
if (image.get(j, i)) {
|
||||
|
@ -267,17 +263,9 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
|
|||
if (foundPatternCross(stateCount) && handlePossibleCenter(stateCount, i, j)) { // Yes
|
||||
// Clear state to start looking again
|
||||
currentState = 0;
|
||||
stateCount[0] = 0;
|
||||
stateCount[1] = 0;
|
||||
stateCount[2] = 0;
|
||||
stateCount[3] = 0;
|
||||
stateCount[4] = 0;
|
||||
clearCounts(stateCount);
|
||||
} else { // No, shift counts back by two
|
||||
stateCount[0] = stateCount[2];
|
||||
stateCount[1] = stateCount[3];
|
||||
stateCount[2] = stateCount[4];
|
||||
stateCount[3] = 1;
|
||||
stateCount[4] = 0;
|
||||
shiftCounts2(stateCount);
|
||||
currentState = 3;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -186,14 +186,9 @@ public final class RSS14Reader extends AbstractRSSReader {
|
|||
throws NotFoundException {
|
||||
|
||||
int[] counters = getDataCharacterCounters();
|
||||
counters[0] = 0;
|
||||
counters[1] = 0;
|
||||
counters[2] = 0;
|
||||
counters[3] = 0;
|
||||
counters[4] = 0;
|
||||
counters[5] = 0;
|
||||
counters[6] = 0;
|
||||
counters[7] = 0;
|
||||
for (int x = 0; x < counters.length; x++) {
|
||||
counters[x] = 0;
|
||||
}
|
||||
|
||||
if (outsideChar) {
|
||||
recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
|
||||
|
|
|
@ -582,14 +582,9 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
|||
boolean isOddPattern,
|
||||
boolean leftChar) throws NotFoundException {
|
||||
int[] counters = this.getDataCharacterCounters();
|
||||
counters[0] = 0;
|
||||
counters[1] = 0;
|
||||
counters[2] = 0;
|
||||
counters[3] = 0;
|
||||
counters[4] = 0;
|
||||
counters[5] = 0;
|
||||
counters[6] = 0;
|
||||
counters[7] = 0;
|
||||
for (int x = 0; x < counters.length; x++) {
|
||||
counters[x] = 0;
|
||||
}
|
||||
|
||||
if (leftChar) {
|
||||
recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
|
||||
|
|
|
@ -93,11 +93,7 @@ public class FinderPatternFinder {
|
|||
int[] stateCount = new int[5];
|
||||
for (int i = iSkip - 1; i < maxI && !done; i += iSkip) {
|
||||
// Get a row of black/white values
|
||||
stateCount[0] = 0;
|
||||
stateCount[1] = 0;
|
||||
stateCount[2] = 0;
|
||||
stateCount[3] = 0;
|
||||
stateCount[4] = 0;
|
||||
clearCounts(stateCount);
|
||||
int currentState = 0;
|
||||
for (int j = 0; j < maxJ; j++) {
|
||||
if (image.get(j, i)) {
|
||||
|
@ -133,27 +129,15 @@ public class FinderPatternFinder {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
stateCount[0] = stateCount[2];
|
||||
stateCount[1] = stateCount[3];
|
||||
stateCount[2] = stateCount[4];
|
||||
stateCount[3] = 1;
|
||||
stateCount[4] = 0;
|
||||
shiftCounts2(stateCount);
|
||||
currentState = 3;
|
||||
continue;
|
||||
}
|
||||
// Clear state to start looking again
|
||||
currentState = 0;
|
||||
stateCount[0] = 0;
|
||||
stateCount[1] = 0;
|
||||
stateCount[2] = 0;
|
||||
stateCount[3] = 0;
|
||||
stateCount[4] = 0;
|
||||
clearCounts(stateCount);
|
||||
} else { // No, shift counts back by two
|
||||
stateCount[0] = stateCount[2];
|
||||
stateCount[1] = stateCount[3];
|
||||
stateCount[2] = stateCount[4];
|
||||
stateCount[3] = 1;
|
||||
stateCount[4] = 0;
|
||||
shiftCounts2(stateCount);
|
||||
currentState = 3;
|
||||
}
|
||||
} else {
|
||||
|
@ -247,14 +231,24 @@ public class FinderPatternFinder {
|
|||
}
|
||||
|
||||
private int[] getCrossCheckStateCount() {
|
||||
crossCheckStateCount[0] = 0;
|
||||
crossCheckStateCount[1] = 0;
|
||||
crossCheckStateCount[2] = 0;
|
||||
crossCheckStateCount[3] = 0;
|
||||
crossCheckStateCount[4] = 0;
|
||||
clearCounts(crossCheckStateCount);
|
||||
return crossCheckStateCount;
|
||||
}
|
||||
|
||||
protected final void clearCounts(int[] counts) {
|
||||
for (int x = 0; x < counts.length; x++) {
|
||||
counts[x] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected final void shiftCounts2(int[] stateCount) {
|
||||
stateCount[0] = stateCount[2];
|
||||
stateCount[1] = stateCount[3];
|
||||
stateCount[2] = stateCount[4];
|
||||
stateCount[3] = 1;
|
||||
stateCount[4] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* After a vertical and horizontal scan finds a potential finder pattern, this method
|
||||
* "cross-cross-cross-checks" by scanning down diagonally through the center of the possible
|
||||
|
|
Loading…
Reference in a new issue