Replaced the semi-public CV_PARALLEL_FRAMEWORK macro with a function.

That way, core/internal.hpp doesn't have to depend on cvconfig.h, which we
don't ship.
This commit is contained in:
Roman Donchenko
2013-06-21 12:43:16 +04:00
parent 1d9660c6d2
commit c16316c4b4
4 changed files with 42 additions and 32 deletions

View File

@@ -61,6 +61,17 @@
#endif
#endif
#ifdef _OPENMP
#define HAVE_OPENMP
#endif
#ifdef __APPLE__
#define HAVE_GCD
#endif
#if defined _MSC_VER && _MSC_VER >= 1600
#define HAVE_CONCURRENCY
#endif
/* IMPORTANT: always use the same order of defines
1. HAVE_TBB - 3rdparty library, should be explicitly enabled
@@ -99,6 +110,18 @@
#endif
#endif
#if defined HAVE_TBB && TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
# define CV_PARALLEL_FRAMEWORK "tbb"
#elif defined HAVE_CSTRIPES
# define CV_PARALLEL_FRAMEWORK "cstripes"
#elif defined HAVE_OPENMP
# define CV_PARALLEL_FRAMEWORK "openmp"
#elif defined HAVE_GCD
# define CV_PARALLEL_FRAMEWORK "gcd"
#elif defined HAVE_CONCURRENCY
# define CV_PARALLEL_FRAMEWORK "ms-concurrency"
#endif
namespace cv
{
ParallelLoopBody::~ParallelLoopBody() {}
@@ -465,6 +488,14 @@ int cv::getNumberOfCPUs(void)
#endif
}
const char* cv::currentParallelFramework() {
#ifdef CV_PARALLEL_FRAMEWORK
return CV_PARALLEL_FRAMEWORK;
#else
return NULL;
#endif
}
CV_IMPL void cvSetNumThreads(int nt)
{
cv::setNumThreads(nt);