summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/panorama
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-11-03 10:59:01 -0700
committerWei-Ta Chen <weita@google.com>2011-11-04 12:27:36 -0700
commit0a039136e8e46ddbcb45b55e92d80ddb2ddfc2c2 (patch)
tree4fde6040c9b57db71ab374a70b507f6d79f6c0d4 /src/com/android/camera/panorama
parent54ae365d5dbd491941dc9dc0111182cc94942267 (diff)
downloadLegacyCamera-0a039136e8e46ddbcb45b55e92d80ddb2ddfc2c2.zip
LegacyCamera-0a039136e8e46ddbcb45b55e92d80ddb2ddfc2c2.tar.gz
LegacyCamera-0a039136e8e46ddbcb45b55e92d80ddb2ddfc2c2.tar.bz2
Fix an OOM issue in mosaic blending.
Set two limits on when we will do mosaic blending. 1) mosaic_width * mosaic_height < (5 * frame_width) * (2 * frame_height) 2) mosaic_height < 2.5 * frame_height The latter limit rejects blending for the cases having too much movement in the secondary direction. Bug: 5554762 Change-Id: I05fb24bb1ff5446bea0cc1a1de8a02c37fb642d7
Diffstat (limited to 'src/com/android/camera/panorama')
-rwxr-xr-xsrc/com/android/camera/panorama/PanoramaActivity.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index 8b9c65a..a65d263 100755
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -989,9 +989,20 @@ public class PanoramaActivity extends ActivityBase implements
keepScreenOnAwhile();
}
+ /**
+ * Generate the final mosaic image.
+ *
+ * @param highRes flag to indicate whether we want to get a high-res version.
+ * @return a MosaicJpeg with its isValid flag set to true if successful; null if the generation
+ * process is cancelled; and a MosaicJpeg with its isValid flag set to false if there
+ * is an error in generating the final mosaic.
+ */
public MosaicJpeg generateFinalMosaic(boolean highRes) {
- if (mMosaicFrameProcessor.createMosaic(highRes) == Mosaic.MOSAIC_RET_CANCELLED) {
+ int mosaicReturnCode = mMosaicFrameProcessor.createMosaic(highRes);
+ if (mosaicReturnCode == Mosaic.MOSAIC_RET_CANCELLED) {
return null;
+ } else if (mosaicReturnCode == Mosaic.MOSAIC_RET_ERROR) {
+ return new MosaicJpeg();
}
byte[] imageData = mMosaicFrameProcessor.getFinalMosaicNV21();