package com.google.zxing.pdf417.decoder; import com.google.zxing.ResultPoint; /* loaded from: classes.dex */ final class DetectionResultRowIndicatorColumn extends DetectionResultColumn { private final boolean c; DetectionResultRowIndicatorColumn(BoundingBox boundingBox, boolean z) { super(boundingBox); this.c = z; } private void b(BarcodeMetadata barcodeMetadata) { BoundingBox a = a(); ResultPoint g = this.c ? a.g() : a.h(); ResultPoint a2 = this.c ? a.a() : a.b(); int c = c((int) a2.b()); Codeword[] b = b(); int i = -1; int i2 = 0; int i3 = 1; for (int c2 = c((int) g.b()); c2 < c; c2++) { if (b[c2] != null) { Codeword codeword = b[c2]; codeword.h(); int c3 = codeword.c() - i; if (c3 == 0) { i2++; } else { if (c3 == 1) { i3 = Math.max(i3, i2); i = codeword.c(); } else if (codeword.c() >= barcodeMetadata.c()) { b[c2] = null; } else { i = codeword.c(); } i2 = 1; } } } } private void f() { for (Codeword codeword : b()) { if (codeword != null) { codeword.h(); } } } void a(BarcodeMetadata barcodeMetadata) { Codeword[] b = b(); f(); a(b, barcodeMetadata); BoundingBox a = a(); ResultPoint g = this.c ? a.g() : a.h(); ResultPoint a2 = this.c ? a.a() : a.b(); int c = c((int) g.b()); int c2 = c((int) a2.b()); int i = -1; int i2 = 0; int i3 = 1; while (c < c2) { if (b[c] != null) { Codeword codeword = b[c]; int c3 = codeword.c() - i; if (c3 == 0) { i2++; } else { if (c3 == 1) { i3 = Math.max(i3, i2); i = codeword.c(); } else if (c3 < 0 || codeword.c() >= barcodeMetadata.c() || c3 > c) { b[c] = null; } else { if (i3 > 2) { c3 *= i3 - 2; } boolean z = c3 >= c; for (int i4 = 1; i4 <= c3 && !z; i4++) { z = b[c - i4] != null; } if (z) { b[c] = null; } else { i = codeword.c(); } } i2 = 1; } } c++; } } BarcodeMetadata c() { Codeword[] b = b(); BarcodeValue barcodeValue = new BarcodeValue(); BarcodeValue barcodeValue2 = new BarcodeValue(); BarcodeValue barcodeValue3 = new BarcodeValue(); BarcodeValue barcodeValue4 = new BarcodeValue(); for (Codeword codeword : b) { if (codeword != null) { codeword.h(); int e = codeword.e() % 30; int c = codeword.c(); if (!this.c) { c += 2; } int i = c % 3; if (i == 0) { barcodeValue2.a((e * 3) + 1); } else if (i == 1) { barcodeValue4.a(e / 3); barcodeValue3.a(e % 3); } else if (i == 2) { barcodeValue.a(e + 1); } } } if (barcodeValue.a().length == 0 || barcodeValue2.a().length == 0 || barcodeValue3.a().length == 0 || barcodeValue4.a().length == 0 || barcodeValue.a()[0] <= 0 || barcodeValue2.a()[0] + barcodeValue3.a()[0] < 3 || barcodeValue2.a()[0] + barcodeValue3.a()[0] > 90) { return null; } BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeValue.a()[0], barcodeValue2.a()[0], barcodeValue3.a()[0], barcodeValue4.a()[0]); a(b, barcodeMetadata); return barcodeMetadata; } int[] d() { int c; BarcodeMetadata c2 = c(); if (c2 == null) { return null; } b(c2); int[] iArr = new int[c2.c()]; for (Codeword codeword : b()) { if (codeword != null && (c = codeword.c()) < iArr.length) { iArr[c] = iArr[c] + 1; } } return iArr; } boolean e() { return this.c; } @Override // com.google.zxing.pdf417.decoder.DetectionResultColumn public String toString() { return "IsLeft: " + this.c + '\n' + super.toString(); } private void a(Codeword[] codewordArr, BarcodeMetadata barcodeMetadata) { for (int i = 0; i < codewordArr.length; i++) { Codeword codeword = codewordArr[i]; if (codewordArr[i] != null) { int e = codeword.e() % 30; int c = codeword.c(); if (c > barcodeMetadata.c()) { codewordArr[i] = null; } else { if (!this.c) { c += 2; } int i2 = c % 3; if (i2 != 0) { if (i2 != 1) { if (i2 == 2 && e + 1 != barcodeMetadata.a()) { codewordArr[i] = null; } } else if (e / 3 != barcodeMetadata.b() || e % 3 != barcodeMetadata.d()) { codewordArr[i] = null; } } else if ((e * 3) + 1 != barcodeMetadata.e()) { codewordArr[i] = null; } } } } } }