diff --git a/modules/gpu/perf/perf_main.cpp b/modules/gpu/perf/perf_main.cpp index 53a19ca412..802d559afb 100644 --- a/modules/gpu/perf/perf_main.cpp +++ b/modules/gpu/perf/perf_main.cpp @@ -44,11 +44,4 @@ using namespace perf; -static const char * impls[] = { -#ifdef HAVE_CUDA - "cuda", -#endif - "plain" -}; - -CV_PERF_TEST_MAIN_WITH_IMPLS(gpu, impls, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpu) diff --git a/modules/gpu/perf4au/main.cpp b/modules/gpu/perf4au/main.cpp index 5e39c3d1e6..a806105de4 100644 --- a/modules/gpu/perf4au/main.cpp +++ b/modules/gpu/perf4au/main.cpp @@ -52,16 +52,7 @@ #include "opencv2/ts.hpp" #include "opencv2/ts/gpu_perf.hpp" -int main(int argc, char* argv[]) -{ - perf::printCudaInfo(); - - perf::Regression::Init("gpu_perf4au"); - perf::TestBase::Init(argc, argv); - testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} +CV_PERF_TEST_CUDA_MAIN(gpu_perf4au) ////////////////////////////////////////////////////////// // HoughLinesP diff --git a/modules/gpuarithm/perf/perf_main.cpp b/modules/gpuarithm/perf/perf_main.cpp index b35791cda2..552cf5c162 100644 --- a/modules/gpuarithm/perf/perf_main.cpp +++ b/modules/gpuarithm/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuarithm, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuarithm) diff --git a/modules/gpubgsegm/perf/perf_main.cpp b/modules/gpubgsegm/perf/perf_main.cpp index 99066f450d..f69d0ea8fd 100644 --- a/modules/gpubgsegm/perf/perf_main.cpp +++ b/modules/gpubgsegm/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpubgsegm, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpubgsegm) diff --git a/modules/gpucodec/perf/perf_main.cpp b/modules/gpucodec/perf/perf_main.cpp index 2f4110b87c..7839653575 100644 --- a/modules/gpucodec/perf/perf_main.cpp +++ b/modules/gpucodec/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpucodec, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpucodec) diff --git a/modules/gpufeatures2d/perf/perf_main.cpp b/modules/gpufeatures2d/perf/perf_main.cpp index 0fd79fde36..5e7fb1b8be 100644 --- a/modules/gpufeatures2d/perf/perf_main.cpp +++ b/modules/gpufeatures2d/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpufeatures2d, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpufeatures2d) diff --git a/modules/gpufilters/perf/perf_main.cpp b/modules/gpufilters/perf/perf_main.cpp index b5a3eda406..44b3129e1f 100644 --- a/modules/gpufilters/perf/perf_main.cpp +++ b/modules/gpufilters/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpufilters, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpufilters) diff --git a/modules/gpuimgproc/perf/perf_main.cpp b/modules/gpuimgproc/perf/perf_main.cpp index 6b3bec5f84..8eb27a27b9 100644 --- a/modules/gpuimgproc/perf/perf_main.cpp +++ b/modules/gpuimgproc/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuimgproc, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuimgproc) diff --git a/modules/gpuoptflow/perf/perf_main.cpp b/modules/gpuoptflow/perf/perf_main.cpp index dad5e52bb6..e261932f8e 100644 --- a/modules/gpuoptflow/perf/perf_main.cpp +++ b/modules/gpuoptflow/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuoptflow, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuoptflow) diff --git a/modules/gpustereo/perf/perf_main.cpp b/modules/gpustereo/perf/perf_main.cpp index d681cdb4df..0766ccf05d 100644 --- a/modules/gpustereo/perf/perf_main.cpp +++ b/modules/gpustereo/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpustereo, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpustereo) diff --git a/modules/gpuwarping/perf/perf_main.cpp b/modules/gpuwarping/perf/perf_main.cpp index a7c1d5c85c..8566b097d4 100644 --- a/modules/gpuwarping/perf/perf_main.cpp +++ b/modules/gpuwarping/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuwarping, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuwarping) diff --git a/modules/photo/perf/perf_main.cpp b/modules/photo/perf/perf_main.cpp index f5863c1974..fd37812126 100644 --- a/modules/photo/perf/perf_main.cpp +++ b/modules/photo/perf/perf_main.cpp @@ -1,3 +1,11 @@ #include "perf_precomp.hpp" +#include "opencv2/ts/gpu_perf.hpp" -CV_PERF_TEST_MAIN(photo) +static const char * impls[] = { +#ifdef HAVE_CUDA + "cuda", +#endif + "plain" +}; + +CV_PERF_TEST_MAIN_WITH_IMPLS(photo, impls, perf::printCudaInfo()) diff --git a/modules/softcascade/perf/perf_main.cpp b/modules/softcascade/perf/perf_main.cpp index f045c4b46d..9a3869f5ef 100644 --- a/modules/softcascade/perf/perf_main.cpp +++ b/modules/softcascade/perf/perf_main.cpp @@ -41,5 +41,13 @@ //M*/ #include "perf_precomp.hpp" +#include "opencv2/ts/gpu_perf.hpp" -CV_PERF_TEST_MAIN(softcascade) +static const char * impls[] = { +#ifdef HAVE_CUDA + "cuda", +#endif + "plain" +}; + +CV_PERF_TEST_MAIN_WITH_IMPLS(softcascade, impls, perf::printCudaInfo()) diff --git a/modules/ts/include/opencv2/ts/gpu_perf.hpp b/modules/ts/include/opencv2/ts/gpu_perf.hpp index cff6f8dc6b..abc17e9942 100644 --- a/modules/ts/include/opencv2/ts/gpu_perf.hpp +++ b/modules/ts/include/opencv2/ts/gpu_perf.hpp @@ -105,6 +105,22 @@ namespace perf CV_EXPORTS void printCudaInfo(); CV_EXPORTS void sortKeyPoints(std::vector& keypoints, cv::InputOutputArray _descriptors = cv::noArray()); + +#ifdef HAVE_CUDA + #define CV_PERF_TEST_CUDA_MAIN(modulename) \ + int main(int argc, char **argv)\ + {\ + const char * impls[] = { "cuda", "plain" };\ + CV_PERF_TEST_MAIN_INTERNALS(modulename, impls, perf::printCudaInfo())\ + } +#else + #define CV_PERF_TEST_CUDA_MAIN(modulename) \ + int main(int argc, char **argv)\ + {\ + const char * plain_only[] = { "plain" };\ + CV_PERF_TEST_MAIN_INTERNALS(modulename, plain_only)\ + } +#endif } #endif // __OPENCV_GPU_PERF_UTILITY_HPP__