summaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-08-26 14:55:12 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-27 11:35:33 -0700
commit3ed51c19514a08aef48d75e98b5b2bc55fb182ca (patch)
tree9d76f96f77a893ec5ff4d4805ff112c4aba670e5 /src/org
parent2edb34a53f8006cf2030956861b05e8e67673fdb (diff)
downloadandroid_packages_apps_Snap-3ed51c19514a08aef48d75e98b5b2bc55fb182ca.tar.gz
android_packages_apps_Snap-3ed51c19514a08aef48d75e98b5b2bc55fb182ca.tar.bz2
android_packages_apps_Snap-3ed51c19514a08aef48d75e98b5b2bc55fb182ca.zip
SnapdragonCamera: Fix cropping issues with CS output
Fix cropping issues with CS output for scenes +6ft. CRs-Fixed: 1058843 Change-Id: I03f9dda175cbba2cdbb5ec1d4933136525feef4a
Diffstat (limited to 'src/org')
-rw-r--r--src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
index a968e3bc6..15240ca23 100644
--- a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
+++ b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
@@ -213,7 +213,7 @@ public class ClearSightImageProcessor {
CameraCharacteristics cc = cm.getCameraCharacteristics("0");
byte[] blob = cc.get(OTP_CALIB_BLOB);
ClearSightNativeEngine.getInstance().init(mNumFrameCount*2,
- width, height, CamSystemCalibrationData.createFromBytes(blob));
+ maxWidth, maxHeight, CamSystemCalibrationData.createFromBytes(blob));
} catch (CameraAccessException e) {
e.printStackTrace();
}
@@ -715,6 +715,12 @@ public class ClearSightImageProcessor {
mImageProcessHandler.removeMessages(MSG_NEW_CAPTURE_FAIL);
mCaptureDone = true;
+
+ if(mReprocessingPairCount == 0) {
+ // No matching pairs
+ Log.w(TAG, "processFinalPair - no matching pairs found");
+ if(mCallback != null) mCallback.onClearSightFailure(null);
+ }
}
private void processNewReprocessImage(Message msg) {
@@ -1194,22 +1200,25 @@ public class ClearSightImageProcessor {
// if ratios are different, adjust crop rect to fit ratio
// if ratios are same, no need to adjust crop
+ Log.d(TAG, "getFinalCropRect - rect: " + rect.toString());
+ Log.d(TAG, "getFinalCropRect - ratios: " + rectRatio + ", " + mFinalPictureRatio);
if(rectRatio > mFinalPictureRatio) {
// ratio indicates need for horizontal crop
// add .5 to round up if necessary
int newWidth = (int)(((float)rect.height() * mFinalPictureRatio) + .5f);
- int newXoffset = (rect.width() - newWidth)/2;
+ int newXoffset = (rect.width() - newWidth)/2 + rect.left;
finalRect.left = newXoffset;
finalRect.right = newXoffset + newWidth;
} else if(rectRatio < mFinalPictureRatio) {
// ratio indicates need for vertical crop
// add .5 to round up if necessary
int newHeight = (int)(((float)rect.width() / mFinalPictureRatio) + .5f);
- int newYoffset = (rect.height() - newHeight)/2;
+ int newYoffset = (rect.height() - newHeight)/2 + rect.top;
finalRect.top = newYoffset;
finalRect.bottom = newYoffset + newHeight;
}
+ Log.d(TAG, "getFinalCropRect - final rect: " + finalRect.toString());
return finalRect;
}
}