117 lines
4.3 KiB
Java
117 lines
4.3 KiB
Java
|
package com.pingan.ai;
|
|||
|
|
|||
|
import android.os.Handler;
|
|||
|
import android.os.HandlerThread;
|
|||
|
import android.os.Looper;
|
|||
|
import android.os.Message;
|
|||
|
import com.pingan.ai.face.control.LiveFaceConfig;
|
|||
|
import com.pingan.ai.face.entity.PaFaceDetectFrame;
|
|||
|
import com.pingan.ai.face.utils.PaFaceLogger;
|
|||
|
import pingan.ai.paverify.vertify.PFaceDetector;
|
|||
|
|
|||
|
/* loaded from: classes3.dex */
|
|||
|
public class f {
|
|||
|
public a a;
|
|||
|
public HandlerThread b;
|
|||
|
|
|||
|
public native void a(PaFaceDetectFrame paFaceDetectFrame);
|
|||
|
|
|||
|
/* loaded from: classes3.dex */
|
|||
|
public final class a extends Handler {
|
|||
|
public d a;
|
|||
|
public LiveFaceConfig b;
|
|||
|
public float[] c;
|
|||
|
public int d;
|
|||
|
|
|||
|
public a(f fVar, Looper looper, d dVar, LiveFaceConfig liveFaceConfig) {
|
|||
|
super(looper);
|
|||
|
this.a = dVar;
|
|||
|
this.b = liveFaceConfig;
|
|||
|
}
|
|||
|
|
|||
|
@Override // android.os.Handler
|
|||
|
public final void handleMessage(Message message) {
|
|||
|
super.handleMessage(message);
|
|||
|
if (10 == message.what) {
|
|||
|
if (this.c != null) {
|
|||
|
int i = this.d;
|
|||
|
this.d = i + 1;
|
|||
|
if (i < 3) {
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
this.d = 0;
|
|||
|
long currentTimeMillis = System.currentTimeMillis();
|
|||
|
float[] nativeGetFeature = PFaceDetector.nativeGetFeature();
|
|||
|
float[] fArr = this.c;
|
|||
|
if (fArr != null) {
|
|||
|
float nativeCompareFeature = PFaceDetector.nativeCompareFeature(fArr, nativeGetFeature);
|
|||
|
long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
|
|||
|
StringBuilder sb = new StringBuilder("native get and compareFeature feature use time:");
|
|||
|
sb.append(currentTimeMillis2);
|
|||
|
sb.append(",compareScore=");
|
|||
|
sb.append(nativeCompareFeature);
|
|||
|
PaFaceLogger.i(sb.toString());
|
|||
|
this.a.d("GetAndCompareFeature:".concat(String.valueOf(currentTimeMillis2)));
|
|||
|
if (this.a.b()) {
|
|||
|
d dVar = this.a;
|
|||
|
StringBuilder sb2 = new StringBuilder();
|
|||
|
sb2.append(c.a());
|
|||
|
sb2.append(" is detecting all done,reset it.");
|
|||
|
dVar.c(sb2.toString());
|
|||
|
PaFaceLogger.i("is detecting all done,reset it.");
|
|||
|
a();
|
|||
|
} else if (nativeCompareFeature < this.b.getFeatureCompareThr()) {
|
|||
|
d dVar2 = this.a;
|
|||
|
StringBuilder sb3 = new StringBuilder("TrackingError:");
|
|||
|
sb3.append(c.a());
|
|||
|
sb3.append(" feature compare failed, compareScore : ");
|
|||
|
sb3.append(nativeCompareFeature);
|
|||
|
dVar2.a(sb3.toString());
|
|||
|
PaFaceLogger.error("TrackingError: feature compare failed, compareScore : ".concat(String.valueOf(nativeCompareFeature)));
|
|||
|
this.a.b(3003);
|
|||
|
this.a.a(true);
|
|||
|
a();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
this.c = nativeGetFeature;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public final void a() {
|
|||
|
this.c = null;
|
|||
|
this.d = 0;
|
|||
|
removeCallbacksAndMessages(null);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void a(boolean z) {
|
|||
|
a aVar = this.a;
|
|||
|
if (aVar != null) {
|
|||
|
aVar.a();
|
|||
|
}
|
|||
|
if (z) {
|
|||
|
HandlerThread handlerThread = this.b;
|
|||
|
if (handlerThread != null) {
|
|||
|
handlerThread.quit();
|
|||
|
}
|
|||
|
this.b = null;
|
|||
|
this.a = null;
|
|||
|
PaFaceLogger.i("quit compare thread");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public f(d dVar, LiveFaceConfig liveFaceConfig) {
|
|||
|
HandlerThread handlerThread = this.b;
|
|||
|
if (handlerThread == null || !handlerThread.isAlive()) {
|
|||
|
HandlerThread handlerThread2 = new HandlerThread("compareThread");
|
|||
|
this.b = handlerThread2;
|
|||
|
handlerThread2.start();
|
|||
|
}
|
|||
|
if (this.a == null) {
|
|||
|
this.a = new a(this, this.b.getLooper(), dVar, liveFaceConfig);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|