summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-09-11 14:28:53 -0700
committerWei-Ta Chen <weita@google.com>2011-09-11 15:23:25 -0700
commit274ca49c63557a8c3ee12c8da5f75e28b4875a5d (patch)
treefe3ae3adbdc66e6f97eb903f05feedebec704e9d /jni
parent452b0dae881f1ed6db431dae2936b4a8115af289 (diff)
downloadLegacyCamera-274ca49c63557a8c3ee12c8da5f75e28b4875a5d.zip
LegacyCamera-274ca49c63557a8c3ee12c8da5f75e28b4875a5d.tar.gz
LegacyCamera-274ca49c63557a8c3ee12c8da5f75e28b4875a5d.tar.bz2
Clean up the logs.
Bug: 5277853 Change-Id: Ic1c9a0395846b6815f2c18663e3c9078781a6194
Diffstat (limited to 'jni')
-rw-r--r--jni/feature_mos/src/mosaic/Blend.cpp17
-rw-r--r--jni/feature_mos/src/mosaic/Blend.h19
-rw-r--r--jni/feature_mos/src/mosaic/Log.h24
-rw-r--r--jni/feature_mos/src/mosaic/Mosaic.cpp17
-rwxr-xr-xjni/feature_mos/src/mosaic_renderer/Renderer.cpp28
-rwxr-xr-xjni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp22
-rwxr-xr-xjni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp21
-rwxr-xr-xjni/feature_mos/src/mosaic_renderer/YVURenderer.cpp21
-rw-r--r--jni/feature_mos_jni.cpp58
-rw-r--r--jni/mosaic_renderer_jni.cpp53
-rw-r--r--jni/mosaic_renderer_jni.h2
11 files changed, 144 insertions, 138 deletions
diff --git a/jni/feature_mos/src/mosaic/Blend.cpp b/jni/feature_mos/src/mosaic/Blend.cpp
index cc146a8..6ecd291 100644
--- a/jni/feature_mos/src/mosaic/Blend.cpp
+++ b/jni/feature_mos/src/mosaic/Blend.cpp
@@ -26,6 +26,9 @@
#include "Geometry.h"
#include "trsMatrix.h"
+#include "Log.h"
+#define LOG_TAG "BLEND"
+
Blend::Blend()
{
m_wb.blendingType = BLEND_TYPE_NONE;
@@ -63,7 +66,7 @@ int Blend::initialize(int blendingType, int frame_width, int frame_height)
if (!m_pFrameYPyr || !m_pFrameUPyr || !m_pFrameVPyr)
{
- LOGIE("Error: Could not allocate pyramids for blending\n");
+ LOGE("Error: Could not allocate pyramids for blending");
return BLEND_RET_ERROR_MEMORY;
}
@@ -101,7 +104,7 @@ int Blend::runBlend(MosaicFrame **frames, int frames_size,
if (numCenters == 0)
{
- LOGIE("Error: No frames to blend\n");
+ LOGE("Error: No frames to blend");
return BLEND_RET_ERROR;
}
@@ -160,14 +163,14 @@ int Blend::runBlend(MosaicFrame **frames, int frames_size,
if (Mwidth < width || Mheight < height)
{
- LOGIE("RunBlend: aborting - consistency check failed, w=%d, h=%d\n", Mwidth, Mheight);
+ LOGE("RunBlend: aborting - consistency check failed, w=%d, h=%d", Mwidth, Mheight);
return BLEND_RET_ERROR;
}
YUVinfo *imgMos = YUVinfo::allocateImage(Mwidth, Mheight);
if (imgMos == NULL)
{
- LOGIE("RunBlend: aborting - couldn't alloc %d x %d mosaic image\n", Mwidth, Mheight);
+ LOGE("RunBlend: aborting - couldn't alloc %d x %d mosaic image", Mwidth, Mheight);
return BLEND_RET_ERROR_MEMORY;
}
@@ -245,7 +248,7 @@ int Blend::FillFramePyramid(MosaicFrame *mb)
!PyramidShort::BorderReduce(m_pFrameUPyr, m_wb.nlevsC) || !PyramidShort::BorderExpand(m_pFrameUPyr, m_wb.nlevsC, -1) ||
!PyramidShort::BorderReduce(m_pFrameVPyr, m_wb.nlevsC) || !PyramidShort::BorderExpand(m_pFrameVPyr, m_wb.nlevsC, -1))
{
- LOGIE("Error: Could not generate Laplacian pyramids\n");
+ LOGE("Error: Could not generate Laplacian pyramids");
return BLEND_RET_ERROR;
}
else
@@ -267,7 +270,7 @@ int Blend::DoMergeAndBlend(MosaicFrame **frames, int nsite,
m_pMosaicVPyr = PyramidShort::allocatePyramidPacked(m_wb.nlevsC,(unsigned short)rect.Width(),(unsigned short)rect.Height(),BORDER);
if (!m_pMosaicYPyr || !m_pMosaicUPyr || !m_pMosaicVPyr)
{
- LOGIE("Error: Could not allocate pyramids for blending\n");
+ LOGE("Error: Could not allocate pyramids for blending");
return BLEND_RET_ERROR_MEMORY;
}
@@ -380,7 +383,7 @@ int Blend::PerformFinalBlending(YUVinfo &imgMos, MosaicRect &cropping_rect)
if (!PyramidShort::BorderExpand(m_pMosaicYPyr, m_wb.nlevs, 1) || !PyramidShort::BorderExpand(m_pMosaicUPyr, m_wb.nlevsC, 1) ||
!PyramidShort::BorderExpand(m_pMosaicVPyr, m_wb.nlevsC, 1))
{
- LOGIE("Error: Could not BorderExpand!\n");
+ LOGE("Error: Could not BorderExpand!");
return BLEND_RET_ERROR;
}
diff --git a/jni/feature_mos/src/mosaic/Blend.h b/jni/feature_mos/src/mosaic/Blend.h
index c878be4..91fbec9 100644
--- a/jni/feature_mos/src/mosaic/Blend.h
+++ b/jni/feature_mos/src/mosaic/Blend.h
@@ -23,7 +23,6 @@
#include "MosaicTypes.h"
#include "Pyramid.h"
-
#include "Delaunay.h"
#define BLEND_RANGE_DEFAULT 6
@@ -34,24 +33,6 @@ 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(...) //
-//#define LOGIE(...) //
-#if 1
-#ifdef ANDROID
-#include <android/log.h>
-#define ANDROID_LOG_VERBOSE ANDROID_LOG_DEBUG
-#define LOG_TAG "CVJNI"
-#define LOGII(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-#define LOGIE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
-#else
-#define LOGII printf
-#define LOGIE printf
-#endif
-#endif
-
-
/**
* Class for pyramid blending a mosaic.
*/
diff --git a/jni/feature_mos/src/mosaic/Log.h b/jni/feature_mos/src/mosaic/Log.h
new file mode 100644
index 0000000..cf6f14b
--- /dev/null
+++ b/jni/feature_mos/src/mosaic/Log.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef LOG_H_
+#define LOG_H
+
+#include <android/log.h>
+#define LOGV(...) __android_log_print(ANDROID_LOG_SILENT, LOG_TAG, __VA_ARGS__)
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
+
+#endif
diff --git a/jni/feature_mos/src/mosaic/Mosaic.cpp b/jni/feature_mos/src/mosaic/Mosaic.cpp
index 3dc1e1d..abbeb96 100644
--- a/jni/feature_mos/src/mosaic/Mosaic.cpp
+++ b/jni/feature_mos/src/mosaic/Mosaic.cpp
@@ -26,6 +26,9 @@
#include "Mosaic.h"
#include "trsMatrix.h"
+#include "Log.h"
+#define LOG_TAG "MOSAIC"
+
Mosaic::Mosaic()
{
initialized = false;
@@ -77,12 +80,12 @@ int Mosaic::initialize(int blendingType, int width, int height, int nframes, boo
}
- LOGIE("Initialize %d %d\n", width, height);
- LOGIE("Frame width %d,%d\n", width, height);
- LOGIE("Max num frames %d\n", max_frames);
+ LOGV("Initialize %d %d", width, height);
+ LOGV("Frame width %d,%d", width, height);
+ LOGV("Max num frames %d", max_frames);
- aligner = new Align();
- aligner->initialize(width, height,quarter_res,thresh_still);
+ aligner = new Align();
+ aligner->initialize(width, height,quarter_res,thresh_still);
if (blendingType == Blend::BLEND_TYPE_FULL ||
blendingType == Blend::BLEND_TYPE_PAN ||
@@ -92,7 +95,7 @@ int Mosaic::initialize(int blendingType, int width, int height, int nframes, boo
blender->initialize(blendingType, width, height);
} else {
blender = NULL;
- LOGIE("Error: Unknown blending type %d\n",blendingType);
+ LOGE("Error: Unknown blending type %d",blendingType);
return MOSAIC_RET_ERROR;
}
@@ -172,7 +175,7 @@ int Mosaic::createMosaic(float &progress, bool &cancelComputation)
}
- int ret;
+ int ret = Blend::BLEND_RET_ERROR;
// Blend the mosaic (alignment has already been done)
if (blender != NULL)
diff --git a/jni/feature_mos/src/mosaic_renderer/Renderer.cpp b/jni/feature_mos/src/mosaic_renderer/Renderer.cpp
index 93049cb..c5c143f 100755
--- a/jni/feature_mos/src/mosaic_renderer/Renderer.cpp
+++ b/jni/feature_mos/src/mosaic_renderer/Renderer.cpp
@@ -1,11 +1,25 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "Renderer.h"
-#include <GLES2/gl2ext.h>
+#include "mosaic/Log.h"
+#define LOG_TAG "Renderer"
-#include <android/log.h>
-#define LOG_TAG "Renderer"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+#include <GLES2/gl2ext.h>
Renderer::Renderer()
: mGlProgram(0),
@@ -54,14 +68,12 @@ GLuint Renderer::createProgram(const char* pVertexSource, const char* pFragmentS
{
return 0;
}
- LOGI("VertexShader Loaded!");
GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
if (!pixelShader)
{
return 0;
}
- LOGI("FragmentShader Loaded!");
GLuint program = glCreateProgram();
if (program)
@@ -71,8 +83,6 @@ GLuint Renderer::createProgram(const char* pVertexSource, const char* pFragmentS
glAttachShader(program, pixelShader);
checkGlError("glAttachShader");
- LOGI("Shaders Attached!");
-
glLinkProgram(program);
GLint linkStatus = GL_FALSE;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
diff --git a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp
index 5b6292b..88aac36 100755
--- a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp
+++ b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp
@@ -1,12 +1,22 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "SurfaceTextureRenderer.h"
#include <GLES2/gl2ext.h>
-
-#include <android/log.h>
-#define LOG_TAG "SurfaceTextureRenderer"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
-
const GLfloat g_vVertices[] = {
-1.f, -1.f, 0.0f, 1.0f, // Position 0
0.0f, 0.0f, // TexCoord 0
diff --git a/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp b/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp
index 80eaa42..af6779a 100755
--- a/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp
+++ b/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp
@@ -1,12 +1,23 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "WarpRenderer.h"
#include <GLES2/gl2ext.h>
-#include <android/log.h>
-#define LOG_TAG "WarpRenderer"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
-
const GLfloat g_vVertices[] = {
-1.f, 1.f, 0.0f, 1.0f, // Position 0
0.0f, 1.0f, // TexCoord 0
diff --git a/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp b/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp
index e244ccf..f7dcf6f 100755
--- a/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp
+++ b/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp
@@ -1,12 +1,23 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "YVURenderer.h"
#include <GLES2/gl2ext.h>
-#include <android/log.h>
-#define LOG_TAG "YVURenderer"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
-
const GLfloat g_vVertices[] = {
-1.f, 1.f, 0.0f, 1.0f, // Position 0
0.0f, 1.0f, // TexCoord 0
diff --git a/jni/feature_mos_jni.cpp b/jni/feature_mos_jni.cpp
index 84647b9..a40c246 100644
--- a/jni/feature_mos_jni.cpp
+++ b/jni/feature_mos_jni.cpp
@@ -24,24 +24,11 @@
#include <time.h>
#include <db_utilities_camera.h>
-
-#ifdef TURN_ON_DEBUG
-#include <android/log.h>
-#define ANDROID_LOG_VERBOSE ANDROID_LOG_DEBUG
-#define LOG_TAG "CVJNI"
-#define LOGV(...) __android_log_print(ANDROID_LOG_SILENT, LOG_TAG, __VA_ARGS__)
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
-#else
-#define LOGI(...) //
-#define LOGE(...) //
-#define LOGV(...) //
-#endif
-
-#include "mosaic/ImageUtils.h"
#include "mosaic/AlignFeatures.h"
#include "mosaic/Blend.h"
#include "mosaic/Mosaic.h"
+#include "mosaic/Log.h"
+#define LOG_TAG "FEATURE_MOS_JNI"
#ifdef __cplusplus
extern "C" {
@@ -129,7 +116,7 @@ int Init(int mID, int nmax)
t1 = now_ms();
time_c = t1 - t0;
LOGV("Init[%d]: %g ms [%d frames]",mID,time_c,nmax);
- return 1;
+ return 1;
}
void GenerateQuarterResImagePlanar(ImageType im, int input_w, int input_h,
@@ -182,15 +169,10 @@ int AddFrame(int mID, int k, float* trs1d)
double t0, t1, time_c;
double trs[3][3];
- t0 = now_ms();
int ret_code = mosaic[mID]->addFrame(tImage[mID][k]);
mosaic[mID]->getAligner()->getLastTRS(trs);
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("Align: %g ms",time_c);
-
if(trs1d!=NULL)
{
@@ -396,35 +378,22 @@ JNIEXPORT jfloatArray JNICALL Java_com_android_camera_panorama_Mosaic_setSourceI
{
double last_tx = mTx;
- t0 = now_ms();
-
sem_wait(&gPreviewImage_semaphore);
ConvertYVUAiToPlanarYVU(tImage[LR][frame_number_LR], gPreviewImage[LR],
tWidth[LR], tHeight[LR]);
sem_post(&gPreviewImage_semaphore);
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("[%d] RGB [LR] => YVU [LR] [%d]: %g ms", frame_number_HR, frame_number_LR,
- time_c);
-
int ret_code = AddFrame(LR, frame_number_LR, gTRS);
if(ret_code == Mosaic::MOSAIC_RET_OK)
{
- t0 = now_ms();
// Copy into HR buffer only if this is a valid frame
sem_wait(&gPreviewImage_semaphore);
ConvertYVUAiToPlanarYVU(tImage[HR][frame_number_HR], gPreviewImage[HR],
tWidth[HR], tHeight[HR]);
sem_post(&gPreviewImage_semaphore);
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("[%d] RGB [HR] => YVU [HR] [%d]: %g ms", frame_number_HR, frame_number_LR,
- time_c);
-
frame_number_LR++;
frame_number_HR++;
}
@@ -459,23 +428,11 @@ JNIEXPORT jfloatArray JNICALL Java_com_android_camera_panorama_Mosaic_setSourceI
{
jbyte *pixels = env->GetByteArrayElements(photo_data, 0);
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("[%d] GetByteArray: %g ms",frame_number_HR,time_c);
-
YUV420toYVU24_NEW(tImage[HR][frame_number_HR], (ImageType)pixels,
tWidth[HR], tHeight[HR]);
- time_c = now_ms() - t1;
- LOGV("[%d] 420to24_NEW: %g ms",frame_number_HR,time_c);
-
env->ReleaseByteArrayElements(photo_data, pixels, 0);
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("[%d] ReadImage [GetByteArray+420to24+ReleaseByteArray]: %g ms",
- frame_number_HR, time_c);
-
double last_tx = mTx;
t0 = now_ms();
@@ -488,11 +445,6 @@ JNIEXPORT jfloatArray JNICALL Java_com_android_camera_panorama_Mosaic_setSourceI
gPreviewImageWidth[LR], gPreviewImageHeight[LR]);
sem_post(&gPreviewImage_semaphore);
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("[%d] HR->LR [%d]: %g ms", frame_number_HR, frame_number_LR,
- time_c);
-
int ret_code = AddFrame(LR, frame_number_LR, gTRS);
if(ret_code == Mosaic::MOSAIC_RET_OK)
@@ -564,6 +516,7 @@ JNIEXPORT jint JNICALL Java_com_android_camera_panorama_Mosaic_createMosaic(
if(high_res)
{
+ LOGV("createMosaic() - High-Res Mode");
double t0, t1, time_c;
gProgress[HR] = 0.0;
@@ -589,7 +542,7 @@ JNIEXPORT jint JNICALL Java_com_android_camera_panorama_Mosaic_createMosaic(
t1 = now_ms();
time_c = t1 - t0;
- LOGV("AlignAll [HR]: %g ms",time_c);
+ LOGV("AlignAll - %d frames [HR]: %g ms", frame_number_HR, time_c);
ret = Finalize(HR);
@@ -600,6 +553,7 @@ JNIEXPORT jint JNICALL Java_com_android_camera_panorama_Mosaic_createMosaic(
}
else
{
+ LOGV("createMosaic() - Low-Res Mode");
gProgress[LR] = TIME_PERCENT_ALIGN;
ret = Finalize(LR);
diff --git a/jni/mosaic_renderer_jni.cpp b/jni/mosaic_renderer_jni.cpp
index b0d6b44..11e7712 100644
--- a/jni/mosaic_renderer_jni.cpp
+++ b/jni/mosaic_renderer_jni.cpp
@@ -1,23 +1,36 @@
-// OpenGL ES 2.0 code
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
#include <jni.h>
-#include <android/log.h>
-
-#include <db_utilities_camera.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "db_utilities_camera.h"
#include "mosaic/ImageUtils.h"
#include "mosaic_renderer/FrameBuffer.h"
#include "mosaic_renderer/WarpRenderer.h"
#include "mosaic_renderer/SurfaceTextureRenderer.h"
#include "mosaic_renderer/YVURenderer.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include "mosaic_renderer_jni.h"
+#include "mosaic/Log.h"
+#define LOG_TAG "MosaicRenderer"
-#define LOG_TAG "MosaicRenderer"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+#include "mosaic_renderer_jni.h"
// Texture handle
GLuint gSurfaceTextureID[1];
@@ -139,14 +152,14 @@ const int GL_TEXTURE_EXTERNAL_OES_ENUM = 0x8D65;
static void printGLString(const char *name, GLenum s) {
const char *v = (const char *) glGetString(s);
- LOGI("GL %s = %s\n", name, v);
+ LOGI("GL %s = %s", name, v);
}
// @return false if there was an error
bool checkGlError(const char* op) {
GLint error = glGetError();
if (error != 0) {
- LOGE("after %s() glError (0x%x)\n", op, error);
+ LOGE("after %s() glError (0x%x)", op, error);
return false;
}
return true;
@@ -565,15 +578,9 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_MosaicRenderer_transferG
{
double t0, t1, time_c;
- t0 = now_ms();
-
gYVURenderer[LR].DrawTexture();
gYVURenderer[HR].DrawTexture();
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("YVU Rendering: %g ms", time_c);
-
sem_wait(&gPreviewImage_semaphore);
// Bind to the input LR FBO and read the Low-Res data from there...
glBindFramebuffer(GL_FRAMEBUFFER, gBufferInputYVU[LR].GetFrameBufferName());
@@ -587,9 +594,6 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_MosaicRenderer_transferG
gPreviewImage[LR]);
checkGlError("glReadPixels LR");
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("glReadPixels LR: %g ms", time_c);
// Bind to the input HR FBO and read the high-res data from there...
glBindFramebuffer(GL_FRAMEBUFFER, gBufferInputYVU[HR].GetFrameBufferName());
@@ -603,9 +607,6 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_MosaicRenderer_transferG
gPreviewImage[HR]);
checkGlError("glReadPixels HR");
- t1 = now_ms();
- time_c = t1 - t0;
- LOGV("glReadPixels HR: %g ms", time_c);
sem_post(&gPreviewImage_semaphore);
}
diff --git a/jni/mosaic_renderer_jni.h b/jni/mosaic_renderer_jni.h
index cd405f9..fa99ffc 100644
--- a/jni/mosaic_renderer_jni.h
+++ b/jni/mosaic_renderer_jni.h
@@ -1,6 +1,4 @@
#pragma once
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
#include <semaphore.h>
// The Preview FBO dimensions are determined from the low-res