"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/oned/rss/RSS14Reader.java" between
zxing-zxing-3.4.0.tar.gz and zxing-zxing-3.4.1.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

RSS14Reader.java  (zxing-zxing-3.4.0):RSS14Reader.java  (zxing-zxing-3.4.1)
skipping to change at line 28 skipping to change at line 28
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType; import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException; import com.google.zxing.NotFoundException;
import com.google.zxing.Result; import com.google.zxing.Result;
import com.google.zxing.ResultPoint; import com.google.zxing.ResultPoint;
import com.google.zxing.ResultPointCallback; import com.google.zxing.ResultPointCallback;
import com.google.zxing.common.BitArray; import com.google.zxing.common.BitArray;
import com.google.zxing.common.detector.MathUtils; import com.google.zxing.common.detector.MathUtils;
import java.util.Arrays;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Decodes RSS-14, including truncated and stacked variants. See ISO/IEC 24724:2 006. * Decodes RSS-14, including truncated and stacked variants. See ISO/IEC 24724:2 006.
*/ */
public final class RSS14Reader extends AbstractRSSReader { public final class RSS14Reader extends AbstractRSSReader {
skipping to change at line 167 skipping to change at line 168
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<Decode HintType,?> hints) { private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<Decode HintType,?> hints) {
try { try {
int[] startEnd = findFinderPattern(row, right); int[] startEnd = findFinderPattern(row, right);
FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, sta rtEnd); FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, sta rtEnd);
ResultPointCallback resultPointCallback = hints == null ? null : ResultPointCallback resultPointCallback = hints == null ? null :
(ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBAC K); (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBAC K);
if (resultPointCallback != null) { if (resultPointCallback != null) {
float center = (startEnd[0] + startEnd[1]) / 2.0f; startEnd = pattern.getStartEnd();
float center = (startEnd[0] + startEnd[1] - 1) / 2.0f;
if (right) { if (right) {
// row is actually reversed // row is actually reversed
center = row.getSize() - 1 - center; center = row.getSize() - 1 - center;
} }
resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, row Number)); resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, row Number));
} }
DataCharacter outside = decodeDataCharacter(row, pattern, true); DataCharacter outside = decodeDataCharacter(row, pattern, true);
DataCharacter inside = decodeDataCharacter(row, pattern, false); DataCharacter inside = decodeDataCharacter(row, pattern, false);
return new Pair(1597 * outside.getValue() + inside.getValue(), return new Pair(1597 * outside.getValue() + inside.getValue(),
skipping to change at line 189 skipping to change at line 191
pattern); pattern);
} catch (NotFoundException ignored) { } catch (NotFoundException ignored) {
return null; return null;
} }
} }
private DataCharacter decodeDataCharacter(BitArray row, FinderPattern pattern, boolean outsideChar) private DataCharacter decodeDataCharacter(BitArray row, FinderPattern pattern, boolean outsideChar)
throws NotFoundException { throws NotFoundException {
int[] counters = getDataCharacterCounters(); int[] counters = getDataCharacterCounters();
for (int x = 0; x < counters.length; x++) { Arrays.fill(counters, 0);
counters[x] = 0;
}
if (outsideChar) { if (outsideChar) {
recordPatternInReverse(row, pattern.getStartEnd()[0], counters); recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
} else { } else {
recordPattern(row, pattern.getStartEnd()[1] + 1, counters); recordPattern(row, pattern.getStartEnd()[1], counters);
// reverse it // reverse it
for (int i = 0, j = counters.length - 1; i < j; i++, j--) { for (int i = 0, j = counters.length - 1; i < j; i++, j--) {
int temp = counters[i]; int temp = counters[i];
counters[i] = counters[j]; counters[i] = counters[j];
counters[j] = temp; counters[j] = temp;
} }
} }
int numModules = outsideChar ? 16 : 15; int numModules = outsideChar ? 16 : 15;
float elementWidth = MathUtils.sum(counters) / (float) numModules; float elementWidth = MathUtils.sum(counters) / (float) numModules;
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)