summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Brabham <optedoblivion@cyngn.com>2015-11-09 15:11:54 -0800
committerArne Coucheron <arco68@gmail.com>2018-01-26 01:09:15 +0100
commitcf28cc8d76e4314e2b72d9d929919dfd432c468b (patch)
tree6f93c7339b97c05df17f1c9f01747bb40d7d8260
parent60469f9a262e7897c68456b6a27b11cb28fcecd8 (diff)
downloadandroid_packages_apps_Snap-cf28cc8d76e4314e2b72d9d929919dfd432c468b.zip
android_packages_apps_Snap-cf28cc8d76e4314e2b72d9d929919dfd432c468b.tar.gz
android_packages_apps_Snap-cf28cc8d76e4314e2b72d9d929919dfd432c468b.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 945a7dc..1765b23 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -68,7 +68,8 @@ public class WideAnglePanoramaModule
implements CameraModule, 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 = 960 * 720;
@@ -583,6 +584,9 @@ public class WideAnglePanoramaModule
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,
@@ -591,8 +595,8 @@ public class WideAnglePanoramaModule
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 {
@@ -612,7 +616,7 @@ public class WideAnglePanoramaModule
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();