package com.kofax.kmc.ken.engines; import android.content.Context; import android.graphics.Bitmap; import com.kofax.kmc.ken.engines.data.DocumentDetectionResult; import com.kofax.kmc.ken.engines.data.DocumentDetectionSettings; import com.kofax.kmc.kut.utilities.Licensing; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import com.kofax.kmc.kut.utilities.error.KmcRuntimeException; import com.kofax.mobile.sdk._internal.dagger.Injector; import o.InterfaceC13391fZD; /* loaded from: classes3.dex */ public class DocumentDetector implements IDocumentDetector { private final Context V; protected IDocumentDetector _detector; @InterfaceC13391fZD public DocumentDetector(Context context) { checkLicense(); if (context == null) { throw new KmcRuntimeException(ErrorInfo.KMC_GN_BAD_APPLICATION_CONTEXT); } this.V = context; } private void checkLicense() { if (!Licensing.isSdkLicensed(Licensing.LicenseType.IMAGE_PROCESSING) && !Licensing.isSdkLicensed(Licensing.LicenseType.IMAGE_CAPTURE)) { throw new KmcRuntimeException(ErrorInfo.KMC_UT_LICENSE_IMAGE_PROCESSING); } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.kofax.kmc.ken.engines.DocumentDetector$1, reason: invalid class name */ /* loaded from: classes3.dex */ public static /* synthetic */ class AnonymousClass1 { static final int[] W; static { int[] iArr = new int[DocumentDetectionSettings.DocumentEdgeDetection.values().length]; W = iArr; try { iArr[DocumentDetectionSettings.DocumentEdgeDetection.GPU_BASED.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { W[DocumentDetectionSettings.DocumentEdgeDetection.ISG.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } } } private void a(DocumentDetectionSettings documentDetectionSettings) { if (this._detector == null) { int i = AnonymousClass1.W[documentDetectionSettings.getEdgeDetection().ordinal()]; if (i == 1) { this._detector = Injector.getInjector(this.V).getGpuDocumentDetector(); } else if (i == 2) { this._detector = Injector.getInjector(this.V).getIsgDocumentDetector(); } } } @Override // com.kofax.kmc.ken.engines.IDocumentDetector public DocumentDetectionResult detect(DocumentDetectionSettings documentDetectionSettings, Bitmap bitmap) { a(documentDetectionSettings); return this._detector.detect(documentDetectionSettings, bitmap); } @Override // com.kofax.kmc.ken.engines.IDocumentDetector public DocumentDetectionResult detect(DocumentDetectionSettings documentDetectionSettings, byte[] bArr, int i, int i2) { a(documentDetectionSettings); return this._detector.detect(documentDetectionSettings, bArr, i, i2); } @Override // com.kofax.kmc.ken.engines.IDocumentDetector public void destroy() { IDocumentDetector iDocumentDetector = this._detector; if (iDocumentDetector != null) { iDocumentDetector.destroy(); } } }