Переглянути джерело

:seedling: 整合人脸SDK

everywindchase 10 місяців тому
батько
коміт
fbc503df71

+ 11 - 7
app/src/main/java/com/ethan/psbc/ui/dialogs/DialogValidateFace.kt

@@ -159,15 +159,19 @@ class DialogValidateFace( mContext: Context) : FullScreenPopupView(mContext), Ko
                     var position:Int= 0;
                     var nv21:ByteArray = ByteArray(ySize + imageProxy.width * imageProxy.height / 2);
 
-                    var chromaHeight:Int=0
+                    var chromaHeight: Int
+                    run {
+                        chromaHeight = 0
+                        while (chromaHeight < imageProxy.height) {
+                            yBuffer[nv21, position, imageProxy.width]
+                            position += imageProxy.width
+                            yBuffer.position(min(ySize.toDouble(), (yBuffer.position() - imageProxy.width + yPlane.rowStride).toDouble()).toInt())
+                            ++chromaHeight
+                        }
+                    }
+
 
 
-                    for( i   in  0.rangeTo(imageProxy.getHeight()) step  1) {
-                    yBuffer.get(nv21, position, imageProxy.getWidth());
-                    position += imageProxy.getWidth();
-                    yBuffer.position(Math.min(ySize, yBuffer.position() - imageProxy.getWidth() + yPlane.getRowStride()));
-                        chromaHeight+= chromaHeight+1
-                    }
 
 
                     chromaHeight = imageProxy.getHeight() / 2