Initial commit
This commit is contained in:
177
sources/com/google/zxing/qrcode/decoder/BitMatrixParser.java
Normal file
177
sources/com/google/zxing/qrcode/decoder/BitMatrixParser.java
Normal file
@@ -0,0 +1,177 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BitMatrixParser {
|
||||
private final BitMatrix a;
|
||||
private Version b;
|
||||
private FormatInformation c;
|
||||
private boolean d;
|
||||
|
||||
BitMatrixParser(BitMatrix bitMatrix) throws FormatException {
|
||||
int i = bitMatrix.i();
|
||||
if (i < 21 || (i & 3) != 1) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
this.a = bitMatrix;
|
||||
}
|
||||
|
||||
private int a(int i, int i2, int i3) {
|
||||
return this.d ? this.a.b(i2, i) : this.a.b(i, i2) ? (i3 << 1) | 1 : i3 << 1;
|
||||
}
|
||||
|
||||
byte[] b() throws FormatException {
|
||||
FormatInformation c = c();
|
||||
Version d = d();
|
||||
DataMask dataMask = DataMask.values()[c.a()];
|
||||
int i = this.a.i();
|
||||
dataMask.a(this.a, i);
|
||||
BitMatrix a = d.a();
|
||||
byte[] bArr = new byte[d.d()];
|
||||
int i2 = i - 1;
|
||||
int i3 = i2;
|
||||
int i4 = 0;
|
||||
boolean z = true;
|
||||
int i5 = 0;
|
||||
int i6 = 0;
|
||||
while (i3 > 0) {
|
||||
if (i3 == 6) {
|
||||
i3--;
|
||||
}
|
||||
int i7 = i6;
|
||||
int i8 = i5;
|
||||
int i9 = i4;
|
||||
int i10 = 0;
|
||||
while (i10 < i) {
|
||||
int i11 = z ? i2 - i10 : i10;
|
||||
int i12 = i7;
|
||||
int i13 = i8;
|
||||
int i14 = i9;
|
||||
for (int i15 = 0; i15 < 2; i15++) {
|
||||
int i16 = i3 - i15;
|
||||
if (!a.b(i16, i11)) {
|
||||
i13++;
|
||||
int i17 = i12 << 1;
|
||||
int i18 = this.a.b(i16, i11) ? i17 | 1 : i17;
|
||||
if (i13 == 8) {
|
||||
bArr[i14] = (byte) i18;
|
||||
i14++;
|
||||
i13 = 0;
|
||||
i12 = 0;
|
||||
} else {
|
||||
i12 = i18;
|
||||
}
|
||||
}
|
||||
}
|
||||
i10++;
|
||||
i9 = i14;
|
||||
i8 = i13;
|
||||
i7 = i12;
|
||||
}
|
||||
z = !z;
|
||||
i3 -= 2;
|
||||
i4 = i9;
|
||||
i5 = i8;
|
||||
i6 = i7;
|
||||
}
|
||||
if (i4 == d.d()) {
|
||||
return bArr;
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
FormatInformation c() throws FormatException {
|
||||
FormatInformation formatInformation = this.c;
|
||||
if (formatInformation != null) {
|
||||
return formatInformation;
|
||||
}
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < 6; i3++) {
|
||||
i2 = a(i3, 8, i2);
|
||||
}
|
||||
int a = a(8, 7, a(8, 8, a(7, 8, i2)));
|
||||
for (int i4 = 5; i4 >= 0; i4--) {
|
||||
a = a(8, i4, a);
|
||||
}
|
||||
int i5 = this.a.i();
|
||||
int i6 = i5 - 7;
|
||||
for (int i7 = i5 - 1; i7 >= i6; i7--) {
|
||||
i = a(8, i7, i);
|
||||
}
|
||||
for (int i8 = i5 - 8; i8 < i5; i8++) {
|
||||
i = a(i8, 8, i);
|
||||
}
|
||||
this.c = FormatInformation.a(a, i);
|
||||
FormatInformation formatInformation2 = this.c;
|
||||
if (formatInformation2 != null) {
|
||||
return formatInformation2;
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
Version d() throws FormatException {
|
||||
Version version = this.b;
|
||||
if (version != null) {
|
||||
return version;
|
||||
}
|
||||
int i = this.a.i();
|
||||
int i2 = (i - 17) / 4;
|
||||
if (i2 <= 6) {
|
||||
return Version.c(i2);
|
||||
}
|
||||
int i3 = i - 11;
|
||||
int i4 = 0;
|
||||
int i5 = 0;
|
||||
for (int i6 = 5; i6 >= 0; i6--) {
|
||||
for (int i7 = i - 9; i7 >= i3; i7--) {
|
||||
i5 = a(i7, i6, i5);
|
||||
}
|
||||
}
|
||||
Version a = Version.a(i5);
|
||||
if (a != null && a.c() == i) {
|
||||
this.b = a;
|
||||
return a;
|
||||
}
|
||||
for (int i8 = 5; i8 >= 0; i8--) {
|
||||
for (int i9 = i - 9; i9 >= i3; i9--) {
|
||||
i4 = a(i8, i9, i4);
|
||||
}
|
||||
}
|
||||
Version a2 = Version.a(i4);
|
||||
if (a2 == null || a2.c() != i) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
this.b = a2;
|
||||
return a2;
|
||||
}
|
||||
|
||||
void e() {
|
||||
if (this.c == null) {
|
||||
return;
|
||||
}
|
||||
DataMask.values()[this.c.a()].a(this.a, this.a.i());
|
||||
}
|
||||
|
||||
void a(boolean z) {
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
this.d = z;
|
||||
}
|
||||
|
||||
void a() {
|
||||
int i = 0;
|
||||
while (i < this.a.k()) {
|
||||
int i2 = i + 1;
|
||||
for (int i3 = i2; i3 < this.a.i(); i3++) {
|
||||
if (this.a.b(i, i3) != this.a.b(i3, i)) {
|
||||
this.a.a(i3, i);
|
||||
this.a.a(i, i3);
|
||||
}
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
}
|
90
sources/com/google/zxing/qrcode/decoder/DataBlock.java
Normal file
90
sources/com/google/zxing/qrcode/decoder/DataBlock.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
import com.google.zxing.qrcode.decoder.Version;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DataBlock {
|
||||
private final int a;
|
||||
private final byte[] b;
|
||||
|
||||
private DataBlock(int i, byte[] bArr) {
|
||||
this.a = i;
|
||||
this.b = bArr;
|
||||
}
|
||||
|
||||
static DataBlock[] a(byte[] bArr, Version version, ErrorCorrectionLevel errorCorrectionLevel) {
|
||||
if (bArr.length != version.d()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Version.ECBlocks a = version.a(errorCorrectionLevel);
|
||||
Version.ECB[] a2 = a.a();
|
||||
int i = 0;
|
||||
for (Version.ECB ecb : a2) {
|
||||
i += ecb.a();
|
||||
}
|
||||
DataBlock[] dataBlockArr = new DataBlock[i];
|
||||
int length = a2.length;
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < length) {
|
||||
Version.ECB ecb2 = a2[i2];
|
||||
int i4 = i3;
|
||||
int i5 = 0;
|
||||
while (i5 < ecb2.a()) {
|
||||
int b = ecb2.b();
|
||||
dataBlockArr[i4] = new DataBlock(b, new byte[a.b() + b]);
|
||||
i5++;
|
||||
i4++;
|
||||
}
|
||||
i2++;
|
||||
i3 = i4;
|
||||
}
|
||||
int length2 = dataBlockArr[0].b.length;
|
||||
int length3 = dataBlockArr.length - 1;
|
||||
while (length3 >= 0 && dataBlockArr[length3].b.length != length2) {
|
||||
length3--;
|
||||
}
|
||||
int i6 = length3 + 1;
|
||||
int b2 = length2 - a.b();
|
||||
int i7 = 0;
|
||||
int i8 = 0;
|
||||
while (i7 < b2) {
|
||||
int i9 = i8;
|
||||
int i10 = 0;
|
||||
while (i10 < i3) {
|
||||
dataBlockArr[i10].b[i7] = bArr[i9];
|
||||
i10++;
|
||||
i9++;
|
||||
}
|
||||
i7++;
|
||||
i8 = i9;
|
||||
}
|
||||
int i11 = i6;
|
||||
while (i11 < i3) {
|
||||
dataBlockArr[i11].b[b2] = bArr[i8];
|
||||
i11++;
|
||||
i8++;
|
||||
}
|
||||
int length4 = dataBlockArr[0].b.length;
|
||||
while (b2 < length4) {
|
||||
int i12 = i8;
|
||||
int i13 = 0;
|
||||
while (i13 < i3) {
|
||||
dataBlockArr[i13].b[i13 < i6 ? b2 : b2 + 1] = bArr[i12];
|
||||
i13++;
|
||||
i12++;
|
||||
}
|
||||
b2++;
|
||||
i8 = i12;
|
||||
}
|
||||
return dataBlockArr;
|
||||
}
|
||||
|
||||
int b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
byte[] a() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
67
sources/com/google/zxing/qrcode/decoder/DataMask.java
Normal file
67
sources/com/google/zxing/qrcode/decoder/DataMask.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
enum DataMask {
|
||||
DATA_MASK_000 { // from class: com.google.zxing.qrcode.decoder.DataMask.1
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return ((i + i2) & 1) == 0;
|
||||
}
|
||||
},
|
||||
DATA_MASK_001 { // from class: com.google.zxing.qrcode.decoder.DataMask.2
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return (i & 1) == 0;
|
||||
}
|
||||
},
|
||||
DATA_MASK_010 { // from class: com.google.zxing.qrcode.decoder.DataMask.3
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return i2 % 3 == 0;
|
||||
}
|
||||
},
|
||||
DATA_MASK_011 { // from class: com.google.zxing.qrcode.decoder.DataMask.4
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return (i + i2) % 3 == 0;
|
||||
}
|
||||
},
|
||||
DATA_MASK_100 { // from class: com.google.zxing.qrcode.decoder.DataMask.5
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return (((i / 2) + (i2 / 3)) & 1) == 0;
|
||||
}
|
||||
},
|
||||
DATA_MASK_101 { // from class: com.google.zxing.qrcode.decoder.DataMask.6
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return (i * i2) % 6 == 0;
|
||||
}
|
||||
},
|
||||
DATA_MASK_110 { // from class: com.google.zxing.qrcode.decoder.DataMask.7
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return (i * i2) % 6 < 3;
|
||||
}
|
||||
},
|
||||
DATA_MASK_111 { // from class: com.google.zxing.qrcode.decoder.DataMask.8
|
||||
@Override // com.google.zxing.qrcode.decoder.DataMask
|
||||
boolean a(int i, int i2) {
|
||||
return (((i + i2) + ((i * i2) % 3)) & 1) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
final void a(BitMatrix bitMatrix, int i2) {
|
||||
for (int i3 = 0; i3 < i2; i3++) {
|
||||
for (int i4 = 0; i4 < i2; i4++) {
|
||||
if (a(i3, i4)) {
|
||||
bitMatrix.a(i4, i3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract boolean a(int i2, int i3);
|
||||
}
|
@@ -0,0 +1,240 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.common.BitSource;
|
||||
import com.google.zxing.common.CharacterSetECI;
|
||||
import com.google.zxing.common.StringUtils;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodedBitStreamParser {
|
||||
private static final char[] a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".toCharArray();
|
||||
|
||||
/* renamed from: com.google.zxing.qrcode.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.NUMERIC.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[Mode.ALPHANUMERIC.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[Mode.BYTE.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[Mode.KANJI.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
try {
|
||||
a[Mode.TERMINATOR.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
try {
|
||||
a[Mode.FNC1_FIRST_POSITION.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError unused6) {
|
||||
}
|
||||
try {
|
||||
a[Mode.FNC1_SECOND_POSITION.ordinal()] = 7;
|
||||
} catch (NoSuchFieldError unused7) {
|
||||
}
|
||||
try {
|
||||
a[Mode.STRUCTURED_APPEND.ordinal()] = 8;
|
||||
} catch (NoSuchFieldError unused8) {
|
||||
}
|
||||
try {
|
||||
a[Mode.ECI.ordinal()] = 9;
|
||||
} catch (NoSuchFieldError unused9) {
|
||||
}
|
||||
try {
|
||||
a[Mode.HANZI.ordinal()] = 10;
|
||||
} catch (NoSuchFieldError unused10) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
/* JADX WARN: Removed duplicated region for block: B:25:0x00dc A[LOOP:0: B:2:0x001e->B:25:0x00dc, LOOP_END] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:26:0x00ba A[SYNTHETIC] */
|
||||
/*
|
||||
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(byte[] r17, com.google.zxing.qrcode.decoder.Version r18, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel r19, java.util.Map<com.google.zxing.DecodeHintType, ?> r20) throws com.google.zxing.FormatException {
|
||||
/*
|
||||
Method dump skipped, instructions count: 244
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.decoder.DecodedBitStreamParser.a(byte[], com.google.zxing.qrcode.decoder.Version, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel, java.util.Map):com.google.zxing.common.DecoderResult");
|
||||
}
|
||||
|
||||
private static void b(BitSource bitSource, StringBuilder sb, int i) throws FormatException {
|
||||
if (i * 13 > bitSource.a()) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
byte[] bArr = new byte[i * 2];
|
||||
int i2 = 0;
|
||||
while (i > 0) {
|
||||
int a2 = bitSource.a(13);
|
||||
int i3 = (a2 % 192) | ((a2 / 192) << 8);
|
||||
int i4 = i3 + (i3 < 7936 ? 33088 : 49472);
|
||||
bArr[i2] = (byte) (i4 >> 8);
|
||||
bArr[i2 + 1] = (byte) i4;
|
||||
i2 += 2;
|
||||
i--;
|
||||
}
|
||||
try {
|
||||
sb.append(new String(bArr, "SJIS"));
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
|
||||
private static void c(BitSource bitSource, StringBuilder sb, int i) throws FormatException {
|
||||
while (i >= 3) {
|
||||
if (bitSource.a() < 10) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
int a2 = bitSource.a(10);
|
||||
if (a2 >= 1000) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
sb.append(a(a2 / 100));
|
||||
sb.append(a((a2 / 10) % 10));
|
||||
sb.append(a(a2 % 10));
|
||||
i -= 3;
|
||||
}
|
||||
if (i == 2) {
|
||||
if (bitSource.a() < 7) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
int a3 = bitSource.a(7);
|
||||
if (a3 >= 100) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
sb.append(a(a3 / 10));
|
||||
sb.append(a(a3 % 10));
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
if (bitSource.a() < 4) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
int a4 = bitSource.a(4);
|
||||
if (a4 >= 10) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
sb.append(a(a4));
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(BitSource bitSource, StringBuilder sb, int i) throws FormatException {
|
||||
if (i * 13 <= bitSource.a()) {
|
||||
byte[] bArr = new byte[i * 2];
|
||||
int i2 = 0;
|
||||
while (i > 0) {
|
||||
int a2 = bitSource.a(13);
|
||||
int i3 = (a2 % 96) | ((a2 / 96) << 8);
|
||||
int i4 = i3 + (i3 < 959 ? 41377 : 42657);
|
||||
bArr[i2] = (byte) (i4 >> 8);
|
||||
bArr[i2 + 1] = (byte) i4;
|
||||
i2 += 2;
|
||||
i--;
|
||||
}
|
||||
try {
|
||||
sb.append(new String(bArr, "GB2312"));
|
||||
return;
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
private static void a(BitSource bitSource, StringBuilder sb, int i, CharacterSetECI characterSetECI, Collection<byte[]> collection, Map<DecodeHintType, ?> map) throws FormatException {
|
||||
String name;
|
||||
if ((i << 3) <= bitSource.a()) {
|
||||
byte[] bArr = new byte[i];
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
bArr[i2] = (byte) bitSource.a(8);
|
||||
}
|
||||
if (characterSetECI == null) {
|
||||
name = StringUtils.a(bArr, map);
|
||||
} else {
|
||||
name = characterSetECI.name();
|
||||
}
|
||||
try {
|
||||
sb.append(new String(bArr, name));
|
||||
collection.add(bArr);
|
||||
return;
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
private static char a(int i) throws FormatException {
|
||||
char[] cArr = a;
|
||||
if (i < cArr.length) {
|
||||
return cArr[i];
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
private static void a(BitSource bitSource, StringBuilder sb, int i, boolean z) throws FormatException {
|
||||
while (i > 1) {
|
||||
if (bitSource.a() >= 11) {
|
||||
int a2 = bitSource.a(11);
|
||||
sb.append(a(a2 / 45));
|
||||
sb.append(a(a2 % 45));
|
||||
i -= 2;
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
if (i == 1) {
|
||||
if (bitSource.a() >= 6) {
|
||||
sb.append(a(bitSource.a(6)));
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
for (int length = sb.length(); length < sb.length(); length++) {
|
||||
if (sb.charAt(length) == '%') {
|
||||
if (length < sb.length() - 1) {
|
||||
int i2 = length + 1;
|
||||
if (sb.charAt(i2) == '%') {
|
||||
sb.deleteCharAt(i2);
|
||||
}
|
||||
}
|
||||
sb.setCharAt(length, (char) 29);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(BitSource bitSource) throws FormatException {
|
||||
int a2 = bitSource.a(8);
|
||||
if ((a2 & PeripheralType.SERVO) == 0) {
|
||||
return a2 & 127;
|
||||
}
|
||||
if ((a2 & 192) == 128) {
|
||||
return bitSource.a(8) | ((a2 & 63) << 8);
|
||||
}
|
||||
if ((a2 & 224) == 192) {
|
||||
return bitSource.a(16) | ((a2 & 31) << 16);
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
99
sources/com/google/zxing/qrcode/decoder/Decoder.java
Normal file
99
sources/com/google/zxing/qrcode/decoder/Decoder.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package com.google.zxing.qrcode.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.l);
|
||||
|
||||
public DecoderResult a(BitMatrix bitMatrix, Map<DecodeHintType, ?> map) throws FormatException, ChecksumException {
|
||||
ChecksumException e;
|
||||
BitMatrixParser bitMatrixParser = new BitMatrixParser(bitMatrix);
|
||||
FormatException formatException = null;
|
||||
try {
|
||||
return a(bitMatrixParser, map);
|
||||
} catch (ChecksumException e2) {
|
||||
e = e2;
|
||||
try {
|
||||
bitMatrixParser.e();
|
||||
bitMatrixParser.a(true);
|
||||
bitMatrixParser.d();
|
||||
bitMatrixParser.c();
|
||||
bitMatrixParser.a();
|
||||
DecoderResult a = a(bitMatrixParser, map);
|
||||
a.a(new QRCodeDecoderMetaData(true));
|
||||
return a;
|
||||
} catch (ChecksumException | FormatException unused) {
|
||||
if (formatException != null) {
|
||||
throw formatException;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
} catch (FormatException e3) {
|
||||
e = null;
|
||||
formatException = e3;
|
||||
bitMatrixParser.e();
|
||||
bitMatrixParser.a(true);
|
||||
bitMatrixParser.d();
|
||||
bitMatrixParser.c();
|
||||
bitMatrixParser.a();
|
||||
DecoderResult a2 = a(bitMatrixParser, map);
|
||||
a2.a(new QRCodeDecoderMetaData(true));
|
||||
return a2;
|
||||
}
|
||||
}
|
||||
|
||||
private DecoderResult a(BitMatrixParser bitMatrixParser, Map<DecodeHintType, ?> map) throws FormatException, ChecksumException {
|
||||
Version d = bitMatrixParser.d();
|
||||
ErrorCorrectionLevel b = bitMatrixParser.c().b();
|
||||
DataBlock[] a = DataBlock.a(bitMatrixParser.b(), d, b);
|
||||
int i = 0;
|
||||
for (DataBlock dataBlock : a) {
|
||||
i += dataBlock.b();
|
||||
}
|
||||
byte[] bArr = new byte[i];
|
||||
int length = a.length;
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < length) {
|
||||
DataBlock dataBlock2 = a[i2];
|
||||
byte[] a2 = dataBlock2.a();
|
||||
int b2 = dataBlock2.b();
|
||||
a(a2, b2);
|
||||
int i4 = i3;
|
||||
int i5 = 0;
|
||||
while (i5 < b2) {
|
||||
bArr[i4] = a2[i5];
|
||||
i5++;
|
||||
i4++;
|
||||
}
|
||||
i2++;
|
||||
i3 = i4;
|
||||
}
|
||||
return DecodedBitStreamParser.a(bArr, d, b, map);
|
||||
}
|
||||
|
||||
private void a(byte[] bArr, int i) throws ChecksumException {
|
||||
int length = bArr.length;
|
||||
int[] iArr = new int[length];
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
iArr[i2] = bArr[i2] & 255;
|
||||
}
|
||||
try {
|
||||
this.a.a(iArr, bArr.length - i);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
bArr[i3] = (byte) iArr[i3];
|
||||
}
|
||||
} catch (ReedSolomonException unused) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum ErrorCorrectionLevel {
|
||||
L(1),
|
||||
M(0),
|
||||
Q(3),
|
||||
H(2);
|
||||
|
||||
private static final ErrorCorrectionLevel[] FOR_BITS;
|
||||
private final int bits;
|
||||
|
||||
static {
|
||||
ErrorCorrectionLevel errorCorrectionLevel = L;
|
||||
ErrorCorrectionLevel errorCorrectionLevel2 = M;
|
||||
ErrorCorrectionLevel errorCorrectionLevel3 = Q;
|
||||
FOR_BITS = new ErrorCorrectionLevel[]{errorCorrectionLevel2, errorCorrectionLevel, H, errorCorrectionLevel3};
|
||||
}
|
||||
|
||||
ErrorCorrectionLevel(int i) {
|
||||
this.bits = i;
|
||||
}
|
||||
|
||||
public static ErrorCorrectionLevel forBits(int i) {
|
||||
if (i >= 0) {
|
||||
ErrorCorrectionLevel[] errorCorrectionLevelArr = FOR_BITS;
|
||||
if (i < errorCorrectionLevelArr.length) {
|
||||
return errorCorrectionLevelArr[i];
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public int getBits() {
|
||||
return this.bits;
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class FormatInformation {
|
||||
private static final int[][] c = {new int[]{21522, 0}, new int[]{20773, 1}, new int[]{24188, 2}, new int[]{23371, 3}, new int[]{17913, 4}, new int[]{16590, 5}, new int[]{20375, 6}, new int[]{19104, 7}, new int[]{30660, 8}, new int[]{29427, 9}, new int[]{32170, 10}, new int[]{30877, 11}, new int[]{26159, 12}, new int[]{25368, 13}, new int[]{27713, 14}, new int[]{26998, 15}, new int[]{5769, 16}, new int[]{5054, 17}, new int[]{7399, 18}, new int[]{6608, 19}, new int[]{1890, 20}, new int[]{597, 21}, new int[]{3340, 22}, new int[]{2107, 23}, new int[]{13663, 24}, new int[]{12392, 25}, new int[]{16177, 26}, new int[]{14854, 27}, new int[]{9396, 28}, new int[]{8579, 29}, new int[]{11994, 30}, new int[]{11245, 31}};
|
||||
private final ErrorCorrectionLevel a;
|
||||
private final byte b;
|
||||
|
||||
private FormatInformation(int i) {
|
||||
this.a = ErrorCorrectionLevel.forBits((i >> 3) & 3);
|
||||
this.b = (byte) (i & 7);
|
||||
}
|
||||
|
||||
static FormatInformation a(int i, int i2) {
|
||||
FormatInformation b = b(i, i2);
|
||||
return b != null ? b : b(i ^ 21522, i2 ^ 21522);
|
||||
}
|
||||
|
||||
private static FormatInformation b(int i, int i2) {
|
||||
int c2;
|
||||
int i3 = Integer.MAX_VALUE;
|
||||
int i4 = 0;
|
||||
for (int[] iArr : c) {
|
||||
int i5 = iArr[0];
|
||||
if (i5 == i || i5 == i2) {
|
||||
return new FormatInformation(iArr[1]);
|
||||
}
|
||||
int c3 = c(i, i5);
|
||||
if (c3 < i3) {
|
||||
i4 = iArr[1];
|
||||
i3 = c3;
|
||||
}
|
||||
if (i != i2 && (c2 = c(i2, i5)) < i3) {
|
||||
i4 = iArr[1];
|
||||
i3 = c2;
|
||||
}
|
||||
}
|
||||
if (i3 <= 3) {
|
||||
return new FormatInformation(i4);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static int c(int i, int i2) {
|
||||
return Integer.bitCount(i ^ i2);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof FormatInformation)) {
|
||||
return false;
|
||||
}
|
||||
FormatInformation formatInformation = (FormatInformation) obj;
|
||||
return this.a == formatInformation.a && this.b == formatInformation.b;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (this.a.ordinal() << 3) | this.b;
|
||||
}
|
||||
|
||||
byte a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
ErrorCorrectionLevel b() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
66
sources/com/google/zxing/qrcode/decoder/Mode.java
Normal file
66
sources/com/google/zxing/qrcode/decoder/Mode.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum Mode {
|
||||
TERMINATOR(new int[]{0, 0, 0}, 0),
|
||||
NUMERIC(new int[]{10, 12, 14}, 1),
|
||||
ALPHANUMERIC(new int[]{9, 11, 13}, 2),
|
||||
STRUCTURED_APPEND(new int[]{0, 0, 0}, 3),
|
||||
BYTE(new int[]{8, 16, 16}, 4),
|
||||
ECI(new int[]{0, 0, 0}, 7),
|
||||
KANJI(new int[]{8, 10, 12}, 8),
|
||||
FNC1_FIRST_POSITION(new int[]{0, 0, 0}, 5),
|
||||
FNC1_SECOND_POSITION(new int[]{0, 0, 0}, 9),
|
||||
HANZI(new int[]{8, 10, 12}, 13);
|
||||
|
||||
private final int bits;
|
||||
private final int[] characterCountBitsForVersions;
|
||||
|
||||
Mode(int[] iArr, int i) {
|
||||
this.characterCountBitsForVersions = iArr;
|
||||
this.bits = i;
|
||||
}
|
||||
|
||||
public static Mode forBits(int i) {
|
||||
if (i == 0) {
|
||||
return TERMINATOR;
|
||||
}
|
||||
if (i == 1) {
|
||||
return NUMERIC;
|
||||
}
|
||||
if (i == 2) {
|
||||
return ALPHANUMERIC;
|
||||
}
|
||||
if (i == 3) {
|
||||
return STRUCTURED_APPEND;
|
||||
}
|
||||
if (i == 4) {
|
||||
return BYTE;
|
||||
}
|
||||
if (i == 5) {
|
||||
return FNC1_FIRST_POSITION;
|
||||
}
|
||||
if (i == 7) {
|
||||
return ECI;
|
||||
}
|
||||
if (i == 8) {
|
||||
return KANJI;
|
||||
}
|
||||
if (i == 9) {
|
||||
return FNC1_SECOND_POSITION;
|
||||
}
|
||||
if (i == 13) {
|
||||
return HANZI;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public int getBits() {
|
||||
return this.bits;
|
||||
}
|
||||
|
||||
public int getCharacterCountBits(Version version) {
|
||||
int e = version.e();
|
||||
return this.characterCountBitsForVersions[e <= 9 ? (char) 0 : e <= 26 ? (char) 1 : (char) 2];
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.google.zxing.qrcode.decoder;
|
||||
|
||||
import com.google.zxing.ResultPoint;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class QRCodeDecoderMetaData {
|
||||
private final boolean a;
|
||||
|
||||
QRCodeDecoderMetaData(boolean z) {
|
||||
this.a = z;
|
||||
}
|
||||
|
||||
public void a(ResultPoint[] resultPointArr) {
|
||||
if (!this.a || resultPointArr == null || resultPointArr.length < 3) {
|
||||
return;
|
||||
}
|
||||
ResultPoint resultPoint = resultPointArr[0];
|
||||
resultPointArr[0] = resultPointArr[2];
|
||||
resultPointArr[2] = resultPoint;
|
||||
}
|
||||
}
|
173
sources/com/google/zxing/qrcode/decoder/Version.java
Normal file
173
sources/com/google/zxing/qrcode/decoder/Version.java
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user