summaryrefslogtreecommitdiffstats
path: root/jni/feature_mos/src/mosaic
diff options
context:
space:
mode:
authormbansal <mayank.bansal@sri.com>2011-08-16 10:01:20 -0400
committerWei-Ta Chen <weita@google.com>2011-08-18 14:39:33 -0700
commit1e762b1f935c9d4a06af6dd56121590ca81d48b1 (patch)
treeb7177cb69ece87e1d55f587779a53f213255592d /jni/feature_mos/src/mosaic
parent362928c00ad4ecc0466c353d942c6d6c7cc5f5ee (diff)
downloadLegacyCamera-1e762b1f935c9d4a06af6dd56121590ca81d48b1.zip
LegacyCamera-1e762b1f935c9d4a06af6dd56121590ca81d48b1.tar.gz
LegacyCamera-1e762b1f935c9d4a06af6dd56121590ca81d48b1.tar.bz2
Updates to allow the viewfinder to slide across the UI with device panning. Also, rendering updates for color conversion using GPU.
1) Refactored the SurfaceTextureRenderer and WarpRenderer classes to inherit from a new base class Renderer. 2) Fixed a minor bug in the Blend class and added a helper function to create the mosaic in middle frame coordinate system [no changes in run-time behavior]. 3) Added a flip-flop gPreviewFBO to allow panning the viewfinder across the UI when the user pans the device. 4) Fixed the size of the viewfinder and preview mosaic to match the UI layout height. 5) The viewfinder in the preview stage is now aligned with the viewfinder in the capture stage. 6) Added new class YVURenderer that converts from RGB to YVU data using GLSL shaders. 7) Modified the rendering pipeline to use GPU for RGB to YVU conversion. The processing thread now only performs conversion from YVUA interlaced to YVU planar format. 8) Updates following Wei-Ta's code-review comments. Change-Id: I6c18df3b57d1c2d78d55da8a8f3b9cd970c8d903
Diffstat (limited to 'jni/feature_mos/src/mosaic')
-rw-r--r--jni/feature_mos/src/mosaic/Blend.cpp23
-rw-r--r--jni/feature_mos/src/mosaic/Blend.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/jni/feature_mos/src/mosaic/Blend.cpp b/jni/feature_mos/src/mosaic/Blend.cpp
index eb0275e..46a4410 100644
--- a/jni/feature_mos/src/mosaic/Blend.cpp
+++ b/jni/feature_mos/src/mosaic/Blend.cpp
@@ -70,6 +70,25 @@ int Blend::initialize(int blendingType, int frame_width, int frame_height)
return BLEND_RET_OK;
}
+void Blend::AlignToMiddleFrame(MosaicFrame **frames, int frames_size)
+{
+ // Unwarp this frame and Warp the others to match
+ MosaicFrame *mb = NULL;
+ MosaicFrame *ref = frames[int(frames_size/2)]; // Middle frame
+
+ double invtrs[3][3];
+ inv33d(ref->trs, invtrs);
+
+ for(int mfit = 0; mfit < frames_size; mfit++)
+ {
+ mb = frames[mfit];
+ double temp[3][3];
+ mult33d(temp, invtrs, mb->trs);
+ memcpy(mb->trs, temp, sizeof(temp));
+ normProjMat33d(mb->trs);
+ }
+}
+
int Blend::runBlend(MosaicFrame **frames, int frames_size, ImageType &imageMosaicYVU, int &mosaicWidth, int &mosaicHeight)
{
int ret;
@@ -872,8 +891,8 @@ void Blend::ComputeBlendParameters(MosaicFrame **frames, int frames_size, int is
MosaicFrame *last = frames[frames_size-1];
MosaicFrame *mb;
- double lxpos = last->trs[0][2], lypos = last->trs[1][5];
- double fxpos = first->trs[0][2], fypos = first->trs[1][5];
+ double lxpos = last->trs[0][2], lypos = last->trs[1][2];
+ double fxpos = first->trs[0][2], fypos = first->trs[1][2];
// Calculate warp to produce proper stitching.
// get x, y displacement
diff --git a/jni/feature_mos/src/mosaic/Blend.h b/jni/feature_mos/src/mosaic/Blend.h
index 9998aa6..3e5b17c 100644
--- a/jni/feature_mos/src/mosaic/Blend.h
+++ b/jni/feature_mos/src/mosaic/Blend.h
@@ -98,6 +98,7 @@ protected:
void MosaicToFrame(double trs[3][3], double x, double y, double &wx, double &wy);
void FrameToMosaicRect(int width, int height, double trs[3][3], BlendRect &brect);
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);
void ComputeMask(CSite *csite, BlendRect &vcrect, BlendRect &brect, MosaicRect &rect, YUVinfo &imgMos, int site_idx);