66 lines
3.2 KiB
Java
66 lines
3.2 KiB
Java
package com.google.android.gms.internal.firebase_ml;
|
|
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.internal.firebase_ml.zzmd;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.firebase.FirebaseApp;
|
|
import com.google.firebase.ml.vision.common.FirebaseVisionImage;
|
|
import com.google.firebase.ml.vision.text.FirebaseVisionCloudTextRecognizerOptions;
|
|
import com.google.firebase.ml.vision.text.FirebaseVisionText;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class zzqh extends zzpo<FirebaseVisionText> {
|
|
private static final Map<zznt<FirebaseVisionCloudTextRecognizerOptions>, zzqh> zzax = new HashMap();
|
|
private final FirebaseVisionCloudTextRecognizerOptions zzazs;
|
|
|
|
public static zzqh zza(FirebaseApp firebaseApp, FirebaseVisionCloudTextRecognizerOptions firebaseVisionCloudTextRecognizerOptions) {
|
|
zzqh zzqhVar;
|
|
synchronized (zzqh.class) {
|
|
Preconditions.checkNotNull(firebaseApp, "FirebaseApp must not be null");
|
|
Preconditions.checkNotNull(firebaseApp.getPersistenceKey(), "Firebase app name must not be null");
|
|
Preconditions.checkNotNull(firebaseVisionCloudTextRecognizerOptions, "Options must not be null");
|
|
zznt<FirebaseVisionCloudTextRecognizerOptions> zzj = zznt.zzj(firebaseApp.getPersistenceKey(), firebaseVisionCloudTextRecognizerOptions);
|
|
Map<zznt<FirebaseVisionCloudTextRecognizerOptions>, zzqh> map = zzax;
|
|
zzqhVar = map.get(zzj);
|
|
if (zzqhVar == null) {
|
|
zzqhVar = new zzqh(firebaseApp, firebaseVisionCloudTextRecognizerOptions);
|
|
map.put(zzj, zzqhVar);
|
|
}
|
|
}
|
|
return zzqhVar;
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.firebase_ml.zzpo
|
|
protected final int zznh() {
|
|
return 1024;
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.firebase_ml.zzpo
|
|
protected final int zzni() {
|
|
return 768;
|
|
}
|
|
|
|
private zzqh(FirebaseApp firebaseApp, FirebaseVisionCloudTextRecognizerOptions firebaseVisionCloudTextRecognizerOptions) {
|
|
super(firebaseApp, firebaseVisionCloudTextRecognizerOptions.getModelType() == 1 ? "TEXT_DETECTION" : "DOCUMENT_TEXT_DETECTION", new zzjf(), firebaseVisionCloudTextRecognizerOptions.isEnforceCertFingerprintMatch());
|
|
this.zzazs = firebaseVisionCloudTextRecognizerOptions;
|
|
zznu.zza(firebaseApp, 1).zza(zzmd.zzq.zzjx(), firebaseVisionCloudTextRecognizerOptions.getModelType() == 2 ? zzmn.CLOUD_DOCUMENT_TEXT_CREATE : zzmn.CLOUD_TEXT_CREATE);
|
|
}
|
|
|
|
public final Task<FirebaseVisionText> processImage(FirebaseVisionImage firebaseVisionImage) {
|
|
zzmn zzmnVar = zzmn.CLOUD_TEXT_DETECT;
|
|
if (this.zzazs.getModelType() == 2) {
|
|
zzmnVar = zzmn.CLOUD_DOCUMENT_TEXT_DETECT;
|
|
}
|
|
zznu.zza(this.zzapo, 1).zza(zzmd.zzq.zzjx(), zzmnVar);
|
|
return super.zza(firebaseVisionImage);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.android.gms.internal.firebase_ml.zzpo
|
|
public final /* synthetic */ FirebaseVisionText zza(zzir zzirVar, float f) {
|
|
return zzql.zzb(zzirVar.zzhm(), 1.0f / f);
|
|
}
|
|
}
|