diff options
author | mbansal <mayank.bansal@sri.com> | 2011-08-23 11:42:36 -0400 |
---|---|---|
committer | Wei-Ta Chen <weita@google.com> | 2011-08-24 10:43:01 -0700 |
commit | 50b3c890986aadb3780b4da8c0b8dbb0f1422eba (patch) | |
tree | 963262c11e8a2e7afc301f9886e0d0d90430db21 /jni/feature_mos | |
parent | f26e1ab12cb3f359fe1d6efcbe65344a3a0bf276 (diff) | |
download | LegacyCamera-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')
-rw-r--r-- | jni/feature_mos/src/mosaic/Blend.cpp | 14 | ||||
-rw-r--r-- | jni/feature_mos/src/mosaic/Blend.h | 10 | ||||
-rw-r--r-- | jni/feature_mos/src/mosaic/Mosaic.cpp | 5 | ||||
-rw-r--r-- | jni/feature_mos/src/mosaic/Mosaic.h | 3 |
4 files changed, 24 insertions, 8 deletions
diff --git a/jni/feature_mos/src/mosaic/Blend.cpp b/jni/feature_mos/src/mosaic/Blend.cpp index 46a4410..5d05abe 100644 --- a/jni/feature_mos/src/mosaic/Blend.cpp +++ b/jni/feature_mos/src/mosaic/Blend.cpp @@ -89,7 +89,9 @@ void Blend::AlignToMiddleFrame(MosaicFrame **frames, int frames_size) } } -int Blend::runBlend(MosaicFrame **frames, int frames_size, ImageType &imageMosaicYVU, int &mosaicWidth, int &mosaicHeight) +int Blend::runBlend(MosaicFrame **frames, int frames_size, + ImageType &imageMosaicYVU, int &mosaicWidth, int &mosaicHeight, + float &progress) { int ret; int numCenters; @@ -182,7 +184,8 @@ int Blend::runBlend(MosaicFrame **frames, int frames_size, ImageType &imageMosai MosaicRect cropping_rect; // Do merging and blending : - ret = DoMergeAndBlend(frames, numCenters, width, height, *imgMos, fullRect, cropping_rect); + ret = DoMergeAndBlend(frames, numCenters, width, height, *imgMos, fullRect, + cropping_rect, progress); if (m_wb.blendingType == BLEND_TYPE_HORZ) CropFinalMosaic(*imgMos, cropping_rect); @@ -252,7 +255,8 @@ int Blend::FillFramePyramid(MosaicFrame *mb) } int Blend::DoMergeAndBlend(MosaicFrame **frames, int nsite, - int width, int height, YUVinfo &imgMos, MosaicRect &rect, MosaicRect &cropping_rect) + int width, int height, YUVinfo &imgMos, MosaicRect &rect, + MosaicRect &cropping_rect, float &progress) { m_pMosaicYPyr = NULL; m_pMosaicUPyr = NULL; @@ -298,6 +302,8 @@ int Blend::DoMergeAndBlend(MosaicFrame **frames, int nsite, ProcessPyramidForThisFrame(csite, mb->vcrect, mb->brect, rect, imgMos, mb->trs, site_idx); + progress += TIME_PERCENT_BLEND/nsite; + site_idx++; } @@ -309,6 +315,8 @@ int Blend::DoMergeAndBlend(MosaicFrame **frames, int nsite, if (m_pMosaicUPyr) free(m_pMosaicUPyr); if (m_pMosaicYPyr) free(m_pMosaicYPyr); + progress += TIME_PERCENT_FINAL; + return BLEND_RET_OK; } diff --git a/jni/feature_mos/src/mosaic/Blend.h b/jni/feature_mos/src/mosaic/Blend.h index b58eef9..050b485 100644 --- a/jni/feature_mos/src/mosaic/Blend.h +++ b/jni/feature_mos/src/mosaic/Blend.h @@ -29,6 +29,11 @@ #define BLEND_RANGE_DEFAULT 6 #define BORDER 8 +// Percent of total mosaicing time spent on each of the following operations +const float TIME_PERCENT_ALIGN = 20.0; +const float TIME_PERCENT_BLEND = 75.0; +const float TIME_PERCENT_FINAL = 5.0; + //#define LINEAR_INTERP //#define LOGII(...) // @@ -69,7 +74,8 @@ public: int initialize(int blendingType, int frame_width, int frame_height); - int runBlend(MosaicFrame **frames, int frames_size, ImageType &imageMosaicYVU, int &mosaicWidth, int &mosaicHeight); + int runBlend(MosaicFrame **frames, int frames_size, ImageType &imageMosaicYVU, + int &mosaicWidth, int &mosaicHeight, float &progress); protected: @@ -99,7 +105,7 @@ protected: void ClipBlendRect(CSite *csite, BlendRect &brect); void AlignToMiddleFrame(MosaicFrame **frames, int frames_size); - int DoMergeAndBlend(MosaicFrame **frames, int nsite, int width, int height, YUVinfo &imgMos, MosaicRect &rect, MosaicRect &cropping_rect); + int DoMergeAndBlend(MosaicFrame **frames, int nsite, int width, int height, YUVinfo &imgMos, MosaicRect &rect, MosaicRect &cropping_rect, float &progress); void ComputeMask(CSite *csite, BlendRect &vcrect, BlendRect &brect, MosaicRect &rect, YUVinfo &imgMos, int site_idx); void ProcessPyramidForThisFrame(CSite *csite, BlendRect &vcrect, BlendRect &brect, MosaicRect &rect, YUVinfo &imgMos, double trs[3][3], int site_idx); diff --git a/jni/feature_mos/src/mosaic/Mosaic.cpp b/jni/feature_mos/src/mosaic/Mosaic.cpp index f8f3265..1b50c0c 100644 --- a/jni/feature_mos/src/mosaic/Mosaic.cpp +++ b/jni/feature_mos/src/mosaic/Mosaic.cpp @@ -153,7 +153,7 @@ int Mosaic::addFrame(ImageType imageYVU) } -int Mosaic::createMosaic() +int Mosaic::createMosaic(float &progress) { printf("Creating mosaic\n"); @@ -167,7 +167,8 @@ int Mosaic::createMosaic() // Blend the mosaic (alignment has already been done) if (blender != NULL) { - blender->runBlend((MosaicFrame **) frames, frames_size, imageMosaicYVU, mosaicWidth, mosaicHeight); + blender->runBlend((MosaicFrame **) frames, frames_size, imageMosaicYVU, + mosaicWidth, mosaicHeight, progress); } return MOSAIC_RET_OK; diff --git a/jni/feature_mos/src/mosaic/Mosaic.h b/jni/feature_mos/src/mosaic/Mosaic.h index c34688c..25abc43 100644 --- a/jni/feature_mos/src/mosaic/Mosaic.h +++ b/jni/feature_mos/src/mosaic/Mosaic.h @@ -109,9 +109,10 @@ public: /*! * After adding all frames, call this function to perform the final blending. + * \param progress Variable to set the current progress in. * \return Return code signifying success or failure. */ - int createMosaic(); + int createMosaic(float &progress); /*! * Obtains the resulting mosaic and its dimensions. |