Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,259 @@
package com.google.zxing.common;
import java.util.Arrays;
/* loaded from: classes.dex */
public final class BitArray implements Cloneable {
private int[] a;
private int b;
public BitArray() {
this.b = 0;
this.a = new int[1];
}
private void e(int i) {
if (i > (this.a.length << 5)) {
int[] f = f(i);
int[] iArr = this.a;
System.arraycopy(iArr, 0, f, 0, iArr.length);
this.a = f;
}
}
private static int[] f(int i) {
return new int[(i + 31) / 32];
}
public boolean a(int i) {
return ((1 << (i & 31)) & this.a[i / 32]) != 0;
}
public int b(int i) {
int i2 = this.b;
if (i >= i2) {
return i2;
}
int i3 = i / 32;
int i4 = (~((1 << (i & 31)) - 1)) & this.a[i3];
while (i4 == 0) {
i3++;
int[] iArr = this.a;
if (i3 == iArr.length) {
return this.b;
}
i4 = iArr[i3];
}
int numberOfTrailingZeros = (i3 << 5) + Integer.numberOfTrailingZeros(i4);
int i5 = this.b;
return numberOfTrailingZeros > i5 ? i5 : numberOfTrailingZeros;
}
public int c(int i) {
int i2 = this.b;
if (i >= i2) {
return i2;
}
int i3 = i / 32;
int i4 = (~((1 << (i & 31)) - 1)) & (~this.a[i3]);
while (i4 == 0) {
i3++;
int[] iArr = this.a;
if (i3 == iArr.length) {
return this.b;
}
i4 = ~iArr[i3];
}
int numberOfTrailingZeros = (i3 << 5) + Integer.numberOfTrailingZeros(i4);
int i5 = this.b;
return numberOfTrailingZeros > i5 ? i5 : numberOfTrailingZeros;
}
public void d(int i) {
int[] iArr = this.a;
int i2 = i / 32;
iArr[i2] = (1 << (i & 31)) | iArr[i2];
}
public boolean equals(Object obj) {
if (!(obj instanceof BitArray)) {
return false;
}
BitArray bitArray = (BitArray) obj;
return this.b == bitArray.b && Arrays.equals(this.a, bitArray.a);
}
public int h() {
return this.b;
}
public int hashCode() {
return (this.b * 31) + Arrays.hashCode(this.a);
}
public int i() {
return (this.b + 7) / 8;
}
public void j() {
int[] iArr = new int[this.a.length];
int i = (this.b - 1) / 32;
int i2 = i + 1;
for (int i3 = 0; i3 < i2; i3++) {
long j = this.a[i3];
long j2 = ((j & 1431655765) << 1) | ((j >> 1) & 1431655765);
long j3 = ((j2 & 858993459) << 2) | ((j2 >> 2) & 858993459);
long j4 = ((j3 & 252645135) << 4) | ((j3 >> 4) & 252645135);
long j5 = ((j4 & 16711935) << 8) | ((j4 >> 8) & 16711935);
iArr[i - i3] = (int) (((j5 & 65535) << 16) | ((j5 >> 16) & 65535));
}
int i4 = this.b;
int i5 = i2 << 5;
if (i4 != i5) {
int i6 = i5 - i4;
int i7 = iArr[0] >>> i6;
for (int i8 = 1; i8 < i2; i8++) {
int i9 = iArr[i8];
iArr[i8 - 1] = i7 | (i9 << (32 - i6));
i7 = i9 >>> i6;
}
iArr[i2 - 1] = i7;
}
this.a = iArr;
}
public String toString() {
int i = this.b;
StringBuilder sb = new StringBuilder(i + (i / 8) + 1);
for (int i2 = 0; i2 < this.b; i2++) {
if ((i2 & 7) == 0) {
sb.append(' ');
}
sb.append(a(i2) ? 'X' : '.');
}
return sb.toString();
}
public void a() {
int length = this.a.length;
for (int i = 0; i < length; i++) {
this.a[i] = 0;
}
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public BitArray m14clone() {
return new BitArray((int[]) this.a.clone(), this.b);
}
public BitArray(int i) {
this.b = i;
this.a = f(i);
}
public boolean a(int i, int i2, boolean z) {
if (i2 < i || i < 0 || i2 > this.b) {
throw new IllegalArgumentException();
}
if (i2 == i) {
return true;
}
int i3 = i2 - 1;
int i4 = i / 32;
int i5 = i3 / 32;
int i6 = i4;
while (i6 <= i5) {
int i7 = (2 << (i6 >= i5 ? 31 & i3 : 31)) - (1 << (i6 > i4 ? 0 : i & 31));
int i8 = this.a[i6] & i7;
if (!z) {
i7 = 0;
}
if (i8 != i7) {
return false;
}
i6++;
}
return true;
}
BitArray(int[] iArr, int i) {
this.a = iArr;
this.b = i;
}
public void a(boolean z) {
e(this.b + 1);
if (z) {
int[] iArr = this.a;
int i = this.b;
int i2 = i / 32;
iArr[i2] = (1 << (i & 31)) | iArr[i2];
}
this.b++;
}
public void b(int i, int i2) {
this.a[i / 32] = i2;
}
public void b(BitArray bitArray) {
if (this.b != bitArray.b) {
throw new IllegalArgumentException("Sizes don't match");
}
int i = 0;
while (true) {
int[] iArr = this.a;
if (i >= iArr.length) {
return;
}
iArr[i] = iArr[i] ^ bitArray.a[i];
i++;
}
}
public void a(int i, int i2) {
if (i2 >= 0 && i2 <= 32) {
e(this.b + i2);
while (i2 > 0) {
boolean z = true;
if (((i >> (i2 - 1)) & 1) != 1) {
z = false;
}
a(z);
i2--;
}
return;
}
throw new IllegalArgumentException("Num bits must be between 0 and 32");
}
public int[] b() {
return this.a;
}
public void a(BitArray bitArray) {
int i = bitArray.b;
e(this.b + i);
for (int i2 = 0; i2 < i; i2++) {
a(bitArray.a(i2));
}
}
public void a(int i, byte[] bArr, int i2, int i3) {
int i4 = i;
int i5 = 0;
while (i5 < i3) {
int i6 = i4;
int i7 = 0;
for (int i8 = 0; i8 < 8; i8++) {
if (a(i6)) {
i7 |= 1 << (7 - i8);
}
i6++;
}
bArr[i2 + i5] = (byte) i7;
i5++;
i4 = i6;
}
}
}

View File

@@ -0,0 +1,261 @@
package com.google.zxing.common;
import java.util.Arrays;
/* loaded from: classes.dex */
public final class BitMatrix implements Cloneable {
private final int a;
private final int b;
private final int c;
private final int[] d;
public BitMatrix(int i) {
this(i, i);
}
public void a(int i, int i2) {
int i3 = (i2 * this.c) + (i / 32);
int[] iArr = this.d;
iArr[i3] = (1 << (i & 31)) ^ iArr[i3];
}
public boolean b(int i, int i2) {
return ((this.d[(i2 * this.c) + (i / 32)] >>> (i & 31)) & 1) != 0;
}
public void c(int i, int i2) {
int i3 = (i2 * this.c) + (i / 32);
int[] iArr = this.d;
iArr[i3] = (1 << (i & 31)) | iArr[i3];
}
public boolean equals(Object obj) {
if (!(obj instanceof BitMatrix)) {
return false;
}
BitMatrix bitMatrix = (BitMatrix) obj;
return this.a == bitMatrix.a && this.b == bitMatrix.b && this.c == bitMatrix.c && Arrays.equals(this.d, bitMatrix.d);
}
public int[] h() {
int i = this.a;
int i2 = -1;
int i3 = this.b;
int i4 = -1;
int i5 = i;
int i6 = 0;
while (i6 < this.b) {
int i7 = i4;
int i8 = i2;
int i9 = i5;
int i10 = 0;
while (true) {
int i11 = this.c;
if (i10 < i11) {
int i12 = this.d[(i11 * i6) + i10];
if (i12 != 0) {
if (i6 < i3) {
i3 = i6;
}
if (i6 > i7) {
i7 = i6;
}
int i13 = i10 << 5;
int i14 = 31;
if (i13 < i9) {
int i15 = 0;
while ((i12 << (31 - i15)) == 0) {
i15++;
}
int i16 = i15 + i13;
if (i16 < i9) {
i9 = i16;
}
}
if (i13 + 31 > i8) {
while ((i12 >>> i14) == 0) {
i14--;
}
int i17 = i13 + i14;
if (i17 > i8) {
i8 = i17;
}
}
}
i10++;
}
}
i6++;
i5 = i9;
i2 = i8;
i4 = i7;
}
if (i2 < i5 || i4 < i3) {
return null;
}
return new int[]{i5, i3, (i2 - i5) + 1, (i4 - i3) + 1};
}
public int hashCode() {
int i = this.a;
return (((((((i * 31) + i) * 31) + this.b) * 31) + this.c) * 31) + Arrays.hashCode(this.d);
}
public int i() {
return this.b;
}
public int[] j() {
int i = 0;
while (true) {
int[] iArr = this.d;
if (i >= iArr.length || iArr[i] != 0) {
break;
}
i++;
}
int[] iArr2 = this.d;
if (i == iArr2.length) {
return null;
}
int i2 = this.c;
int i3 = i / i2;
int i4 = (i % i2) << 5;
int i5 = iArr2[i];
int i6 = 0;
while ((i5 << (31 - i6)) == 0) {
i6++;
}
return new int[]{i4 + i6, i3};
}
public int k() {
return this.a;
}
public void l() {
int k = k();
int i = i();
BitArray bitArray = new BitArray(k);
BitArray bitArray2 = new BitArray(k);
for (int i2 = 0; i2 < (i + 1) / 2; i2++) {
bitArray = a(i2, bitArray);
int i3 = (i - 1) - i2;
bitArray2 = a(i3, bitArray2);
bitArray.j();
bitArray2.j();
b(i2, bitArray2);
b(i3, bitArray);
}
}
public String toString() {
return a("X ", " ");
}
public BitMatrix(int i, int i2) {
if (i <= 0 || i2 <= 0) {
throw new IllegalArgumentException("Both dimensions must be greater than 0");
}
this.a = i;
this.b = i2;
this.c = (i + 31) / 32;
this.d = new int[this.c * i2];
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public BitMatrix m15clone() {
return new BitMatrix(this.a, this.b, this.c, (int[]) this.d.clone());
}
public void a() {
int length = this.d.length;
for (int i = 0; i < length; i++) {
this.d[i] = 0;
}
}
public void b(int i, BitArray bitArray) {
int[] b = bitArray.b();
int[] iArr = this.d;
int i2 = this.c;
System.arraycopy(b, 0, iArr, i * i2, i2);
}
public int[] b() {
int length = this.d.length - 1;
while (length >= 0 && this.d[length] == 0) {
length--;
}
if (length < 0) {
return null;
}
int i = this.c;
int i2 = length / i;
int i3 = (length % i) << 5;
int i4 = 31;
while ((this.d[length] >>> i4) == 0) {
i4--;
}
return new int[]{i3 + i4, i2};
}
public void a(int i, int i2, int i3, int i4) {
if (i2 < 0 || i < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (i4 > 0 && i3 > 0) {
int i5 = i3 + i;
int i6 = i4 + i2;
if (i6 > this.b || i5 > this.a) {
throw new IllegalArgumentException("The region must fit inside the matrix");
}
while (i2 < i6) {
int i7 = this.c * i2;
for (int i8 = i; i8 < i5; i8++) {
int[] iArr = this.d;
int i9 = (i8 / 32) + i7;
iArr[i9] = iArr[i9] | (1 << (i8 & 31));
}
i2++;
}
return;
}
throw new IllegalArgumentException("Height and width must be at least 1");
}
private BitMatrix(int i, int i2, int i3, int[] iArr) {
this.a = i;
this.b = i2;
this.c = i3;
this.d = iArr;
}
public BitArray a(int i, BitArray bitArray) {
if (bitArray != null && bitArray.h() >= this.a) {
bitArray.a();
} else {
bitArray = new BitArray(this.a);
}
int i2 = i * this.c;
for (int i3 = 0; i3 < this.c; i3++) {
bitArray.b(i3 << 5, this.d[i2 + i3]);
}
return bitArray;
}
public String a(String str, String str2) {
return a(str, str2, "\n");
}
private String a(String str, String str2, String str3) {
StringBuilder sb = new StringBuilder(this.b * (this.a + 1));
for (int i = 0; i < this.b; i++) {
for (int i2 = 0; i2 < this.a; i2++) {
sb.append(b(i2, i) ? str : str2);
}
sb.append(str3);
}
return sb.toString();
}
}

View File

@@ -0,0 +1,65 @@
package com.google.zxing.common;
/* loaded from: classes.dex */
public final class BitSource {
private final byte[] a;
private int b;
private int c;
public BitSource(byte[] bArr) {
this.a = bArr;
}
public int a(int i) {
int i2;
if (i <= 0 || i > 32 || i > a()) {
throw new IllegalArgumentException(String.valueOf(i));
}
int i3 = this.c;
if (i3 > 0) {
int i4 = 8 - i3;
int i5 = i < i4 ? i : i4;
int i6 = i4 - i5;
byte[] bArr = this.a;
int i7 = this.b;
i2 = (((255 >> (8 - i5)) << i6) & bArr[i7]) >> i6;
i -= i5;
this.c += i5;
if (this.c == 8) {
this.c = 0;
this.b = i7 + 1;
}
} else {
i2 = 0;
}
if (i <= 0) {
return i2;
}
while (i >= 8) {
byte[] bArr2 = this.a;
int i8 = this.b;
i2 = (i2 << 8) | (bArr2[i8] & 255);
this.b = i8 + 1;
i -= 8;
}
if (i <= 0) {
return i2;
}
int i9 = 8 - i;
int i10 = (i2 << i) | ((((255 >> i9) << i9) & this.a[this.b]) >> i9);
this.c += i;
return i10;
}
public int b() {
return this.c;
}
public int c() {
return this.b;
}
public int a() {
return ((this.a.length - this.b) * 8) - this.c;
}
}

View File

@@ -0,0 +1,82 @@
package com.google.zxing.common;
import com.google.zxing.FormatException;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public enum CharacterSetECI {
Cp437(new int[]{0, 2}, new String[0]),
ISO8859_1(new int[]{1, 3}, "ISO-8859-1"),
ISO8859_2(4, "ISO-8859-2"),
ISO8859_3(5, "ISO-8859-3"),
ISO8859_4(6, "ISO-8859-4"),
ISO8859_5(7, "ISO-8859-5"),
ISO8859_6(8, "ISO-8859-6"),
ISO8859_7(9, "ISO-8859-7"),
ISO8859_8(10, "ISO-8859-8"),
ISO8859_9(11, "ISO-8859-9"),
ISO8859_10(12, "ISO-8859-10"),
ISO8859_11(13, "ISO-8859-11"),
ISO8859_13(15, "ISO-8859-13"),
ISO8859_14(16, "ISO-8859-14"),
ISO8859_15(17, "ISO-8859-15"),
ISO8859_16(18, "ISO-8859-16"),
SJIS(20, "Shift_JIS"),
Cp1250(21, "windows-1250"),
Cp1251(22, "windows-1251"),
Cp1252(23, "windows-1252"),
Cp1256(24, "windows-1256"),
UnicodeBigUnmarked(25, "UTF-16BE", "UnicodeBig"),
UTF8(26, "UTF-8"),
ASCII(new int[]{27, 170}, "US-ASCII"),
Big5(28),
GB18030(29, "GB2312", "EUC_CN", "GBK"),
EUC_KR(30, "EUC-KR");
private final String[] otherEncodingNames;
private final int[] values;
private static final Map<Integer, CharacterSetECI> VALUE_TO_ECI = new HashMap();
private static final Map<String, CharacterSetECI> NAME_TO_ECI = new HashMap();
static {
for (CharacterSetECI characterSetECI : values()) {
for (int i : characterSetECI.values) {
VALUE_TO_ECI.put(Integer.valueOf(i), characterSetECI);
}
NAME_TO_ECI.put(characterSetECI.name(), characterSetECI);
for (String str : characterSetECI.otherEncodingNames) {
NAME_TO_ECI.put(str, characterSetECI);
}
}
}
CharacterSetECI(int i) {
this(new int[]{i}, new String[0]);
}
public static CharacterSetECI getCharacterSetECIByName(String str) {
return NAME_TO_ECI.get(str);
}
public static CharacterSetECI getCharacterSetECIByValue(int i) throws FormatException {
if (i < 0 || i >= 900) {
throw FormatException.getFormatInstance();
}
return VALUE_TO_ECI.get(Integer.valueOf(i));
}
public int getValue() {
return this.values[0];
}
CharacterSetECI(int i, String... strArr) {
this.values = new int[]{i};
this.otherEncodingNames = strArr;
}
CharacterSetECI(int[] iArr, String... strArr) {
this.values = iArr;
this.otherEncodingNames = strArr;
}
}

View File

@@ -0,0 +1,79 @@
package com.google.zxing.common;
import java.util.List;
/* loaded from: classes.dex */
public final class DecoderResult {
private final byte[] a;
private int b;
private final String c;
private final List<byte[]> d;
private final String e;
private Object f;
private final int g;
private final int h;
public DecoderResult(byte[] bArr, String str, List<byte[]> list, String str2) {
this(bArr, str, list, str2, -1, -1);
}
public void a(int i) {
this.b = i;
}
public void a(Integer num) {
}
public String b() {
return this.e;
}
public void b(Integer num) {
}
public int c() {
return this.b;
}
public Object d() {
return this.f;
}
public byte[] e() {
return this.a;
}
public int f() {
return this.g;
}
public int g() {
return this.h;
}
public String h() {
return this.c;
}
public boolean i() {
return this.g >= 0 && this.h >= 0;
}
public DecoderResult(byte[] bArr, String str, List<byte[]> list, String str2, int i, int i2) {
this.a = bArr;
this.b = bArr == null ? 0 : bArr.length * 8;
this.c = str;
this.d = list;
this.e = str2;
this.g = i2;
this.h = i;
}
public List<byte[]> a() {
return this.d;
}
public void a(Object obj) {
this.f = obj;
}
}

View File

@@ -0,0 +1,40 @@
package com.google.zxing.common;
import com.google.zxing.NotFoundException;
/* loaded from: classes.dex */
public final class DefaultGridSampler extends GridSampler {
@Override // com.google.zxing.common.GridSampler
public BitMatrix a(BitMatrix bitMatrix, int i, int i2, float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14, float f15, float f16) throws NotFoundException {
return a(bitMatrix, i, i2, PerspectiveTransform.a(f, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16));
}
@Override // com.google.zxing.common.GridSampler
public BitMatrix a(BitMatrix bitMatrix, int i, int i2, PerspectiveTransform perspectiveTransform) throws NotFoundException {
if (i > 0 && i2 > 0) {
BitMatrix bitMatrix2 = new BitMatrix(i, i2);
float[] fArr = new float[i * 2];
for (int i3 = 0; i3 < i2; i3++) {
int length = fArr.length;
float f = i3 + 0.5f;
for (int i4 = 0; i4 < length; i4 += 2) {
fArr[i4] = (i4 / 2) + 0.5f;
fArr[i4 + 1] = f;
}
perspectiveTransform.a(fArr);
GridSampler.a(bitMatrix, fArr);
for (int i5 = 0; i5 < length; i5 += 2) {
try {
if (bitMatrix.b((int) fArr[i5], (int) fArr[i5 + 1])) {
bitMatrix2.c(i5 / 2, i3);
}
} catch (ArrayIndexOutOfBoundsException unused) {
throw NotFoundException.getNotFoundInstance();
}
}
}
return bitMatrix2;
}
throw NotFoundException.getNotFoundInstance();
}
}

View File

@@ -0,0 +1,22 @@
package com.google.zxing.common;
import com.google.zxing.ResultPoint;
/* loaded from: classes.dex */
public class DetectorResult {
private final BitMatrix a;
private final ResultPoint[] b;
public DetectorResult(BitMatrix bitMatrix, ResultPoint[] resultPointArr) {
this.a = bitMatrix;
this.b = resultPointArr;
}
public final BitMatrix a() {
return this.a;
}
public final ResultPoint[] b() {
return this.b;
}
}

View File

@@ -0,0 +1,145 @@
package com.google.zxing.common;
import com.google.zxing.Binarizer;
import com.google.zxing.LuminanceSource;
import com.google.zxing.NotFoundException;
/* loaded from: classes.dex */
public class GlobalHistogramBinarizer extends Binarizer {
private static final byte[] d = new byte[0];
private byte[] b;
private final int[] c;
public GlobalHistogramBinarizer(LuminanceSource luminanceSource) {
super(luminanceSource);
this.b = d;
this.c = new int[32];
}
@Override // com.google.zxing.Binarizer
public BitArray a(int i, BitArray bitArray) throws NotFoundException {
LuminanceSource c = c();
int c2 = c.c();
if (bitArray == null || bitArray.h() < c2) {
bitArray = new BitArray(c2);
} else {
bitArray.a();
}
a(c2);
byte[] a = c.a(i, this.b);
int[] iArr = this.c;
for (int i2 = 0; i2 < c2; i2++) {
int i3 = (a[i2] & 255) >> 3;
iArr[i3] = iArr[i3] + 1;
}
int a2 = a(iArr);
if (c2 < 3) {
for (int i4 = 0; i4 < c2; i4++) {
if ((a[i4] & 255) < a2) {
bitArray.d(i4);
}
}
} else {
int i5 = a[0] & 255;
int i6 = a[1] & 255;
int i7 = i5;
int i8 = 1;
while (i8 < c2 - 1) {
int i9 = i8 + 1;
int i10 = a[i9] & 255;
if ((((i6 << 2) - i7) - i10) / 2 < a2) {
bitArray.d(i8);
}
i7 = i6;
i8 = i9;
i6 = i10;
}
}
return bitArray;
}
@Override // com.google.zxing.Binarizer
public BitMatrix a() throws NotFoundException {
LuminanceSource c = c();
int c2 = c.c();
int a = c.a();
BitMatrix bitMatrix = new BitMatrix(c2, a);
a(c2);
int[] iArr = this.c;
for (int i = 1; i < 5; i++) {
byte[] a2 = c.a((a * i) / 5, this.b);
int i2 = (c2 << 2) / 5;
for (int i3 = c2 / 5; i3 < i2; i3++) {
int i4 = (a2[i3] & 255) >> 3;
iArr[i4] = iArr[i4] + 1;
}
}
int a3 = a(iArr);
byte[] b = c.b();
for (int i5 = 0; i5 < a; i5++) {
int i6 = i5 * c2;
for (int i7 = 0; i7 < c2; i7++) {
if ((b[i6 + i7] & 255) < a3) {
bitMatrix.c(i7, i5);
}
}
}
return bitMatrix;
}
private void a(int i) {
if (this.b.length < i) {
this.b = new byte[i];
}
for (int i2 = 0; i2 < 32; i2++) {
this.c[i2] = 0;
}
}
private static int a(int[] iArr) throws NotFoundException {
int length = iArr.length;
int i = 0;
int i2 = 0;
int i3 = 0;
for (int i4 = 0; i4 < length; i4++) {
if (iArr[i4] > i) {
i = iArr[i4];
i3 = i4;
}
if (iArr[i4] > i2) {
i2 = iArr[i4];
}
}
int i5 = 0;
int i6 = 0;
for (int i7 = 0; i7 < length; i7++) {
int i8 = i7 - i3;
int i9 = iArr[i7] * i8 * i8;
if (i9 > i6) {
i5 = i7;
i6 = i9;
}
}
if (i3 > i5) {
int i10 = i3;
i3 = i5;
i5 = i10;
}
if (i5 - i3 <= length / 16) {
throw NotFoundException.getNotFoundInstance();
}
int i11 = i5 - 1;
int i12 = i11;
int i13 = -1;
while (i11 > i3) {
int i14 = i11 - i3;
int i15 = i14 * i14 * (i5 - i11) * (i2 - iArr[i11]);
if (i15 > i13) {
i12 = i11;
i13 = i15;
}
i11--;
}
return i12 << 3;
}
}

View File

@@ -0,0 +1,131 @@
package com.google.zxing.common;
import com.google.zxing.NotFoundException;
/* loaded from: classes.dex */
public abstract class GridSampler {
private static GridSampler a = new DefaultGridSampler();
public static GridSampler a() {
return a;
}
public abstract BitMatrix a(BitMatrix bitMatrix, int i, int i2, float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14, float f15, float f16) throws NotFoundException;
public abstract BitMatrix a(BitMatrix bitMatrix, int i, int i2, PerspectiveTransform perspectiveTransform) throws NotFoundException;
/* JADX WARN: Removed duplicated region for block: B:14:0x0034 */
/* JADX WARN: Removed duplicated region for block: B:18:0x0038 */
/* JADX WARN: Removed duplicated region for block: B:44:0x0071 */
/* JADX WARN: Removed duplicated region for block: B:48:0x0075 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
protected static void a(com.google.zxing.common.BitMatrix r9, float[] r10) throws com.google.zxing.NotFoundException {
/*
int r0 = r9.k()
int r9 = r9.i()
r1 = 0
r2 = 1
r3 = 0
r4 = 1
Lc:
int r5 = r10.length
r6 = 0
r7 = -1
if (r3 >= r5) goto L48
if (r4 == 0) goto L48
r4 = r10[r3]
int r4 = (int) r4
int r5 = r3 + 1
r8 = r10[r5]
int r8 = (int) r8
if (r4 < r7) goto L43
if (r4 > r0) goto L43
if (r8 < r7) goto L43
if (r8 > r9) goto L43
if (r4 != r7) goto L29
r10[r3] = r6
L27:
r4 = 1
goto L32
L29:
if (r4 != r0) goto L31
int r4 = r0 + (-1)
float r4 = (float) r4
r10[r3] = r4
goto L27
L31:
r4 = 0
L32:
if (r8 != r7) goto L38
r10[r5] = r6
L36:
r4 = 1
goto L40
L38:
if (r8 != r9) goto L40
int r4 = r9 + (-1)
float r4 = (float) r4
r10[r5] = r4
goto L36
L40:
int r3 = r3 + 2
goto Lc
L43:
com.google.zxing.NotFoundException r9 = com.google.zxing.NotFoundException.getNotFoundInstance()
throw r9
L48:
int r3 = r10.length
int r3 = r3 + (-2)
r4 = 1
L4c:
if (r3 < 0) goto L85
if (r4 == 0) goto L85
r4 = r10[r3]
int r4 = (int) r4
int r5 = r3 + 1
r8 = r10[r5]
int r8 = (int) r8
if (r4 < r7) goto L80
if (r4 > r0) goto L80
if (r8 < r7) goto L80
if (r8 > r9) goto L80
if (r4 != r7) goto L66
r10[r3] = r6
L64:
r4 = 1
goto L6f
L66:
if (r4 != r0) goto L6e
int r4 = r0 + (-1)
float r4 = (float) r4
r10[r3] = r4
goto L64
L6e:
r4 = 0
L6f:
if (r8 != r7) goto L75
r10[r5] = r6
L73:
r4 = 1
goto L7d
L75:
if (r8 != r9) goto L7d
int r4 = r9 + (-1)
float r4 = (float) r4
r10[r5] = r4
goto L73
L7d:
int r3 = r3 + (-2)
goto L4c
L80:
com.google.zxing.NotFoundException r9 = com.google.zxing.NotFoundException.getNotFoundInstance()
throw r9
L85:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.common.GridSampler.a(com.google.zxing.common.BitMatrix, float[]):void");
}
}

View File

@@ -0,0 +1,155 @@
package com.google.zxing.common;
import com.google.zxing.LuminanceSource;
import com.google.zxing.NotFoundException;
import java.lang.reflect.Array;
/* loaded from: classes.dex */
public final class HybridBinarizer extends GlobalHistogramBinarizer {
private BitMatrix e;
public HybridBinarizer(LuminanceSource luminanceSource) {
super(luminanceSource);
}
private static int a(int i, int i2, int i3) {
return i < i2 ? i2 : i > i3 ? i3 : i;
}
@Override // com.google.zxing.common.GlobalHistogramBinarizer, com.google.zxing.Binarizer
public BitMatrix a() throws NotFoundException {
BitMatrix bitMatrix = this.e;
if (bitMatrix != null) {
return bitMatrix;
}
LuminanceSource c = c();
int c2 = c.c();
int a = c.a();
if (c2 < 40 || a < 40) {
this.e = super.a();
} else {
byte[] b = c.b();
int i = c2 >> 3;
if ((c2 & 7) != 0) {
i++;
}
int i2 = i;
int i3 = a >> 3;
if ((a & 7) != 0) {
i3++;
}
int i4 = i3;
int[][] a2 = a(b, i2, i4, c2, a);
BitMatrix bitMatrix2 = new BitMatrix(c2, a);
a(b, i2, i4, c2, a, a2, bitMatrix2);
this.e = bitMatrix2;
}
return this.e;
}
private static void a(byte[] bArr, int i, int i2, int i3, int i4, int[][] iArr, BitMatrix bitMatrix) {
int i5 = i4 - 8;
int i6 = i3 - 8;
for (int i7 = 0; i7 < i2; i7++) {
int i8 = i7 << 3;
int i9 = i8 > i5 ? i5 : i8;
int a = a(i7, 2, i2 - 3);
for (int i10 = 0; i10 < i; i10++) {
int i11 = i10 << 3;
int i12 = i11 > i6 ? i6 : i11;
int a2 = a(i10, 2, i - 3);
int i13 = 0;
for (int i14 = -2; i14 <= 2; i14++) {
int[] iArr2 = iArr[a + i14];
i13 += iArr2[a2 - 2] + iArr2[a2 - 1] + iArr2[a2] + iArr2[a2 + 1] + iArr2[a2 + 2];
}
a(bArr, i12, i9, i13 / 25, i3, bitMatrix);
}
}
}
private static void a(byte[] bArr, int i, int i2, int i3, int i4, BitMatrix bitMatrix) {
int i5 = (i2 * i4) + i;
int i6 = 0;
while (i6 < 8) {
for (int i7 = 0; i7 < 8; i7++) {
if ((bArr[i5 + i7] & 255) <= i3) {
bitMatrix.c(i + i7, i2 + i6);
}
}
i6++;
i5 += i4;
}
}
private static int[][] a(byte[] bArr, int i, int i2, int i3, int i4) {
int i5 = 8;
int i6 = i4 - 8;
int i7 = i3 - 8;
int[][] iArr = (int[][]) Array.newInstance((Class<?>) int.class, i2, i);
for (int i8 = 0; i8 < i2; i8++) {
int i9 = i8 << 3;
if (i9 > i6) {
i9 = i6;
}
for (int i10 = 0; i10 < i; i10++) {
int i11 = i10 << 3;
if (i11 > i7) {
i11 = i7;
}
int i12 = (i9 * i3) + i11;
int i13 = 0;
int i14 = 0;
int i15 = 0;
int i16 = 255;
while (i13 < i5) {
int i17 = i14;
int i18 = 0;
while (i18 < i5) {
int i19 = bArr[i12 + i18] & 255;
i17 += i19;
if (i19 < i16) {
i16 = i19;
}
if (i19 > i15) {
i15 = i19;
}
i18++;
i5 = 8;
}
if (i15 - i16 > 24) {
i13++;
i12 += i3;
i5 = 8;
while (i13 < 8) {
for (int i20 = 0; i20 < 8; i20++) {
i17 += bArr[i12 + i20] & 255;
}
i13++;
i12 += i3;
}
} else {
i5 = 8;
}
i14 = i17;
i13++;
i12 += i3;
}
int i21 = i14 >> 6;
if (i15 - i16 <= 24) {
i21 = i16 / 2;
if (i8 > 0 && i10 > 0) {
int i22 = i8 - 1;
int i23 = i10 - 1;
int i24 = ((iArr[i22][i10] + (iArr[i8][i23] * 2)) + iArr[i22][i23]) / 4;
if (i16 < i24) {
i21 = i24;
}
}
}
iArr[i8][i10] = i21;
}
}
return iArr;
}
}

View File

@@ -0,0 +1,117 @@
package com.google.zxing.common;
/* loaded from: classes.dex */
public final class PerspectiveTransform {
private final float a;
private final float b;
private final float c;
private final float d;
private final float e;
private final float f;
private final float g;
private final float h;
private final float i;
private PerspectiveTransform(float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
this.a = f;
this.b = f4;
this.c = f7;
this.d = f2;
this.e = f5;
this.f = f8;
this.g = f3;
this.h = f6;
this.i = f9;
}
public static PerspectiveTransform a(float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14, float f15, float f16) {
return b(f9, f10, f11, f12, f13, f14, f15, f16).a(a(f, f2, f3, f4, f5, f6, f7, f8));
}
public static PerspectiveTransform b(float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8) {
float f9 = ((f - f3) + f5) - f7;
float f10 = ((f2 - f4) + f6) - f8;
if (f9 == 0.0f && f10 == 0.0f) {
return new PerspectiveTransform(f3 - f, f5 - f3, f, f4 - f2, f6 - f4, f2, 0.0f, 0.0f, 1.0f);
}
float f11 = f3 - f5;
float f12 = f7 - f5;
float f13 = f4 - f6;
float f14 = f8 - f6;
float f15 = (f11 * f14) - (f12 * f13);
float f16 = ((f14 * f9) - (f12 * f10)) / f15;
float f17 = ((f11 * f10) - (f9 * f13)) / f15;
return new PerspectiveTransform((f16 * f3) + (f3 - f), (f17 * f7) + (f7 - f), f, (f4 - f2) + (f16 * f4), (f8 - f2) + (f17 * f8), f2, f16, f17, 1.0f);
}
public void a(float[] fArr) {
int length = fArr.length;
float f = this.a;
float f2 = this.b;
float f3 = this.c;
float f4 = this.d;
float f5 = this.e;
float f6 = this.f;
float f7 = this.g;
float f8 = this.h;
float f9 = this.i;
for (int i = 0; i < length; i += 2) {
float f10 = fArr[i];
int i2 = i + 1;
float f11 = fArr[i2];
float f12 = (f3 * f10) + (f6 * f11) + f9;
fArr[i] = (((f * f10) + (f4 * f11)) + f7) / f12;
fArr[i2] = (((f10 * f2) + (f11 * f5)) + f8) / f12;
}
}
public static PerspectiveTransform a(float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8) {
return b(f, f2, f3, f4, f5, f6, f7, f8).a();
}
PerspectiveTransform a() {
float f = this.e;
float f2 = this.i;
float f3 = this.f;
float f4 = this.h;
float f5 = (f * f2) - (f3 * f4);
float f6 = this.g;
float f7 = this.d;
float f8 = (f3 * f6) - (f7 * f2);
float f9 = (f7 * f4) - (f * f6);
float f10 = this.c;
float f11 = this.b;
float f12 = (f10 * f4) - (f11 * f2);
float f13 = this.a;
return new PerspectiveTransform(f5, f8, f9, f12, (f2 * f13) - (f10 * f6), (f6 * f11) - (f4 * f13), (f11 * f3) - (f10 * f), (f10 * f7) - (f3 * f13), (f13 * f) - (f11 * f7));
}
PerspectiveTransform a(PerspectiveTransform perspectiveTransform) {
float f = this.a;
float f2 = perspectiveTransform.a;
float f3 = this.d;
float f4 = perspectiveTransform.b;
float f5 = this.g;
float f6 = perspectiveTransform.c;
float f7 = (f * f2) + (f3 * f4) + (f5 * f6);
float f8 = perspectiveTransform.d;
float f9 = perspectiveTransform.e;
float f10 = perspectiveTransform.f;
float f11 = (f * f8) + (f3 * f9) + (f5 * f10);
float f12 = perspectiveTransform.g;
float f13 = perspectiveTransform.h;
float f14 = perspectiveTransform.i;
float f15 = (f * f12) + (f3 * f13) + (f5 * f14);
float f16 = this.b;
float f17 = this.e;
float f18 = this.h;
float f19 = (f16 * f2) + (f17 * f4) + (f18 * f6);
float f20 = (f16 * f8) + (f17 * f9) + (f18 * f10);
float f21 = (f18 * f14) + (f16 * f12) + (f17 * f13);
float f22 = this.c;
float f23 = this.f;
float f24 = (f2 * f22) + (f4 * f23);
float f25 = this.i;
return new PerspectiveTransform(f7, f11, f15, f19, f20, f21, (f6 * f25) + f24, (f8 * f22) + (f9 * f23) + (f10 * f25), (f22 * f12) + (f23 * f13) + (f25 * f14));
}
}

View File

@@ -0,0 +1,122 @@
package com.google.zxing.common;
import com.google.zxing.DecodeHintType;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.nio.charset.Charset;
import java.util.Map;
/* loaded from: classes.dex */
public final class StringUtils {
private static final String a = Charset.defaultCharset().name();
private static final boolean b;
static {
b = "SJIS".equalsIgnoreCase(a) || "EUC_JP".equalsIgnoreCase(a);
}
public static String a(byte[] bArr, Map<DecodeHintType, ?> map) {
byte[] bArr2 = bArr;
if (map != null && map.containsKey(DecodeHintType.CHARACTER_SET)) {
return map.get(DecodeHintType.CHARACTER_SET).toString();
}
int length = bArr2.length;
int i = 0;
boolean z = bArr2.length > 3 && bArr2[0] == -17 && bArr2[1] == -69 && bArr2[2] == -65;
int i2 = 0;
int i3 = 0;
boolean z2 = true;
boolean z3 = true;
boolean z4 = true;
int i4 = 0;
int i5 = 0;
int i6 = 0;
int i7 = 0;
int i8 = 0;
int i9 = 0;
int i10 = 0;
int i11 = 0;
int i12 = 0;
while (i3 < length && (z2 || z3 || z4)) {
int i13 = bArr2[i3] & 255;
if (z4) {
if (i4 > 0) {
if ((i13 & PeripheralType.SERVO) != 0) {
i4--;
}
z4 = false;
} else if ((i13 & PeripheralType.SERVO) != 0) {
if ((i13 & 64) != 0) {
i4++;
if ((i13 & 32) == 0) {
i6++;
} else {
i4++;
if ((i13 & 16) == 0) {
i7++;
} else {
i4++;
if ((i13 & 8) == 0) {
i8++;
}
}
}
}
z4 = false;
}
}
if (z2) {
if (i13 > 127 && i13 < 160) {
z2 = false;
} else if (i13 > 159 && (i13 < 192 || i13 == 215 || i13 == 247)) {
i10++;
}
}
if (z3) {
if (i5 > 0) {
if (i13 >= 64 && i13 != 127 && i13 <= 252) {
i5--;
}
z3 = false;
} else {
if (i13 != 128 && i13 != 160 && i13 <= 239) {
if (i13 <= 160 || i13 >= 224) {
if (i13 > 127) {
i5++;
int i14 = i11 + 1;
if (i14 > i) {
i = i14;
i11 = i;
} else {
i11 = i14;
}
} else {
i11 = 0;
}
i12 = 0;
} else {
i2++;
int i15 = i12 + 1;
if (i15 > i9) {
i9 = i15;
i12 = i9;
} else {
i12 = i15;
}
i11 = 0;
}
}
z3 = false;
}
}
i3++;
bArr2 = bArr;
}
if (z4 && i4 > 0) {
z4 = false;
}
if (z3 && i5 > 0) {
z3 = false;
}
return (!z4 || (!z && (i6 + i7) + i8 <= 0)) ? (!z3 || (!b && i9 < 3 && i < 3)) ? (z2 && z3) ? (!(i9 == 2 && i2 == 2) && i10 * 10 < length) ? "ISO8859_1" : "SJIS" : z2 ? "ISO8859_1" : z3 ? "SJIS" : z4 ? "UTF8" : a : "SJIS" : "UTF8";
}
}

View File

@@ -0,0 +1,28 @@
package com.google.zxing.common.detector;
/* loaded from: classes.dex */
public final class MathUtils {
public static float a(float f, float f2, float f3, float f4) {
float f5 = f - f3;
float f6 = f2 - f4;
return (float) Math.sqrt((f5 * f5) + (f6 * f6));
}
public static int a(float f) {
return (int) (f + (f < 0.0f ? -0.5f : 0.5f));
}
public static float a(int i, int i2, int i3, int i4) {
int i5 = i - i3;
int i6 = i2 - i4;
return (float) Math.sqrt((i5 * i5) + (i6 * i6));
}
public static int a(int[] iArr) {
int i = 0;
for (int i2 : iArr) {
i += i2;
}
return i;
}
}

View File

@@ -0,0 +1,197 @@
package com.google.zxing.common.detector;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
/* loaded from: classes.dex */
public final class WhiteRectangleDetector {
private final BitMatrix a;
private final int b;
private final int c;
private final int d;
private final int e;
private final int f;
private final int g;
public WhiteRectangleDetector(BitMatrix bitMatrix) throws NotFoundException {
this(bitMatrix, 10, bitMatrix.k() / 2, bitMatrix.i() / 2);
}
public ResultPoint[] a() throws NotFoundException {
boolean z;
int i = this.d;
int i2 = this.e;
int i3 = this.g;
int i4 = this.f;
boolean z2 = false;
int i5 = i;
boolean z3 = false;
boolean z4 = false;
boolean z5 = false;
boolean z6 = false;
boolean z7 = false;
for (boolean z8 = true; z8; z8 = z) {
boolean z9 = true;
z = false;
while (true) {
if ((z9 || !z3) && i2 < this.c) {
z9 = a(i3, i4, i2, false);
if (z9) {
i2++;
z3 = true;
z = true;
} else if (!z3) {
i2++;
}
}
}
if (i2 < this.c) {
boolean z10 = true;
while (true) {
if ((z10 || !z4) && i4 < this.b) {
z10 = a(i5, i2, i4, true);
if (z10) {
i4++;
z4 = true;
z = true;
} else if (!z4) {
i4++;
}
}
}
if (i4 < this.b) {
boolean z11 = true;
while (true) {
if ((z11 || !z5) && i5 >= 0) {
z11 = a(i3, i4, i5, false);
if (z11) {
i5--;
z5 = true;
z = true;
} else if (!z5) {
i5--;
}
}
}
if (i5 >= 0) {
boolean z12 = true;
while (true) {
if ((z12 || !z7) && i3 >= 0) {
z12 = a(i5, i2, i3, true);
if (z12) {
i3--;
z7 = true;
z = true;
} else if (!z7) {
i3--;
}
}
}
if (i3 >= 0) {
if (z) {
z6 = true;
}
}
}
}
}
z2 = true;
break;
}
if (z2 || !z6) {
throw NotFoundException.getNotFoundInstance();
}
int i6 = i2 - i5;
ResultPoint resultPoint = null;
ResultPoint resultPoint2 = null;
for (int i7 = 1; resultPoint2 == null && i7 < i6; i7++) {
resultPoint2 = a(i5, i4 - i7, i5 + i7, i4);
}
if (resultPoint2 == null) {
throw NotFoundException.getNotFoundInstance();
}
ResultPoint resultPoint3 = null;
for (int i8 = 1; resultPoint3 == null && i8 < i6; i8++) {
resultPoint3 = a(i5, i3 + i8, i5 + i8, i3);
}
if (resultPoint3 == null) {
throw NotFoundException.getNotFoundInstance();
}
ResultPoint resultPoint4 = null;
for (int i9 = 1; resultPoint4 == null && i9 < i6; i9++) {
resultPoint4 = a(i2, i3 + i9, i2 - i9, i3);
}
if (resultPoint4 == null) {
throw NotFoundException.getNotFoundInstance();
}
for (int i10 = 1; resultPoint == null && i10 < i6; i10++) {
resultPoint = a(i2, i4 - i10, i2 - i10, i4);
}
if (resultPoint != null) {
return a(resultPoint, resultPoint2, resultPoint4, resultPoint3);
}
throw NotFoundException.getNotFoundInstance();
}
public WhiteRectangleDetector(BitMatrix bitMatrix, int i, int i2, int i3) throws NotFoundException {
this.a = bitMatrix;
this.b = bitMatrix.i();
this.c = bitMatrix.k();
int i4 = i / 2;
this.d = i2 - i4;
this.e = i2 + i4;
this.g = i3 - i4;
this.f = i3 + i4;
if (this.g < 0 || this.d < 0 || this.f >= this.b || this.e >= this.c) {
throw NotFoundException.getNotFoundInstance();
}
}
private ResultPoint a(float f, float f2, float f3, float f4) {
int a = MathUtils.a(MathUtils.a(f, f2, f3, f4));
float f5 = a;
float f6 = (f3 - f) / f5;
float f7 = (f4 - f2) / f5;
for (int i = 0; i < a; i++) {
float f8 = i;
int a2 = MathUtils.a((f8 * f6) + f);
int a3 = MathUtils.a((f8 * f7) + f2);
if (this.a.b(a2, a3)) {
return new ResultPoint(a2, a3);
}
}
return null;
}
private ResultPoint[] a(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3, ResultPoint resultPoint4) {
float a = resultPoint.a();
float b = resultPoint.b();
float a2 = resultPoint2.a();
float b2 = resultPoint2.b();
float a3 = resultPoint3.a();
float b3 = resultPoint3.b();
float a4 = resultPoint4.a();
float b4 = resultPoint4.b();
return a < ((float) this.c) / 2.0f ? new ResultPoint[]{new ResultPoint(a4 - 1.0f, b4 + 1.0f), new ResultPoint(a2 + 1.0f, b2 + 1.0f), new ResultPoint(a3 - 1.0f, b3 - 1.0f), new ResultPoint(a + 1.0f, b - 1.0f)} : new ResultPoint[]{new ResultPoint(a4 + 1.0f, b4 + 1.0f), new ResultPoint(a2 + 1.0f, b2 - 1.0f), new ResultPoint(a3 - 1.0f, b3 + 1.0f), new ResultPoint(a - 1.0f, b - 1.0f)};
}
private boolean a(int i, int i2, int i3, boolean z) {
if (z) {
while (i <= i2) {
if (this.a.b(i, i3)) {
return true;
}
i++;
}
return false;
}
while (i <= i2) {
if (this.a.b(i3, i)) {
return true;
}
i++;
}
return false;
}
}

View File

@@ -0,0 +1,115 @@
package com.google.zxing.common.reedsolomon;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.ubt.jimu.base.util.FileUtil;
import com.ubt.jimu.diy.model.DiyPreviewStep;
/* loaded from: classes.dex */
public final class GenericGF {
public static final GenericGF h = new GenericGF(4201, FileUtil.ZIP_BUFFER_SIZE, 1);
public static final GenericGF i = new GenericGF(1033, DataDecryptTool.DECRYPT_SP_FILE, 1);
public static final GenericGF j = new GenericGF(67, 64, 1);
public static final GenericGF k = new GenericGF(19, 16, 1);
public static final GenericGF l = new GenericGF(285, DataDecryptTool.DECRYPT_ALL_FILE, 0);
public static final GenericGF m;
public static final GenericGF n;
public static final GenericGF o;
private final int[] a;
private final int[] b;
private final GenericGFPoly c;
private final GenericGFPoly d;
private final int e;
private final int f;
private final int g;
static {
GenericGF genericGF = new GenericGF(DiyPreviewStep.TYPE_PROGRAM, DataDecryptTool.DECRYPT_ALL_FILE, 1);
m = genericGF;
n = genericGF;
o = j;
}
public GenericGF(int i2, int i3, int i4) {
this.f = i2;
this.e = i3;
this.g = i4;
this.a = new int[i3];
this.b = new int[i3];
int i5 = 1;
for (int i6 = 0; i6 < i3; i6++) {
this.a[i6] = i5;
i5 <<= 1;
if (i5 >= i3) {
i5 = (i5 ^ i2) & (i3 - 1);
}
}
for (int i7 = 0; i7 < i3 - 1; i7++) {
this.b[this.a[i7]] = i7;
}
this.c = new GenericGFPoly(this, new int[]{0});
this.d = new GenericGFPoly(this, new int[]{1});
}
static int c(int i2, int i3) {
return i2 ^ i3;
}
GenericGFPoly a(int i2, int i3) {
if (i2 < 0) {
throw new IllegalArgumentException();
}
if (i3 == 0) {
return this.c;
}
int[] iArr = new int[i2 + 1];
iArr[0] = i3;
return new GenericGFPoly(this, iArr);
}
GenericGFPoly b() {
return this.d;
}
int c(int i2) {
if (i2 != 0) {
return this.b[i2];
}
throw new IllegalArgumentException();
}
GenericGFPoly d() {
return this.c;
}
public String toString() {
return "GF(0x" + Integer.toHexString(this.f) + ',' + this.e + ')';
}
int b(int i2) {
if (i2 != 0) {
return this.a[(this.e - this.b[i2]) - 1];
}
throw new ArithmeticException();
}
public int c() {
return this.e;
}
int b(int i2, int i3) {
if (i2 == 0 || i3 == 0) {
return 0;
}
int[] iArr = this.a;
int[] iArr2 = this.b;
return iArr[(iArr2[i2] + iArr2[i3]) % (this.e - 1)];
}
int a(int i2) {
return this.a[i2];
}
public int a() {
return this.g;
}
}

View File

@@ -0,0 +1,199 @@
package com.google.zxing.common.reedsolomon;
/* loaded from: classes.dex */
final class GenericGFPoly {
private final GenericGF a;
private final int[] b;
GenericGFPoly(GenericGF genericGF, int[] iArr) {
if (iArr.length == 0) {
throw new IllegalArgumentException();
}
this.a = genericGF;
int length = iArr.length;
if (length <= 1 || iArr[0] != 0) {
this.b = iArr;
return;
}
int i = 1;
while (i < length && iArr[i] == 0) {
i++;
}
if (i == length) {
this.b = new int[]{0};
return;
}
this.b = new int[length - i];
int[] iArr2 = this.b;
System.arraycopy(iArr, i, iArr2, 0, iArr2.length);
}
int[] a() {
return this.b;
}
int b() {
return this.b.length - 1;
}
boolean c() {
return this.b[0] == 0;
}
public String toString() {
StringBuilder sb = new StringBuilder(b() * 8);
for (int b = b(); b >= 0; b--) {
int b2 = b(b);
if (b2 != 0) {
if (b2 < 0) {
sb.append(" - ");
b2 = -b2;
} else if (sb.length() > 0) {
sb.append(" + ");
}
if (b == 0 || b2 != 1) {
int c = this.a.c(b2);
if (c == 0) {
sb.append('1');
} else if (c == 1) {
sb.append('a');
} else {
sb.append("a^");
sb.append(c);
}
}
if (b != 0) {
if (b == 1) {
sb.append('x');
} else {
sb.append("x^");
sb.append(b);
}
}
}
}
return sb.toString();
}
int a(int i) {
if (i == 0) {
return b(0);
}
if (i == 1) {
int i2 = 0;
for (int i3 : this.b) {
i2 = GenericGF.c(i2, i3);
}
return i2;
}
int[] iArr = this.b;
int i4 = iArr[0];
int length = iArr.length;
for (int i5 = 1; i5 < length; i5++) {
i4 = GenericGF.c(this.a.b(i, i4), this.b[i5]);
}
return i4;
}
int b(int i) {
return this.b[(r0.length - 1) - i];
}
GenericGFPoly c(GenericGFPoly genericGFPoly) {
if (!this.a.equals(genericGFPoly.a)) {
throw new IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
if (c() || genericGFPoly.c()) {
return this.a.d();
}
int[] iArr = this.b;
int length = iArr.length;
int[] iArr2 = genericGFPoly.b;
int length2 = iArr2.length;
int[] iArr3 = new int[(length + length2) - 1];
for (int i = 0; i < length; i++) {
int i2 = iArr[i];
for (int i3 = 0; i3 < length2; i3++) {
int i4 = i + i3;
iArr3[i4] = GenericGF.c(iArr3[i4], this.a.b(i2, iArr2[i3]));
}
}
return new GenericGFPoly(this.a, iArr3);
}
GenericGFPoly[] b(GenericGFPoly genericGFPoly) {
if (this.a.equals(genericGFPoly.a)) {
if (!genericGFPoly.c()) {
GenericGFPoly d = this.a.d();
int b = this.a.b(genericGFPoly.b(genericGFPoly.b()));
GenericGFPoly genericGFPoly2 = d;
GenericGFPoly genericGFPoly3 = this;
while (genericGFPoly3.b() >= genericGFPoly.b() && !genericGFPoly3.c()) {
int b2 = genericGFPoly3.b() - genericGFPoly.b();
int b3 = this.a.b(genericGFPoly3.b(genericGFPoly3.b()), b);
GenericGFPoly a = genericGFPoly.a(b2, b3);
genericGFPoly2 = genericGFPoly2.a(this.a.a(b2, b3));
genericGFPoly3 = genericGFPoly3.a(a);
}
return new GenericGFPoly[]{genericGFPoly2, genericGFPoly3};
}
throw new IllegalArgumentException("Divide by 0");
}
throw new IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
GenericGFPoly a(GenericGFPoly genericGFPoly) {
if (this.a.equals(genericGFPoly.a)) {
if (c()) {
return genericGFPoly;
}
if (genericGFPoly.c()) {
return this;
}
int[] iArr = this.b;
int[] iArr2 = genericGFPoly.b;
if (iArr.length > iArr2.length) {
iArr = iArr2;
iArr2 = iArr;
}
int[] iArr3 = new int[iArr2.length];
int length = iArr2.length - iArr.length;
System.arraycopy(iArr2, 0, iArr3, 0, length);
for (int i = length; i < iArr2.length; i++) {
iArr3[i] = GenericGF.c(iArr[i - length], iArr2[i]);
}
return new GenericGFPoly(this.a, iArr3);
}
throw new IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
GenericGFPoly c(int i) {
if (i == 0) {
return this.a.d();
}
if (i == 1) {
return this;
}
int length = this.b.length;
int[] iArr = new int[length];
for (int i2 = 0; i2 < length; i2++) {
iArr[i2] = this.a.b(this.b[i2], i);
}
return new GenericGFPoly(this.a, iArr);
}
GenericGFPoly a(int i, int i2) {
if (i < 0) {
throw new IllegalArgumentException();
}
if (i2 == 0) {
return this.a.d();
}
int length = this.b.length;
int[] iArr = new int[i + length];
for (int i3 = 0; i3 < length; i3++) {
iArr[i3] = this.a.b(this.b[i3], i2);
}
return new GenericGFPoly(this.a, iArr);
}
}

View File

@@ -0,0 +1,118 @@
package com.google.zxing.common.reedsolomon;
/* loaded from: classes.dex */
public final class ReedSolomonDecoder {
private final GenericGF a;
public ReedSolomonDecoder(GenericGF genericGF) {
this.a = genericGF;
}
public void a(int[] iArr, int i) throws ReedSolomonException {
GenericGFPoly genericGFPoly = new GenericGFPoly(this.a, iArr);
int[] iArr2 = new int[i];
boolean z = true;
for (int i2 = 0; i2 < i; i2++) {
GenericGF genericGF = this.a;
int a = genericGFPoly.a(genericGF.a(genericGF.a() + i2));
iArr2[(i - 1) - i2] = a;
if (a != 0) {
z = false;
}
}
if (z) {
return;
}
GenericGFPoly[] a2 = a(this.a.a(i, 1), new GenericGFPoly(this.a, iArr2), i);
GenericGFPoly genericGFPoly2 = a2[0];
GenericGFPoly genericGFPoly3 = a2[1];
int[] a3 = a(genericGFPoly2);
int[] a4 = a(genericGFPoly3, a3);
for (int i3 = 0; i3 < a3.length; i3++) {
int length = (iArr.length - 1) - this.a.c(a3[i3]);
if (length < 0) {
throw new ReedSolomonException("Bad error location");
}
iArr[length] = GenericGF.c(iArr[length], a4[i3]);
}
}
private GenericGFPoly[] a(GenericGFPoly genericGFPoly, GenericGFPoly genericGFPoly2, int i) throws ReedSolomonException {
if (genericGFPoly.b() < genericGFPoly2.b()) {
genericGFPoly2 = genericGFPoly;
genericGFPoly = genericGFPoly2;
}
GenericGFPoly d = this.a.d();
GenericGFPoly b = this.a.b();
do {
GenericGFPoly genericGFPoly3 = genericGFPoly2;
genericGFPoly2 = genericGFPoly;
genericGFPoly = genericGFPoly3;
GenericGFPoly genericGFPoly4 = b;
GenericGFPoly genericGFPoly5 = d;
d = genericGFPoly4;
if (genericGFPoly.b() >= i / 2) {
if (!genericGFPoly.c()) {
GenericGFPoly d2 = this.a.d();
int b2 = this.a.b(genericGFPoly.b(genericGFPoly.b()));
while (genericGFPoly2.b() >= genericGFPoly.b() && !genericGFPoly2.c()) {
int b3 = genericGFPoly2.b() - genericGFPoly.b();
int b4 = this.a.b(genericGFPoly2.b(genericGFPoly2.b()), b2);
d2 = d2.a(this.a.a(b3, b4));
genericGFPoly2 = genericGFPoly2.a(genericGFPoly.a(b3, b4));
}
b = d2.c(d).a(genericGFPoly5);
} else {
throw new ReedSolomonException("r_{i-1} was zero");
}
} else {
int b5 = d.b(0);
if (b5 != 0) {
int b6 = this.a.b(b5);
return new GenericGFPoly[]{d.c(b6), genericGFPoly.c(b6)};
}
throw new ReedSolomonException("sigmaTilde(0) was zero");
}
} while (genericGFPoly2.b() < genericGFPoly.b());
throw new IllegalStateException("Division algorithm failed to reduce polynomial?");
}
private int[] a(GenericGFPoly genericGFPoly) throws ReedSolomonException {
int b = genericGFPoly.b();
int i = 0;
if (b == 1) {
return new int[]{genericGFPoly.b(1)};
}
int[] iArr = new int[b];
for (int i2 = 1; i2 < this.a.c() && i < b; i2++) {
if (genericGFPoly.a(i2) == 0) {
iArr[i] = this.a.b(i2);
i++;
}
}
if (i == b) {
return iArr;
}
throw new ReedSolomonException("Error locator degree does not match number of roots");
}
private int[] a(GenericGFPoly genericGFPoly, int[] iArr) {
int length = iArr.length;
int[] iArr2 = new int[length];
for (int i = 0; i < length; i++) {
int b = this.a.b(iArr[i]);
int i2 = 1;
for (int i3 = 0; i3 < length; i3++) {
if (i != i3) {
int b2 = this.a.b(iArr[i3], b);
i2 = this.a.b(i2, (b2 & 1) == 0 ? b2 | 1 : b2 & (-2));
}
}
iArr2[i] = this.a.b(genericGFPoly.a(b), this.a.b(i2));
if (this.a.a() != 0) {
iArr2[i] = this.a.b(iArr2[i], b);
}
}
return iArr2;
}
}

View File

@@ -0,0 +1,48 @@
package com.google.zxing.common.reedsolomon;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public final class ReedSolomonEncoder {
private final GenericGF a;
private final List<GenericGFPoly> b = new ArrayList();
public ReedSolomonEncoder(GenericGF genericGF) {
this.a = genericGF;
this.b.add(new GenericGFPoly(genericGF, new int[]{1}));
}
private GenericGFPoly a(int i) {
if (i >= this.b.size()) {
List<GenericGFPoly> list = this.b;
GenericGFPoly genericGFPoly = list.get(list.size() - 1);
for (int size = this.b.size(); size <= i; size++) {
GenericGF genericGF = this.a;
genericGFPoly = genericGFPoly.c(new GenericGFPoly(genericGF, new int[]{1, genericGF.a((size - 1) + genericGF.a())}));
this.b.add(genericGFPoly);
}
}
return this.b.get(i);
}
public void a(int[] iArr, int i) {
if (i != 0) {
int length = iArr.length - i;
if (length > 0) {
GenericGFPoly a = a(i);
int[] iArr2 = new int[length];
System.arraycopy(iArr, 0, iArr2, 0, length);
int[] a2 = new GenericGFPoly(this.a, iArr2).a(i, 1).b(a)[1].a();
int length2 = i - a2.length;
for (int i2 = 0; i2 < length2; i2++) {
iArr[length + i2] = 0;
}
System.arraycopy(a2, 0, iArr, length + length2, a2.length);
return;
}
throw new IllegalArgumentException("No data bytes provided");
}
throw new IllegalArgumentException("No error correction bytes");
}
}

View File

@@ -0,0 +1,8 @@
package com.google.zxing.common.reedsolomon;
/* loaded from: classes.dex */
public final class ReedSolomonException extends Exception {
public ReedSolomonException(String str) {
super(str);
}
}