summaryrefslogtreecommitdiffstats
path: root/jni/feature_mos_jni.cpp
diff options
context:
space:
mode:
authormbansal <mayank.bansal@sri.com>2011-08-23 11:42:36 -0400
committerWei-Ta Chen <weita@google.com>2011-08-24 10:43:01 -0700
commit50b3c890986aadb3780b4da8c0b8dbb0f1422eba (patch)
tree963262c11e8a2e7afc301f9886e0d0d90430db21 /jni/feature_mos_jni.cpp
parentf26e1ab12cb3f359fe1d6efcbe65344a3a0bf276 (diff)
downloadLegacyCamera-50b3c890986aadb3780b4da8c0b8dbb0f1422eba.zip
LegacyCamera-50b3c890986aadb3780b4da8c0b8dbb0f1422eba.tar.gz
LegacyCamera-50b3c890986aadb3780b4da8c0b8dbb0f1422eba.tar.bz2
Updates to allow the mosaic library to report the mosaic computation progress (both low-res and high-res).
1) Added a new method to the Mosaic class that reports the percent progress for both LR and HR mosaicers. 2) Added a test function to the activity that logs the reported progress. 3) [REMOVED] Added a test progress-bar to the UI for quick testing of the progress reporting UI. 4) Made minor updates in response to Wei-Ta's review. Change-Id: Iaf8ccf771579a40580a868743a6b53c6b05f14c6
Diffstat (limited to 'jni/feature_mos_jni.cpp')
-rw-r--r--jni/feature_mos_jni.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/jni/feature_mos_jni.cpp b/jni/feature_mos_jni.cpp
index d82c47d..1c163ab 100644
--- a/jni/feature_mos_jni.cpp
+++ b/jni/feature_mos_jni.cpp
@@ -65,6 +65,8 @@ Mosaic *mosaic[NR] = {NULL,NULL};
ImageType resultYVU = ImageUtils::IMAGE_TYPE_NOIMAGE;
ImageType resultBGR = ImageUtils::IMAGE_TYPE_NOIMAGE;
float gTRS[10];
+// Variables to keep track of the mosaic computation progress for both LR & HR.
+float gProgress[NR];
int c;
int ret;
@@ -211,7 +213,7 @@ void Finalize(int mID)
t0 = now_ms();
// Create the mosaic
- ret = mosaic[mID]->createMosaic();
+ ret = mosaic[mID]->createMosaic(gProgress[mID]);
t1 = now_ms();
time_c = t1 - t0;
LOGV("CreateMosaic: %g ms",time_c);
@@ -527,9 +529,21 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_reset(
frame_number_HR = 0;
frame_number_LR = 0;
+ gProgress[LR] = 0.0;
+ gProgress[HR] = 0.0;
+
Init(LR,MAX_FRAMES_LR);
}
+JNIEXPORT jint JNICALL Java_com_android_camera_panorama_Mosaic_reportProgress(
+ JNIEnv* env, jobject thiz, jboolean hires)
+{
+ if(bool(hires))
+ return (jint) gProgress[HR];
+ else
+ return (jint) gProgress[LR];
+}
+
JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_createMosaic(
JNIEnv* env, jobject thiz, jboolean value)
{
@@ -539,24 +553,34 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_createMosaic(
{
double t0, t1, time_c;
+ gProgress[HR] = 0.0;
t0 = now_ms();
Init(HR, frame_number_HR);
+
for(int k = 0; k < frame_number_HR; k++)
{
AddFrame(HR, k, NULL);
+ gProgress[HR] += TIME_PERCENT_ALIGN/frame_number_HR;
}
+ gProgress[HR] = TIME_PERCENT_ALIGN;
+
t1 = now_ms();
time_c = t1 - t0;
LOGV("AlignAll [HR]: %g ms",time_c);
Finalize(HR);
+
+ gProgress[HR] = 100.0;
+
high_res = false;
}
else
{
+ gProgress[LR] = TIME_PERCENT_ALIGN;
Finalize(LR);
+ gProgress[LR] = 100.0;
}
}