From ce82f64e6e14da6f3cfe69cf1ce55c2f1b62f0af Mon Sep 17 00:00:00 2001 From: Matthew Date: Sat, 11 May 2024 11:12:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97Y=E5=88=86=E9=87=8F=E5=B9=B3?= =?UTF-8?q?=E5=9D=87=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/camera2/ndkcamera.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/camera2/ndkcamera.cpp b/app/src/main/cpp/camera2/ndkcamera.cpp index b4c4993e..e9c0d7f1 100644 --- a/app/src/main/cpp/camera2/ndkcamera.cpp +++ b/app/src/main/cpp/camera2/ndkcamera.cpp @@ -740,11 +740,11 @@ void NdkCamera::onImageAvailable(AImageReader* reader) AImage_getPlaneData(image, 2, &v_data, &v_len); #if __cplusplus >= 201703L - uint64_t avgy = std::reduce(y_data, y_data + y_len, 0) / y_len; + uint64_t avgy = std::reduce(y_data, y_data + y_len, 0); #else - uint64_t avgy = std::accumulate(y_data, y_data + y_len, 0) / y_len; + uint64_t avgy = std::accumulate(y_data, y_data + y_len, 0); #endif - mResult.avgY = avgy; + mResult.avgY = avgy / y_len; if (u_data == v_data + 1 && v_data == y_data + width * height && y_pixelStride == 1 && u_pixelStride == 2 && v_pixelStride == 2 && y_rowStride == width && u_rowStride == width && v_rowStride == width) {