package com.kofax.kmc.ken.engines;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import com.kofax.android.abc.machine_vision.CaptureGuidance;
import com.kofax.android.abc.machine_vision.DocumentTracker;
import com.kofax.kmc.ken.engines.data.HorizontalGuidance;
import com.kofax.kmc.ken.engines.data.OrientationGuidance;
import com.kofax.kmc.ken.engines.data.PassportDetectionResult;
import com.kofax.kmc.ken.engines.data.PassportDetectionSettings;
import com.kofax.kmc.ken.engines.data.TurnGuidance;
import com.kofax.kmc.ken.engines.data.VerticalGuidance;
import com.kofax.kmc.ken.engines.data.ZoomGuidance;
import com.kofax.mobile.sdk._internal.impl.detection.Frame;
import java.util.List;
import java.util.Locale;
/* loaded from: classes3.dex */
public class IsgPassportDetector implements IPassportDetector {
private static final String TAG;
private static final int bD = 1;
private static int bE = 0;
private static final int bM = 921600;
private final IBoundingRectCalculator T;
private final IOrientationGuidanceCalculator ae;
private final DocumentTracker bA = new DocumentTracker();
private Rect bB;
public IsgPassportDetector() {
com.kofax.kmc.ken.engines.a aVar = new com.kofax.kmc.ken.engines.a();
this.T = aVar;
this.ae = new l(aVar);
this.bB = new Rect();
}
static {
System.loadLibrary("a1ac4");
System.loadLibrary("ee77d4");
System.loadLibrary("d8b3e6");
System.loadLibrary("b2681f");
TAG = "IsgPassportDetector";
bE = 0;
}
@Override // com.kofax.kmc.ken.engines.IDocumentDetector
public void destroy() {
this.bA.dispose();
}
@Override // com.kofax.kmc.ken.engines.IDocumentDetector
public PassportDetectionResult detect(PassportDetectionSettings passportDetectionSettings, Bitmap bitmap) {
return a(passportDetectionSettings, new com.kofax.mobile.sdk.o.d(bitmap));
}
@Override // com.kofax.kmc.ken.engines.IDocumentDetector
public PassportDetectionResult detect(PassportDetectionSettings passportDetectionSettings, byte[] bArr, int i, int i2) {
return a(passportDetectionSettings, new com.kofax.mobile.sdk.o.e(bArr, 17, i, i2));
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:14:0x0054 A[Catch: all -> 0x0120, TRY_LEAVE, TryCatch #0 {, blocks: (B:5:0x0021, B:11:0x0030, B:12:0x0044, B:14:0x0054, B:19:0x005e, B:21:0x00c4, B:23:0x00cc, B:25:0x00d4, B:27:0x00dc, B:28:0x00e6, B:30:0x00e9, B:35:0x00f6, B:37:0x00f9, B:39:0x00fd, B:42:0x0106, B:44:0x010d, B:48:0x0116, B:55:0x0042, B:58:0x011a, B:59:0x011f, B:7:0x0024, B:10:0x0028, B:54:0x003b), top: B:4:0x0021, inners: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:18:0x005d */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private com.kofax.kmc.ken.engines.IsgPassportDetector.a a(com.kofax.kmc.ken.engines.data.PassportDetectionSettings r19, com.kofax.mobile.sdk.o.f r20) {
/*
Method dump skipped, instructions count: 291
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.IsgPassportDetector.a(com.kofax.kmc.ken.engines.data.PassportDetectionSettings, com.kofax.mobile.sdk.o.f):com.kofax.kmc.ken.engines.IsgPassportDetector$a");
}
private void a(int i, int i2, PassportDetectionSettings passportDetectionSettings) {
if (i == this.bB.width() && i2 == this.bB.height()) {
return;
}
Rect rect = new Rect(0, 0, i, i2);
this.bA.initializeString(b(i, i2), "DocumentTracker");
r();
this.bB = rect;
}
private void r() {
this.bA.reset();
this.bA.startup();
this.bA.RunDetection = true;
this.bA.RunLocalSearch = false;
this.bA.RunBoundaryDetection = true;
this.bA.RunDirectionDetection = true;
this.bA.RunRecognition = false;
}
private static String b(int i, int i2) {
float f;
float f2;
if (i * i2 < bM) {
f = 50.0f;
f2 = 1.0f;
} else {
f = 100.0f;
f2 = 0.5f;
}
return String.format(Locale.US, " ", Float.valueOf(f2), Float.valueOf(f));
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class a extends PassportDetectionResult {
private final OrientationGuidance U;
private final b bG;
public a(Rect rect, List list, boolean z, Frame frame, CaptureGuidance captureGuidance, PassportDetectionSettings passportDetectionSettings, IOrientationGuidanceCalculator iOrientationGuidanceCalculator) {
super(rect, list, frame);
this.bG = new b(new k(captureGuidance), passportDetectionSettings, rect, frame.getWidth(), frame.getHeight(), this.bounds, z);
this.U = iOrientationGuidanceCalculator.calculate(rect, this.bounds);
}
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
public ZoomGuidance getZoomGuidance() {
return this.bG.e();
}
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
public TurnGuidance getTurnGuidance() {
return this.bG.getTurnGuidance();
}
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
public HorizontalGuidance getHorizontalMovementGuidance() {
return this.bG.getHorizontalMovementGuidance();
}
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
public VerticalGuidance getVerticalMovementGuidance() {
return this.bG.getVerticalMovementGuidance();
}
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
public OrientationGuidance getOrientationGuidance() {
return this.U;
}
}
}