summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorqimengp <qimengp@codeaurora.org>2016-12-28 12:41:02 +0800
committerqimengp <qimengp@codeaurora.org>2017-01-11 16:16:35 +0800
commit332382b24b2c9e5e7f2b21485eea42e85a0fe505 (patch)
tree47dd11f44eb3299d1dec6d4c21cd0c7751f938ae /src
parent84aa68c1fa9a3b3658a2b0d1718ceb109342fee6 (diff)
downloadandroid_packages_apps_Snap-332382b24b2c9e5e7f2b21485eea42e85a0fe505.tar.gz
android_packages_apps_Snap-332382b24b2c9e5e7f2b21485eea42e85a0fe505.tar.bz2
android_packages_apps_Snap-332382b24b2c9e5e7f2b21485eea42e85a0fe505.zip
SnapdragonCamera: Dualcamera fix ReprocessingFrames mismatch
Since mReprocessingFrames use timestamp as index, when bayer and mono has the same timestamp, will cause index mismatch. Use two mReprocessingFrames to represent the B, M buffer, can fix this issue Change-Id: Iaf3171717158c1c405aa7a1e141c247897aaad7d CRs-Fixed: 1110019
Diffstat (limited to 'src')
-rwxr-xr-xsrc/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
index cb9aa9df1..b938363fa 100755
--- a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
+++ b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
@@ -459,7 +459,7 @@ public class ClearSightImageProcessor {
private ArrayDeque<Image> mMonoImages = new ArrayDeque<Image>(
mNumBurstCount);
- private SparseLongArray mReprocessingFrames = new SparseLongArray();
+ private SparseLongArray[] mReprocessingFrames = new SparseLongArray[NUM_CAM];
private ArrayList<CaptureRequest> mReprocessingRequests = new ArrayList<CaptureRequest>();
private int mReprocessingPairCount;
private int mReprocessedBayerCount;
@@ -471,6 +471,8 @@ public class ClearSightImageProcessor {
ImageProcessHandler(Looper looper) {
super(looper);
+ mReprocessingFrames[CAM_TYPE_BAYER] = new SparseLongArray();
+ mReprocessingFrames[CAM_TYPE_MONO] = new SparseLongArray();
}
@Override
@@ -517,7 +519,8 @@ public class ClearSightImageProcessor {
Log.d(TAG, "handleTimeout");
releaseBayerFrames();
releaseMonoFrames();
- mReprocessingFrames.clear();
+ mReprocessingFrames[CAM_TYPE_BAYER].clear();
+ mReprocessingFrames[CAM_TYPE_MONO].clear();
mReprocessingRequests.clear();
removeMessages(MSG_NEW_CAPTURE_RESULT);
@@ -537,10 +540,11 @@ public class ClearSightImageProcessor {
}
private void processImg(Message msg) {
- Log.d(TAG, "processImg: " + msg.arg1);
+ int camId = msg.arg1;
+ Log.d(TAG, "processImg: " + camId);
Image image = (Image) msg.obj;
- if(mReprocessingFrames.size() > 0
- && mReprocessingFrames.indexOfValue(image.getTimestamp()) >= 0) {
+ if(mReprocessingFrames[camId].size() > 0
+ && mReprocessingFrames[camId].indexOfValue(image.getTimestamp()) >= 0) {
// reproc frame
processNewReprocessImage(msg);
} else {
@@ -607,7 +611,7 @@ public class ClearSightImageProcessor {
" imagestoprocess[mono]: " + mNumImagesToProcess[CAM_TYPE_MONO] +
" mReprocessingPairCount: " + mReprocessingPairCount +
" mNumFrameCount: " + mNumFrameCount +
- " mFinishReprocessNum" + mFinishReprocessNum);
+ " mFinishReprocessNum: " + mFinishReprocessNum);
if ((mNumImagesToProcess[CAM_TYPE_BAYER] == 0
&& mNumImagesToProcess[CAM_TYPE_MONO] == 0)
@@ -702,7 +706,7 @@ public class ClearSightImageProcessor {
Long ts = Long.valueOf(reprocImg.mImage.getTimestamp());
Integer hash = ts.hashCode();
reprocRequest.setTag(hash);
- mReprocessingFrames.put(hash, ts);
+ mReprocessingFrames[camId].put(hash, ts);
Log.d(TAG, "sendReprocessRequest - adding reproc frame - hash: " + hash + ", ts: " + ts);
mImageWriter[camId].queueInputImage(reprocImg.mImage);
@@ -798,7 +802,8 @@ public class ClearSightImageProcessor {
Image image = (Image) msg.obj;
long ts = image.getTimestamp();
- Log.d(TAG, "processNewReprocessImage - cam: " + msg.arg1 + ", ts: " + ts);
+ int camId = msg.arg1;
+ Log.d(TAG, "processNewReprocessImage - cam: " + camId + ", ts: " + ts);
int frameCount = isBayer?++mReprocessedBayerCount:++mReprocessedMonoCount;
if(mDumpImages) {
@@ -812,7 +817,7 @@ public class ClearSightImageProcessor {
mClearsightRegisterHandler.obtainMessage(MSG_NEW_IMG,
msg.arg1, 0, msg.obj).sendToTarget();
- mReprocessingFrames.removeAt(mReprocessingFrames.indexOfValue(ts));
+ mReprocessingFrames[camId].removeAt(mReprocessingFrames[camId].indexOfValue(ts));
checkReprocessDone();
}
@@ -833,20 +838,25 @@ public class ClearSightImageProcessor {
}
private void processNewReprocessFailure(Message msg) {
- Log.d(TAG, "processNewReprocessFailure: " + msg.arg1);
+ int camId = msg.arg1;
+ Log.d(TAG, "processNewReprocessFailure: " + camId);
CaptureFailure failure = (CaptureFailure)msg.obj;
mReprocessingRequests.remove(failure.getRequest());
- mReprocessingFrames.delete(msg.arg2);
+ mReprocessingFrames[camId].delete(msg.arg2);
mHasFailures = true;
mFinishReprocessNum++;
checkReprocessDone();
}
private void checkReprocessDone() {
- Log.d(TAG, "checkReprocessDone capture done: " + mCaptureDone
- + ", reproc frames: " + mReprocessingFrames.size());
+ Log.d(TAG, "checkReprocessDone capture done: " + mCaptureDone +
+ ", reproc frames[bay]: " + mReprocessingFrames[CAM_TYPE_BAYER].size() +
+ ", reproc frames[mono]: " + mReprocessingFrames[CAM_TYPE_MONO].size() +
+ ", mReprocessingRequests: " + mReprocessingRequests.size());
// If all burst frames and results have been processed
- if(mCaptureDone && mReprocessingFrames.size() == 0 && mReprocessingRequests.isEmpty()) {
+ if(mCaptureDone && mReprocessingFrames[CAM_TYPE_BAYER].size() == 0
+ && mReprocessingFrames[CAM_TYPE_MONO].size() == 0
+ && mReprocessingRequests.isEmpty()) {
mClearsightRegisterHandler.obtainMessage(MSG_END_CAPTURE, mHasFailures?1:0, 0).sendToTarget();
removeMessages(MSG_NEW_REPROC_RESULT);
removeMessages(MSG_NEW_REPROC_FAIL);