Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get U/V planes instead of V/U, and encode RGBA instead of BGRA. #846

Merged
merged 1 commit into from
May 3, 2024

Conversation

mansourmoufid
Copy link
Contributor

The U and V planes are swapped here:

  AImage_getPlaneData(image, 0, &yPixel, &yLen);
  AImage_getPlaneData(image, 1, &vPixel, &vLen);
  AImage_getPlaneData(image, 2, &uPixel, &uLen);

According to the docs:

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 actually encodes BGRA, not RGBA:

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

(Swapping U and V is equivalent to swapping R and B.)

@google-cla
Copy link

google-cla bot commented Jun 16, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@DanAlbert DanAlbert enabled auto-merge (squash) May 3, 2024 20:52
@DanAlbert DanAlbert merged commit 9fa9867 into android:main May 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants