Initial commit
This commit is contained in:
141
sources/com/google/zxing/qrcode/QRCodeReader.java
Normal file
141
sources/com/google/zxing/qrcode/QRCodeReader.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package com.google.zxing.qrcode;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Reader;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.DetectorResult;
|
||||
import com.google.zxing.qrcode.decoder.Decoder;
|
||||
import com.google.zxing.qrcode.decoder.QRCodeDecoderMetaData;
|
||||
import com.google.zxing.qrcode.detector.Detector;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class QRCodeReader implements Reader {
|
||||
private static final ResultPoint[] b = new ResultPoint[0];
|
||||
private final Decoder a = new Decoder();
|
||||
|
||||
@Override // com.google.zxing.Reader
|
||||
public final Result a(BinaryBitmap binaryBitmap, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException {
|
||||
ResultPoint[] b2;
|
||||
DecoderResult decoderResult;
|
||||
if (map == null || !map.containsKey(DecodeHintType.PURE_BARCODE)) {
|
||||
DetectorResult a = new Detector(binaryBitmap.a()).a(map);
|
||||
DecoderResult a2 = this.a.a(a.a(), map);
|
||||
b2 = a.b();
|
||||
decoderResult = a2;
|
||||
} else {
|
||||
decoderResult = this.a.a(a(binaryBitmap.a()), map);
|
||||
b2 = b;
|
||||
}
|
||||
if (decoderResult.d() instanceof QRCodeDecoderMetaData) {
|
||||
((QRCodeDecoderMetaData) decoderResult.d()).a(b2);
|
||||
}
|
||||
Result result = new Result(decoderResult.h(), decoderResult.e(), b2, BarcodeFormat.QR_CODE);
|
||||
List<byte[]> a3 = decoderResult.a();
|
||||
if (a3 != null) {
|
||||
result.a(ResultMetadataType.BYTE_SEGMENTS, a3);
|
||||
}
|
||||
String b3 = decoderResult.b();
|
||||
if (b3 != null) {
|
||||
result.a(ResultMetadataType.ERROR_CORRECTION_LEVEL, b3);
|
||||
}
|
||||
if (decoderResult.i()) {
|
||||
result.a(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, Integer.valueOf(decoderResult.g()));
|
||||
result.a(ResultMetadataType.STRUCTURED_APPEND_PARITY, Integer.valueOf(decoderResult.f()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.Reader
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
private static BitMatrix a(BitMatrix bitMatrix) throws NotFoundException {
|
||||
int[] j = bitMatrix.j();
|
||||
int[] b2 = bitMatrix.b();
|
||||
if (j != null && b2 != null) {
|
||||
float a = a(j, bitMatrix);
|
||||
int i = j[1];
|
||||
int i2 = b2[1];
|
||||
int i3 = j[0];
|
||||
int i4 = b2[0];
|
||||
if (i3 < i4 && i < i2) {
|
||||
int i5 = i2 - i;
|
||||
if (i5 != i4 - i3 && (i4 = i3 + i5) >= bitMatrix.k()) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
int round = Math.round(((i4 - i3) + 1) / a);
|
||||
int round2 = Math.round((i5 + 1) / a);
|
||||
if (round <= 0 || round2 <= 0) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (round2 == round) {
|
||||
int i6 = (int) (a / 2.0f);
|
||||
int i7 = i + i6;
|
||||
int i8 = i3 + i6;
|
||||
int i9 = (((int) ((round - 1) * a)) + i8) - i4;
|
||||
if (i9 > 0) {
|
||||
if (i9 > i6) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
i8 -= i9;
|
||||
}
|
||||
int i10 = (((int) ((round2 - 1) * a)) + i7) - i2;
|
||||
if (i10 > 0) {
|
||||
if (i10 > i6) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
i7 -= i10;
|
||||
}
|
||||
BitMatrix bitMatrix2 = new BitMatrix(round, round2);
|
||||
for (int i11 = 0; i11 < round2; i11++) {
|
||||
int i12 = ((int) (i11 * a)) + i7;
|
||||
for (int i13 = 0; i13 < round; i13++) {
|
||||
if (bitMatrix.b(((int) (i13 * a)) + i8, i12)) {
|
||||
bitMatrix2.c(i13, i11);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bitMatrix2;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static float a(int[] iArr, BitMatrix bitMatrix) throws NotFoundException {
|
||||
int i = bitMatrix.i();
|
||||
int k = bitMatrix.k();
|
||||
int i2 = iArr[0];
|
||||
boolean z = true;
|
||||
int i3 = iArr[1];
|
||||
int i4 = 0;
|
||||
while (i2 < k && i3 < i) {
|
||||
if (z != bitMatrix.b(i2, i3)) {
|
||||
i4++;
|
||||
if (i4 == 5) {
|
||||
break;
|
||||
}
|
||||
z = !z;
|
||||
}
|
||||
i2++;
|
||||
i3++;
|
||||
}
|
||||
if (i2 != k && i3 != i) {
|
||||
return (i2 - iArr[0]) / 7.0f;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
72
sources/com/google/zxing/qrcode/QRCodeWriter.java
Normal file
72
sources/com/google/zxing/qrcode/QRCodeWriter.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.google.zxing.qrcode;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.Writer;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.google.zxing.qrcode.encoder.ByteMatrix;
|
||||
import com.google.zxing.qrcode.encoder.Encoder;
|
||||
import com.google.zxing.qrcode.encoder.QRCode;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class QRCodeWriter implements Writer {
|
||||
@Override // com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (str.isEmpty()) {
|
||||
throw new IllegalArgumentException("Found empty contents");
|
||||
}
|
||||
if (barcodeFormat != BarcodeFormat.QR_CODE) {
|
||||
throw new IllegalArgumentException("Can only encode QR_CODE, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
if (i < 0 || i2 < 0) {
|
||||
throw new IllegalArgumentException("Requested dimensions are too small: " + i + 'x' + i2);
|
||||
}
|
||||
ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
|
||||
int i3 = 4;
|
||||
if (map != null) {
|
||||
if (map.containsKey(EncodeHintType.ERROR_CORRECTION)) {
|
||||
errorCorrectionLevel = ErrorCorrectionLevel.valueOf(map.get(EncodeHintType.ERROR_CORRECTION).toString());
|
||||
}
|
||||
if (map.containsKey(EncodeHintType.MARGIN)) {
|
||||
i3 = Integer.parseInt(map.get(EncodeHintType.MARGIN).toString());
|
||||
}
|
||||
}
|
||||
return a(Encoder.a(str, errorCorrectionLevel, map), i, i2, i3);
|
||||
}
|
||||
|
||||
private static BitMatrix a(QRCode qRCode, int i, int i2, int i3) {
|
||||
ByteMatrix a = qRCode.a();
|
||||
if (a != null) {
|
||||
int c = a.c();
|
||||
int b = a.b();
|
||||
int i4 = i3 << 1;
|
||||
int i5 = c + i4;
|
||||
int i6 = i4 + b;
|
||||
int max = Math.max(i, i5);
|
||||
int max2 = Math.max(i2, i6);
|
||||
int min = Math.min(max / i5, max2 / i6);
|
||||
int i7 = (max - (c * min)) / 2;
|
||||
int i8 = (max2 - (b * min)) / 2;
|
||||
BitMatrix bitMatrix = new BitMatrix(max, max2);
|
||||
int i9 = 0;
|
||||
while (i9 < b) {
|
||||
int i10 = i7;
|
||||
int i11 = 0;
|
||||
while (i11 < c) {
|
||||
if (a.a(i11, i9) == 1) {
|
||||
bitMatrix.a(i10, i8, min, min);
|
||||
}
|
||||
i11++;
|
||||
i10 += min;
|
||||
}
|
||||
i9++;
|
||||
i8 += min;
|
||||
}
|
||||
return bitMatrix;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
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
@@ -0,0 +1,25 @@
|
||||
package com.google.zxing.qrcode.detector;
|
||||
|
||||
import com.google.zxing.ResultPoint;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AlignmentPattern extends ResultPoint {
|
||||
private final float c;
|
||||
|
||||
AlignmentPattern(float f, float f2, float f3) {
|
||||
super(f, f2);
|
||||
this.c = f3;
|
||||
}
|
||||
|
||||
boolean a(float f, float f2, float f3) {
|
||||
if (Math.abs(f2 - b()) > f || Math.abs(f3 - a()) > f) {
|
||||
return false;
|
||||
}
|
||||
float abs = Math.abs(f - this.c);
|
||||
return abs <= 1.0f || abs <= this.c;
|
||||
}
|
||||
|
||||
AlignmentPattern b(float f, float f2, float f3) {
|
||||
return new AlignmentPattern((a() + f2) / 2.0f, (b() + f) / 2.0f, (this.c + f3) / 2.0f);
|
||||
}
|
||||
}
|
@@ -0,0 +1,268 @@
|
||||
package com.google.zxing.qrcode.detector;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AlignmentPatternFinder {
|
||||
private final BitMatrix a;
|
||||
private final int c;
|
||||
private final int d;
|
||||
private final int e;
|
||||
private final int f;
|
||||
private final float g;
|
||||
private final ResultPointCallback i;
|
||||
private final List<AlignmentPattern> b = new ArrayList(5);
|
||||
private final int[] h = new int[3];
|
||||
|
||||
AlignmentPatternFinder(BitMatrix bitMatrix, int i, int i2, int i3, int i4, float f, ResultPointCallback resultPointCallback) {
|
||||
this.a = bitMatrix;
|
||||
this.c = i;
|
||||
this.d = i2;
|
||||
this.e = i3;
|
||||
this.f = i4;
|
||||
this.g = f;
|
||||
this.i = resultPointCallback;
|
||||
}
|
||||
|
||||
AlignmentPattern a() throws NotFoundException {
|
||||
AlignmentPattern a;
|
||||
AlignmentPattern a2;
|
||||
int i = this.c;
|
||||
int i2 = this.f;
|
||||
int i3 = this.e + i;
|
||||
int i4 = this.d + (i2 / 2);
|
||||
int[] iArr = new int[3];
|
||||
for (int i5 = 0; i5 < i2; i5++) {
|
||||
int i6 = ((i5 & 1) == 0 ? (i5 + 1) / 2 : -((i5 + 1) / 2)) + i4;
|
||||
iArr[0] = 0;
|
||||
iArr[1] = 0;
|
||||
iArr[2] = 0;
|
||||
int i7 = i;
|
||||
while (i7 < i3 && !this.a.b(i7, i6)) {
|
||||
i7++;
|
||||
}
|
||||
int i8 = 0;
|
||||
while (i7 < i3) {
|
||||
if (!this.a.b(i7, i6)) {
|
||||
if (i8 == 1) {
|
||||
i8++;
|
||||
}
|
||||
iArr[i8] = iArr[i8] + 1;
|
||||
} else if (i8 == 1) {
|
||||
iArr[1] = iArr[1] + 1;
|
||||
} else if (i8 != 2) {
|
||||
i8++;
|
||||
iArr[i8] = iArr[i8] + 1;
|
||||
} else {
|
||||
if (a(iArr) && (a2 = a(iArr, i6, i7)) != null) {
|
||||
return a2;
|
||||
}
|
||||
iArr[0] = iArr[2];
|
||||
iArr[1] = 1;
|
||||
iArr[2] = 0;
|
||||
i8 = 1;
|
||||
}
|
||||
i7++;
|
||||
}
|
||||
if (a(iArr) && (a = a(iArr, i6, i3)) != null) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
if (this.b.isEmpty()) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
return this.b.get(0);
|
||||
}
|
||||
|
||||
private static float a(int[] iArr, int i) {
|
||||
return (i - iArr[2]) - (iArr[1] / 2.0f);
|
||||
}
|
||||
|
||||
private boolean a(int[] iArr) {
|
||||
float f = this.g;
|
||||
float f2 = f / 2.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (Math.abs(f - iArr[i]) >= f2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:34:0x0062, code lost:
|
||||
|
||||
if (r2[1] <= r12) goto L34;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:35:0x0065, code lost:
|
||||
|
||||
if (r10 >= r1) goto L60;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:37:0x006b, code lost:
|
||||
|
||||
if (r0.b(r11, r10) != false) goto L61;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:39:0x006f, code lost:
|
||||
|
||||
if (r2[2] > r12) goto L62;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:40:0x0071, code lost:
|
||||
|
||||
r2[2] = r2[2] + 1;
|
||||
r10 = r10 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:43:0x007b, code lost:
|
||||
|
||||
if (r2[2] <= r12) goto L43;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:44:0x007d, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:46:0x008f, code lost:
|
||||
|
||||
if ((java.lang.Math.abs(((r2[0] + r2[1]) + r2[2]) - r13) * 5) < (r13 * 2)) goto L46;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:47:0x0091, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:49:0x0096, code lost:
|
||||
|
||||
if (a(r2) == false) goto L50;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:51:0x009c, code lost:
|
||||
|
||||
return a(r2, r10);
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private float a(int r10, int r11, int r12, int r13) {
|
||||
/*
|
||||
r9 = this;
|
||||
com.google.zxing.common.BitMatrix r0 = r9.a
|
||||
int r1 = r0.i()
|
||||
int[] r2 = r9.h
|
||||
r3 = 0
|
||||
r2[r3] = r3
|
||||
r4 = 1
|
||||
r2[r4] = r3
|
||||
r5 = 2
|
||||
r2[r5] = r3
|
||||
r6 = r10
|
||||
L12:
|
||||
if (r6 < 0) goto L26
|
||||
boolean r7 = r0.b(r11, r6)
|
||||
if (r7 == 0) goto L26
|
||||
r7 = r2[r4]
|
||||
if (r7 > r12) goto L26
|
||||
r7 = r2[r4]
|
||||
int r7 = r7 + r4
|
||||
r2[r4] = r7
|
||||
int r6 = r6 + (-1)
|
||||
goto L12
|
||||
L26:
|
||||
r7 = 2143289344(0x7fc00000, float:NaN)
|
||||
if (r6 < 0) goto L9d
|
||||
r8 = r2[r4]
|
||||
if (r8 <= r12) goto L30
|
||||
goto L9d
|
||||
L30:
|
||||
if (r6 < 0) goto L44
|
||||
boolean r8 = r0.b(r11, r6)
|
||||
if (r8 != 0) goto L44
|
||||
r8 = r2[r3]
|
||||
if (r8 > r12) goto L44
|
||||
r8 = r2[r3]
|
||||
int r8 = r8 + r4
|
||||
r2[r3] = r8
|
||||
int r6 = r6 + (-1)
|
||||
goto L30
|
||||
L44:
|
||||
r6 = r2[r3]
|
||||
if (r6 <= r12) goto L49
|
||||
return r7
|
||||
L49:
|
||||
int r10 = r10 + r4
|
||||
L4a:
|
||||
if (r10 >= r1) goto L5e
|
||||
boolean r6 = r0.b(r11, r10)
|
||||
if (r6 == 0) goto L5e
|
||||
r6 = r2[r4]
|
||||
if (r6 > r12) goto L5e
|
||||
r6 = r2[r4]
|
||||
int r6 = r6 + r4
|
||||
r2[r4] = r6
|
||||
int r10 = r10 + 1
|
||||
goto L4a
|
||||
L5e:
|
||||
if (r10 == r1) goto L9d
|
||||
r6 = r2[r4]
|
||||
if (r6 <= r12) goto L65
|
||||
goto L9d
|
||||
L65:
|
||||
if (r10 >= r1) goto L79
|
||||
boolean r6 = r0.b(r11, r10)
|
||||
if (r6 != 0) goto L79
|
||||
r6 = r2[r5]
|
||||
if (r6 > r12) goto L79
|
||||
r6 = r2[r5]
|
||||
int r6 = r6 + r4
|
||||
r2[r5] = r6
|
||||
int r10 = r10 + 1
|
||||
goto L65
|
||||
L79:
|
||||
r11 = r2[r5]
|
||||
if (r11 <= r12) goto L7e
|
||||
return r7
|
||||
L7e:
|
||||
r11 = r2[r3]
|
||||
r12 = r2[r4]
|
||||
int r11 = r11 + r12
|
||||
r12 = r2[r5]
|
||||
int r11 = r11 + r12
|
||||
int r11 = r11 - r13
|
||||
int r11 = java.lang.Math.abs(r11)
|
||||
int r11 = r11 * 5
|
||||
int r13 = r13 * 2
|
||||
if (r11 < r13) goto L92
|
||||
return r7
|
||||
L92:
|
||||
boolean r11 = r9.a(r2)
|
||||
if (r11 == 0) goto L9d
|
||||
float r10 = a(r2, r10)
|
||||
return r10
|
||||
L9d:
|
||||
return r7
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.detector.AlignmentPatternFinder.a(int, int, int, int):float");
|
||||
}
|
||||
|
||||
private AlignmentPattern a(int[] iArr, int i, int i2) {
|
||||
int i3 = iArr[0] + iArr[1] + iArr[2];
|
||||
float a = a(iArr, i2);
|
||||
float a2 = a(i, (int) a, iArr[1] * 2, i3);
|
||||
if (Float.isNaN(a2)) {
|
||||
return null;
|
||||
}
|
||||
float f = ((iArr[0] + iArr[1]) + iArr[2]) / 3.0f;
|
||||
for (AlignmentPattern alignmentPattern : this.b) {
|
||||
if (alignmentPattern.a(f, a2, a)) {
|
||||
return alignmentPattern.b(a2, a, f);
|
||||
}
|
||||
}
|
||||
AlignmentPattern alignmentPattern2 = new AlignmentPattern(a, a2, f);
|
||||
this.b.add(alignmentPattern2);
|
||||
ResultPointCallback resultPointCallback = this.i;
|
||||
if (resultPointCallback == null) {
|
||||
return null;
|
||||
}
|
||||
resultPointCallback.a(alignmentPattern2);
|
||||
return null;
|
||||
}
|
||||
}
|
226
sources/com/google/zxing/qrcode/detector/Detector.java
Normal file
226
sources/com/google/zxing/qrcode/detector/Detector.java
Normal file
@@ -0,0 +1,226 @@
|
||||
package com.google.zxing.qrcode.detector;
|
||||
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.DetectorResult;
|
||||
import com.google.zxing.common.GridSampler;
|
||||
import com.google.zxing.common.PerspectiveTransform;
|
||||
import com.google.zxing.common.detector.MathUtils;
|
||||
import com.google.zxing.qrcode.decoder.Version;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Detector {
|
||||
private final BitMatrix a;
|
||||
private ResultPointCallback b;
|
||||
|
||||
public Detector(BitMatrix bitMatrix) {
|
||||
this.a = bitMatrix;
|
||||
}
|
||||
|
||||
private float b(int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
float f;
|
||||
float f2;
|
||||
float a = a(i, i2, i3, i4);
|
||||
int i6 = i - (i3 - i);
|
||||
int i7 = 0;
|
||||
if (i6 < 0) {
|
||||
f = i / (i - i6);
|
||||
i5 = 0;
|
||||
} else if (i6 >= this.a.k()) {
|
||||
f = ((this.a.k() - 1) - i) / (i6 - i);
|
||||
i5 = this.a.k() - 1;
|
||||
} else {
|
||||
i5 = i6;
|
||||
f = 1.0f;
|
||||
}
|
||||
float f3 = i2;
|
||||
int i8 = (int) (f3 - ((i4 - i2) * f));
|
||||
if (i8 < 0) {
|
||||
f2 = f3 / (i2 - i8);
|
||||
} else if (i8 >= this.a.i()) {
|
||||
f2 = ((this.a.i() - 1) - i2) / (i8 - i2);
|
||||
i7 = this.a.i() - 1;
|
||||
} else {
|
||||
i7 = i8;
|
||||
f2 = 1.0f;
|
||||
}
|
||||
return (a + a(i, i2, (int) (i + ((i5 - i) * f2)), i7)) - 1.0f;
|
||||
}
|
||||
|
||||
public final DetectorResult a(Map<DecodeHintType, ?> map) throws NotFoundException, FormatException {
|
||||
this.b = map == null ? null : (ResultPointCallback) map.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
||||
return a(new FinderPatternFinder(this.a, this.b).a(map));
|
||||
}
|
||||
|
||||
protected final DetectorResult a(FinderPatternInfo finderPatternInfo) throws NotFoundException, FormatException {
|
||||
FinderPattern b = finderPatternInfo.b();
|
||||
FinderPattern c = finderPatternInfo.c();
|
||||
FinderPattern a = finderPatternInfo.a();
|
||||
float a2 = a(b, c, a);
|
||||
if (a2 >= 1.0f) {
|
||||
int a3 = a(b, c, a, a2);
|
||||
Version b2 = Version.b(a3);
|
||||
int c2 = b2.c() - 7;
|
||||
AlignmentPattern alignmentPattern = null;
|
||||
if (b2.b().length > 0) {
|
||||
float a4 = (c.a() - b.a()) + a.a();
|
||||
float b3 = (c.b() - b.b()) + a.b();
|
||||
float f = 1.0f - (3.0f / c2);
|
||||
int a5 = (int) (b.a() + ((a4 - b.a()) * f));
|
||||
int b4 = (int) (b.b() + (f * (b3 - b.b())));
|
||||
for (int i = 4; i <= 16; i <<= 1) {
|
||||
try {
|
||||
alignmentPattern = a(a2, a5, b4, i);
|
||||
break;
|
||||
} catch (NotFoundException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new DetectorResult(a(this.a, a(b, c, a, alignmentPattern, a3), a3), alignmentPattern == null ? new ResultPoint[]{a, b, c} : new ResultPoint[]{a, b, c, alignmentPattern});
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static PerspectiveTransform a(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3, ResultPoint resultPoint4, int i) {
|
||||
float a;
|
||||
float b;
|
||||
float f;
|
||||
float f2 = i - 3.5f;
|
||||
if (resultPoint4 != null) {
|
||||
a = resultPoint4.a();
|
||||
b = resultPoint4.b();
|
||||
f = f2 - 3.0f;
|
||||
} else {
|
||||
a = (resultPoint2.a() - resultPoint.a()) + resultPoint3.a();
|
||||
b = (resultPoint2.b() - resultPoint.b()) + resultPoint3.b();
|
||||
f = f2;
|
||||
}
|
||||
return PerspectiveTransform.a(3.5f, 3.5f, f2, 3.5f, f, f, 3.5f, f2, resultPoint.a(), resultPoint.b(), resultPoint2.a(), resultPoint2.b(), a, b, resultPoint3.a(), resultPoint3.b());
|
||||
}
|
||||
|
||||
private static BitMatrix a(BitMatrix bitMatrix, PerspectiveTransform perspectiveTransform, int i) throws NotFoundException {
|
||||
return GridSampler.a().a(bitMatrix, i, i, perspectiveTransform);
|
||||
}
|
||||
|
||||
private static int a(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3, float f) throws NotFoundException {
|
||||
int a = ((MathUtils.a(ResultPoint.a(resultPoint, resultPoint2) / f) + MathUtils.a(ResultPoint.a(resultPoint, resultPoint3) / f)) / 2) + 7;
|
||||
int i = a & 3;
|
||||
if (i == 0) {
|
||||
return a + 1;
|
||||
}
|
||||
if (i == 2) {
|
||||
return a - 1;
|
||||
}
|
||||
if (i != 3) {
|
||||
return a;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
protected final float a(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3) {
|
||||
return (a(resultPoint, resultPoint2) + a(resultPoint, resultPoint3)) / 2.0f;
|
||||
}
|
||||
|
||||
private float a(ResultPoint resultPoint, ResultPoint resultPoint2) {
|
||||
float b = b((int) resultPoint.a(), (int) resultPoint.b(), (int) resultPoint2.a(), (int) resultPoint2.b());
|
||||
float b2 = b((int) resultPoint2.a(), (int) resultPoint2.b(), (int) resultPoint.a(), (int) resultPoint.b());
|
||||
return Float.isNaN(b) ? b2 / 7.0f : Float.isNaN(b2) ? b / 7.0f : (b + b2) / 14.0f;
|
||||
}
|
||||
|
||||
private float a(int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
int i6;
|
||||
int i7;
|
||||
int i8;
|
||||
int i9;
|
||||
Detector detector;
|
||||
boolean z;
|
||||
boolean z2;
|
||||
int i10 = 1;
|
||||
boolean z3 = Math.abs(i4 - i2) > Math.abs(i3 - i);
|
||||
if (z3) {
|
||||
i6 = i;
|
||||
i5 = i2;
|
||||
i8 = i3;
|
||||
i7 = i4;
|
||||
} else {
|
||||
i5 = i;
|
||||
i6 = i2;
|
||||
i7 = i3;
|
||||
i8 = i4;
|
||||
}
|
||||
int abs = Math.abs(i7 - i5);
|
||||
int abs2 = Math.abs(i8 - i6);
|
||||
int i11 = (-abs) / 2;
|
||||
int i12 = i5 < i7 ? 1 : -1;
|
||||
int i13 = i6 < i8 ? 1 : -1;
|
||||
int i14 = i7 + i12;
|
||||
int i15 = i6;
|
||||
int i16 = i11;
|
||||
int i17 = 0;
|
||||
int i18 = i5;
|
||||
while (true) {
|
||||
if (i18 == i14) {
|
||||
i9 = i14;
|
||||
break;
|
||||
}
|
||||
int i19 = z3 ? i15 : i18;
|
||||
int i20 = z3 ? i18 : i15;
|
||||
if (i17 == i10) {
|
||||
detector = this;
|
||||
z = z3;
|
||||
i9 = i14;
|
||||
z2 = true;
|
||||
} else {
|
||||
detector = this;
|
||||
z = z3;
|
||||
i9 = i14;
|
||||
z2 = false;
|
||||
}
|
||||
if (z2 == detector.a.b(i19, i20)) {
|
||||
if (i17 == 2) {
|
||||
return MathUtils.a(i18, i15, i5, i6);
|
||||
}
|
||||
i17++;
|
||||
}
|
||||
i16 += abs2;
|
||||
if (i16 > 0) {
|
||||
if (i15 == i8) {
|
||||
break;
|
||||
}
|
||||
i15 += i13;
|
||||
i16 -= abs;
|
||||
}
|
||||
i18 += i12;
|
||||
i14 = i9;
|
||||
z3 = z;
|
||||
i10 = 1;
|
||||
}
|
||||
if (i17 == 2) {
|
||||
return MathUtils.a(i9, i8, i5, i6);
|
||||
}
|
||||
return Float.NaN;
|
||||
}
|
||||
|
||||
protected final AlignmentPattern a(float f, int i, int i2, float f2) throws NotFoundException {
|
||||
int i3 = (int) (f2 * f);
|
||||
int max = Math.max(0, i - i3);
|
||||
int min = Math.min(this.a.k() - 1, i + i3) - max;
|
||||
float f3 = 3.0f * f;
|
||||
if (min >= f3) {
|
||||
int max2 = Math.max(0, i2 - i3);
|
||||
int min2 = Math.min(this.a.i() - 1, i2 + i3) - max2;
|
||||
if (min2 >= f3) {
|
||||
return new AlignmentPatternFinder(this.a, max, max2, min, min2, f, this.b).a();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
43
sources/com/google/zxing/qrcode/detector/FinderPattern.java
Normal file
43
sources/com/google/zxing/qrcode/detector/FinderPattern.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.google.zxing.qrcode.detector;
|
||||
|
||||
import com.google.zxing.ResultPoint;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class FinderPattern extends ResultPoint {
|
||||
private final float c;
|
||||
private final int d;
|
||||
|
||||
FinderPattern(float f, float f2, float f3) {
|
||||
this(f, f2, f3, 1);
|
||||
}
|
||||
|
||||
boolean a(float f, float f2, float f3) {
|
||||
if (Math.abs(f2 - b()) > f || Math.abs(f3 - a()) > f) {
|
||||
return false;
|
||||
}
|
||||
float abs = Math.abs(f - this.c);
|
||||
return abs <= 1.0f || abs <= this.c;
|
||||
}
|
||||
|
||||
FinderPattern b(float f, float f2, float f3) {
|
||||
int i = this.d;
|
||||
int i2 = i + 1;
|
||||
float a = (i * a()) + f2;
|
||||
float f4 = i2;
|
||||
return new FinderPattern(a / f4, ((this.d * b()) + f) / f4, ((this.d * this.c) + f3) / f4, i2);
|
||||
}
|
||||
|
||||
int c() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public float d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
private FinderPattern(float f, float f2, float f3, int i) {
|
||||
super(f, f2);
|
||||
this.c = f3;
|
||||
this.d = i;
|
||||
}
|
||||
}
|
@@ -0,0 +1,629 @@
|
||||
package com.google.zxing.qrcode.detector;
|
||||
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FinderPatternFinder {
|
||||
private final BitMatrix a;
|
||||
private boolean c;
|
||||
private final ResultPointCallback e;
|
||||
private final List<FinderPattern> b = new ArrayList();
|
||||
private final int[] d = new int[5];
|
||||
|
||||
private static final class CenterComparator implements Serializable, Comparator<FinderPattern> {
|
||||
private final float a;
|
||||
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(FinderPattern finderPattern, FinderPattern finderPattern2) {
|
||||
int compare = Integer.compare(finderPattern2.c(), finderPattern.c());
|
||||
return compare == 0 ? Float.compare(Math.abs(finderPattern.d() - this.a), Math.abs(finderPattern2.d() - this.a)) : compare;
|
||||
}
|
||||
|
||||
private CenterComparator(float f) {
|
||||
this.a = f;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class FurthestFromAverageComparator implements Serializable, Comparator<FinderPattern> {
|
||||
private final float a;
|
||||
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(FinderPattern finderPattern, FinderPattern finderPattern2) {
|
||||
return Float.compare(Math.abs(finderPattern2.d() - this.a), Math.abs(finderPattern.d() - this.a));
|
||||
}
|
||||
|
||||
private FurthestFromAverageComparator(float f) {
|
||||
this.a = f;
|
||||
}
|
||||
}
|
||||
|
||||
public FinderPatternFinder(BitMatrix bitMatrix, ResultPointCallback resultPointCallback) {
|
||||
this.a = bitMatrix;
|
||||
this.e = resultPointCallback;
|
||||
}
|
||||
|
||||
private int[] b() {
|
||||
a(this.d);
|
||||
return this.d;
|
||||
}
|
||||
|
||||
protected static boolean c(int[] iArr) {
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < 5; i2++) {
|
||||
int i3 = iArr[i2];
|
||||
if (i3 == 0) {
|
||||
return false;
|
||||
}
|
||||
i += i3;
|
||||
}
|
||||
if (i < 7) {
|
||||
return false;
|
||||
}
|
||||
float f = i / 7.0f;
|
||||
float f2 = f / 2.0f;
|
||||
return Math.abs(f - ((float) iArr[0])) < f2 && Math.abs(f - ((float) iArr[1])) < f2 && Math.abs((f * 3.0f) - ((float) iArr[2])) < 3.0f * f2 && Math.abs(f - ((float) iArr[3])) < f2 && Math.abs(f - ((float) iArr[4])) < f2;
|
||||
}
|
||||
|
||||
protected static boolean d(int[] iArr) {
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < 5; i2++) {
|
||||
int i3 = iArr[i2];
|
||||
if (i3 == 0) {
|
||||
return false;
|
||||
}
|
||||
i += i3;
|
||||
}
|
||||
if (i < 7) {
|
||||
return false;
|
||||
}
|
||||
float f = i / 7.0f;
|
||||
float f2 = f / 1.333f;
|
||||
return Math.abs(f - ((float) iArr[0])) < f2 && Math.abs(f - ((float) iArr[1])) < f2 && Math.abs((f * 3.0f) - ((float) iArr[2])) < 3.0f * f2 && Math.abs(f - ((float) iArr[3])) < f2 && Math.abs(f - ((float) iArr[4])) < f2;
|
||||
}
|
||||
|
||||
final FinderPatternInfo a(Map<DecodeHintType, ?> map) throws NotFoundException {
|
||||
boolean z = map != null && map.containsKey(DecodeHintType.TRY_HARDER);
|
||||
int i = this.a.i();
|
||||
int k = this.a.k();
|
||||
int i2 = (i * 3) / 388;
|
||||
if (i2 < 3 || z) {
|
||||
i2 = 3;
|
||||
}
|
||||
int[] iArr = new int[5];
|
||||
int i3 = i2 - 1;
|
||||
int i4 = i2;
|
||||
boolean z2 = false;
|
||||
while (i3 < i && !z2) {
|
||||
a(iArr);
|
||||
boolean z3 = z2;
|
||||
int i5 = i4;
|
||||
int i6 = 0;
|
||||
int i7 = 0;
|
||||
while (i6 < k) {
|
||||
if (this.a.b(i6, i3)) {
|
||||
if ((i7 & 1) == 1) {
|
||||
i7++;
|
||||
}
|
||||
iArr[i7] = iArr[i7] + 1;
|
||||
} else if ((i7 & 1) != 0) {
|
||||
iArr[i7] = iArr[i7] + 1;
|
||||
} else if (i7 == 4) {
|
||||
if (!c(iArr)) {
|
||||
b(iArr);
|
||||
} else if (a(iArr, i3, i6)) {
|
||||
if (this.c) {
|
||||
z3 = c();
|
||||
} else {
|
||||
int a = a();
|
||||
if (a > iArr[2]) {
|
||||
i3 += (a - iArr[2]) - 2;
|
||||
i6 = k - 1;
|
||||
}
|
||||
}
|
||||
a(iArr);
|
||||
i7 = 0;
|
||||
i5 = 2;
|
||||
} else {
|
||||
b(iArr);
|
||||
}
|
||||
i7 = 3;
|
||||
} else {
|
||||
i7++;
|
||||
iArr[i7] = iArr[i7] + 1;
|
||||
}
|
||||
i6++;
|
||||
}
|
||||
if (c(iArr) && a(iArr, i3, k)) {
|
||||
int i8 = iArr[0];
|
||||
if (this.c) {
|
||||
i4 = i8;
|
||||
z2 = c();
|
||||
i3 += i4;
|
||||
} else {
|
||||
i4 = i8;
|
||||
}
|
||||
} else {
|
||||
i4 = i5;
|
||||
}
|
||||
z2 = z3;
|
||||
i3 += i4;
|
||||
}
|
||||
FinderPattern[] d = d();
|
||||
ResultPoint.a(d);
|
||||
return new FinderPatternInfo(d);
|
||||
}
|
||||
|
||||
protected final void b(int[] iArr) {
|
||||
iArr[0] = iArr[2];
|
||||
iArr[1] = iArr[3];
|
||||
iArr[2] = iArr[4];
|
||||
iArr[3] = 1;
|
||||
iArr[4] = 0;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:21:0x003a, code lost:
|
||||
|
||||
if (r2[1] <= r13) goto L21;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:23:0x003f, code lost:
|
||||
|
||||
if (r3 < 0) goto L74;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:25:0x0045, code lost:
|
||||
|
||||
if (r0.b(r12, r3) == false) goto L72;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:27:0x0049, code lost:
|
||||
|
||||
if (r2[0] > r13) goto L73;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:28:0x004b, code lost:
|
||||
|
||||
r2[0] = r2[0] + 1;
|
||||
r3 = r3 - 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:31:0x0055, code lost:
|
||||
|
||||
if (r2[0] <= r13) goto L31;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:32:0x0057, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:33:0x0058, code lost:
|
||||
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:34:0x0059, code lost:
|
||||
|
||||
if (r11 >= r1) goto L75;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:36:0x005f, code lost:
|
||||
|
||||
if (r0.b(r12, r11) == false) goto L76;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:37:0x0061, code lost:
|
||||
|
||||
r2[2] = r2[2] + 1;
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:39:0x0069, code lost:
|
||||
|
||||
if (r11 != r1) goto L38;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:40:0x006b, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:42:0x006d, code lost:
|
||||
|
||||
if (r11 >= r1) goto L79;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:44:0x0073, code lost:
|
||||
|
||||
if (r0.b(r12, r11) != false) goto L77;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:46:0x0077, code lost:
|
||||
|
||||
if (r2[3] >= r13) goto L78;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:47:0x0079, code lost:
|
||||
|
||||
r2[3] = r2[3] + 1;
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:49:0x0081, code lost:
|
||||
|
||||
if (r11 == r1) goto L66;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:51:0x0085, code lost:
|
||||
|
||||
if (r2[3] < r13) goto L49;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:53:0x0089, code lost:
|
||||
|
||||
if (r11 >= r1) goto L81;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:55:0x008f, code lost:
|
||||
|
||||
if (r0.b(r12, r11) == false) goto L82;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:57:0x0093, code lost:
|
||||
|
||||
if (r2[4] >= r13) goto L80;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:58:0x0095, code lost:
|
||||
|
||||
r2[4] = r2[4] + 1;
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:61:0x009f, code lost:
|
||||
|
||||
if (r2[4] < r13) goto L59;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:62:0x00a1, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:64:0x00b9, code lost:
|
||||
|
||||
if ((java.lang.Math.abs(((((r2[0] + r2[1]) + r2[2]) + r2[3]) + r2[4]) - r14) * 5) < (r14 * 2)) goto L62;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:65:0x00bb, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:67:0x00c0, code lost:
|
||||
|
||||
if (c(r2) == false) goto L66;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:69:0x00c6, code lost:
|
||||
|
||||
return a(r2, r11);
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private float b(int r11, int r12, int r13, int r14) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 200
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.detector.FinderPatternFinder.b(int, int, int, int):float");
|
||||
}
|
||||
|
||||
private boolean c() {
|
||||
int size = this.b.size();
|
||||
float f = 0.0f;
|
||||
int i = 0;
|
||||
float f2 = 0.0f;
|
||||
for (FinderPattern finderPattern : this.b) {
|
||||
if (finderPattern.c() >= 2) {
|
||||
i++;
|
||||
f2 += finderPattern.d();
|
||||
}
|
||||
}
|
||||
if (i < 3) {
|
||||
return false;
|
||||
}
|
||||
float f3 = f2 / size;
|
||||
Iterator<FinderPattern> it = this.b.iterator();
|
||||
while (it.hasNext()) {
|
||||
f += Math.abs(it.next().d() - f3);
|
||||
}
|
||||
return f <= f2 * 0.05f;
|
||||
}
|
||||
|
||||
private FinderPattern[] d() throws NotFoundException {
|
||||
int size = this.b.size();
|
||||
if (size >= 3) {
|
||||
float f = 0.0f;
|
||||
if (size > 3) {
|
||||
Iterator<FinderPattern> it = this.b.iterator();
|
||||
float f2 = 0.0f;
|
||||
float f3 = 0.0f;
|
||||
while (it.hasNext()) {
|
||||
float d = it.next().d();
|
||||
f2 += d;
|
||||
f3 += d * d;
|
||||
}
|
||||
float f4 = f2 / size;
|
||||
float sqrt = (float) Math.sqrt((f3 / r0) - (f4 * f4));
|
||||
Collections.sort(this.b, new FurthestFromAverageComparator(f4));
|
||||
float max = Math.max(0.2f * f4, sqrt);
|
||||
int i = 0;
|
||||
while (i < this.b.size() && this.b.size() > 3) {
|
||||
if (Math.abs(this.b.get(i).d() - f4) > max) {
|
||||
this.b.remove(i);
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (this.b.size() > 3) {
|
||||
Iterator<FinderPattern> it2 = this.b.iterator();
|
||||
while (it2.hasNext()) {
|
||||
f += it2.next().d();
|
||||
}
|
||||
Collections.sort(this.b, new CenterComparator(f / this.b.size()));
|
||||
List<FinderPattern> list = this.b;
|
||||
list.subList(3, list.size()).clear();
|
||||
}
|
||||
return new FinderPattern[]{this.b.get(0), this.b.get(1), this.b.get(2)};
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static float a(int[] iArr, int i) {
|
||||
return ((i - iArr[4]) - iArr[3]) - (iArr[2] / 2.0f);
|
||||
}
|
||||
|
||||
protected final void a(int[] iArr) {
|
||||
for (int i = 0; i < iArr.length; i++) {
|
||||
iArr[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(int i, int i2) {
|
||||
int i3;
|
||||
int i4;
|
||||
int i5;
|
||||
int[] b = b();
|
||||
int i6 = 0;
|
||||
while (i >= i6 && i2 >= i6 && this.a.b(i2 - i6, i - i6)) {
|
||||
b[2] = b[2] + 1;
|
||||
i6++;
|
||||
}
|
||||
if (b[2] == 0) {
|
||||
return false;
|
||||
}
|
||||
while (i >= i6 && i2 >= i6 && !this.a.b(i2 - i6, i - i6)) {
|
||||
b[1] = b[1] + 1;
|
||||
i6++;
|
||||
}
|
||||
if (b[1] == 0) {
|
||||
return false;
|
||||
}
|
||||
while (i >= i6 && i2 >= i6 && this.a.b(i2 - i6, i - i6)) {
|
||||
b[0] = b[0] + 1;
|
||||
i6++;
|
||||
}
|
||||
if (b[0] == 0) {
|
||||
return false;
|
||||
}
|
||||
int i7 = this.a.i();
|
||||
int k = this.a.k();
|
||||
int i8 = 1;
|
||||
while (true) {
|
||||
int i9 = i + i8;
|
||||
if (i9 >= i7 || (i5 = i2 + i8) >= k || !this.a.b(i5, i9)) {
|
||||
break;
|
||||
}
|
||||
b[2] = b[2] + 1;
|
||||
i8++;
|
||||
}
|
||||
while (true) {
|
||||
int i10 = i + i8;
|
||||
if (i10 >= i7 || (i4 = i2 + i8) >= k || this.a.b(i4, i10)) {
|
||||
break;
|
||||
}
|
||||
b[3] = b[3] + 1;
|
||||
i8++;
|
||||
}
|
||||
if (b[3] == 0) {
|
||||
return false;
|
||||
}
|
||||
while (true) {
|
||||
int i11 = i + i8;
|
||||
if (i11 >= i7 || (i3 = i2 + i8) >= k || !this.a.b(i3, i11)) {
|
||||
break;
|
||||
}
|
||||
b[4] = b[4] + 1;
|
||||
i8++;
|
||||
}
|
||||
if (b[4] == 0) {
|
||||
return false;
|
||||
}
|
||||
return d(b);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:21:0x003a, code lost:
|
||||
|
||||
if (r2[1] <= r13) goto L21;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:23:0x003f, code lost:
|
||||
|
||||
if (r3 < 0) goto L74;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:25:0x0045, code lost:
|
||||
|
||||
if (r0.b(r3, r12) == false) goto L72;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:27:0x0049, code lost:
|
||||
|
||||
if (r2[0] > r13) goto L73;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:28:0x004b, code lost:
|
||||
|
||||
r2[0] = r2[0] + 1;
|
||||
r3 = r3 - 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:31:0x0055, code lost:
|
||||
|
||||
if (r2[0] <= r13) goto L31;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:32:0x0057, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:33:0x0058, code lost:
|
||||
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:34:0x0059, code lost:
|
||||
|
||||
if (r11 >= r1) goto L75;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:36:0x005f, code lost:
|
||||
|
||||
if (r0.b(r11, r12) == false) goto L76;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:37:0x0061, code lost:
|
||||
|
||||
r2[2] = r2[2] + 1;
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:39:0x0069, code lost:
|
||||
|
||||
if (r11 != r1) goto L38;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:40:0x006b, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:42:0x006d, code lost:
|
||||
|
||||
if (r11 >= r1) goto L79;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:44:0x0073, code lost:
|
||||
|
||||
if (r0.b(r11, r12) != false) goto L77;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:46:0x0077, code lost:
|
||||
|
||||
if (r2[3] >= r13) goto L78;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:47:0x0079, code lost:
|
||||
|
||||
r2[3] = r2[3] + 1;
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:49:0x0081, code lost:
|
||||
|
||||
if (r11 == r1) goto L66;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:51:0x0085, code lost:
|
||||
|
||||
if (r2[3] < r13) goto L49;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:53:0x0089, code lost:
|
||||
|
||||
if (r11 >= r1) goto L81;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:55:0x008f, code lost:
|
||||
|
||||
if (r0.b(r11, r12) == false) goto L82;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:57:0x0093, code lost:
|
||||
|
||||
if (r2[4] >= r13) goto L80;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:58:0x0095, code lost:
|
||||
|
||||
r2[4] = r2[4] + 1;
|
||||
r11 = r11 + 1;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:61:0x009f, code lost:
|
||||
|
||||
if (r2[4] < r13) goto L59;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:62:0x00a1, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:64:0x00b7, code lost:
|
||||
|
||||
if ((java.lang.Math.abs(((((r2[0] + r2[1]) + r2[2]) + r2[3]) + r2[4]) - r14) * 5) < r14) goto L62;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:65:0x00b9, code lost:
|
||||
|
||||
return Float.NaN;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:67:0x00be, code lost:
|
||||
|
||||
if (c(r2) == false) goto L66;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:69:0x00c4, code lost:
|
||||
|
||||
return a(r2, r11);
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private float a(int r11, int r12, int r13, int r14) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 198
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.detector.FinderPatternFinder.a(int, int, int, int):float");
|
||||
}
|
||||
|
||||
protected final boolean a(int[] iArr, int i, int i2) {
|
||||
boolean z = false;
|
||||
int i3 = iArr[0] + iArr[1] + iArr[2] + iArr[3] + iArr[4];
|
||||
int a = (int) a(iArr, i2);
|
||||
float b = b(i, a, iArr[2], i3);
|
||||
if (!Float.isNaN(b)) {
|
||||
int i4 = (int) b;
|
||||
float a2 = a(a, i4, iArr[2], i3);
|
||||
if (!Float.isNaN(a2) && a(i4, (int) a2)) {
|
||||
float f = i3 / 7.0f;
|
||||
int i5 = 0;
|
||||
while (true) {
|
||||
if (i5 >= this.b.size()) {
|
||||
break;
|
||||
}
|
||||
FinderPattern finderPattern = this.b.get(i5);
|
||||
if (finderPattern.a(f, b, a2)) {
|
||||
this.b.set(i5, finderPattern.b(b, a2, f));
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
if (!z) {
|
||||
FinderPattern finderPattern2 = new FinderPattern(a2, b, f);
|
||||
this.b.add(finderPattern2);
|
||||
ResultPointCallback resultPointCallback = this.e;
|
||||
if (resultPointCallback != null) {
|
||||
resultPointCallback.a(finderPattern2);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int a() {
|
||||
if (this.b.size() <= 1) {
|
||||
return 0;
|
||||
}
|
||||
FinderPattern finderPattern = null;
|
||||
for (FinderPattern finderPattern2 : this.b) {
|
||||
if (finderPattern2.c() >= 2) {
|
||||
if (finderPattern != null) {
|
||||
this.c = true;
|
||||
return ((int) (Math.abs(finderPattern.a() - finderPattern2.a()) - Math.abs(finderPattern.b() - finderPattern2.b()))) / 2;
|
||||
}
|
||||
finderPattern = finderPattern2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.google.zxing.qrcode.detector;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class FinderPatternInfo {
|
||||
private final FinderPattern a;
|
||||
private final FinderPattern b;
|
||||
private final FinderPattern c;
|
||||
|
||||
public FinderPatternInfo(FinderPattern[] finderPatternArr) {
|
||||
this.a = finderPatternArr[0];
|
||||
this.b = finderPatternArr[1];
|
||||
this.c = finderPatternArr[2];
|
||||
}
|
||||
|
||||
public FinderPattern a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public FinderPattern b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public FinderPattern c() {
|
||||
return this.c;
|
||||
}
|
||||
}
|
20
sources/com/google/zxing/qrcode/encoder/BlockPair.java
Normal file
20
sources/com/google/zxing/qrcode/encoder/BlockPair.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.google.zxing.qrcode.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BlockPair {
|
||||
private final byte[] a;
|
||||
private final byte[] b;
|
||||
|
||||
BlockPair(byte[] bArr, byte[] bArr2) {
|
||||
this.a = bArr;
|
||||
this.b = bArr2;
|
||||
}
|
||||
|
||||
public byte[] a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public byte[] b() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
66
sources/com/google/zxing/qrcode/encoder/ByteMatrix.java
Normal file
66
sources/com/google/zxing/qrcode/encoder/ByteMatrix.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.google.zxing.qrcode.encoder;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ByteMatrix {
|
||||
private final byte[][] a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
|
||||
public ByteMatrix(int i, int i2) {
|
||||
this.a = (byte[][]) Array.newInstance((Class<?>) byte.class, i2, i);
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
}
|
||||
|
||||
public byte a(int i, int i2) {
|
||||
return this.a[i2][i];
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder((this.b * 2 * this.c) + 2);
|
||||
for (int i = 0; i < this.c; i++) {
|
||||
byte[] bArr = this.a[i];
|
||||
for (int i2 = 0; i2 < this.b; i2++) {
|
||||
byte b = bArr[i2];
|
||||
if (b == 0) {
|
||||
sb.append(" 0");
|
||||
} else if (b != 1) {
|
||||
sb.append(" ");
|
||||
} else {
|
||||
sb.append(" 1");
|
||||
}
|
||||
}
|
||||
sb.append('\n');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public byte[][] a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(int i, int i2, int i3) {
|
||||
this.a[i2][i] = (byte) i3;
|
||||
}
|
||||
|
||||
public void a(int i, int i2, boolean z) {
|
||||
this.a[i2][i] = z ? (byte) 1 : (byte) 0;
|
||||
}
|
||||
|
||||
public void a(byte b) {
|
||||
for (byte[] bArr : this.a) {
|
||||
Arrays.fill(bArr, b);
|
||||
}
|
||||
}
|
||||
}
|
459
sources/com/google/zxing/qrcode/encoder/Encoder.java
Normal file
459
sources/com/google/zxing/qrcode/encoder/Encoder.java
Normal file
@@ -0,0 +1,459 @@
|
||||
package com.google.zxing.qrcode.encoder;
|
||||
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.google.zxing.common.CharacterSetECI;
|
||||
import com.google.zxing.common.reedsolomon.GenericGF;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.google.zxing.qrcode.decoder.Mode;
|
||||
import com.google.zxing.qrcode.decoder.Version;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Encoder {
|
||||
private static final int[] a = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1};
|
||||
|
||||
/* renamed from: com.google.zxing.qrcode.encoder.Encoder$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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(ByteMatrix byteMatrix) {
|
||||
return MaskUtil.a(byteMatrix) + MaskUtil.b(byteMatrix) + MaskUtil.c(byteMatrix) + MaskUtil.d(byteMatrix);
|
||||
}
|
||||
|
||||
static void b(CharSequence charSequence, BitArray bitArray) {
|
||||
int length = charSequence.length();
|
||||
int i = 0;
|
||||
while (i < length) {
|
||||
int charAt = charSequence.charAt(i) - '0';
|
||||
int i2 = i + 2;
|
||||
if (i2 < length) {
|
||||
bitArray.a((charAt * 100) + ((charSequence.charAt(i + 1) - '0') * 10) + (charSequence.charAt(i2) - '0'), 10);
|
||||
i += 3;
|
||||
} else {
|
||||
i++;
|
||||
if (i < length) {
|
||||
bitArray.a((charAt * 10) + (charSequence.charAt(i) - '0'), 7);
|
||||
i = i2;
|
||||
} else {
|
||||
bitArray.a(charAt, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static QRCode a(String str, ErrorCorrectionLevel errorCorrectionLevel, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
Version a2;
|
||||
CharacterSetECI characterSetECIByName;
|
||||
boolean z = map != null && map.containsKey(EncodeHintType.CHARACTER_SET);
|
||||
String obj = z ? map.get(EncodeHintType.CHARACTER_SET).toString() : "ISO-8859-1";
|
||||
Mode a3 = a(str, obj);
|
||||
BitArray bitArray = new BitArray();
|
||||
if (a3 == Mode.BYTE && z && (characterSetECIByName = CharacterSetECI.getCharacterSetECIByName(obj)) != null) {
|
||||
a(characterSetECIByName, bitArray);
|
||||
}
|
||||
if ((map != null && map.containsKey(EncodeHintType.GS1_FORMAT)) && Boolean.valueOf(map.get(EncodeHintType.GS1_FORMAT).toString()).booleanValue()) {
|
||||
a(Mode.FNC1_FIRST_POSITION, bitArray);
|
||||
}
|
||||
a(a3, bitArray);
|
||||
BitArray bitArray2 = new BitArray();
|
||||
a(str, a3, bitArray2, obj);
|
||||
if (map != null && map.containsKey(EncodeHintType.QR_VERSION)) {
|
||||
a2 = Version.c(Integer.parseInt(map.get(EncodeHintType.QR_VERSION).toString()));
|
||||
if (!a(a(a3, bitArray, bitArray2, a2), a2, errorCorrectionLevel)) {
|
||||
throw new WriterException("Data too big for requested version");
|
||||
}
|
||||
} else {
|
||||
a2 = a(errorCorrectionLevel, a3, bitArray, bitArray2);
|
||||
}
|
||||
BitArray bitArray3 = new BitArray();
|
||||
bitArray3.a(bitArray);
|
||||
a(a3 == Mode.BYTE ? bitArray2.i() : str.length(), a2, a3, bitArray3);
|
||||
bitArray3.a(bitArray2);
|
||||
Version.ECBlocks a4 = a2.a(errorCorrectionLevel);
|
||||
int d = a2.d() - a4.d();
|
||||
a(d, bitArray3);
|
||||
BitArray a5 = a(bitArray3, a2.d(), d, a4.c());
|
||||
QRCode qRCode = new QRCode();
|
||||
qRCode.a(errorCorrectionLevel);
|
||||
qRCode.a(a3);
|
||||
qRCode.a(a2);
|
||||
int c = a2.c();
|
||||
ByteMatrix byteMatrix = new ByteMatrix(c, c);
|
||||
int a6 = a(a5, errorCorrectionLevel, a2, byteMatrix);
|
||||
qRCode.a(a6);
|
||||
MatrixUtil.a(a5, errorCorrectionLevel, a2, a6, byteMatrix);
|
||||
qRCode.a(byteMatrix);
|
||||
return qRCode;
|
||||
}
|
||||
|
||||
private static Version a(ErrorCorrectionLevel errorCorrectionLevel, Mode mode, BitArray bitArray, BitArray bitArray2) throws WriterException {
|
||||
return a(a(mode, bitArray, bitArray2, a(a(mode, bitArray, bitArray2, Version.c(1)), errorCorrectionLevel)), errorCorrectionLevel);
|
||||
}
|
||||
|
||||
private static int a(Mode mode, BitArray bitArray, BitArray bitArray2, Version version) {
|
||||
return bitArray.h() + mode.getCharacterCountBits(version) + bitArray2.h();
|
||||
}
|
||||
|
||||
static int a(int i) {
|
||||
int[] iArr = a;
|
||||
if (i < iArr.length) {
|
||||
return iArr[i];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static Mode a(String str, String str2) {
|
||||
if ("Shift_JIS".equals(str2) && a(str)) {
|
||||
return Mode.KANJI;
|
||||
}
|
||||
boolean z = false;
|
||||
boolean z2 = false;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char charAt = str.charAt(i);
|
||||
if (charAt >= '0' && charAt <= '9') {
|
||||
z2 = true;
|
||||
} else {
|
||||
if (a(charAt) == -1) {
|
||||
return Mode.BYTE;
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
return Mode.ALPHANUMERIC;
|
||||
}
|
||||
if (z2) {
|
||||
return Mode.NUMERIC;
|
||||
}
|
||||
return Mode.BYTE;
|
||||
}
|
||||
|
||||
private static boolean a(String str) {
|
||||
try {
|
||||
byte[] bytes = str.getBytes("Shift_JIS");
|
||||
int length = bytes.length;
|
||||
if (length % 2 != 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length; i += 2) {
|
||||
int i2 = bytes[i] & 255;
|
||||
if ((i2 < 129 || i2 > 159) && (i2 < 224 || i2 > 235)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(BitArray bitArray, ErrorCorrectionLevel errorCorrectionLevel, Version version, ByteMatrix byteMatrix) throws WriterException {
|
||||
int i = Integer.MAX_VALUE;
|
||||
int i2 = -1;
|
||||
for (int i3 = 0; i3 < 8; i3++) {
|
||||
MatrixUtil.a(bitArray, errorCorrectionLevel, version, i3, byteMatrix);
|
||||
int a2 = a(byteMatrix);
|
||||
if (a2 < i) {
|
||||
i2 = i3;
|
||||
i = a2;
|
||||
}
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
|
||||
private static Version a(int i, ErrorCorrectionLevel errorCorrectionLevel) throws WriterException {
|
||||
for (int i2 = 1; i2 <= 40; i2++) {
|
||||
Version c = Version.c(i2);
|
||||
if (a(i, c, errorCorrectionLevel)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
throw new WriterException("Data too big");
|
||||
}
|
||||
|
||||
private static boolean a(int i, Version version, ErrorCorrectionLevel errorCorrectionLevel) {
|
||||
return version.d() - version.a(errorCorrectionLevel).d() >= (i + 7) / 8;
|
||||
}
|
||||
|
||||
static void a(int i, BitArray bitArray) throws WriterException {
|
||||
int i2 = i << 3;
|
||||
if (bitArray.h() <= i2) {
|
||||
for (int i3 = 0; i3 < 4 && bitArray.h() < i2; i3++) {
|
||||
bitArray.a(false);
|
||||
}
|
||||
int h = bitArray.h() & 7;
|
||||
if (h > 0) {
|
||||
while (h < 8) {
|
||||
bitArray.a(false);
|
||||
h++;
|
||||
}
|
||||
}
|
||||
int i4 = i - bitArray.i();
|
||||
for (int i5 = 0; i5 < i4; i5++) {
|
||||
bitArray.a((i5 & 1) == 0 ? 236 : 17, 8);
|
||||
}
|
||||
if (bitArray.h() != i2) {
|
||||
throw new WriterException("Bits size does not equal capacity");
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new WriterException("data bits cannot fit in the QR Code" + bitArray.h() + " > " + i2);
|
||||
}
|
||||
|
||||
static void a(int i, int i2, int i3, int i4, int[] iArr, int[] iArr2) throws WriterException {
|
||||
if (i4 < i3) {
|
||||
int i5 = i % i3;
|
||||
int i6 = i3 - i5;
|
||||
int i7 = i / i3;
|
||||
int i8 = i7 + 1;
|
||||
int i9 = i2 / i3;
|
||||
int i10 = i9 + 1;
|
||||
int i11 = i7 - i9;
|
||||
int i12 = i8 - i10;
|
||||
if (i11 != i12) {
|
||||
throw new WriterException("EC bytes mismatch");
|
||||
}
|
||||
if (i3 != i6 + i5) {
|
||||
throw new WriterException("RS blocks mismatch");
|
||||
}
|
||||
if (i != ((i9 + i11) * i6) + ((i10 + i12) * i5)) {
|
||||
throw new WriterException("Total bytes mismatch");
|
||||
}
|
||||
if (i4 < i6) {
|
||||
iArr[0] = i9;
|
||||
iArr2[0] = i11;
|
||||
return;
|
||||
} else {
|
||||
iArr[0] = i10;
|
||||
iArr2[0] = i12;
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new WriterException("Block ID too large");
|
||||
}
|
||||
|
||||
static BitArray a(BitArray bitArray, int i, int i2, int i3) throws WriterException {
|
||||
if (bitArray.i() == i2) {
|
||||
ArrayList arrayList = new ArrayList(i3);
|
||||
int i4 = 0;
|
||||
int i5 = 0;
|
||||
int i6 = 0;
|
||||
for (int i7 = 0; i7 < i3; i7++) {
|
||||
int[] iArr = new int[1];
|
||||
int[] iArr2 = new int[1];
|
||||
a(i, i2, i3, i7, iArr, iArr2);
|
||||
int i8 = iArr[0];
|
||||
byte[] bArr = new byte[i8];
|
||||
bitArray.a(i4 << 3, bArr, 0, i8);
|
||||
byte[] a2 = a(bArr, iArr2[0]);
|
||||
arrayList.add(new BlockPair(bArr, a2));
|
||||
i5 = Math.max(i5, i8);
|
||||
i6 = Math.max(i6, a2.length);
|
||||
i4 += iArr[0];
|
||||
}
|
||||
if (i2 == i4) {
|
||||
BitArray bitArray2 = new BitArray();
|
||||
for (int i9 = 0; i9 < i5; i9++) {
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
byte[] a3 = ((BlockPair) it.next()).a();
|
||||
if (i9 < a3.length) {
|
||||
bitArray2.a(a3[i9], 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i10 = 0; i10 < i6; i10++) {
|
||||
Iterator it2 = arrayList.iterator();
|
||||
while (it2.hasNext()) {
|
||||
byte[] b = ((BlockPair) it2.next()).b();
|
||||
if (i10 < b.length) {
|
||||
bitArray2.a(b[i10], 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == bitArray2.i()) {
|
||||
return bitArray2;
|
||||
}
|
||||
throw new WriterException("Interleaving error: " + i + " and " + bitArray2.i() + " differ.");
|
||||
}
|
||||
throw new WriterException("Data bytes does not match offset");
|
||||
}
|
||||
throw new WriterException("Number of bits and data bytes does not match");
|
||||
}
|
||||
|
||||
static byte[] a(byte[] bArr, int i) {
|
||||
int length = bArr.length;
|
||||
int[] iArr = new int[length + i];
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
iArr[i2] = bArr[i2] & 255;
|
||||
}
|
||||
new ReedSolomonEncoder(GenericGF.l).a(iArr, i);
|
||||
byte[] bArr2 = new byte[i];
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
bArr2[i3] = (byte) iArr[length + i3];
|
||||
}
|
||||
return bArr2;
|
||||
}
|
||||
|
||||
static void a(Mode mode, BitArray bitArray) {
|
||||
bitArray.a(mode.getBits(), 4);
|
||||
}
|
||||
|
||||
static void a(int i, Version version, Mode mode, BitArray bitArray) throws WriterException {
|
||||
int characterCountBits = mode.getCharacterCountBits(version);
|
||||
int i2 = 1 << characterCountBits;
|
||||
if (i < i2) {
|
||||
bitArray.a(i, characterCountBits);
|
||||
return;
|
||||
}
|
||||
throw new WriterException(i + " is bigger than " + (i2 - 1));
|
||||
}
|
||||
|
||||
static void a(String str, Mode mode, BitArray bitArray, String str2) throws WriterException {
|
||||
int i = AnonymousClass1.a[mode.ordinal()];
|
||||
if (i == 1) {
|
||||
b(str, bitArray);
|
||||
return;
|
||||
}
|
||||
if (i == 2) {
|
||||
a((CharSequence) str, bitArray);
|
||||
} else if (i == 3) {
|
||||
a(str, bitArray, str2);
|
||||
} else {
|
||||
if (i == 4) {
|
||||
a(str, bitArray);
|
||||
return;
|
||||
}
|
||||
throw new WriterException("Invalid mode: ".concat(String.valueOf(mode)));
|
||||
}
|
||||
}
|
||||
|
||||
static void a(CharSequence charSequence, BitArray bitArray) throws WriterException {
|
||||
int length = charSequence.length();
|
||||
int i = 0;
|
||||
while (i < length) {
|
||||
int a2 = a(charSequence.charAt(i));
|
||||
if (a2 == -1) {
|
||||
throw new WriterException();
|
||||
}
|
||||
int i2 = i + 1;
|
||||
if (i2 < length) {
|
||||
int a3 = a(charSequence.charAt(i2));
|
||||
if (a3 != -1) {
|
||||
bitArray.a((a2 * 45) + a3, 11);
|
||||
i += 2;
|
||||
} else {
|
||||
throw new WriterException();
|
||||
}
|
||||
} else {
|
||||
bitArray.a(a2, 6);
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void a(String str, BitArray bitArray, String str2) throws WriterException {
|
||||
try {
|
||||
for (byte b : str.getBytes(str2)) {
|
||||
bitArray.a(b, 8);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new WriterException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0035 A[LOOP:0: B:4:0x0008->B:11:0x0035, LOOP_END] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:12:0x0044 A[SYNTHETIC] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
static void a(java.lang.String r6, com.google.zxing.common.BitArray r7) throws com.google.zxing.WriterException {
|
||||
/*
|
||||
java.lang.String r0 = "Shift_JIS"
|
||||
byte[] r6 = r6.getBytes(r0) // Catch: java.io.UnsupportedEncodingException -> L4d
|
||||
int r0 = r6.length
|
||||
r1 = 0
|
||||
L8:
|
||||
if (r1 >= r0) goto L4c
|
||||
r2 = r6[r1]
|
||||
r2 = r2 & 255(0xff, float:3.57E-43)
|
||||
int r3 = r1 + 1
|
||||
r3 = r6[r3]
|
||||
r3 = r3 & 255(0xff, float:3.57E-43)
|
||||
int r2 = r2 << 8
|
||||
r2 = r2 | r3
|
||||
r3 = 33088(0x8140, float:4.6366E-41)
|
||||
r4 = -1
|
||||
if (r2 < r3) goto L24
|
||||
r5 = 40956(0x9ffc, float:5.7392E-41)
|
||||
if (r2 > r5) goto L24
|
||||
L22:
|
||||
int r2 = r2 - r3
|
||||
goto L33
|
||||
L24:
|
||||
r3 = 57408(0xe040, float:8.0446E-41)
|
||||
if (r2 < r3) goto L32
|
||||
r3 = 60351(0xebbf, float:8.457E-41)
|
||||
if (r2 > r3) goto L32
|
||||
r3 = 49472(0xc140, float:6.9325E-41)
|
||||
goto L22
|
||||
L32:
|
||||
r2 = -1
|
||||
L33:
|
||||
if (r2 == r4) goto L44
|
||||
int r3 = r2 >> 8
|
||||
int r3 = r3 * 192
|
||||
r2 = r2 & 255(0xff, float:3.57E-43)
|
||||
int r3 = r3 + r2
|
||||
r2 = 13
|
||||
r7.a(r3, r2)
|
||||
int r1 = r1 + 2
|
||||
goto L8
|
||||
L44:
|
||||
com.google.zxing.WriterException r6 = new com.google.zxing.WriterException
|
||||
java.lang.String r7 = "Invalid byte sequence"
|
||||
r6.<init>(r7)
|
||||
throw r6
|
||||
L4c:
|
||||
return
|
||||
L4d:
|
||||
r6 = move-exception
|
||||
com.google.zxing.WriterException r7 = new com.google.zxing.WriterException
|
||||
r7.<init>(r6)
|
||||
throw r7
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.encoder.Encoder.a(java.lang.String, com.google.zxing.common.BitArray):void");
|
||||
}
|
||||
|
||||
private static void a(CharacterSetECI characterSetECI, BitArray bitArray) {
|
||||
bitArray.a(Mode.ECI.getBits(), 4);
|
||||
bitArray.a(characterSetECI.getValue(), 8);
|
||||
}
|
||||
}
|
204
sources/com/google/zxing/qrcode/encoder/MaskUtil.java
Normal file
204
sources/com/google/zxing/qrcode/encoder/MaskUtil.java
Normal file
@@ -0,0 +1,204 @@
|
||||
package com.google.zxing.qrcode.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class MaskUtil {
|
||||
static int a(ByteMatrix byteMatrix) {
|
||||
return a(byteMatrix, true) + a(byteMatrix, false);
|
||||
}
|
||||
|
||||
static int b(ByteMatrix byteMatrix) {
|
||||
byte[][] a = byteMatrix.a();
|
||||
int c = byteMatrix.c();
|
||||
int b = byteMatrix.b();
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
while (i < b - 1) {
|
||||
byte[] bArr = a[i];
|
||||
int i3 = i2;
|
||||
int i4 = 0;
|
||||
while (i4 < c - 1) {
|
||||
byte b2 = bArr[i4];
|
||||
int i5 = i4 + 1;
|
||||
if (b2 == bArr[i5]) {
|
||||
int i6 = i + 1;
|
||||
if (b2 == a[i6][i4] && b2 == a[i6][i5]) {
|
||||
i3++;
|
||||
}
|
||||
}
|
||||
i4 = i5;
|
||||
}
|
||||
i++;
|
||||
i2 = i3;
|
||||
}
|
||||
return i2 * 3;
|
||||
}
|
||||
|
||||
static int c(ByteMatrix byteMatrix) {
|
||||
byte[][] a = byteMatrix.a();
|
||||
int c = byteMatrix.c();
|
||||
int b = byteMatrix.b();
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
while (i < b) {
|
||||
int i3 = i2;
|
||||
for (int i4 = 0; i4 < c; i4++) {
|
||||
byte[] bArr = a[i];
|
||||
int i5 = i4 + 6;
|
||||
if (i5 < c && bArr[i4] == 1 && bArr[i4 + 1] == 0 && bArr[i4 + 2] == 1 && bArr[i4 + 3] == 1 && bArr[i4 + 4] == 1 && bArr[i4 + 5] == 0 && bArr[i5] == 1 && (a(bArr, i4 - 4, i4) || a(bArr, i4 + 7, i4 + 11))) {
|
||||
i3++;
|
||||
}
|
||||
int i6 = i + 6;
|
||||
if (i6 < b && a[i][i4] == 1 && a[i + 1][i4] == 0 && a[i + 2][i4] == 1 && a[i + 3][i4] == 1 && a[i + 4][i4] == 1 && a[i + 5][i4] == 0 && a[i6][i4] == 1 && (a(a, i4, i - 4, i) || a(a, i4, i + 7, i + 11))) {
|
||||
i3++;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
i2 = i3;
|
||||
}
|
||||
return i2 * 40;
|
||||
}
|
||||
|
||||
static int d(ByteMatrix byteMatrix) {
|
||||
byte[][] a = byteMatrix.a();
|
||||
int c = byteMatrix.c();
|
||||
int b = byteMatrix.b();
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
while (i < b) {
|
||||
byte[] bArr = a[i];
|
||||
int i3 = i2;
|
||||
for (int i4 = 0; i4 < c; i4++) {
|
||||
if (bArr[i4] == 1) {
|
||||
i3++;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
i2 = i3;
|
||||
}
|
||||
int b2 = byteMatrix.b() * byteMatrix.c();
|
||||
return ((Math.abs((i2 << 1) - b2) * 10) / b2) * 10;
|
||||
}
|
||||
|
||||
private static boolean a(byte[] bArr, int i, int i2) {
|
||||
int min = Math.min(i2, bArr.length);
|
||||
for (int max = Math.max(i, 0); max < min; max++) {
|
||||
if (bArr[max] == 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean a(byte[][] bArr, int i, int i2, int i3) {
|
||||
int min = Math.min(i3, bArr.length);
|
||||
for (int max = Math.max(i2, 0); max < min; max++) {
|
||||
if (bArr[max][i] == 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
/* JADX WARN: Removed duplicated region for block: B:10:0x0040 A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:9:0x003f A[RETURN] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
static boolean a(int r1, int r2, int r3) {
|
||||
/*
|
||||
r0 = 1
|
||||
switch(r1) {
|
||||
case 0: goto L3a;
|
||||
case 1: goto L3b;
|
||||
case 2: goto L37;
|
||||
case 3: goto L33;
|
||||
case 4: goto L2e;
|
||||
case 5: goto L26;
|
||||
case 6: goto L1d;
|
||||
case 7: goto L14;
|
||||
default: goto L4;
|
||||
}
|
||||
L4:
|
||||
java.lang.IllegalArgumentException r2 = new java.lang.IllegalArgumentException
|
||||
java.lang.String r1 = java.lang.String.valueOf(r1)
|
||||
java.lang.String r3 = "Invalid mask pattern: "
|
||||
java.lang.String r1 = r3.concat(r1)
|
||||
r2.<init>(r1)
|
||||
throw r2
|
||||
L14:
|
||||
int r1 = r3 * r2
|
||||
int r1 = r1 % 3
|
||||
int r3 = r3 + r2
|
||||
r2 = r3 & 1
|
||||
int r1 = r1 + r2
|
||||
goto L24
|
||||
L1d:
|
||||
int r3 = r3 * r2
|
||||
r1 = r3 & 1
|
||||
int r3 = r3 % 3
|
||||
int r1 = r1 + r3
|
||||
L24:
|
||||
r1 = r1 & r0
|
||||
goto L3d
|
||||
L26:
|
||||
int r3 = r3 * r2
|
||||
r1 = r3 & 1
|
||||
int r3 = r3 % 3
|
||||
int r1 = r1 + r3
|
||||
goto L3d
|
||||
L2e:
|
||||
int r3 = r3 / 2
|
||||
int r2 = r2 / 3
|
||||
goto L3a
|
||||
L33:
|
||||
int r3 = r3 + r2
|
||||
int r1 = r3 % 3
|
||||
goto L3d
|
||||
L37:
|
||||
int r1 = r2 % 3
|
||||
goto L3d
|
||||
L3a:
|
||||
int r3 = r3 + r2
|
||||
L3b:
|
||||
r1 = r3 & 1
|
||||
L3d:
|
||||
if (r1 != 0) goto L40
|
||||
return r0
|
||||
L40:
|
||||
r1 = 0
|
||||
return r1
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.encoder.MaskUtil.a(int, int, int):boolean");
|
||||
}
|
||||
|
||||
private static int a(ByteMatrix byteMatrix, boolean z) {
|
||||
int b = z ? byteMatrix.b() : byteMatrix.c();
|
||||
int c = z ? byteMatrix.c() : byteMatrix.b();
|
||||
byte[][] a = byteMatrix.a();
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < b; i2++) {
|
||||
int i3 = i;
|
||||
int i4 = 0;
|
||||
byte b2 = -1;
|
||||
for (int i5 = 0; i5 < c; i5++) {
|
||||
byte b3 = z ? a[i2][i5] : a[i5][i2];
|
||||
if (b3 == b2) {
|
||||
i4++;
|
||||
} else {
|
||||
if (i4 >= 5) {
|
||||
i3 += (i4 - 5) + 3;
|
||||
}
|
||||
i4 = 1;
|
||||
b2 = b3;
|
||||
}
|
||||
}
|
||||
if (i4 >= 5) {
|
||||
i3 += (i4 - 5) + 3;
|
||||
}
|
||||
i = i3;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
246
sources/com/google/zxing/qrcode/encoder/MatrixUtil.java
Normal file
246
sources/com/google/zxing/qrcode/encoder/MatrixUtil.java
Normal file
@@ -0,0 +1,246 @@
|
||||
package com.google.zxing.qrcode.encoder;
|
||||
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.google.zxing.qrcode.decoder.Version;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class MatrixUtil {
|
||||
private static final int[][] a = {new int[]{1, 1, 1, 1, 1, 1, 1}, new int[]{1, 0, 0, 0, 0, 0, 1}, new int[]{1, 0, 1, 1, 1, 0, 1}, new int[]{1, 0, 1, 1, 1, 0, 1}, new int[]{1, 0, 1, 1, 1, 0, 1}, new int[]{1, 0, 0, 0, 0, 0, 1}, new int[]{1, 1, 1, 1, 1, 1, 1}};
|
||||
private static final int[][] b = {new int[]{1, 1, 1, 1, 1}, new int[]{1, 0, 0, 0, 1}, new int[]{1, 0, 1, 0, 1}, new int[]{1, 0, 0, 0, 1}, new int[]{1, 1, 1, 1, 1}};
|
||||
private static final int[][] c = {new int[]{-1, -1, -1, -1, -1, -1, -1}, new int[]{6, 18, -1, -1, -1, -1, -1}, new int[]{6, 22, -1, -1, -1, -1, -1}, new int[]{6, 26, -1, -1, -1, -1, -1}, new int[]{6, 30, -1, -1, -1, -1, -1}, new int[]{6, 34, -1, -1, -1, -1, -1}, new int[]{6, 22, 38, -1, -1, -1, -1}, new int[]{6, 24, 42, -1, -1, -1, -1}, new int[]{6, 26, 46, -1, -1, -1, -1}, new int[]{6, 28, 50, -1, -1, -1, -1}, new int[]{6, 30, 54, -1, -1, -1, -1}, new int[]{6, 32, 58, -1, -1, -1, -1}, new int[]{6, 34, 62, -1, -1, -1, -1}, new int[]{6, 26, 46, 66, -1, -1, -1}, new int[]{6, 26, 48, 70, -1, -1, -1}, new int[]{6, 26, 50, 74, -1, -1, -1}, new int[]{6, 30, 54, 78, -1, -1, -1}, new int[]{6, 30, 56, 82, -1, -1, -1}, new int[]{6, 30, 58, 86, -1, -1, -1}, new int[]{6, 34, 62, 90, -1, -1, -1}, new int[]{6, 28, 50, 72, 94, -1, -1}, new int[]{6, 26, 50, 74, 98, -1, -1}, new int[]{6, 30, 54, 78, 102, -1, -1}, new int[]{6, 28, 54, 80, 106, -1, -1}, new int[]{6, 32, 58, 84, 110, -1, -1}, new int[]{6, 30, 58, 86, 114, -1, -1}, new int[]{6, 34, 62, 90, 118, -1, -1}, new int[]{6, 26, 50, 74, 98, 122, -1}, new int[]{6, 30, 54, 78, 102, 126, -1}, new int[]{6, 26, 52, 78, 104, 130, -1}, new int[]{6, 30, 56, 82, 108, 134, -1}, new int[]{6, 34, 60, 86, 112, 138, -1}, new int[]{6, 30, 58, 86, 114, 142, -1}, new int[]{6, 34, 62, 90, 118, 146, -1}, new int[]{6, 30, 54, 78, 102, 126, 150}, new int[]{6, 24, 50, 76, 102, PeripheralType.SERVO, 154}, new int[]{6, 28, 54, 80, 106, 132, 158}, new int[]{6, 32, 58, 84, 110, 136, 162}, new int[]{6, 26, 54, 82, 110, 138, 166}, new int[]{6, 30, 58, 86, 114, 142, 170}};
|
||||
private static final int[][] d = {new int[]{8, 0}, new int[]{8, 1}, new int[]{8, 2}, new int[]{8, 3}, new int[]{8, 4}, new int[]{8, 5}, new int[]{8, 7}, new int[]{8, 8}, new int[]{7, 8}, new int[]{5, 8}, new int[]{4, 8}, new int[]{3, 8}, new int[]{2, 8}, new int[]{1, 8}, new int[]{0, 8}};
|
||||
|
||||
static void a(ByteMatrix byteMatrix) {
|
||||
byteMatrix.a((byte) -1);
|
||||
}
|
||||
|
||||
private static void b(ByteMatrix byteMatrix) throws WriterException {
|
||||
if (byteMatrix.a(8, byteMatrix.b() - 8) == 0) {
|
||||
throw new WriterException();
|
||||
}
|
||||
byteMatrix.a(8, byteMatrix.b() - 8, 1);
|
||||
}
|
||||
|
||||
private static boolean b(int i) {
|
||||
return i == -1;
|
||||
}
|
||||
|
||||
static void c(Version version, ByteMatrix byteMatrix) throws WriterException {
|
||||
if (version.e() < 7) {
|
||||
return;
|
||||
}
|
||||
BitArray bitArray = new BitArray();
|
||||
a(version, bitArray);
|
||||
int i = 0;
|
||||
int i2 = 17;
|
||||
while (i < 6) {
|
||||
int i3 = i2;
|
||||
for (int i4 = 0; i4 < 3; i4++) {
|
||||
boolean a2 = bitArray.a(i3);
|
||||
i3--;
|
||||
byteMatrix.a(i, (byteMatrix.b() - 11) + i4, a2);
|
||||
byteMatrix.a((byteMatrix.b() - 11) + i4, i, a2);
|
||||
}
|
||||
i++;
|
||||
i2 = i3;
|
||||
}
|
||||
}
|
||||
|
||||
private static void d(ByteMatrix byteMatrix) {
|
||||
int i = 8;
|
||||
while (i < byteMatrix.c() - 8) {
|
||||
int i2 = i + 1;
|
||||
int i3 = i2 % 2;
|
||||
if (b(byteMatrix.a(i, 6))) {
|
||||
byteMatrix.a(i, 6, i3);
|
||||
}
|
||||
if (b(byteMatrix.a(6, i))) {
|
||||
byteMatrix.a(6, i, i3);
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
|
||||
static void a(BitArray bitArray, ErrorCorrectionLevel errorCorrectionLevel, Version version, int i, ByteMatrix byteMatrix) throws WriterException {
|
||||
a(byteMatrix);
|
||||
a(version, byteMatrix);
|
||||
a(errorCorrectionLevel, i, byteMatrix);
|
||||
c(version, byteMatrix);
|
||||
a(bitArray, i, byteMatrix);
|
||||
}
|
||||
|
||||
private static void b(int i, int i2, ByteMatrix byteMatrix) {
|
||||
for (int i3 = 0; i3 < 5; i3++) {
|
||||
int[] iArr = b[i3];
|
||||
for (int i4 = 0; i4 < 5; i4++) {
|
||||
byteMatrix.a(i + i4, i2 + i3, iArr[i4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void b(Version version, ByteMatrix byteMatrix) {
|
||||
if (version.e() < 2) {
|
||||
return;
|
||||
}
|
||||
int[] iArr = c[version.e() - 1];
|
||||
for (int i : iArr) {
|
||||
if (i >= 0) {
|
||||
for (int i2 : iArr) {
|
||||
if (i2 >= 0 && b(byteMatrix.a(i2, i))) {
|
||||
b(i2 - 2, i - 2, byteMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void a(Version version, ByteMatrix byteMatrix) throws WriterException {
|
||||
c(byteMatrix);
|
||||
b(byteMatrix);
|
||||
b(version, byteMatrix);
|
||||
d(byteMatrix);
|
||||
}
|
||||
|
||||
private static void c(int i, int i2, ByteMatrix byteMatrix) {
|
||||
for (int i3 = 0; i3 < 7; i3++) {
|
||||
int[] iArr = a[i3];
|
||||
for (int i4 = 0; i4 < 7; i4++) {
|
||||
byteMatrix.a(i + i4, i2 + i3, iArr[i4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void d(int i, int i2, ByteMatrix byteMatrix) throws WriterException {
|
||||
for (int i3 = 0; i3 < 7; i3++) {
|
||||
int i4 = i2 + i3;
|
||||
if (b(byteMatrix.a(i, i4))) {
|
||||
byteMatrix.a(i, i4, 0);
|
||||
} else {
|
||||
throw new WriterException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void c(ByteMatrix byteMatrix) throws WriterException {
|
||||
int length = a[0].length;
|
||||
c(0, 0, byteMatrix);
|
||||
c(byteMatrix.c() - length, 0, byteMatrix);
|
||||
c(0, byteMatrix.c() - length, byteMatrix);
|
||||
a(0, 7, byteMatrix);
|
||||
a(byteMatrix.c() - 8, 7, byteMatrix);
|
||||
a(0, byteMatrix.c() - 8, byteMatrix);
|
||||
d(7, 0, byteMatrix);
|
||||
d((byteMatrix.b() - 7) - 1, 0, byteMatrix);
|
||||
d(7, byteMatrix.b() - 7, byteMatrix);
|
||||
}
|
||||
|
||||
static void a(ErrorCorrectionLevel errorCorrectionLevel, int i, ByteMatrix byteMatrix) throws WriterException {
|
||||
BitArray bitArray = new BitArray();
|
||||
a(errorCorrectionLevel, i, bitArray);
|
||||
for (int i2 = 0; i2 < bitArray.h(); i2++) {
|
||||
boolean a2 = bitArray.a((bitArray.h() - 1) - i2);
|
||||
int[] iArr = d[i2];
|
||||
byteMatrix.a(iArr[0], iArr[1], a2);
|
||||
if (i2 < 8) {
|
||||
byteMatrix.a((byteMatrix.c() - i2) - 1, 8, a2);
|
||||
} else {
|
||||
byteMatrix.a(8, (byteMatrix.b() - 7) + (i2 - 8), a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void a(BitArray bitArray, int i, ByteMatrix byteMatrix) throws WriterException {
|
||||
boolean z;
|
||||
int c2 = byteMatrix.c() - 1;
|
||||
int b2 = byteMatrix.b() - 1;
|
||||
int i2 = 0;
|
||||
int i3 = -1;
|
||||
while (c2 > 0) {
|
||||
if (c2 == 6) {
|
||||
c2--;
|
||||
}
|
||||
while (b2 >= 0 && b2 < byteMatrix.b()) {
|
||||
int i4 = i2;
|
||||
for (int i5 = 0; i5 < 2; i5++) {
|
||||
int i6 = c2 - i5;
|
||||
if (b(byteMatrix.a(i6, b2))) {
|
||||
if (i4 < bitArray.h()) {
|
||||
z = bitArray.a(i4);
|
||||
i4++;
|
||||
} else {
|
||||
z = false;
|
||||
}
|
||||
if (i != -1 && MaskUtil.a(i, i6, b2)) {
|
||||
z = !z;
|
||||
}
|
||||
byteMatrix.a(i6, b2, z);
|
||||
}
|
||||
}
|
||||
b2 += i3;
|
||||
i2 = i4;
|
||||
}
|
||||
i3 = -i3;
|
||||
b2 += i3;
|
||||
c2 -= 2;
|
||||
}
|
||||
if (i2 == bitArray.h()) {
|
||||
return;
|
||||
}
|
||||
throw new WriterException("Not all bits consumed: " + i2 + '/' + bitArray.h());
|
||||
}
|
||||
|
||||
static int a(int i) {
|
||||
return 32 - Integer.numberOfLeadingZeros(i);
|
||||
}
|
||||
|
||||
static int a(int i, int i2) {
|
||||
if (i2 != 0) {
|
||||
int a2 = a(i2);
|
||||
int i3 = i << (a2 - 1);
|
||||
while (a(i3) >= a2) {
|
||||
i3 ^= i2 << (a(i3) - a2);
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
throw new IllegalArgumentException("0 polynomial");
|
||||
}
|
||||
|
||||
static void a(ErrorCorrectionLevel errorCorrectionLevel, int i, BitArray bitArray) throws WriterException {
|
||||
if (QRCode.b(i)) {
|
||||
int bits = (errorCorrectionLevel.getBits() << 3) | i;
|
||||
bitArray.a(bits, 5);
|
||||
bitArray.a(a(bits, 1335), 10);
|
||||
BitArray bitArray2 = new BitArray();
|
||||
bitArray2.a(21522, 15);
|
||||
bitArray.b(bitArray2);
|
||||
if (bitArray.h() == 15) {
|
||||
return;
|
||||
}
|
||||
throw new WriterException("should not happen but we got: " + bitArray.h());
|
||||
}
|
||||
throw new WriterException("Invalid mask pattern");
|
||||
}
|
||||
|
||||
static void a(Version version, BitArray bitArray) throws WriterException {
|
||||
bitArray.a(version.e(), 6);
|
||||
bitArray.a(a(version.e(), 7973), 12);
|
||||
if (bitArray.h() == 18) {
|
||||
return;
|
||||
}
|
||||
throw new WriterException("should not happen but we got: " + bitArray.h());
|
||||
}
|
||||
|
||||
private static void a(int i, int i2, ByteMatrix byteMatrix) throws WriterException {
|
||||
for (int i3 = 0; i3 < 8; i3++) {
|
||||
int i4 = i + i3;
|
||||
if (b(byteMatrix.a(i4, i2))) {
|
||||
byteMatrix.a(i4, i2, 0);
|
||||
} else {
|
||||
throw new WriterException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
63
sources/com/google/zxing/qrcode/encoder/QRCode.java
Normal file
63
sources/com/google/zxing/qrcode/encoder/QRCode.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.google.zxing.qrcode.encoder;
|
||||
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.google.zxing.qrcode.decoder.Mode;
|
||||
import com.google.zxing.qrcode.decoder.Version;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class QRCode {
|
||||
private Mode a;
|
||||
private ErrorCorrectionLevel b;
|
||||
private Version c;
|
||||
private int d = -1;
|
||||
private ByteMatrix e;
|
||||
|
||||
public static boolean b(int i) {
|
||||
return i >= 0 && i < 8;
|
||||
}
|
||||
|
||||
public ByteMatrix a() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(200);
|
||||
sb.append("<<\n");
|
||||
sb.append(" mode: ");
|
||||
sb.append(this.a);
|
||||
sb.append("\n ecLevel: ");
|
||||
sb.append(this.b);
|
||||
sb.append("\n version: ");
|
||||
sb.append(this.c);
|
||||
sb.append("\n maskPattern: ");
|
||||
sb.append(this.d);
|
||||
if (this.e == null) {
|
||||
sb.append("\n matrix: null\n");
|
||||
} else {
|
||||
sb.append("\n matrix:\n");
|
||||
sb.append(this.e);
|
||||
}
|
||||
sb.append(">>\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void a(Mode mode) {
|
||||
this.a = mode;
|
||||
}
|
||||
|
||||
public void a(ErrorCorrectionLevel errorCorrectionLevel) {
|
||||
this.b = errorCorrectionLevel;
|
||||
}
|
||||
|
||||
public void a(Version version) {
|
||||
this.c = version;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.d = i;
|
||||
}
|
||||
|
||||
public void a(ByteMatrix byteMatrix) {
|
||||
this.e = byteMatrix;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user