Initial commit
This commit is contained in:
59
sources/com/google/zxing/maxicode/decoder/Decoder.java
Normal file
59
sources/com/google/zxing/maxicode/decoder/Decoder.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.google.zxing.maxicode.decoder;
|
||||
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.reedsolomon.GenericGF;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonException;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Decoder {
|
||||
private final ReedSolomonDecoder a = new ReedSolomonDecoder(GenericGF.o);
|
||||
|
||||
public DecoderResult a(BitMatrix bitMatrix, Map<DecodeHintType, ?> map) throws FormatException, ChecksumException {
|
||||
byte[] bArr;
|
||||
byte[] a = new BitMatrixParser(bitMatrix).a();
|
||||
a(a, 0, 10, 10, 0);
|
||||
int i = a[0] & 15;
|
||||
if (i == 2 || i == 3 || i == 4) {
|
||||
a(a, 20, 84, 40, 1);
|
||||
a(a, 20, 84, 40, 2);
|
||||
bArr = new byte[94];
|
||||
} else {
|
||||
if (i != 5) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
a(a, 20, 68, 56, 1);
|
||||
a(a, 20, 68, 56, 2);
|
||||
bArr = new byte[78];
|
||||
}
|
||||
System.arraycopy(a, 0, bArr, 0, 10);
|
||||
System.arraycopy(a, 20, bArr, 10, bArr.length - 10);
|
||||
return DecodedBitStreamParser.a(bArr, i);
|
||||
}
|
||||
|
||||
private void a(byte[] bArr, int i, int i2, int i3, int i4) throws ChecksumException {
|
||||
int i5 = i2 + i3;
|
||||
int i6 = i4 == 0 ? 1 : 2;
|
||||
int[] iArr = new int[i5 / i6];
|
||||
for (int i7 = 0; i7 < i5; i7++) {
|
||||
if (i4 == 0 || i7 % 2 == i4 - 1) {
|
||||
iArr[i7 / i6] = bArr[i7 + i] & 255;
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.a.a(iArr, i3 / i6);
|
||||
for (int i8 = 0; i8 < i2; i8++) {
|
||||
if (i4 == 0 || i8 % 2 == i4 - 1) {
|
||||
bArr[i8 + i] = (byte) iArr[i8 / i6];
|
||||
}
|
||||
}
|
||||
} catch (ReedSolomonException unused) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user