summaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authormingwax <mingwax@codeaurora.org>2017-04-28 13:36:54 +0800
committermingwax <mingwax@codeaurora.org>2017-07-04 10:38:20 +0800
commit45916b7512c08097ee53ab38c08fc979026fbe3c (patch)
treeaa640fff276360cb34552a0306b8806b04e81244 /src/org
parent2b2d7f4c6cffdc6ad6bc0b6ef459271291c99aea (diff)
downloadandroid_packages_apps_Snap-45916b7512c08097ee53ab38c08fc979026fbe3c.tar.gz
android_packages_apps_Snap-45916b7512c08097ee53ab38c08fc979026fbe3c.tar.bz2
android_packages_apps_Snap-45916b7512c08097ee53ab38c08fc979026fbe3c.zip
SnapdragonCamera: Pass device mount orientation to Clearsight JNI
1. Add persist system property to config device mount orientation 2. Pass device mount orientation to Clearsight JNI 3. Recalculate the size of the buffer YUV. CRs-Fixed: 2039320 Change-Id: Ie3c13ccd3d261df4cad310aa6235f548263b3ca1
Diffstat (limited to 'src/org')
-rw-r--r--src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java5
-rw-r--r--src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java27
2 files changed, 26 insertions, 6 deletions
diff --git a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
index b2a81389d..f26caf717 100644
--- a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
+++ b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
@@ -1543,11 +1543,14 @@ public class ClearSightImageProcessor {
ByteBuffer vuBuffer = planes[2].getBuffer();
int sizeY = yBuffer.capacity();
int sizeVU = vuBuffer.capacity();
- byte[] data = new byte[sizeY + sizeVU];
+ int stride = image.getPlanes()[0].getRowStride();
+ int height = image.getHeight();
+ byte[] data = new byte[stride * height*3/2];
yBuffer.rewind();
yBuffer.get(data, 0, sizeY);
vuBuffer.rewind();
vuBuffer.get(data, sizeY, sizeVU);
+
int[] strides = new int[] { planes[0].getRowStride(),
planes[2].getRowStride() };
diff --git a/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java b/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java
index 8b30ca032..5ba0fd951 100644
--- a/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java
+++ b/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java
@@ -41,8 +41,12 @@ import android.media.Image;
import android.media.Image.Plane;
import android.util.Log;
+import com.android.camera.util.PersistUtil;
+
public class ClearSightNativeEngine {
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG =
+ (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_LOG) ||
+ (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_ALL);
private static final String TAG = "ClearSightNativeEngine";
static {
try {
@@ -75,8 +79,14 @@ public class ClearSightNativeEngine {
private ArrayList<SourceImage> mCache = new ArrayList<SourceImage>();
private ArrayList<SourceImage> mSrcColor = new ArrayList<SourceImage>();
private ArrayList<SourceImage> mSrcMono = new ArrayList<SourceImage>();
+ private final float mBrIntensity;
+ private final float mSmoothingIntensity;
+ private final boolean mIsVerticallyAlignedSensor;
private ClearSightNativeEngine() {
+ mBrIntensity = PersistUtil.getDualCameraBrIntensity();
+ mSmoothingIntensity = PersistUtil.getDualCameraSmoothingIntensity();
+ mIsVerticallyAlignedSensor = PersistUtil.getDualCameraSensorAlign();
}
public static void createInstance() {
@@ -296,10 +306,16 @@ public class ClearSightNativeEngine {
exposure /= 100000;
Log.d(TAG, "processImage - iso: " + iso + " exposure ms: " + exposure);
- return nativeClearSightProcessInit(numImages,
+ if (DEBUG) {
+ Log.d(TAG,"processImage - mBrIntensity :" + mBrIntensity +
+ ", mSmoothingIntensity :" + mSmoothingIntensity +
+ ", mIsVerticallyAlignedSensor :" + mIsVerticallyAlignedSensor);
+ }
+ return nativeClearSightProcessInit2(numImages,
srcColorY, srcColorVU, metadataColor, mImageWidth, mImageHeight,
mYStride, mVUStride, srcMonoY, metadataMono, mImageWidth, mImageHeight,
- mYStride, mOtpCalibData, (int)exposure, iso);
+ mYStride, mOtpCalibData, (int)exposure, iso,
+ mBrIntensity, mSmoothingIntensity, mIsVerticallyAlignedSensor);
}
public boolean processImage(ClearsightImage csImage) {
@@ -326,12 +342,13 @@ public class ClearSightNativeEngine {
int strideY, int strideVU, ByteBuffer dstY, ByteBuffer dstVU,
float[] metadata);
- private native final boolean nativeClearSightProcessInit(int numImagePairs,
+ private native final boolean nativeClearSightProcessInit2(int numImagePairs,
ByteBuffer[] srcColorY, ByteBuffer[] srcColorVU,
float[][] metadataColor, int srcColorWidth, int srcColorHeight,
int srcColorStrideY, int srcColorStrideVU, ByteBuffer[] srcMonoY,
float[][] metadataMono, int srcMonoWidth, int srcMonoHeight,
- int srcMonoStrideY, byte[] otp, int exposureMs, int iso);
+ int srcMonoStrideY, byte[] otp, int exposureMs, int iso,
+ float brIntensity, float smoothingIntensity, boolean isVerticallyAlignedSensor);
private native final boolean nativeClearSightProcess(ByteBuffer dstY,
ByteBuffer dstVU, int dstStrideY, int dstStrideVU, int[] roiRect);