summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorJack Yoo <jyoo@codeaurora.org>2016-07-13 14:49:22 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-16 16:10:03 -0700
commit7d80bdb6ca1db08ecd29389ac7f263ecff6c5b70 (patch)
treeddbfe6349ed8f7b619817b0c84f6c2105793d499 /jni
parentbec67f460a2acb5d239ab5455a8eb0b8a66cfe23 (diff)
downloadandroid_packages_apps_Snap-7d80bdb6ca1db08ecd29389ac7f263ecff6c5b70.tar.gz
android_packages_apps_Snap-7d80bdb6ca1db08ecd29389ac7f263ecff6c5b70.tar.bz2
android_packages_apps_Snap-7d80bdb6ca1db08ecd29389ac7f263ecff6c5b70.zip
SnapdragonCamera: Selfie Mirror mode
Selfie mirror menu for front camera1. Change-Id: I2e6845c9e25481106f51772b5d3dfd0a971a2be7 CRs-Fixed: 1050663
Diffstat (limited to 'jni')
-rw-r--r--jni/image_util_jni.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/jni/image_util_jni.cpp b/jni/image_util_jni.cpp
index 2297f9164..a4779b3d7 100644
--- a/jni/image_util_jni.cpp
+++ b/jni/image_util_jni.cpp
@@ -44,6 +44,8 @@ JNIEXPORT jint JNICALL Java_com_android_camera_imageprocessor_FrameProcessor_nat
jint imageWidth, jint imageHeight, jint degree, jobjectArray outBuf);
JNIEXPORT jint JNICALL Java_com_android_camera_imageprocessor_FrameProcessor_nativeNV21toRgb(
JNIEnv *env, jobject thiz, jobjectArray yvuBuf, jobjectArray rgbBuf, jint width, jint height);
+JNIEXPORT jint JNICALL Java_com_android_camera_imageprocessor_PostProcessor_nativeFlipVerticalNV21(
+ JNIEnv* env, jobject thiz, jbyteArray yvuBytes, jint width, jint height);
#ifdef __cplusplus
}
#endif
@@ -150,4 +152,32 @@ jint JNICALL Java_com_android_camera_imageprocessor_FrameProcessor_nativeNV21toR
}
}
return 0;
+}
+
+jint JNICALL Java_com_android_camera_imageprocessor_PostProcessor_nativeFlipVerticalNV21(
+ JNIEnv* env, jobject thiz, jbyteArray yvuBytes, jint width, jint height)
+{
+ jbyte* imageDataNV21Array = env->GetByteArrayElements(yvuBytes, NULL);
+ uint8_t *buf = (uint8_t *)imageDataNV21Array;
+ int ysize = width * height;
+ uint8_t temp1, temp2;
+ for(int x=0; x < width; x++) {
+ for(int y=0; y < height/2; y++) {
+ temp1 = buf[y*width + x];
+ buf[y*width + x] = buf[(height-1-y)*width + x];
+ buf[(height-1-y)*width + x] = temp1;
+ }
+ }
+ for(int x=0; x < width; x+=2) {
+ for(int y=0; y < height/4; y++) {
+ temp1 = buf[ysize + y*width + x];
+ temp2 = buf[ysize + y*width + x + 1];
+ buf[ysize + y*width + x] = buf[ysize + (height/2-1-y)*width + x];
+ buf[ysize + y*width + x + 1] = buf[ysize + (height/2-1-y)*width + x + 1];
+ buf[ysize + (height/2-1-y)*width + x] = temp1;
+ buf[ysize + (height/2-1-y)*width + x + 1] = temp2;
+ }
+ }
+ env->ReleaseByteArrayElements(yvuBytes, imageDataNV21Array, JNI_ABORT);
+ return 0;
} \ No newline at end of file