Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix doubly incorrect encoding/decoding.
The U and V planes are swapped [here](https://github.com/android/ndk-samples/blob/main/camera/basic/src/main/cpp/image_reader.cpp#L257): AImage_getPlaneData(image, 0, &yPixel, &yLen); AImage_getPlaneData(image, 1, &vPixel, &vLen); AImage_getPlaneData(image, 2, &uPixel, &uLen); According to [the docs](https://developer.android.com/ndk/reference/group/media#group___media_1gga9c3dace30485a0f28163a882a5d65a19aea9797f9b5db5d26a2055a43d8491890): > The order of planes is guaranteed such that plane #0 is always Y, plane #1 is always U (Cb), and plane #2 is always V (Cr). This works out because [the function YUV2RGB](https://github.com/android/ndk-samples/blob/main/camera/basic/src/main/cpp/image_reader.cpp#L193) actually encodes BGRA, not RGBA: return 0xff000000 | (nR << 16) | (nG << 8) | nB; (Swapping U and V is equivalent to swapping R and B.)
- Loading branch information