summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Brabham <optedoblivion@cyngn.com>2015-11-09 15:11:54 -0800
committerSteve Kondik <steve@cyngn.com>2016-11-20 02:22:51 -0800
commitb7da1542fb0d8c136b49b951390ca0a99f048c8a (patch)
tree02199d56dac5d1e6f1942f54d6451783524c6cac
parentd1754762f03706737efa3ada96b692c891235b24 (diff)
downloadandroid_packages_apps_Snap-b7da1542fb0d8c136b49b951390ca0a99f048c8a.zip
android_packages_apps_Snap-b7da1542fb0d8c136b49b951390ca0a99f048c8a.tar.gz
android_packages_apps_Snap-b7da1542fb0d8c136b49b951390ca0a99f048c8a.tar.bz2
Make panorama able to go 270 degrees in landscape
Change-Id: Icfab44c674bcc59c1d369af64985956ccaf63ccc issue-id: SAMBAR-869 (cherry picked from commit e0ca697b97ef2d872f682d2b357d7233762cfafd)
-rw-r--r--jni/feature_mos_jni.cpp2
-rw-r--r--src/com/android/camera/MosaicFrameProcessor.java2
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java12
3 files changed, 10 insertions, 6 deletions
diff --git a/jni/feature_mos_jni.cpp b/jni/feature_mos_jni.cpp
index 0fa792a..1445a5c 100644
--- a/jni/feature_mos_jni.cpp
+++ b/jni/feature_mos_jni.cpp
@@ -38,7 +38,7 @@ extern "C" {
char buffer[1024];
-const int MAX_FRAMES = 100;
+const int MAX_FRAMES = 200; // 100 per 180 degrees
static double mTx;
diff --git a/src/com/android/camera/MosaicFrameProcessor.java b/src/com/android/camera/MosaicFrameProcessor.java
index cb30534..2e027b3 100644
--- a/src/com/android/camera/MosaicFrameProcessor.java
+++ b/src/com/android/camera/MosaicFrameProcessor.java
@@ -24,7 +24,7 @@ import android.util.Log;
public class MosaicFrameProcessor {
private static final String TAG = "MosaicFrameProcessor";
private static final int NUM_FRAMES_IN_BUFFER = 2;
- private static final int MAX_NUMBER_OF_FRAMES = 100;
+ private static final int MAX_NUMBER_OF_FRAMES = 100 * 2; // We need 200 frames for 360 degrees
private static final int MOSAIC_RET_CODE_INDEX = 10;
private static final int FRAME_COUNT_INDEX = 9;
private static final int X_COORD_INDEX = 2;
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 9c44f5c..424d849 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -69,7 +69,8 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
WideAnglePanoramaController,
SurfaceTexture.OnFrameAvailableListener {
- public static final int DEFAULT_SWEEP_ANGLE = 160;
+ public static final int DEFAULT_SWEEP_ANGLE_PORTRAIT = 160;
+ public static final int DEFAULT_SWEEP_ANGLE_LANDSCAPE = 270;
public static final int DEFAULT_BLEND_MODE = Mosaic.BLENDTYPE_HORIZONTAL;
public static final int DEFAULT_CAPTURE_PIXELS = 1440 * 1080;
@@ -576,6 +577,9 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
parameters.setAutoWhiteBalanceLock(true);
configureCamera(parameters);
+ final int sweepAngle = (mDeviceOrientation == 90 || mDeviceOrientation == 270) ?
+ DEFAULT_SWEEP_ANGLE_LANDSCAPE : DEFAULT_SWEEP_ANGLE_PORTRAIT;
+
mMosaicFrameProcessor.setProgressListener(new MosaicFrameProcessor.ProgressListener() {
@Override
public void onProgress(boolean isFinished, float panningRateX, float panningRateY,
@@ -584,8 +588,8 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
float accumulatedVerticalAngle = progressY * mVerticalViewAngle;
boolean isRotated = !(mDeviceOrientationAtCapture == mDeviceOrientation);
if (isFinished
- || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE)
- || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)
+ || (Math.abs(accumulatedHorizontalAngle) >= sweepAngle)
+ || (Math.abs(accumulatedVerticalAngle) >= sweepAngle)
|| isRotated) {
stopCapture(false);
} else {
@@ -605,7 +609,7 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
mUI.resetCaptureProgress();
// TODO: calculate the indicator width according to different devices to reflect the actual
// angle of view of the camera device.
- mUI.setMaxCaptureProgress(DEFAULT_SWEEP_ANGLE);
+ mUI.setMaxCaptureProgress(sweepAngle);
mUI.showCaptureProgress();
mDeviceOrientationAtCapture = mDeviceOrientation;
keepScreenOn();