fix_android_ndk_camera_order_of_u_and_v
authorutibenkei <utibenkei2@gmail.com>
Mon, 29 Nov 2021 13:43:29 +0000 (22:43 +0900)
committerutibenkei <utibenkei2@gmail.com>
Mon, 29 Nov 2021 16:44:22 +0000 (01:44 +0900)
modules/videoio/src/cap_android_camera.cpp

index f51bfe9..18fc604 100644 (file)
@@ -313,7 +313,7 @@ public:
             if (fourCC == FOURCC_UNKNOWN) {
                 fourCC = FOURCC_NV21;
             }
-        } else if ( (uvPixelStride == 1) && (vPixel == uPixel + uLen) && (yLen == frameWidth * frameHeight) && (uLen == yLen / 4) && (vLen == uLen) ) {
+        } else if ( (uvPixelStride == 1) && (uPixel == vPixel + vLen) && (yLen == frameWidth * frameHeight) && (uLen == yLen / 4) && (vLen == uLen) ) {
             colorFormat = COLOR_FormatYUV420Planar;
             if (fourCC == FOURCC_UNKNOWN) {
                 fourCC = FOURCC_YV12;
@@ -327,7 +327,7 @@ public:
 
         buffer.clear();
         buffer.insert(buffer.end(), yPixel, yPixel + yLen);
-        buffer.insert(buffer.end(), uPixel, uPixel + yLen / 2);
+        buffer.insert(buffer.end(), vPixel, vPixel + yLen / 2);
         return true;
     }