工作需要,从网上整理的mk文件解释
=====================================================================================================================
LOCAL_PATH := $(call my-dir)//标准mk语句,指编译路径,所有mk文件第一句都是这个
/**这个模块表示引用了一个本地的静态库
include $(CLEAR_VARS) //清除各种变量,因为这些变量是静态全局的,如果清除,下次编译时又会用到这些变量造成出错
LOCAL_MODULE := libopencore-amrnb //本地静态库模块的名字,这个名字在下面编译jni时需要引用
LOCAL_SRC_FILES := lib/libopencore-amrnb.a //本地静态库文件地址
include $(PREBUILT_STATIC_LIBRARY) //PREBUILT_STATIC_LIBRARY表示先build一个静态库
**/
/**这个模块表示引用了一个本地的动态链接库
include $(CLEAR_VARS)
LOCAL_MODULE := libswscale //本地动态库模块的名字
LOCAL_SRC_FILES := lib/libswscale.so //本地动态库文件位置
include $(PREBUILT_SHARED_LIBRARY) //表示先build这个动态链接库
**/
include $(CLEAR_VARS)
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := lib/libavutil.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libavcore
LOCAL_SRC_FILES := lib/libavcore.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := lib/libavcodec.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := lib/libavformat.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenal
LOCAL_SRC_FILES := lib/libopenal.so
include $(PREBUILT_SHARED_LIBRARY)
/**此模块编译自己写的jni文件
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg-jni 模块名字
LOCAL_C_INCLUDES:= $(LOCAL_PATH)/include //我将所有头文件都放到了jni目录的include目录下,这句表示所有引用头文件都到这个目录下去找
LOCAL_SRC_FILES := ../../test-ffmpeg-jni/ffmpeg-jni.c \ //这句表示jni文件的位置,因为我装了一个CDT插件去开发c代码,所以将jni文件都放在了另一个test-ffmpeg-jni工
//程下,其中../表示上级目录
../../test-ffmpeg-jni/openal.c \
../../test-ffmpeg-jni/opengl.cpp
LOCAL_SHARED_LIBRARIES := libavformat libavcodec libavutil libswscale openal //这个表示编译本模块需要用到的其它库,这几个名字都是前面定义的模块名
LOCAL_STATIC_LIBRARIES := libopencore-amrnb //同上
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lGLESv2//表示使用了系统的log库和GLESv2库
include $(BUILD_SHARED_LIBRARY) //注意与前面的不同之处
**/
diff --git a/Android.mk b/Android.mk
index e5281b9..543b7de 100644
--- a/Android.mk
+++ b/Android.mk
@@ -35,6 +35,7 @@ LOCAL_SRC_FILES += \
CameraAAAProcess.cpp
LOCAL_CFLAGS += -DLOG_NDEBUG=1 -DSTDC99 -Wno-write-strings
+LOCAL_CFLAGS += -DPERFORMANCE_TUNING //定义了该宏,可以在代码中判断
ifeq ($(TARGET_PRODUCT), mfld_cdk)
LOCAL_CFLAGS += -DMFLD_CDK
diff --git a/CameraHardware.cpp b/CameraHardware.cpp
index f115583..409d441 100644
--- a/CameraHardware.cpp
+++ b/CameraHardware.cpp
@@ -2040,6 +2040,9 @@ int CameraHardware::burstCaptureHandle(void)
int skipped;
void *main_out, *postview_out;
struct BCBuffer *bcbuf;
+#ifdef PERFORMANCE_TUNING
+ gettimeofday(&burst_mode_handle, 0);
+#endif
sp <MemoryBase> JpegBuffer;
// get size
@@ -2073,6 +2076,9 @@ int CameraHardware::burstCaptureHandle(void)
//Skip frames
snapshotSkipFrames( &main_out, &postview_out);
for (i = 0; i < mBCNumReq; i++) {
+#ifdef PERFORMANCE_TUNING
+ gettimeofday(&burst_mode_start, 0);
+#endif
if (mBCCancelPicture) {
LOG1( "BC, line:%d, in burstCaptureHandle, mBCCancelPicture is true, terminate", __LINE__);
burstCaptureCancelPic();
@@ -2102,6 +2108,10 @@ int CameraHardware::burstCaptureHandle(void)
mNotifyCb(CAMERA_MSG_SHUTTER, 0, 0, mCallbackCookie);
LOG1( "BC, line:%d, shutter:%d", __LINE__, i);
+#ifdef PERFORMANCE_TUNING
+ gettimeofday(&burst_mode_shuttered, 0);
+ LOGD("xiaohai : ----------- each frame shutterd time : %ldms\n", calc_timediff(&burst_mode_start, &burst_mode_shuttered));
+#endif
// do nothing for RAW message
if (mMsgEnabled & CAMERA_MSG_RAW_IMAGE) {
LOG1( "BC, line:%d,do nothing for CAMERA_MSG_RAW_IMAGE", __LINE__);
@@ -2140,6 +2150,10 @@ int CameraHardware::burstCaptureHandle(void)
mDataCb(CAMERA_MSG_POSTVIEW_FRAME, pv_buffer, mCallbackCookie);
pv_buffer.clear();
}
+#ifdef PERFORMANCE_TUNING