Merge remote-tracking branch 'upstream/2.4' into merge-2.4
* #1538 from StevenPuttemans:bugfix_3283 * #1545 from alalek:ocl_test_fix_rng * #1551 from alalek:cmake_install_win * #1570 from ilya-lavrenov:ipp_warn_fix * #1573 from alalek:perf_simple_strategy * #1574 from alalek:svm_workaround * #1576 from alalek:ocl_fix_cl_double * #1577 from ilya-lavrenov:ocl_setto_opencl12 * #1578 from asmorkalov:android_fd_cp_fix * #1579 from ilya-lavrenov:ocl_norm * #1582 from sperrholz:ocl-arithm-additions * #1586 from ilya-lavrenov:ocl_setto_win_fix * #1589 from ilya-lavrenov:pr1582_fix * #1591 from alalek:ocl_remove_cl_hpp_h * #1592 from alalek:ocl_program_cache_update * #1593 from ilya-lavrenov:ocl_war_on_double * #1594 from ilya-lavrenov:ocl_perf * #1595 from alalek:cl_code_cleanup * #1596 from alalek:test_fix_run_py * #1597 from alalek:ocl_fix_cleanup * #1598 from alalek:ocl_fix_build_mac * #1599 from ilya-lavrenov:ocl_mac_kernel_warnings * #1601 from ilya-lavrenov:ocl_fix_tvl1_and_sparse * #1602 from alalek:ocl_test_dump_info * #1603 from ilya-lavrenov:ocl_disable_svm_noblas * #1605 from alalek:ocl_fixes * #1606 from ilya-lavrenov:ocl_imgproc * #1607 from ilya-lavrenov:ocl_fft_cleanup * #1608 from alalek:fix_warn_upd_haar * #1609 from ilya-lavrenov:ocl_some_optimization * #1610 from alalek:ocl_fix_perf_kalman * #1612 from alalek:ocl_fix_string_info * #1614 from ilya-lavrenov:ocl_svm_misprint * #1616 from ilya-lavrenov:ocl_cvtColor * #1617 from ilya-lavrenov:ocl_info * #1622 from a0byte:2.4 * #1625 from ilya-lavrenov:to_string Conflicts: cmake/OpenCVConfig.cmake cmake/OpenCVDetectPython.cmake cmake/OpenCVGenConfig.cmake modules/core/CMakeLists.txt modules/nonfree/src/surf.ocl.cpp modules/ocl/include/opencv2/ocl/ocl.hpp modules/ocl/include/opencv2/ocl/private/util.hpp modules/ocl/perf/main.cpp modules/ocl/src/arithm.cpp modules/ocl/src/cl_operations.cpp modules/ocl/src/cl_programcache.cpp modules/ocl/src/color.cpp modules/ocl/src/fft.cpp modules/ocl/src/filtering.cpp modules/ocl/src/gemm.cpp modules/ocl/src/haar.cpp modules/ocl/src/imgproc.cpp modules/ocl/src/matrix_operations.cpp modules/ocl/src/pyrlk.cpp modules/ocl/src/split_merge.cpp modules/ocl/src/svm.cpp modules/ocl/test/main.cpp modules/ocl/test/test_fft.cpp modules/ocl/test/test_moments.cpp modules/ocl/test/test_objdetect.cpp modules/ocl/test/test_optflow.cpp modules/ocl/test/utility.hpp modules/python/CMakeLists.txt modules/ts/include/opencv2/ts.hpp modules/ts/src/ts_perf.cpp samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
@@ -42,7 +42,20 @@
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
const char * impls[] =
|
||||
#define DUMP_INFO_STDOUT(propertyDisplayName, propertyValue) \
|
||||
do { \
|
||||
std::cout << (propertyDisplayName) << ": " << (propertyValue) << std::endl; \
|
||||
} while (false)
|
||||
|
||||
#define DUMP_INFO_XML(propertyXMLName, propertyValue) \
|
||||
do { \
|
||||
std::stringstream ss; ss << propertyValue; \
|
||||
::testing::Test::RecordProperty((propertyXMLName), ss.str()); \
|
||||
} while (false)
|
||||
|
||||
#include "opencv2/ocl/private/opencl_dumpinfo.hpp"
|
||||
|
||||
static const char * impls[] =
|
||||
{
|
||||
IMPL_OCL,
|
||||
IMPL_PLAIN,
|
||||
@@ -51,59 +64,10 @@ const char * impls[] =
|
||||
#endif
|
||||
};
|
||||
|
||||
using namespace cv::ocl;
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
const char * keys =
|
||||
"{ h help | false | print help message }"
|
||||
"{ t type | gpu | set device type:cpu or gpu}"
|
||||
"{ p platform | -1 | set platform id }"
|
||||
"{ d device | 0 | set device id }";
|
||||
::perf::TestBase::setPerformanceStrategy(::perf::PERF_STRATEGY_SIMPLE);
|
||||
|
||||
if (getenv("OPENCV_OPENCL_DEVICE") == NULL) // TODO Remove this after buildbot updates
|
||||
{
|
||||
CommandLineParser cmd(argc, argv, keys);
|
||||
if (cmd.has("help"))
|
||||
{
|
||||
cout << "Available options besides google test option:" << endl;
|
||||
cmd.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
string type = cmd.get<string>("type");
|
||||
int pid = cmd.get<int>("platform");
|
||||
int device = cmd.get<int>("device");
|
||||
|
||||
int flag = type == "cpu" ? cv::ocl::CVCL_DEVICE_TYPE_CPU :
|
||||
cv::ocl::CVCL_DEVICE_TYPE_GPU;
|
||||
|
||||
cv::ocl::PlatformsInfo platformsInfo;
|
||||
cv::ocl::getOpenCLPlatforms(platformsInfo);
|
||||
if (pid >= (int)platformsInfo.size())
|
||||
{
|
||||
std::cout << "platform is invalid\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
cv::ocl::DevicesInfo devicesInfo;
|
||||
int devnums = cv::ocl::getOpenCLDevices(devicesInfo, flag, (pid < 0) ? NULL : platformsInfo[pid]);
|
||||
if (device < 0 || device >= devnums)
|
||||
{
|
||||
std::cout << "device/platform invalid\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
cv::ocl::setDevice(devicesInfo[device]);
|
||||
}
|
||||
|
||||
const DeviceInfo& deviceInfo = cv::ocl::Context::getContext()->getDeviceInfo();
|
||||
|
||||
cout << "Device type: " << (deviceInfo.deviceType == CVCL_DEVICE_TYPE_CPU ?
|
||||
"CPU" :
|
||||
(deviceInfo.deviceType == CVCL_DEVICE_TYPE_GPU ? "GPU" : "unknown")) << endl
|
||||
<< "Platform name: " << deviceInfo.platform->platformName << endl
|
||||
<< "Device name: " << deviceInfo.deviceName << endl;
|
||||
|
||||
CV_PERF_TEST_MAIN_INTERNALS(ocl, impls)
|
||||
CV_PERF_TEST_MAIN_INTERNALS(ocl, impls, dumpOpenCLDevice())
|
||||
}
|
||||
|
@@ -877,3 +877,108 @@ PERF_TEST_P(AddWeightedFixture, AddWeighted,
|
||||
else
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
||||
///////////// Min ////////////////////////
|
||||
|
||||
typedef Size_MatType MinFixture;
|
||||
|
||||
PERF_TEST_P(MinFixture, Min,
|
||||
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
|
||||
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
|
||||
Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src1, src2, WARMUP_RNG).out(dst);
|
||||
|
||||
if (RUN_OCL_IMPL)
|
||||
{
|
||||
ocl::oclMat oclSrc1(src1), oclSrc2(src2), oclDst(srcSize, type);
|
||||
|
||||
OCL_TEST_CYCLE() cv::ocl::min(oclSrc1, oclSrc2, oclDst);
|
||||
|
||||
oclDst.download(dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
else if (RUN_PLAIN_IMPL)
|
||||
{
|
||||
TEST_CYCLE() dst = cv::min(src1, src2);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
else
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
||||
///////////// Max ////////////////////////
|
||||
|
||||
typedef Size_MatType MaxFixture;
|
||||
|
||||
PERF_TEST_P(MaxFixture, Max,
|
||||
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
|
||||
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
|
||||
Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src1, src2, WARMUP_RNG).out(dst);
|
||||
|
||||
if (RUN_OCL_IMPL)
|
||||
{
|
||||
ocl::oclMat oclSrc1(src1), oclSrc2(src2), oclDst(srcSize, type);
|
||||
|
||||
OCL_TEST_CYCLE() cv::ocl::max(oclSrc1, oclSrc2, oclDst);
|
||||
|
||||
oclDst.download(dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
else if (RUN_PLAIN_IMPL)
|
||||
{
|
||||
TEST_CYCLE() dst = cv::max(src1, src2);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
else
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
||||
///////////// Max ////////////////////////
|
||||
|
||||
typedef Size_MatType AbsFixture;
|
||||
|
||||
PERF_TEST_P(AbsFixture, Abs,
|
||||
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
|
||||
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
|
||||
Mat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
if (RUN_OCL_IMPL)
|
||||
{
|
||||
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
|
||||
|
||||
OCL_TEST_CYCLE() cv::ocl::abs(oclSrc, oclDst);
|
||||
|
||||
oclDst.download(dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
else if (RUN_PLAIN_IMPL)
|
||||
{
|
||||
TEST_CYCLE() dst = cv::abs(src);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
else
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
@@ -43,20 +43,25 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CLAMDBLAS
|
||||
|
||||
using namespace perf;
|
||||
using namespace std;
|
||||
using namespace cv::ocl;
|
||||
using namespace cv;
|
||||
using std::tr1::tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
///////////// Kalman Filter ////////////////////////
|
||||
|
||||
typedef tuple<int> KalmanFilterType;
|
||||
typedef TestBaseWithParam<KalmanFilterType> KalmanFilterFixture;
|
||||
|
||||
PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
|
||||
::testing::Values(1000, 1500))
|
||||
::testing::Values(1000, 1500))
|
||||
{
|
||||
KalmanFilterType params = GetParam();
|
||||
const int dim = get<0>(params);
|
||||
@@ -66,7 +71,7 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
|
||||
|
||||
cv::Mat statePre_;
|
||||
|
||||
if(RUN_PLAIN_IMPL)
|
||||
if (RUN_PLAIN_IMPL)
|
||||
{
|
||||
cv::KalmanFilter kalman;
|
||||
TEST_CYCLE()
|
||||
@@ -76,7 +81,8 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
|
||||
kalman.predict();
|
||||
}
|
||||
statePre_ = kalman.statePre;
|
||||
}else if(RUN_OCL_IMPL)
|
||||
}
|
||||
else if(RUN_OCL_IMPL)
|
||||
{
|
||||
cv::ocl::oclMat dsample(sample);
|
||||
cv::ocl::KalmanFilter kalman_ocl;
|
||||
@@ -87,7 +93,11 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
|
||||
kalman_ocl.predict();
|
||||
}
|
||||
kalman_ocl.statePre.download(statePre_);
|
||||
}else
|
||||
}
|
||||
else
|
||||
OCL_PERF_ELSE
|
||||
|
||||
SANITY_CHECK(statePre_);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_CLAMDBLAS
|
||||
|
Reference in New Issue
Block a user