summaryrefslogtreecommitdiffstats
path: root/src/org/codeaurora/snapcam/filter
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-08-17 16:54:32 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-27 11:35:08 -0700
commitd7ce24aa42f45eae09427b13c42613312f86d11c (patch)
treeeef9a8846e4b8cf4fcb0a872a70f028d9288b52e /src/org/codeaurora/snapcam/filter
parent00bce4a55d9080938414c806116ce22d2e0b49e0 (diff)
downloadandroid_packages_apps_Snap-d7ce24aa42f45eae09427b13c42613312f86d11c.tar.gz
android_packages_apps_Snap-d7ce24aa42f45eae09427b13c42613312f86d11c.tar.bz2
android_packages_apps_Snap-d7ce24aa42f45eae09427b13c42613312f86d11c.zip
SnapdragonCamera: Fix naming issue for frame dumps
Due to switching registerImage to a parallel task, we ran into the issue of overwriting the previous frame with the current frame. Decouple numbering with registered status to avoid overwrites. Also add timestamp in ms to dump filenames. CRs-Fixed: 1054524 Change-Id: I8cc17989c4c72c8f9bed11c2b208df61583c8866
Diffstat (limited to 'src/org/codeaurora/snapcam/filter')
-rw-r--r--src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
index b599b9175..d360da276 100644
--- a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
+++ b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java
@@ -406,6 +406,8 @@ public class ClearSightImageProcessor {
private SparseLongArray mReprocessingFrames = new SparseLongArray();
private SparseLongArray mReprocessedFrames = new SparseLongArray();
+ private int mReprocessedBayerCount;
+ private int mReprocessedMonoCount;
private NamedEntity mNamedEntity;
private int[] mNumImagesToProcess = new int[NUM_CAM];
private boolean mCaptureDone;
@@ -419,6 +421,8 @@ public class ClearSightImageProcessor {
switch (msg.what) {
case MSG_START_CAPTURE:
mCaptureDone = false;
+ mReprocessedBayerCount = 0;
+ mReprocessedMonoCount = 0;
mNumImagesToProcess[msg.arg1] = msg.arg2;
mNamedImages.nameNewImage(System.currentTimeMillis());
mNamedEntity = mNamedImages.getNextNameEntity();
@@ -638,15 +642,15 @@ public class ClearSightImageProcessor {
Image image = (Image) msg.obj;
long ts = image.getTimestamp();
- Log.d(TAG, "processNewReprocessImage - ts: " + ts);
+ Log.d(TAG, "processNewReprocessImage - cam: " + msg.arg1 + ", ts: " + ts);
+ int frameCount = isBayer?++mReprocessedBayerCount:++mReprocessedMonoCount;
if(mDumpImages) {
saveDebugImageAsJpeg(mMediaSaveService, image, isBayer, mNamedEntity,
- ClearSightNativeEngine.getInstance().getImageCount(isBayer));
+ frameCount, ts/1000000);
}
if(mDumpYUV) {
- saveDebugImageAsNV21(image, isBayer, mNamedEntity,
- ClearSightNativeEngine.getInstance().getImageCount(isBayer));
+ saveDebugImageAsNV21(image, isBayer, mNamedEntity, frameCount, ts/1000000);
}
if (!ClearSightNativeEngine.getInstance()
@@ -959,10 +963,10 @@ public class ClearSightImageProcessor {
}
public void saveDebugImageAsJpeg(MediaSaveService service, byte[] data,
- int width, int height, boolean isBayer, NamedEntity namedEntity, int count) {
- String type = isBayer?"bayer":"mono";
+ int width, int height, boolean isBayer, NamedEntity namedEntity, int count, long ts) {
+ String type = isBayer?"b":"m";
long date = (namedEntity == null) ? -1 : namedEntity.date;
- String title = String.format("%s_%s_%02d", namedEntity.title, type, count);
+ String title = String.format("%s_%s%02d_%d", namedEntity.title, type, count, ts);
service.addImage(data, title, date, null,
width, height, 0, null, null,
@@ -970,33 +974,33 @@ public class ClearSightImageProcessor {
}
public void saveDebugImageAsJpeg(MediaSaveService service, YuvImage image, boolean isBayer,
- NamedEntity namedEntity, int count) {
+ NamedEntity namedEntity, int count, long ts) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compressToJpeg(
new Rect(0, 0, image.getWidth(), image.getHeight()), 100, baos);
saveDebugImageAsJpeg(service, baos.toByteArray(), image.getWidth(), image.getHeight(),
- isBayer, namedEntity, count);
+ isBayer, namedEntity, count, ts);
}
public void saveDebugImageAsJpeg(MediaSaveService service, Image image, boolean isBayer,
- NamedEntity namedEntity, int count) {
+ NamedEntity namedEntity, int count, long ts) {
if(image.getFormat() == ImageFormat.YUV_420_888)
- saveDebugImageAsJpeg(service, createYuvImage(image), isBayer, namedEntity, count);
+ saveDebugImageAsJpeg(service, createYuvImage(image), isBayer, namedEntity, count, ts);
else if (image.getFormat() == ImageFormat.JPEG) {
saveDebugImageAsJpeg(service, getJpegData(image), image.getWidth(), image.getHeight(),
- isBayer, namedEntity, count);
+ isBayer, namedEntity, count, ts);
}
}
- public void saveDebugImageAsNV21(Image image, boolean isBayer, NamedEntity namedEntity, int count) {
+ public void saveDebugImageAsNV21(Image image, boolean isBayer, NamedEntity namedEntity, int count, long ts) {
if(image.getFormat() != ImageFormat.YUV_420_888) {
Log.d(TAG, "saveDebugImageAsNV21 - invalid param");
}
- String type = isBayer?"bayer":"mono";
- String title = String.format("%s_%dx%d_NV21_%s_%02d", namedEntity.title,
- image.getWidth(), image.getHeight(), type, count);
+ String type = isBayer?"b":"m";
+ String title = String.format("%s_%dx%d_NV21_%s%02d_%d", namedEntity.title,
+ image.getWidth(), image.getHeight(), type, count, ts);
YuvImage yuv = createYuvImage(image);
String path = Storage.generateFilepath(title, "yuv");