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

hello-jni: add README and packaging metadata #2

Merged
merged 2 commits into from
Jun 15, 2015

Conversation

proppy
Copy link
Contributor

@proppy proppy commented Jun 15, 2015

/cc @hak @ggfan

@@ -0,0 +1,59 @@
Hello JNI
=========
This sample show how to call Native C++ code from a Android Java activity using JNI. Note this require a preview build of Android Studio and the experimental version Android Gradle plugin, see the [Pre-requisites](#pre-requisites) and [Getting Started](#getting-started) instructions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shows how to call Native C++ code from Android Java Activity using JNI. Note this requires
^ ^ ^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

proppy added a commit that referenced this pull request Jun 15, 2015
hello-jni: add README and packaging metadata
@proppy proppy merged commit 5c1de1a into android:master Jun 15, 2015
DanAlbert pushed a commit that referenced this pull request May 3, 2024
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.)
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.

2 participants