376 lines
14 KiB
Java
376 lines
14 KiB
Java
package com.google.zxing.pdf417.decoder;
|
|
|
|
import com.baidu.cloud.media.player.IMediaPlayer;
|
|
import com.google.zxing.FormatException;
|
|
import com.google.zxing.pdf417.PDF417ResultMetadata;
|
|
import java.math.BigInteger;
|
|
import java.util.Arrays;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class DecodedBitStreamParser {
|
|
private static final char[] a = ";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'".toCharArray();
|
|
private static final char[] b = "0123456789&\r\t,:#-.$/+%*=^".toCharArray();
|
|
private static final BigInteger[] c;
|
|
|
|
/* renamed from: com.google.zxing.pdf417.decoder.DecodedBitStreamParser$1, reason: invalid class name */
|
|
static /* synthetic */ class AnonymousClass1 {
|
|
static final /* synthetic */ int[] a = new int[Mode.values().length];
|
|
|
|
static {
|
|
try {
|
|
a[Mode.ALPHA.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
a[Mode.LOWER.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
a[Mode.MIXED.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
try {
|
|
a[Mode.PUNCT.ordinal()] = 4;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
try {
|
|
a[Mode.ALPHA_SHIFT.ordinal()] = 5;
|
|
} catch (NoSuchFieldError unused5) {
|
|
}
|
|
try {
|
|
a[Mode.PUNCT_SHIFT.ordinal()] = 6;
|
|
} catch (NoSuchFieldError unused6) {
|
|
}
|
|
}
|
|
}
|
|
|
|
private enum Mode {
|
|
ALPHA,
|
|
LOWER,
|
|
MIXED,
|
|
PUNCT,
|
|
ALPHA_SHIFT,
|
|
PUNCT_SHIFT
|
|
}
|
|
|
|
static {
|
|
BigInteger[] bigIntegerArr = new BigInteger[16];
|
|
c = bigIntegerArr;
|
|
bigIntegerArr[0] = BigInteger.ONE;
|
|
BigInteger valueOf = BigInteger.valueOf(900L);
|
|
c[1] = valueOf;
|
|
int i = 2;
|
|
while (true) {
|
|
BigInteger[] bigIntegerArr2 = c;
|
|
if (i >= bigIntegerArr2.length) {
|
|
return;
|
|
}
|
|
bigIntegerArr2[i] = bigIntegerArr2[i - 1].multiply(valueOf);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
/* JADX WARN: Removed duplicated region for block: B:24:0x004e */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
static com.google.zxing.common.DecoderResult a(int[] r6, java.lang.String r7) throws com.google.zxing.FormatException {
|
|
/*
|
|
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
|
int r1 = r6.length
|
|
r2 = 1
|
|
int r1 = r1 << r2
|
|
r0.<init>(r1)
|
|
java.nio.charset.Charset r1 = java.nio.charset.StandardCharsets.ISO_8859_1
|
|
r2 = r6[r2]
|
|
com.google.zxing.pdf417.PDF417ResultMetadata r3 = new com.google.zxing.pdf417.PDF417ResultMetadata
|
|
r3.<init>()
|
|
r4 = 2
|
|
L12:
|
|
r5 = 0
|
|
r5 = r6[r5]
|
|
if (r4 >= r5) goto L6d
|
|
r5 = 913(0x391, float:1.28E-42)
|
|
if (r2 == r5) goto L58
|
|
switch(r2) {
|
|
case 900: goto L53;
|
|
case 901: goto L4e;
|
|
case 902: goto L49;
|
|
default: goto L1e;
|
|
}
|
|
L1e:
|
|
switch(r2) {
|
|
case 922: goto L44;
|
|
case 923: goto L44;
|
|
case 924: goto L4e;
|
|
case 925: goto L41;
|
|
case 926: goto L3e;
|
|
case 927: goto L2d;
|
|
case 928: goto L28;
|
|
default: goto L21;
|
|
}
|
|
L21:
|
|
int r4 = r4 + (-1)
|
|
int r2 = b(r6, r4, r0)
|
|
goto L60
|
|
L28:
|
|
int r2 = a(r6, r4, r3)
|
|
goto L60
|
|
L2d:
|
|
int r2 = r4 + 1
|
|
r1 = r6[r4]
|
|
com.google.zxing.common.CharacterSetECI r1 = com.google.zxing.common.CharacterSetECI.getCharacterSetECIByValue(r1)
|
|
java.lang.String r1 = r1.name()
|
|
java.nio.charset.Charset r1 = java.nio.charset.Charset.forName(r1)
|
|
goto L60
|
|
L3e:
|
|
int r2 = r4 + 2
|
|
goto L60
|
|
L41:
|
|
int r2 = r4 + 1
|
|
goto L60
|
|
L44:
|
|
com.google.zxing.FormatException r6 = com.google.zxing.FormatException.getFormatInstance()
|
|
throw r6
|
|
L49:
|
|
int r2 = a(r6, r4, r0)
|
|
goto L60
|
|
L4e:
|
|
int r2 = a(r2, r6, r1, r4, r0)
|
|
goto L60
|
|
L53:
|
|
int r2 = b(r6, r4, r0)
|
|
goto L60
|
|
L58:
|
|
int r2 = r4 + 1
|
|
r4 = r6[r4]
|
|
char r4 = (char) r4
|
|
r0.append(r4)
|
|
L60:
|
|
int r4 = r6.length
|
|
if (r2 >= r4) goto L68
|
|
int r4 = r2 + 1
|
|
r2 = r6[r2]
|
|
goto L12
|
|
L68:
|
|
com.google.zxing.FormatException r6 = com.google.zxing.FormatException.getFormatInstance()
|
|
throw r6
|
|
L6d:
|
|
int r6 = r0.length()
|
|
if (r6 == 0) goto L81
|
|
com.google.zxing.common.DecoderResult r6 = new com.google.zxing.common.DecoderResult
|
|
java.lang.String r0 = r0.toString()
|
|
r1 = 0
|
|
r6.<init>(r1, r0, r1, r7)
|
|
r6.a(r3)
|
|
return r6
|
|
L81:
|
|
com.google.zxing.FormatException r6 = com.google.zxing.FormatException.getFormatInstance()
|
|
throw r6
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.decoder.DecodedBitStreamParser.a(int[], java.lang.String):com.google.zxing.common.DecoderResult");
|
|
}
|
|
|
|
/* JADX WARN: Failed to find 'out' block for switch in B:16:0x0034. Please report as an issue. */
|
|
/* JADX WARN: Failed to find 'out' block for switch in B:17:0x0037. Please report as an issue. */
|
|
private static int b(int[] iArr, int i, StringBuilder sb) {
|
|
int[] iArr2 = new int[(iArr[0] - i) << 1];
|
|
int[] iArr3 = new int[(iArr[0] - i) << 1];
|
|
boolean z = false;
|
|
int i2 = 0;
|
|
while (i < iArr[0] && !z) {
|
|
int i3 = i + 1;
|
|
int i4 = iArr[i];
|
|
if (i4 < 900) {
|
|
iArr2[i2] = i4 / 30;
|
|
iArr2[i2 + 1] = i4 % 30;
|
|
i2 += 2;
|
|
} else if (i4 != 913) {
|
|
if (i4 != 928) {
|
|
switch (i4) {
|
|
case IMediaPlayer.MEDIA_INFO_TIMED_TEXT_ERROR /* 900 */:
|
|
iArr2[i2] = 900;
|
|
i2++;
|
|
break;
|
|
case IMediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE /* 901 */:
|
|
case IMediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT /* 902 */:
|
|
break;
|
|
default:
|
|
switch (i4) {
|
|
}
|
|
}
|
|
}
|
|
i = i3 - 1;
|
|
z = true;
|
|
} else {
|
|
iArr2[i2] = 913;
|
|
i = i3 + 1;
|
|
iArr3[i2] = iArr[i3];
|
|
i2++;
|
|
}
|
|
i = i3;
|
|
}
|
|
a(iArr2, iArr3, i2, sb);
|
|
return i;
|
|
}
|
|
|
|
static int a(int[] iArr, int i, PDF417ResultMetadata pDF417ResultMetadata) throws FormatException {
|
|
if (i + 2 <= iArr[0]) {
|
|
int[] iArr2 = new int[2];
|
|
int i2 = i;
|
|
int i3 = 0;
|
|
while (i3 < 2) {
|
|
iArr2[i3] = iArr[i2];
|
|
i3++;
|
|
i2++;
|
|
}
|
|
pDF417ResultMetadata.c(Integer.parseInt(a(iArr2, 2)));
|
|
StringBuilder sb = new StringBuilder();
|
|
int b2 = b(iArr, i2, sb);
|
|
pDF417ResultMetadata.b(sb.toString());
|
|
int i4 = iArr[b2] == 923 ? b2 + 1 : -1;
|
|
while (b2 < iArr[0]) {
|
|
int i5 = iArr[b2];
|
|
if (i5 == 922) {
|
|
b2++;
|
|
pDF417ResultMetadata.a(true);
|
|
} else if (i5 == 923) {
|
|
int i6 = b2 + 1;
|
|
switch (iArr[i6]) {
|
|
case 0:
|
|
StringBuilder sb2 = new StringBuilder();
|
|
b2 = b(iArr, i6 + 1, sb2);
|
|
pDF417ResultMetadata.c(sb2.toString());
|
|
break;
|
|
case 1:
|
|
StringBuilder sb3 = new StringBuilder();
|
|
b2 = a(iArr, i6 + 1, sb3);
|
|
pDF417ResultMetadata.b(Integer.parseInt(sb3.toString()));
|
|
break;
|
|
case 2:
|
|
StringBuilder sb4 = new StringBuilder();
|
|
b2 = a(iArr, i6 + 1, sb4);
|
|
pDF417ResultMetadata.b(Long.parseLong(sb4.toString()));
|
|
break;
|
|
case 3:
|
|
StringBuilder sb5 = new StringBuilder();
|
|
b2 = b(iArr, i6 + 1, sb5);
|
|
pDF417ResultMetadata.d(sb5.toString());
|
|
break;
|
|
case 4:
|
|
StringBuilder sb6 = new StringBuilder();
|
|
b2 = b(iArr, i6 + 1, sb6);
|
|
pDF417ResultMetadata.a(sb6.toString());
|
|
break;
|
|
case 5:
|
|
StringBuilder sb7 = new StringBuilder();
|
|
b2 = a(iArr, i6 + 1, sb7);
|
|
pDF417ResultMetadata.a(Long.parseLong(sb7.toString()));
|
|
break;
|
|
case 6:
|
|
StringBuilder sb8 = new StringBuilder();
|
|
b2 = a(iArr, i6 + 1, sb8);
|
|
pDF417ResultMetadata.a(Integer.parseInt(sb8.toString()));
|
|
break;
|
|
default:
|
|
throw FormatException.getFormatInstance();
|
|
}
|
|
} else {
|
|
throw FormatException.getFormatInstance();
|
|
}
|
|
}
|
|
if (i4 != -1) {
|
|
int i7 = b2 - i4;
|
|
if (pDF417ResultMetadata.a()) {
|
|
i7--;
|
|
}
|
|
pDF417ResultMetadata.a(Arrays.copyOfRange(iArr, i4, i7 + i4));
|
|
}
|
|
return b2;
|
|
}
|
|
throw FormatException.getFormatInstance();
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
/* JADX WARN: Removed duplicated region for block: B:26:0x00dc A[PHI: r2
|
|
0x00dc: PHI (r2v15 com.google.zxing.pdf417.decoder.DecodedBitStreamParser$Mode) =
|
|
(r2v1 com.google.zxing.pdf417.decoder.DecodedBitStreamParser$Mode)
|
|
(r2v1 com.google.zxing.pdf417.decoder.DecodedBitStreamParser$Mode)
|
|
(r2v1 com.google.zxing.pdf417.decoder.DecodedBitStreamParser$Mode)
|
|
(r2v16 com.google.zxing.pdf417.decoder.DecodedBitStreamParser$Mode)
|
|
binds: [B:63:0x00cb, B:53:0x00aa, B:40:0x0083, B:25:0x0052] A[DONT_GENERATE, DONT_INLINE]] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
private static void a(int[] r12, int[] r13, int r14, java.lang.StringBuilder r15) {
|
|
/*
|
|
Method dump skipped, instructions count: 298
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.decoder.DecodedBitStreamParser.a(int[], int[], int, java.lang.StringBuilder):void");
|
|
}
|
|
|
|
/* JADX WARN: Failed to find 'out' block for switch in B:45:0x0078. Please report as an issue. */
|
|
/* JADX WARN: Failed to find 'out' block for switch in B:46:0x007b. Please report as an issue. */
|
|
/* JADX WARN: Removed duplicated region for block: B:20:0x0046 A[SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:31:0x0021 A[ADDED_TO_REGION, SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:45:0x0078 */
|
|
/* JADX WARN: Removed duplicated region for block: B:64:0x00aa A[SYNTHETIC] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
private static int a(int r16, int[] r17, java.nio.charset.Charset r18, int r19, java.lang.StringBuilder r20) {
|
|
/*
|
|
Method dump skipped, instructions count: 258
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.decoder.DecodedBitStreamParser.a(int, int[], java.nio.charset.Charset, int, java.lang.StringBuilder):int");
|
|
}
|
|
|
|
private static int a(int[] iArr, int i, StringBuilder sb) throws FormatException {
|
|
int[] iArr2 = new int[15];
|
|
boolean z = false;
|
|
int i2 = 0;
|
|
while (i < iArr[0] && !z) {
|
|
int i3 = i + 1;
|
|
int i4 = iArr[i];
|
|
if (i3 == iArr[0]) {
|
|
z = true;
|
|
}
|
|
if (i4 < 900) {
|
|
iArr2[i2] = i4;
|
|
i2++;
|
|
} else {
|
|
if (i4 != 900 && i4 != 901 && i4 != 928) {
|
|
switch (i4) {
|
|
}
|
|
}
|
|
i3--;
|
|
z = true;
|
|
}
|
|
if ((i2 % 15 == 0 || i4 == 902 || z) && i2 > 0) {
|
|
sb.append(a(iArr2, i2));
|
|
i2 = 0;
|
|
}
|
|
i = i3;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
private static String a(int[] iArr, int i) throws FormatException {
|
|
BigInteger bigInteger = BigInteger.ZERO;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
bigInteger = bigInteger.add(c[(i - i2) - 1].multiply(BigInteger.valueOf(iArr[i2])));
|
|
}
|
|
String bigInteger2 = bigInteger.toString();
|
|
if (bigInteger2.charAt(0) == '1') {
|
|
return bigInteger2.substring(1);
|
|
}
|
|
throw FormatException.getFormatInstance();
|
|
}
|
|
}
|