From 70166820ead0a1dae37db543a39b270614ce579a Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Fri, 18 May 2012 12:59:40 +0000 Subject: [PATCH] Merged the trunk r8324:8345 --- CMakeLists.txt | 11 +++++- cmake/OpenCVDetectPython.cmake | 2 +- cmake/OpenCVModule.cmake | 34 ++++++++++++++----- modules/core/perf/perf_convertTo.cpp | 2 +- modules/core/src/matmul.cpp | 5 +-- modules/ml/include/opencv2/ml/ml.hpp | 2 ++ modules/ts/CMakeLists.txt | 7 ++-- modules/video/include/opencv2/video/video.hpp | 9 +++++ samples/gpu/performance/performance.cpp | 16 +++++---- 9 files changed, 65 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b98ba12f..6999ecb1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,10 +154,19 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID ) OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT IOS AND BUILD_SHARED_LIBS) ) + +if(CMAKE_GENERATOR MATCHES Xcode) + set(ENABLE_SOLUTION_FOLDERS0 ON) +elseif(MSVC_IDE) + set(ENABLE_SOLUTION_FOLDERS0 ON) +else() + set(ENABLE_SOLUTION_FOLDERS0 OFF) +endif() + # OpenCV build options # =================================================== OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) ) -OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" MSVC_IDE IF (CMAKE_VERSION VERSION_GREATER "2.8.0") ) +OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" ${ENABLE_SOLUTION_FOLDERS0} IF (CMAKE_VERSION VERSION_GREATER "2.8.0") ) OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) ) diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index 9b8b826f9..e025a7fd2 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -20,8 +20,8 @@ unset(HAVE_SPHINX CACHE) if(PYTHON_EXECUTABLE) if(PYTHON_VERSION_STRING) - set(PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}") set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}") else() execute_process(COMMAND ${PYTHON_EXECUTABLE} --version ERROR_VARIABLE PYTHON_VERSION_FULL diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 9c21c732f..8d37ffe56 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -7,6 +7,7 @@ # # OPENCV_MODULE_${the_module}_LOCATION # OPENCV_MODULE_${the_module}_DESCRIPTION +# OPENCV_MODULE_${the_module}_CLASS - PUBLIC|INTERNAL|BINDINGS # OPENCV_MODULE_${the_module}_HEADERS # OPENCV_MODULE_${the_module}_SOURCES # OPENCV_MODULE_${the_module}_DEPS - final flattened set of module dependencies @@ -18,6 +19,8 @@ # To control the setup of the module you could also set: # the_description - text to be used as current module description # OPENCV_MODULE_TYPE - STATIC|SHARED - set to force override global settings for current module +# OPENCV_MODULE_IS_PART_OF_WORLD - ON|OFF (default ON) - should the module be added to the opencv_world? +# BUILD_${the_module}_INIT - ON|OFF (default ON) - initial value for BUILD_${the_module} # The verbose template for OpenCV module: # @@ -38,10 +41,12 @@ # clean flags for modules enabled on previous cmake run # this is necessary to correctly handle modules removal -foreach(mod ${OPENCV_MODULES_BUILD}) +foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE}) if(HAVE_${mod}) unset(HAVE_${mod} CACHE) endif() + unset(OPENCV_MODULE_${mod}_REQ_DEPS CACHE) + unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE) endforeach() # clean modules info which needs to be recalculated @@ -58,8 +63,8 @@ set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules whic # * - can include full names of modules or full pathes to shared/static libraries or cmake targets macro(ocv_add_dependencies full_modname) #we don't clean the dependencies here to allow this macro several times for every module - foreach(d "REQIRED" ${ARGN}) - if(d STREQUAL "REQIRED") + foreach(d "REQUIRED" ${ARGN}) + if(d STREQUAL "REQUIRED") set(__depsvar OPENCV_MODULE_${full_modname}_REQ_DEPS) elseif(d STREQUAL "OPTIONAL") set(__depsvar OPENCV_MODULE_${full_modname}_OPT_DEPS) @@ -84,7 +89,7 @@ endmacro() # Usage: # ocv_add_module( [INTERNAL|BINDINGS] [REQUIRED] [] [OPTIONAL ]) # Example: -# ocv_add_module(yaom INTERNAL opencv_core opencv_highgui NOLINK opencv_flann OPTIONAL opencv_gpu) +# ocv_add_module(yaom INTERNAL opencv_core opencv_highgui opencv_flann OPTIONAL opencv_gpu) macro(ocv_add_module _name) string(TOLOWER "${_name}" name) string(REGEX REPLACE "^opencv_" "" ${name} "${name}") @@ -106,23 +111,31 @@ macro(ocv_add_module _name) endif() set(OPENCV_MODULE_${the_module}_DESCRIPTION "${the_description}" CACHE INTERNAL "Brief description of ${the_module} module") set(OPENCV_MODULE_${the_module}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${the_module} module sources") - unset(OPENCV_MODULE_${the_module}_REQ_DEPS CACHE) - unset(OPENCV_MODULE_${the_module}_OPT_DEPS CACHE) #create option to enable/disable this module - option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ON) + if(NOT DEFINED BUILD_${the_module}_INIT) + set(BUILD_${the_module}_INIT ON) + endif() + option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${BUILD_${the_module}_INIT}) if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS") + set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module") set(__ocv_argn__ ${ARGN}) list(REMOVE_AT __ocv_argn__ 0) ocv_add_dependencies(${the_module} ${__ocv_argn__}) unset(__ocv_argn__) else() + set(OPENCV_MODULE_${the_module}_CLASS "PUBLIC" CACHE INTERNAL "The cathegory of the module") ocv_add_dependencies(${the_module} ${ARGN}) if(BUILD_${the_module}) set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export") endif() endif() + + # add self to the world dependencies + if(NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS" OR OPENCV_MODULE_IS_PART_OF_WORLD) + ocv_add_dependencies(opencv_world OPTIONAL ${the_module}) + endif() if(BUILD_${the_module}) set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} "${the_module}" CACHE INTERNAL "List of OpenCV modules included into the build") @@ -429,10 +442,13 @@ endmacro() # creates OpenCV module in current folder # creates new target, configures standard dependencies, compilers flags, install rules # Usage: -# ocv_create_module() +# ocv_create_module() +# ocv_create_module(SKIP_LINK) macro(ocv_create_module) add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}) - target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) + if(NOT "${ARGN}" STREQUAL "SKIP_LINK") + target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) + endif() add_dependencies(opencv_modules ${the_module}) if(ENABLE_SOLUTION_FOLDERS) diff --git a/modules/core/perf/perf_convertTo.cpp b/modules/core/perf/perf_convertTo.cpp index ef0bf6545..7ba9d367b 100644 --- a/modules/core/perf/perf_convertTo.cpp +++ b/modules/core/perf/perf_convertTo.cpp @@ -32,5 +32,5 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo, TEST_CYCLE() src.convertTo(dst, depthDst, alpha); - SANITY_CHECK(dst, 1e-12); + SANITY_CHECK(dst, alpha == 1.0 ? 1e-12 : 1e-7); } diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index dbfa36e3d..a55fab30c 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -2768,8 +2768,9 @@ typedef double (*DotProdFunc)(const uchar* src1, const uchar* src2, int len); static DotProdFunc dotProdTab[] = { - (DotProdFunc)GET_OPTIMIZED(dotProd_8u), (DotProdFunc)dotProd_8s, (DotProdFunc)dotProd_16u, - (DotProdFunc)dotProd_16s, (DotProdFunc)dotProd_32s, (DotProdFunc)GET_OPTIMIZED(dotProd_32f), + (DotProdFunc)GET_OPTIMIZED(dotProd_8u), (DotProdFunc)GET_OPTIMIZED(dotProd_8s), + (DotProdFunc)dotProd_16u, (DotProdFunc)dotProd_16s, + (DotProdFunc)dotProd_32s, (DotProdFunc)GET_OPTIMIZED(dotProd_32f), (DotProdFunc)dotProd_64f, 0 }; diff --git a/modules/ml/include/opencv2/ml/ml.hpp b/modules/ml/include/opencv2/ml/ml.hpp index 0cc1b5feb..6358fa7be 100644 --- a/modules/ml/include/opencv2/ml/ml.hpp +++ b/modules/ml/include/opencv2/ml/ml.hpp @@ -2136,6 +2136,8 @@ typedef CvGBTreesParams GradientBoostingTreeParams; typedef CvGBTrees GradientBoostingTrees; template<> CV_EXPORTS void Ptr::delete_obj(); + +CV_EXPORTS bool initModule_ml(void); } diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt index b62375020..ba4847b0f 100644 --- a/modules/ts/CMakeLists.txt +++ b/modules/ts/CMakeLists.txt @@ -1,3 +1,5 @@ +set(the_description "The ts module") + if(IOS) ocv_module_disable(ts) endif() @@ -5,8 +7,9 @@ endif() if(MINGW) set(OPENCV_MODULE_TYPE STATIC) endif() - -set(the_description "The ts module") + +set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE) + ocv_add_module(ts opencv_core) ocv_glob_module_sources() ocv_module_include_directories() diff --git a/modules/video/include/opencv2/video/video.hpp b/modules/video/include/opencv2/video/video.hpp index 21a2fcec4..ebac290a0 100644 --- a/modules/video/include/opencv2/video/video.hpp +++ b/modules/video/include/opencv2/video/video.hpp @@ -46,4 +46,13 @@ #include "opencv2/video/tracking.hpp" #include "opencv2/video/background_segm.hpp" +#ifdef __cplusplus +namespace cv +{ + +CV_EXPORTS bool initModule_video(void); + +} +#endif + #endif //__OPENCV_VIDEO_HPP__ diff --git a/samples/gpu/performance/performance.cpp b/samples/gpu/performance/performance.cpp index e268d650b..b9c193996 100644 --- a/samples/gpu/performance/performance.cpp +++ b/samples/gpu/performance/performance.cpp @@ -17,7 +17,7 @@ void TestSystem::run() return; } - // Run test initializers + // Run test initializers for (vector::iterator it = inits_.begin(); it != inits_.end(); ++it) { if ((*it)->name().find(test_filter_, 0) != string::npos) @@ -67,7 +67,7 @@ void TestSystem::finishCurrentSubtest() speedup_total_ += speedup; printMetrics(cpu_time, gpu_time, speedup); - + num_subtests_called_++; resetCurrentSubtest(); } @@ -86,8 +86,8 @@ void TestSystem::printHeading() { cout << endl; cout << setiosflags(ios_base::left); - cout << TAB << setw(10) << "CPU, ms" << setw(10) << "GPU, ms" - << setw(14) << "SPEEDUP" + cout << TAB << setw(10) << "CPU, ms" << setw(10) << "GPU, ms" + << setw(14) << "SPEEDUP" << "DESCRIPTION\n"; cout << resetiosflags(ios_base::left); } @@ -96,8 +96,8 @@ void TestSystem::printHeading() void TestSystem::printSummary() { cout << setiosflags(ios_base::fixed); - cout << "\naverage GPU speedup: x" - << setprecision(3) << speedup_total_ / std::max(1, num_subtests_called_) + cout << "\naverage GPU speedup: x" + << setprecision(3) << speedup_total_ / std::max(1, num_subtests_called_) << endl; cout << resetiosflags(ios_base::fixed); } @@ -144,7 +144,7 @@ string abspath(const string& relpath) } -int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/, +int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/, const char* err_msg, const char* /*file_name*/, int /*line*/, void* /*userdata*/) { @@ -217,6 +217,8 @@ int main(int argc, const char* argv[]) TestSystem::instance().setNumIters(iters); + cout << "\nNote: the timings for GPU don't include data transfer" << endl; + TestSystem::instance().run(); return 0;