mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
205 lines
7 KiB
Java
205 lines
7 KiB
Java
|
package com.google.zxing.qrcode.encoder;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
final class MaskUtil {
|
||
|
private static final int N1 = 3;
|
||
|
private static final int N2 = 3;
|
||
|
private static final int N3 = 40;
|
||
|
private static final int N4 = 10;
|
||
|
|
||
|
private MaskUtil() {
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static int applyMaskPenaltyRule1(ByteMatrix byteMatrix) {
|
||
|
return applyMaskPenaltyRule1Internal(byteMatrix, true) + applyMaskPenaltyRule1Internal(byteMatrix, false);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static int applyMaskPenaltyRule2(ByteMatrix byteMatrix) {
|
||
|
byte[][] array = byteMatrix.getArray();
|
||
|
int width = byteMatrix.getWidth();
|
||
|
int height = byteMatrix.getHeight();
|
||
|
int i = 0;
|
||
|
for (int i2 = 0; i2 < height - 1; i2++) {
|
||
|
byte[] bArr = array[i2];
|
||
|
int i3 = 0;
|
||
|
while (i3 < width - 1) {
|
||
|
byte b = bArr[i3];
|
||
|
int i4 = i3 + 1;
|
||
|
if (b == bArr[i4]) {
|
||
|
byte[] bArr2 = array[i2 + 1];
|
||
|
if (b == bArr2[i3] && b == bArr2[i4]) {
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
i3 = i4;
|
||
|
}
|
||
|
}
|
||
|
return i * 3;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static int applyMaskPenaltyRule3(ByteMatrix byteMatrix) {
|
||
|
byte[][] array = byteMatrix.getArray();
|
||
|
int width = byteMatrix.getWidth();
|
||
|
int height = byteMatrix.getHeight();
|
||
|
int i = 0;
|
||
|
for (int i2 = 0; i2 < height; i2++) {
|
||
|
for (int i3 = 0; i3 < width; i3++) {
|
||
|
byte[] bArr = array[i2];
|
||
|
int i4 = i3 + 6;
|
||
|
if (i4 < width && bArr[i3] == 1 && bArr[i3 + 1] == 0 && bArr[i3 + 2] == 1 && bArr[i3 + 3] == 1 && bArr[i3 + 4] == 1 && bArr[i3 + 5] == 0 && bArr[i4] == 1 && (isWhiteHorizontal(bArr, i3 - 4, i3) || isWhiteHorizontal(bArr, i3 + 7, i3 + 11))) {
|
||
|
i++;
|
||
|
}
|
||
|
int i5 = i2 + 6;
|
||
|
if (i5 < height && array[i2][i3] == 1 && array[i2 + 1][i3] == 0 && array[i2 + 2][i3] == 1 && array[i2 + 3][i3] == 1 && array[i2 + 4][i3] == 1 && array[i2 + 5][i3] == 0 && array[i5][i3] == 1 && (isWhiteVertical(array, i3, i2 - 4, i2) || isWhiteVertical(array, i3, i2 + 7, i2 + 11))) {
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return i * 40;
|
||
|
}
|
||
|
|
||
|
private static boolean isWhiteHorizontal(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 isWhiteVertical(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 INFO: Access modifiers changed from: package-private */
|
||
|
public static int applyMaskPenaltyRule4(ByteMatrix byteMatrix) {
|
||
|
byte[][] array = byteMatrix.getArray();
|
||
|
int width = byteMatrix.getWidth();
|
||
|
int height = byteMatrix.getHeight();
|
||
|
int i = 0;
|
||
|
for (int i2 = 0; i2 < height; i2++) {
|
||
|
byte[] bArr = array[i2];
|
||
|
for (int i3 = 0; i3 < width; i3++) {
|
||
|
if (bArr[i3] == 1) {
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
int height2 = byteMatrix.getHeight() * byteMatrix.getWidth();
|
||
|
return ((Math.abs((i << 1) - height2) * 10) / height2) * 10;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||
|
/* JADX WARN: Failed to find 'out' block for switch in B:2:0x0001. Please report as an issue. */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:10:0x003e A[RETURN] */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:9:0x003d A[RETURN] */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public static boolean getDataMaskBit(int r1, int r2, int r3) {
|
||
|
/*
|
||
|
r0 = 1
|
||
|
switch(r1) {
|
||
|
case 0: goto L38;
|
||
|
case 1: goto L39;
|
||
|
case 2: goto L35;
|
||
|
case 3: goto L31;
|
||
|
case 4: goto L2c;
|
||
|
case 5: goto L25;
|
||
|
case 6: goto L1d;
|
||
|
case 7: goto L14;
|
||
|
default: goto L4;
|
||
|
}
|
||
|
L4:
|
||
|
java.lang.IllegalArgumentException r2 = new java.lang.IllegalArgumentException
|
||
|
java.lang.String r3 = "Invalid mask pattern: "
|
||
|
java.lang.String r1 = java.lang.String.valueOf(r1)
|
||
|
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 L23
|
||
|
L1d:
|
||
|
int r3 = r3 * r2
|
||
|
r1 = r3 & 1
|
||
|
int r3 = r3 % 3
|
||
|
int r1 = r1 + r3
|
||
|
L23:
|
||
|
r1 = r1 & r0
|
||
|
goto L3b
|
||
|
L25:
|
||
|
int r3 = r3 * r2
|
||
|
r1 = r3 & 1
|
||
|
int r3 = r3 % 3
|
||
|
int r1 = r1 + r3
|
||
|
goto L3b
|
||
|
L2c:
|
||
|
int r3 = r3 / 2
|
||
|
int r2 = r2 / 3
|
||
|
goto L38
|
||
|
L31:
|
||
|
int r3 = r3 + r2
|
||
|
int r1 = r3 % 3
|
||
|
goto L3b
|
||
|
L35:
|
||
|
int r1 = r2 % 3
|
||
|
goto L3b
|
||
|
L38:
|
||
|
int r3 = r3 + r2
|
||
|
L39:
|
||
|
r1 = r3 & 1
|
||
|
L3b:
|
||
|
if (r1 != 0) goto L3e
|
||
|
return r0
|
||
|
L3e:
|
||
|
r1 = 0
|
||
|
return r1
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.encoder.MaskUtil.getDataMaskBit(int, int, int):boolean");
|
||
|
}
|
||
|
|
||
|
private static int applyMaskPenaltyRule1Internal(ByteMatrix byteMatrix, boolean z) {
|
||
|
int height = z ? byteMatrix.getHeight() : byteMatrix.getWidth();
|
||
|
int width = z ? byteMatrix.getWidth() : byteMatrix.getHeight();
|
||
|
byte[][] array = byteMatrix.getArray();
|
||
|
int i = 0;
|
||
|
for (int i2 = 0; i2 < height; i2++) {
|
||
|
byte b = -1;
|
||
|
int i3 = 0;
|
||
|
for (int i4 = 0; i4 < width; i4++) {
|
||
|
byte b2 = z ? array[i2][i4] : array[i4][i2];
|
||
|
if (b2 == b) {
|
||
|
i3++;
|
||
|
} else {
|
||
|
if (i3 >= 5) {
|
||
|
i += i3 - 2;
|
||
|
}
|
||
|
i3 = 1;
|
||
|
b = b2;
|
||
|
}
|
||
|
}
|
||
|
if (i3 >= 5) {
|
||
|
i += i3 - 2;
|
||
|
}
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
}
|