package o; import com.google.common.primitives.UnsignedBytes; import com.google.zxing.NotFoundException; import java.lang.reflect.Array; /* loaded from: classes2.dex */ public final class qgs extends C10628eJt { private C8902dZc a; public qgs(AbstractC13394fZQ abstractC13394fZQ) { super(abstractC13394fZQ); } @Override // o.C10628eJt, o.Bjk public final Bjk d(AbstractC13394fZQ abstractC13394fZQ) { return new qgs(abstractC13394fZQ); } @Override // o.C10628eJt, o.Bjk public final C8902dZc d() throws NotFoundException { int i; int i2; C8902dZc c8902dZc = this.a; if (c8902dZc != null) { return c8902dZc; } AbstractC13394fZQ abstractC13394fZQ = this.d; int i3 = abstractC13394fZQ.a; int i4 = abstractC13394fZQ.c; if (i3 >= 40 && i4 >= 40) { byte[] c = abstractC13394fZQ.c(); int i5 = i3 >> 3; if ((i3 & 7) != 0) { i5++; } int i6 = i4 >> 3; if ((i4 & 7) != 0) { i6++; } int i7 = i4 - 8; int i8 = i3 - 8; int[][] iArr = (int[][]) Array.newInstance((Class) Integer.TYPE, i6, i5); int i9 = 0; while (true) { int i10 = 8; if (i9 >= i6) { break; } int i11 = i9 << 3; if (i11 > i7) { i11 = i7; } int i12 = 0; while (i12 < i5) { int i13 = i12 << 3; if (i13 > i8) { i13 = i8; } int i14 = (i11 * i3) + i13; int i15 = 255; int i16 = 0; int i17 = 0; int i18 = 0; while (i16 < i10) { int i19 = i11; int i20 = i18; int i21 = 0; while (i21 < i10) { int i22 = i16; int i23 = c[i14 + i21] & UnsignedBytes.MAX_VALUE; i17 += i23; if (i23 < i15) { i15 = i23; } if (i23 > i20) { i20 = i23; } i21++; i16 = i22; i10 = 8; } int i24 = i16; if (i20 - i15 > 24) { i2 = i24; while (true) { i2++; i14 += i3; if (i2 >= 8) { break; } int i25 = 0; for (int i26 = 8; i25 < i26; i26 = 8) { i17 += c[i14 + i25] & UnsignedBytes.MAX_VALUE; i25++; i15 = i15; } } i = i15; } else { i = i15; i2 = i24; } i16 = i2 + 1; i14 += i3; i15 = i; i11 = i19; i10 = 8; i18 = i20; } int i27 = i11; int i28 = i17 >> 6; if (i18 - i15 <= 24) { i28 = i15 / 2; if (i9 > 0 && i12 > 0) { int[] iArr2 = iArr[i9 - 1]; int i29 = i12 - 1; int i30 = ((iArr2[i12] + (iArr[i9][i29] << 1)) + iArr2[i29]) / 4; if (i15 < i30) { i28 = i30; } } } iArr[i9][i12] = i28; i12++; i11 = i27; i10 = 8; } i9++; } C8902dZc c8902dZc2 = new C8902dZc(i3, i4); int i31 = 0; while (i31 < i6) { int i32 = i31 << 3; if (i32 > i7) { i32 = i7; } int i33 = 2; int min = i31 < 2 ? 2 : Math.min(i31, i6 - 3); int i34 = 0; while (i34 < i5) { int i35 = i34 << 3; if (i35 > i8) { i35 = i8; } int min2 = i34 < i33 ? i33 : Math.min(i34, i5 - 3); int i36 = i5; int i37 = 0; for (int i38 = -2; i38 <= i33; i38++) { int[] iArr3 = iArr[min + i38]; i37 += iArr3[min2 - 2] + iArr3[min2 - 1] + iArr3[min2] + iArr3[min2 + 1] + iArr3[min2 + 2]; } int i39 = i37 / 25; int i40 = (i32 * i3) + i35; int i41 = i6; int i42 = 8; int i43 = 0; while (i43 < i42) { int i44 = i7; int i45 = 0; while (i45 < i42) { byte[] bArr = c; if ((c[i40 + i45] & UnsignedBytes.MAX_VALUE) <= i39) { c8902dZc2.a(i35 + i45, i32 + i43); } i45++; c = bArr; i42 = 8; } i43++; i40 += i3; i7 = i44; i42 = 8; } i34++; i5 = i36; i6 = i41; i33 = 2; } i31++; } this.a = c8902dZc2; } else { this.a = super.d(); } return this.a; } }