Initial commit
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,141 @@
|
||||
package com.google.zxing.maxicode.decoder;
|
||||
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodedBitStreamParser {
|
||||
private static final String[] a = {"\nABCDEFGHIJKLMNOPQRSTUVWXYZ\ufffa\u001c\u001d\u001e\ufffb \"#$%&'()*+,-./0123456789:\ufff1\ufff2\ufff3\ufff4\ufff8", "`abcdefghijklmnopqrstuvwxyz\ufffa\u001c\u001d\u001e\ufffb{}~\u007f;<=>?[\\]^_ ,./:@!|\ufff5\ufff6\ufff0\ufff2\ufff3\ufff4\ufff7", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚ\ufffa\u001c\u001d\u001eÛÜÝÞߪ¬±²³µ¹º¼½¾\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\ufff7 \ufff9\ufff3\ufff4\ufff8", "àáâãäåæçèéêëìíîïðñòóôõö÷øùú\ufffa\u001c\u001d\u001e\ufffbûüýþÿ¡¨«¯°´·¸»¿\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\ufff7 \ufff2\ufff9\ufff4\ufff8", "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\ufffa\u001b\ufffb\u001c\u001d\u001e\u001f\u009f ¢£¤¥¦§©\u00ad®¶\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\ufff7 \ufff2\ufff3\ufff9\ufff8", "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?"};
|
||||
|
||||
static DecoderResult a(byte[] bArr, int i) {
|
||||
String d;
|
||||
StringBuilder sb = new StringBuilder(144);
|
||||
if (i == 2 || i == 3) {
|
||||
if (i == 2) {
|
||||
d = new DecimalFormat("0000000000".substring(0, c(bArr))).format(b(bArr));
|
||||
} else {
|
||||
d = d(bArr);
|
||||
}
|
||||
DecimalFormat decimalFormat = new DecimalFormat("000");
|
||||
String format = decimalFormat.format(a(bArr));
|
||||
String format2 = decimalFormat.format(e(bArr));
|
||||
sb.append(a(bArr, 10, 84));
|
||||
if (sb.toString().startsWith("[)>\u001e01\u001d")) {
|
||||
sb.insert(9, d + (char) 29 + format + (char) 29 + format2 + (char) 29);
|
||||
} else {
|
||||
sb.insert(0, d + (char) 29 + format + (char) 29 + format2 + (char) 29);
|
||||
}
|
||||
} else if (i == 4) {
|
||||
sb.append(a(bArr, 1, 93));
|
||||
} else if (i == 5) {
|
||||
sb.append(a(bArr, 1, 77));
|
||||
}
|
||||
return new DecoderResult(bArr, sb.toString(), null, String.valueOf(i));
|
||||
}
|
||||
|
||||
private static int b(byte[] bArr) {
|
||||
return a(bArr, new byte[]{33, 34, 35, 36, 25, 26, 27, 28, 29, 30, 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18, 7, 8, 9, 10, 11, 12, 1, 2});
|
||||
}
|
||||
|
||||
private static int c(byte[] bArr) {
|
||||
return a(bArr, new byte[]{39, 40, 41, 42, 31, 32});
|
||||
}
|
||||
|
||||
private static String d(byte[] bArr) {
|
||||
return String.valueOf(new char[]{a[0].charAt(a(bArr, new byte[]{39, 40, 41, 42, 31, 32})), a[0].charAt(a(bArr, new byte[]{33, 34, 35, 36, 25, 26})), a[0].charAt(a(bArr, new byte[]{27, 28, 29, 30, 19, 20})), a[0].charAt(a(bArr, new byte[]{21, 22, 23, 24, 13, 14})), a[0].charAt(a(bArr, new byte[]{15, 16, 17, 18, 7, 8})), a[0].charAt(a(bArr, new byte[]{9, 10, 11, 12, 1, 2}))});
|
||||
}
|
||||
|
||||
private static int e(byte[] bArr) {
|
||||
return a(bArr, new byte[]{55, 56, 57, 58, 59, 60, 49, 50, 51, 52});
|
||||
}
|
||||
|
||||
private static int a(int i, byte[] bArr) {
|
||||
int i2 = i - 1;
|
||||
return ((1 << (5 - (i2 % 6))) & bArr[i2 / 6]) == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static int a(byte[] bArr, byte[] bArr2) {
|
||||
if (bArr2.length != 0) {
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < bArr2.length; i2++) {
|
||||
i += a(bArr2[i2], bArr) << ((bArr2.length - i2) - 1);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private static int a(byte[] bArr) {
|
||||
return a(bArr, new byte[]{53, 54, 43, 44, 45, 46, 47, 48, 37, 38});
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
private static String a(byte[] bArr, int i, int i2) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int i3 = i;
|
||||
int i4 = 0;
|
||||
int i5 = -1;
|
||||
int i6 = 0;
|
||||
while (i3 < i + i2) {
|
||||
char charAt = a[i4].charAt(bArr[i3]);
|
||||
switch (charAt) {
|
||||
case 65520:
|
||||
case 65521:
|
||||
case 65522:
|
||||
case 65523:
|
||||
case 65524:
|
||||
i6 = i4;
|
||||
i4 = charAt - 65520;
|
||||
i5 = 1;
|
||||
break;
|
||||
case 65525:
|
||||
i5 = 2;
|
||||
i6 = i4;
|
||||
i4 = 0;
|
||||
break;
|
||||
case 65526:
|
||||
i5 = 3;
|
||||
i6 = i4;
|
||||
i4 = 0;
|
||||
break;
|
||||
case 65527:
|
||||
i4 = 0;
|
||||
i5 = -1;
|
||||
break;
|
||||
case 65528:
|
||||
i4 = 1;
|
||||
i5 = -1;
|
||||
break;
|
||||
case 65529:
|
||||
i5 = -1;
|
||||
break;
|
||||
case 65530:
|
||||
default:
|
||||
sb.append(charAt);
|
||||
break;
|
||||
case 65531:
|
||||
int i7 = i3 + 1;
|
||||
int i8 = bArr[i7] << 24;
|
||||
int i9 = i7 + 1;
|
||||
int i10 = i8 + (bArr[i9] << 18);
|
||||
int i11 = i9 + 1;
|
||||
int i12 = i10 + (bArr[i11] << 12);
|
||||
int i13 = i11 + 1;
|
||||
int i14 = i12 + (bArr[i13] << 6);
|
||||
i3 = i13 + 1;
|
||||
sb.append(new DecimalFormat("000000000").format(i14 + bArr[i3]));
|
||||
break;
|
||||
}
|
||||
int i15 = i5 - 1;
|
||||
if (i5 == 0) {
|
||||
i4 = i6;
|
||||
}
|
||||
i3++;
|
||||
i5 = i15;
|
||||
}
|
||||
while (sb.length() > 0 && sb.charAt(sb.length() - 1) == 65532) {
|
||||
sb.setLength(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
59
sources/com/google/zxing/maxicode/decoder/Decoder.java
Normal file
59
sources/com/google/zxing/maxicode/decoder/Decoder.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.google.zxing.maxicode.decoder;
|
||||
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.reedsolomon.GenericGF;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonException;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Decoder {
|
||||
private final ReedSolomonDecoder a = new ReedSolomonDecoder(GenericGF.o);
|
||||
|
||||
public DecoderResult a(BitMatrix bitMatrix, Map<DecodeHintType, ?> map) throws FormatException, ChecksumException {
|
||||
byte[] bArr;
|
||||
byte[] a = new BitMatrixParser(bitMatrix).a();
|
||||
a(a, 0, 10, 10, 0);
|
||||
int i = a[0] & 15;
|
||||
if (i == 2 || i == 3 || i == 4) {
|
||||
a(a, 20, 84, 40, 1);
|
||||
a(a, 20, 84, 40, 2);
|
||||
bArr = new byte[94];
|
||||
} else {
|
||||
if (i != 5) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
a(a, 20, 68, 56, 1);
|
||||
a(a, 20, 68, 56, 2);
|
||||
bArr = new byte[78];
|
||||
}
|
||||
System.arraycopy(a, 0, bArr, 0, 10);
|
||||
System.arraycopy(a, 20, bArr, 10, bArr.length - 10);
|
||||
return DecodedBitStreamParser.a(bArr, i);
|
||||
}
|
||||
|
||||
private void a(byte[] bArr, int i, int i2, int i3, int i4) throws ChecksumException {
|
||||
int i5 = i2 + i3;
|
||||
int i6 = i4 == 0 ? 1 : 2;
|
||||
int[] iArr = new int[i5 / i6];
|
||||
for (int i7 = 0; i7 < i5; i7++) {
|
||||
if (i4 == 0 || i7 % 2 == i4 - 1) {
|
||||
iArr[i7 / i6] = bArr[i7 + i] & 255;
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.a.a(iArr, i3 / i6);
|
||||
for (int i8 = 0; i8 < i2; i8++) {
|
||||
if (i4 == 0 || i8 % 2 == i4 - 1) {
|
||||
bArr[i8 + i] = (byte) iArr[i8 / i6];
|
||||
}
|
||||
}
|
||||
} catch (ReedSolomonException unused) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user