summaryrefslogtreecommitdiffstats
path: root/jni/feature_mos/src/mosaic
diff options
context:
space:
mode:
authormbansal <mayank.bansal@sri.com>2011-08-08 20:23:02 -0400
committerWei-Ta Chen <weita@google.com>2011-08-12 15:05:43 -0700
commit41a2e9735136f372de95652d0828600282c8e967 (patch)
tree25e946121b6940cd3dfa19746a393e5c05179ef4 /jni/feature_mos/src/mosaic
parent7058a9318dd5d6d5a1e79a84080cdc02975f68c1 (diff)
downloadLegacyCamera-41a2e9735136f372de95652d0828600282c8e967.zip
LegacyCamera-41a2e9735136f372de95652d0828600282c8e967.tar.gz
LegacyCamera-41a2e9735136f372de95652d0828600282c8e967.tar.bz2
Updates to allow using SurfaceTexture for reading the preview frames directly from GPU memory.
1) SurfaceTexture is now used to obtain the data processed by the mosaicing library. 2) SurfaceTexture in GPU memory is directly rendered using the transformation from the mosaicing library to generate the preview mosaic. 3) GPU is also used to generate the Low-Res frames from the High-res frames (was being done in CPU before). 4) SurfaceTexture is also used to render the viewfinder as soon as the mosaicing application starts (eliminating the need for a separate SurfaceHolder to render the camera). 5) Modified the XML layout during the preview state to be the same size as during the capture stage to accommodate the SurfaceTexture based viewfinder [this needs to be reviewed and adjusted]. 6) Fixed the viewfinder and back button issues identified by Wei-Ta. 7) Round-1 of removing trailing spaces and tabs. 8) Added documentation to new Java side interfaces and cleaned up code in general. 9) Cleaned up redundant and commented out code from the native side. 10) Merged with latest updates from the main trunk. 11) Fixed issues identified in code review and also cleaned up and refactored some code. 12) Added layout-w1024dp/pano_capture.xml for tablet layout. Change-Id: If8fb0116de6c7fc6652cc67ac453553726961c32
Diffstat (limited to 'jni/feature_mos/src/mosaic')
-rw-r--r--jni/feature_mos/src/mosaic/ImageUtils.cpp45
-rw-r--r--jni/feature_mos/src/mosaic/ImageUtils.h2
2 files changed, 47 insertions, 0 deletions
diff --git a/jni/feature_mos/src/mosaic/ImageUtils.cpp b/jni/feature_mos/src/mosaic/ImageUtils.cpp
index 792b90d..2671dd4 100644
--- a/jni/feature_mos/src/mosaic/ImageUtils.cpp
+++ b/jni/feature_mos/src/mosaic/ImageUtils.cpp
@@ -25,6 +25,51 @@
#include "ImageUtils.h"
+void ImageUtils::rgba2yvu(ImageType out, ImageType in, int width, int height)
+{
+ int r,g,b, a;
+ ImageType yimg = out;
+ ImageType vimg = yimg + width*height;
+ ImageType uimg = vimg + width*height;
+ ImageType image = in;
+
+ for (int ii = 0; ii < height; ii++) {
+ for (int ij = 0; ij < width; ij++) {
+ r = (*image++);
+ g = (*image++);
+ b = (*image++);
+ a = (*image++);
+
+ if (r < 0) r = 0;
+ if (r > 255) r = 255;
+ if (g < 0) g = 0;
+ if (g > 255) g = 255;
+ if (b < 0) b = 0;
+ if (b > 255) b = 255;
+
+ int val = (int) (REDY * r + GREENY * g + BLUEY * b) / 1000 + 16;
+ if (val < 0) val = 0;
+ if (val > 255) val = 255;
+ *(yimg) = val;
+
+ val = (int) (REDV * r - GREENV * g - BLUEV * b) / 1000 + 128;
+ if (val < 0) val = 0;
+ if (val > 255) val = 255;
+ *(vimg) = val;
+
+ val = (int) (-REDU * r - GREENU * g + BLUEU * b) / 1000 + 128;
+ if (val < 0) val = 0;
+ if (val > 255) val = 255;
+ *(uimg) = val;
+
+ yimg++;
+ uimg++;
+ vimg++;
+ }
+ }
+}
+
+
void ImageUtils::rgb2yvu(ImageType out, ImageType in, int width, int height)
{
int r,g,b;
diff --git a/jni/feature_mos/src/mosaic/ImageUtils.h b/jni/feature_mos/src/mosaic/ImageUtils.h
index 9a47cc1..8778238 100644
--- a/jni/feature_mos/src/mosaic/ImageUtils.h
+++ b/jni/feature_mos/src/mosaic/ImageUtils.h
@@ -61,6 +61,8 @@ public:
*/
static void rgb2yvu(ImageType out, ImageType in, int width, int height);
+ static void rgba2yvu(ImageType out, ImageType in, int width, int height);
+
/**
* Convert image from YVU (non-interlaced) to BGR (interlaced)
*