From 274ca49c63557a8c3ee12c8da5f75e28b4875a5d Mon Sep 17 00:00:00 2001 From: Wei-Ta Chen Date: Sun, 11 Sep 2011 14:28:53 -0700 Subject: Clean up the logs. Bug: 5277853 Change-Id: Ic1c9a0395846b6815f2c18663e3c9078781a6194 --- jni/feature_mos/src/mosaic/Blend.cpp | 17 +++++++------ jni/feature_mos/src/mosaic/Blend.h | 19 --------------- jni/feature_mos/src/mosaic/Log.h | 24 +++++++++++++++++++ jni/feature_mos/src/mosaic/Mosaic.cpp | 17 +++++++------ jni/feature_mos/src/mosaic_renderer/Renderer.cpp | 28 +++++++++++++++------- .../src/mosaic_renderer/SurfaceTextureRenderer.cpp | 22 ++++++++++++----- .../src/mosaic_renderer/WarpRenderer.cpp | 21 ++++++++++++---- .../src/mosaic_renderer/YVURenderer.cpp | 21 ++++++++++++---- 8 files changed, 111 insertions(+), 58 deletions(-) create mode 100644 jni/feature_mos/src/mosaic/Log.h (limited to 'jni/feature_mos') 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 -#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 +#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 +#include "mosaic/Log.h" +#define LOG_TAG "Renderer" -#include -#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 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 - -#include -#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 -#include -#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 -#include -#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 -- cgit v1.1