Rabbit-R1/switch port/java/sources/com/google/zxing/oned/Code128Reader.java
2024-05-21 17:08:36 -04:00

146 lines
9 KiB
Java

package com.google.zxing.oned;
import com.google.zxing.NotFoundException;
import com.google.zxing.common.BitArray;
/* loaded from: classes3.dex */
public final class Code128Reader extends OneDReader {
private static final int CODE_CODE_A = 101;
private static final int CODE_CODE_B = 100;
private static final int CODE_CODE_C = 99;
private static final int CODE_FNC_1 = 102;
private static final int CODE_FNC_2 = 97;
private static final int CODE_FNC_3 = 96;
private static final int CODE_FNC_4_A = 101;
private static final int CODE_FNC_4_B = 100;
static final int[][] CODE_PATTERNS = {new int[]{2, 1, 2, 2, 2, 2}, new int[]{2, 2, 2, 1, 2, 2}, new int[]{2, 2, 2, 2, 2, 1}, new int[]{1, 2, 1, 2, 2, 3}, new int[]{1, 2, 1, 3, 2, 2}, new int[]{1, 3, 1, 2, 2, 2}, new int[]{1, 2, 2, 2, 1, 3}, new int[]{1, 2, 2, 3, 1, 2}, new int[]{1, 3, 2, 2, 1, 2}, new int[]{2, 2, 1, 2, 1, 3}, new int[]{2, 2, 1, 3, 1, 2}, new int[]{2, 3, 1, 2, 1, 2}, new int[]{1, 1, 2, 2, 3, 2}, new int[]{1, 2, 2, 1, 3, 2}, new int[]{1, 2, 2, 2, 3, 1}, new int[]{1, 1, 3, 2, 2, 2}, new int[]{1, 2, 3, 1, 2, 2}, new int[]{1, 2, 3, 2, 2, 1}, new int[]{2, 2, 3, 2, 1, 1}, new int[]{2, 2, 1, 1, 3, 2}, new int[]{2, 2, 1, 2, 3, 1}, new int[]{2, 1, 3, 2, 1, 2}, new int[]{2, 2, 3, 1, 1, 2}, new int[]{3, 1, 2, 1, 3, 1}, new int[]{3, 1, 1, 2, 2, 2}, new int[]{3, 2, 1, 1, 2, 2}, new int[]{3, 2, 1, 2, 2, 1}, new int[]{3, 1, 2, 2, 1, 2}, new int[]{3, 2, 2, 1, 1, 2}, new int[]{3, 2, 2, 2, 1, 1}, new int[]{2, 1, 2, 1, 2, 3}, new int[]{2, 1, 2, 3, 2, 1}, new int[]{2, 3, 2, 1, 2, 1}, new int[]{1, 1, 1, 3, 2, 3}, new int[]{1, 3, 1, 1, 2, 3}, new int[]{1, 3, 1, 3, 2, 1}, new int[]{1, 1, 2, 3, 1, 3}, new int[]{1, 3, 2, 1, 1, 3}, new int[]{1, 3, 2, 3, 1, 1}, new int[]{2, 1, 1, 3, 1, 3}, new int[]{2, 3, 1, 1, 1, 3}, new int[]{2, 3, 1, 3, 1, 1}, new int[]{1, 1, 2, 1, 3, 3}, new int[]{1, 1, 2, 3, 3, 1}, new int[]{1, 3, 2, 1, 3, 1}, new int[]{1, 1, 3, 1, 2, 3}, new int[]{1, 1, 3, 3, 2, 1}, new int[]{1, 3, 3, 1, 2, 1}, new int[]{3, 1, 3, 1, 2, 1}, new int[]{2, 1, 1, 3, 3, 1}, new int[]{2, 3, 1, 1, 3, 1}, new int[]{2, 1, 3, 1, 1, 3}, new int[]{2, 1, 3, 3, 1, 1}, new int[]{2, 1, 3, 1, 3, 1}, new int[]{3, 1, 1, 1, 2, 3}, new int[]{3, 1, 1, 3, 2, 1}, new int[]{3, 3, 1, 1, 2, 1}, new int[]{3, 1, 2, 1, 1, 3}, new int[]{3, 1, 2, 3, 1, 1}, new int[]{3, 3, 2, 1, 1, 1}, new int[]{3, 1, 4, 1, 1, 1}, new int[]{2, 2, 1, 4, 1, 1}, new int[]{4, 3, 1, 1, 1, 1}, new int[]{1, 1, 1, 2, 2, 4}, new int[]{1, 1, 1, 4, 2, 2}, new int[]{1, 2, 1, 1, 2, 4}, new int[]{1, 2, 1, 4, 2, 1}, new int[]{1, 4, 1, 1, 2, 2}, new int[]{1, 4, 1, 2, 2, 1}, new int[]{1, 1, 2, 2, 1, 4}, new int[]{1, 1, 2, 4, 1, 2}, new int[]{1, 2, 2, 1, 1, 4}, new int[]{1, 2, 2, 4, 1, 1}, new int[]{1, 4, 2, 1, 1, 2}, new int[]{1, 4, 2, 2, 1, 1}, new int[]{2, 4, 1, 2, 1, 1}, new int[]{2, 2, 1, 1, 1, 4}, new int[]{4, 1, 3, 1, 1, 1}, new int[]{2, 4, 1, 1, 1, 2}, new int[]{1, 3, 4, 1, 1, 1}, new int[]{1, 1, 1, 2, 4, 2}, new int[]{1, 2, 1, 1, 4, 2}, new int[]{1, 2, 1, 2, 4, 1}, new int[]{1, 1, 4, 2, 1, 2}, new int[]{1, 2, 4, 1, 1, 2}, new int[]{1, 2, 4, 2, 1, 1}, new int[]{4, 1, 1, 2, 1, 2}, new int[]{4, 2, 1, 1, 1, 2}, new int[]{4, 2, 1, 2, 1, 1}, new int[]{2, 1, 2, 1, 4, 1}, new int[]{2, 1, 4, 1, 2, 1}, new int[]{4, 1, 2, 1, 2, 1}, new int[]{1, 1, 1, 1, 4, 3}, new int[]{1, 1, 1, 3, 4, 1}, new int[]{1, 3, 1, 1, 4, 1}, new int[]{1, 1, 4, 1, 1, 3}, new int[]{1, 1, 4, 3, 1, 1}, new int[]{4, 1, 1, 1, 1, 3}, new int[]{4, 1, 1, 3, 1, 1}, new int[]{1, 1, 3, 1, 4, 1}, new int[]{1, 1, 4, 1, 3, 1}, new int[]{3, 1, 1, 1, 4, 1}, new int[]{4, 1, 1, 1, 3, 1}, new int[]{2, 1, 1, 4, 1, 2}, new int[]{2, 1, 1, 2, 1, 4}, new int[]{2, 1, 1, 2, 3, 2}, new int[]{2, 3, 3, 1, 1, 1, 2}};
private static final int CODE_SHIFT = 98;
private static final int CODE_START_A = 103;
private static final int CODE_START_B = 104;
private static final int CODE_START_C = 105;
private static final int CODE_STOP = 106;
private static final float MAX_AVG_VARIANCE = 0.25f;
private static final float MAX_INDIVIDUAL_VARIANCE = 0.7f;
private static int[] findStartPattern(BitArray bitArray) throws NotFoundException {
int size = bitArray.getSize();
int nextSet = bitArray.getNextSet(0);
int[] iArr = new int[6];
boolean z = false;
int i = 0;
int i2 = nextSet;
while (nextSet < size) {
if (bitArray.get(nextSet) != z) {
iArr[i] = iArr[i] + 1;
} else {
if (i == 5) {
int i3 = -1;
float f = MAX_AVG_VARIANCE;
for (int i4 = CODE_START_A; i4 <= CODE_START_C; i4++) {
float patternMatchVariance = patternMatchVariance(iArr, CODE_PATTERNS[i4], 0.7f);
if (patternMatchVariance < f) {
i3 = i4;
f = patternMatchVariance;
}
}
if (i3 >= 0 && bitArray.isRange(Math.max(0, i2 - ((nextSet - i2) / 2)), i2, false)) {
return new int[]{i2, nextSet, i3};
}
i2 += iArr[0] + iArr[1];
int i5 = i - 1;
System.arraycopy(iArr, 2, iArr, 0, i5);
iArr[i5] = 0;
iArr[i] = 0;
i--;
} else {
i++;
}
iArr[i] = 1;
z = !z;
}
nextSet++;
}
throw NotFoundException.getNotFoundInstance();
}
private static int decodeCode(BitArray bitArray, int[] iArr, int i) throws NotFoundException {
recordPattern(bitArray, i, iArr);
float f = MAX_AVG_VARIANCE;
int i2 = -1;
int i3 = 0;
while (true) {
int[][] iArr2 = CODE_PATTERNS;
if (i3 >= iArr2.length) {
break;
}
float patternMatchVariance = patternMatchVariance(iArr, iArr2[i3], 0.7f);
if (patternMatchVariance < f) {
i2 = i3;
f = patternMatchVariance;
}
i3++;
}
if (i2 >= 0) {
return i2;
}
throw NotFoundException.getNotFoundInstance();
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Code restructure failed: missing block: B:62:0x00df, code lost:
if (r12 != false) goto L82;
*/
/* JADX WARN: Code restructure failed: missing block: B:63:0x0134, code lost:
r11 = r8;
r10 = 'd';
r12 = false;
r14 = false;
*/
/* JADX WARN: Code restructure failed: missing block: B:91:0x0132, code lost:
if (r12 != false) goto L82;
*/
/* JADX WARN: Failed to find 'out' block for switch in B:103:0x016b. Please report as an issue. */
/* JADX WARN: Failed to find 'out' block for switch in B:25:0x0085. Please report as an issue. */
/* JADX WARN: Failed to find 'out' block for switch in B:52:0x00bf. Please report as an issue. */
/* JADX WARN: Failed to find 'out' block for switch in B:79:0x010c. Please report as an issue. */
/* JADX WARN: Removed duplicated region for block: B:68:0x0141 A[PHI: r8
0x0141: PHI (r8v14 boolean) = (r8v10 boolean), (r8v19 boolean) binds: [B:79:0x010c, B:52:0x00bf] A[DONT_GENERATE, DONT_INLINE]] */
/* JADX WARN: Removed duplicated region for block: B:69:0x014f A[PHI: r6 r8
0x014f: PHI (r6v10 boolean) =
(r6v2 boolean)
(r6v2 boolean)
(r6v2 boolean)
(r6v2 boolean)
(r6v9 boolean)
(r6v2 boolean)
(r6v2 boolean)
(r6v2 boolean)
(r6v2 boolean)
binds: [B:79:0x010c, B:80:0x0110, B:84:0x011c, B:83:0x0118, B:70:0x014e, B:52:0x00bf, B:53:0x00c4, B:57:0x00d1, B:56:0x00cc] A[DONT_GENERATE, DONT_INLINE]
0x014f: PHI (r8v13 boolean) =
(r8v10 boolean)
(r8v10 boolean)
(r8v10 boolean)
(r8v10 boolean)
(r8v12 boolean)
(r8v19 boolean)
(r8v19 boolean)
(r8v19 boolean)
(r8v19 boolean)
binds: [B:79:0x010c, B:80:0x0110, B:84:0x011c, B:83:0x0118, B:70:0x014e, B:52:0x00bf, B:53:0x00c4, B:57:0x00d1, B:56:0x00cc] A[DONT_GENERATE, DONT_INLINE]] */
@Override // com.google.zxing.oned.OneDReader
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public com.google.zxing.Result decodeRow(int r24, com.google.zxing.common.BitArray r25, java.util.Map<com.google.zxing.DecodeHintType, ?> r26) throws com.google.zxing.NotFoundException, com.google.zxing.FormatException, com.google.zxing.ChecksumException {
/*
Method dump skipped, instructions count: 656
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.oned.Code128Reader.decodeRow(int, com.google.zxing.common.BitArray, java.util.Map):com.google.zxing.Result");
}
}