Skip to content

Commit

Permalink
Get U/V planes instead of V/U, and encode RGBA instead of BGRA.
Browse files Browse the repository at this point in the history
  • Loading branch information
mansourmoufid authored and DanAlbert committed May 3, 2024
1 parent 1cb6518 commit 3066c6d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions camera/basic/src/main/cpp/image_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static inline uint32_t YUV2RGB(int nY, int nU, int nV) {
nG = (nG >> 10) & 0xff;
nB = (nB >> 10) & 0xff;

return 0xff000000 | (nR << 16) | (nG << 8) | nB;
return 0xff000000 | (nB << 16) | (nG << 8) | nR;
}

/**
Expand Down Expand Up @@ -258,8 +258,8 @@ void ImageReader::PresentImage(ANativeWindow_Buffer *buf, AImage *image) {
AImage_getPlaneRowStride(image, 0, &yStride);
AImage_getPlaneRowStride(image, 1, &uvStride);
AImage_getPlaneData(image, 0, &yPixel, &yLen);
AImage_getPlaneData(image, 1, &vPixel, &vLen);
AImage_getPlaneData(image, 2, &uPixel, &uLen);
AImage_getPlaneData(image, 1, &uPixel, &uLen);
AImage_getPlaneData(image, 2, &vPixel, &vLen);
int32_t uvPixelStride;
AImage_getPlanePixelStride(image, 1, &uvPixelStride);

Expand Down Expand Up @@ -297,8 +297,8 @@ void ImageReader::PresentImage90(ANativeWindow_Buffer *buf, AImage *image) {
AImage_getPlaneRowStride(image, 0, &yStride);
AImage_getPlaneRowStride(image, 1, &uvStride);
AImage_getPlaneData(image, 0, &yPixel, &yLen);
AImage_getPlaneData(image, 1, &vPixel, &vLen);
AImage_getPlaneData(image, 2, &uPixel, &uLen);
AImage_getPlaneData(image, 1, &uPixel, &uLen);
AImage_getPlaneData(image, 2, &vPixel, &vLen);
int32_t uvPixelStride;
AImage_getPlanePixelStride(image, 1, &uvPixelStride);

Expand Down Expand Up @@ -338,8 +338,8 @@ void ImageReader::PresentImage180(ANativeWindow_Buffer *buf, AImage *image) {
AImage_getPlaneRowStride(image, 0, &yStride);
AImage_getPlaneRowStride(image, 1, &uvStride);
AImage_getPlaneData(image, 0, &yPixel, &yLen);
AImage_getPlaneData(image, 1, &vPixel, &vLen);
AImage_getPlaneData(image, 2, &uPixel, &uLen);
AImage_getPlaneData(image, 1, &uPixel, &uLen);
AImage_getPlaneData(image, 2, &vPixel, &vLen);
int32_t uvPixelStride;
AImage_getPlanePixelStride(image, 1, &uvPixelStride);

Expand Down Expand Up @@ -380,8 +380,8 @@ void ImageReader::PresentImage270(ANativeWindow_Buffer *buf, AImage *image) {
AImage_getPlaneRowStride(image, 0, &yStride);
AImage_getPlaneRowStride(image, 1, &uvStride);
AImage_getPlaneData(image, 0, &yPixel, &yLen);
AImage_getPlaneData(image, 1, &vPixel, &vLen);
AImage_getPlaneData(image, 2, &uPixel, &uLen);
AImage_getPlaneData(image, 1, &uPixel, &uLen);
AImage_getPlaneData(image, 2, &vPixel, &vLen);
int32_t uvPixelStride;
AImage_getPlanePixelStride(image, 1, &uvPixelStride);

Expand Down

0 comments on commit 3066c6d

Please sign in to comment.