mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -43,25 +43,6 @@
|
||||
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
#define DUMP_CONFIG_PROPERTY(propertyName, propertyValue) \
|
||||
do { \
|
||||
std::stringstream ssName, ssValue;\
|
||||
ssName << propertyName;\
|
||||
ssValue << (propertyValue); \
|
||||
::testing::Test::RecordProperty(ssName.str(), ssValue.str()); \
|
||||
} while (false)
|
||||
|
||||
#define DUMP_MESSAGE_STDOUT(msg) \
|
||||
do { \
|
||||
std::cout << msg << std::endl; \
|
||||
} while (false)
|
||||
|
||||
#include <opencv2/core/opencl/opencl_info.hpp>
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace ocl {
|
||||
|
||||
@@ -69,13 +50,6 @@ using namespace cv;
|
||||
|
||||
int test_loop_times = 1; // TODO Read from command line / environment
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
void dumpOpenCLDevice()
|
||||
{
|
||||
cv::dumpOpenCLInformation();
|
||||
}
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
Mat TestUtils::readImage(const String &fileName, int flags)
|
||||
{
|
||||
return cv::imread(cvtest::TS::ptr()->get_data_path() + fileName, flags);
|
||||
|
||||
+83
-5
@@ -74,7 +74,26 @@
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
#define DUMP_CONFIG_PROPERTY(propertyName, propertyValue) \
|
||||
do { \
|
||||
std::stringstream ssName, ssValue;\
|
||||
ssName << propertyName;\
|
||||
ssValue << (propertyValue); \
|
||||
::testing::Test::RecordProperty(ssName.str(), ssValue.str()); \
|
||||
} while (false)
|
||||
|
||||
#define DUMP_MESSAGE_STDOUT(msg) \
|
||||
do { \
|
||||
std::cout << msg << std::endl; \
|
||||
} while (false)
|
||||
|
||||
#include "opencv2/core/opencl/opencl_info.hpp"
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#include "opencv_tests_config.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
@@ -230,7 +249,6 @@ bool BaseTest::can_do_fast_forward()
|
||||
void BaseTest::safe_run( int start_from )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
read_params( ts->get_file_storage() );
|
||||
ts->update_context( 0, -1, true );
|
||||
ts->update_context( this, -1, true );
|
||||
|
||||
@@ -552,8 +570,6 @@ void TS::set_gtest_status()
|
||||
}
|
||||
|
||||
|
||||
CvFileStorage* TS::get_file_storage() { return 0; }
|
||||
|
||||
void TS::update_context( BaseTest* test, int test_case_idx, bool update_ts_context )
|
||||
{
|
||||
if( current_test_info.test != test )
|
||||
@@ -614,8 +630,11 @@ void TS::printf( int streams, const char* fmt, ... )
|
||||
}
|
||||
|
||||
|
||||
static TS ts;
|
||||
TS* TS::ptr() { return &ts; }
|
||||
TS* TS::ptr()
|
||||
{
|
||||
static TS ts;
|
||||
return &ts;
|
||||
}
|
||||
|
||||
void fillGradient(Mat& img, int delta)
|
||||
{
|
||||
@@ -866,6 +885,65 @@ std::string findDataDirectory(const std::string& relative_path, bool required)
|
||||
return findData(relative_path, required, true);
|
||||
}
|
||||
|
||||
inline static std::string getSnippetFromConfig(const std::string & start, const std::string & end)
|
||||
{
|
||||
const std::string buildInfo = cv::getBuildInformation();
|
||||
size_t pos1 = buildInfo.find(start);
|
||||
if (pos1 != std::string::npos)
|
||||
{
|
||||
pos1 += start.length();
|
||||
pos1 = buildInfo.find_first_not_of(" \t\n\r", pos1);
|
||||
}
|
||||
size_t pos2 = buildInfo.find(end, pos1);
|
||||
if (pos2 != std::string::npos)
|
||||
{
|
||||
pos2 = buildInfo.find_last_not_of(" \t\n\r", pos2);
|
||||
}
|
||||
if (pos1 != std::string::npos && pos2 != std::string::npos && pos1 < pos2)
|
||||
{
|
||||
return buildInfo.substr(pos1, pos2 - pos1 + 1);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
inline static void recordPropertyVerbose(const std::string & property,
|
||||
const std::string & msg,
|
||||
const std::string & value,
|
||||
const std::string & build_value = std::string())
|
||||
{
|
||||
::testing::Test::RecordProperty(property, value);
|
||||
std::cout << msg << ": " << (value.empty() ? std::string("N/A") : value) << std::endl;
|
||||
if (!build_value.empty())
|
||||
{
|
||||
::testing::Test::RecordProperty(property + "_build", build_value);
|
||||
if (build_value != value)
|
||||
std::cout << "WARNING: build value differs from runtime: " << build_value << endl;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define CV_TEST_BUILD_CONFIG "Debug"
|
||||
#else
|
||||
#define CV_TEST_BUILD_CONFIG "Release"
|
||||
#endif
|
||||
|
||||
void SystemInfoCollector::OnTestProgramStart(const testing::UnitTest&)
|
||||
{
|
||||
std::cout << "CTEST_FULL_OUTPUT" << std::endl; // Tell CTest not to discard any output
|
||||
recordPropertyVerbose("cv_version", "OpenCV version", cv::getVersionString(), CV_VERSION);
|
||||
recordPropertyVerbose("cv_vcs_version", "OpenCV VCS version", getSnippetFromConfig("Version control:", "\n"));
|
||||
recordPropertyVerbose("cv_build_type", "Build type", getSnippetFromConfig("Configuration:", "\n"), CV_TEST_BUILD_CONFIG);
|
||||
recordPropertyVerbose("cv_compiler", "Compiler", getSnippetFromConfig("C++ Compiler:", "\n"));
|
||||
recordPropertyVerbose("cv_parallel_framework", "Parallel framework", cv::currentParallelFramework());
|
||||
recordPropertyVerbose("cv_cpu_features", "CPU features", cv::getCPUFeaturesLine());
|
||||
#ifdef HAVE_IPP
|
||||
recordPropertyVerbose("cv_ipp_version", "Intel(R) IPP version", cv::ipp::useIPP() ? cv::ipp::getIppVersion() : "disabled");
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
cv::dumpOpenCLInformation();
|
||||
#endif
|
||||
}
|
||||
|
||||
} //namespace cvtest
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -2973,143 +2973,6 @@ MatComparator::operator()(const char* expr1, const char* expr2,
|
||||
<< "- " << expr2 << ":\n" << MatPart(m2part, border > 0 ? &loc : 0) << ".\n";
|
||||
}
|
||||
|
||||
void printVersionInfo(bool useStdOut)
|
||||
{
|
||||
// Tell CTest not to discard any output
|
||||
if(useStdOut) std::cout << "CTEST_FULL_OUTPUT" << std::endl;
|
||||
|
||||
::testing::Test::RecordProperty("cv_version", CV_VERSION);
|
||||
if(useStdOut) std::cout << "OpenCV version: " << CV_VERSION << std::endl;
|
||||
|
||||
std::string buildInfo( cv::getBuildInformation() );
|
||||
|
||||
size_t pos1 = buildInfo.find("Version control");
|
||||
size_t pos2 = buildInfo.find('\n', pos1);
|
||||
if(pos1 != std::string::npos && pos2 != std::string::npos)
|
||||
{
|
||||
size_t value_start = buildInfo.rfind(' ', pos2) + 1;
|
||||
std::string ver( buildInfo.substr(value_start, pos2 - value_start) );
|
||||
::testing::Test::RecordProperty("cv_vcs_version", ver);
|
||||
if (useStdOut) std::cout << "OpenCV VCS version: " << ver << std::endl;
|
||||
}
|
||||
|
||||
pos1 = buildInfo.find("inner version");
|
||||
pos2 = buildInfo.find('\n', pos1);
|
||||
if(pos1 != std::string::npos && pos2 != std::string::npos)
|
||||
{
|
||||
size_t value_start = buildInfo.rfind(' ', pos2) + 1;
|
||||
std::string ver( buildInfo.substr(value_start, pos2 - value_start) );
|
||||
::testing::Test::RecordProperty("cv_inner_vcs_version", ver);
|
||||
if(useStdOut) std::cout << "Inner VCS version: " << ver << std::endl;
|
||||
}
|
||||
|
||||
const char * build_type =
|
||||
#ifdef _DEBUG
|
||||
"debug";
|
||||
#else
|
||||
"release";
|
||||
#endif
|
||||
|
||||
::testing::Test::RecordProperty("cv_build_type", build_type);
|
||||
if (useStdOut) std::cout << "Build type: " << build_type << std::endl;
|
||||
|
||||
const char* parallel_framework = currentParallelFramework();
|
||||
|
||||
if (parallel_framework) {
|
||||
::testing::Test::RecordProperty("cv_parallel_framework", parallel_framework);
|
||||
if (useStdOut) std::cout << "Parallel framework: " << parallel_framework << std::endl;
|
||||
}
|
||||
|
||||
std::string cpu_features;
|
||||
|
||||
#if CV_POPCNT
|
||||
if (checkHardwareSupport(CV_CPU_POPCNT)) cpu_features += " popcnt";
|
||||
#endif
|
||||
#if CV_MMX
|
||||
if (checkHardwareSupport(CV_CPU_MMX)) cpu_features += " mmx";
|
||||
#endif
|
||||
#if CV_SSE
|
||||
if (checkHardwareSupport(CV_CPU_SSE)) cpu_features += " sse";
|
||||
#endif
|
||||
#if CV_SSE2
|
||||
if (checkHardwareSupport(CV_CPU_SSE2)) cpu_features += " sse2";
|
||||
#endif
|
||||
#if CV_SSE3
|
||||
if (checkHardwareSupport(CV_CPU_SSE3)) cpu_features += " sse3";
|
||||
#endif
|
||||
#if CV_SSSE3
|
||||
if (checkHardwareSupport(CV_CPU_SSSE3)) cpu_features += " ssse3";
|
||||
#endif
|
||||
#if CV_SSE4_1
|
||||
if (checkHardwareSupport(CV_CPU_SSE4_1)) cpu_features += " sse4.1";
|
||||
#endif
|
||||
#if CV_SSE4_2
|
||||
if (checkHardwareSupport(CV_CPU_SSE4_2)) cpu_features += " sse4.2";
|
||||
#endif
|
||||
#if CV_AVX
|
||||
if (checkHardwareSupport(CV_CPU_AVX)) cpu_features += " avx";
|
||||
#endif
|
||||
#if CV_AVX2
|
||||
if (checkHardwareSupport(CV_CPU_AVX2)) cpu_features += " avx2";
|
||||
#endif
|
||||
#if CV_FMA3
|
||||
if (checkHardwareSupport(CV_CPU_FMA3)) cpu_features += " fma3";
|
||||
#endif
|
||||
#if CV_AVX_512F
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512F)) cpu_features += " avx-512f";
|
||||
#endif
|
||||
#if CV_AVX_512BW
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512BW)) cpu_features += " avx-512bw";
|
||||
#endif
|
||||
#if CV_AVX_512CD
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512CD)) cpu_features += " avx-512cd";
|
||||
#endif
|
||||
#if CV_AVX_512DQ
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512DQ)) cpu_features += " avx-512dq";
|
||||
#endif
|
||||
#if CV_AVX_512ER
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512ER)) cpu_features += " avx-512er";
|
||||
#endif
|
||||
#if CV_AVX_512IFMA512
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512IFMA512)) cpu_features += " avx-512ifma512";
|
||||
#endif
|
||||
#if CV_AVX_512PF
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512PF)) cpu_features += " avx-512pf";
|
||||
#endif
|
||||
#if CV_AVX_512VBMI
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512VBMI)) cpu_features += " avx-512vbmi";
|
||||
#endif
|
||||
#if CV_AVX_512VL
|
||||
if (checkHardwareSupport(CV_CPU_AVX_512VL)) cpu_features += " avx-512vl";
|
||||
#endif
|
||||
#if CV_NEON
|
||||
if (checkHardwareSupport(CV_CPU_NEON)) cpu_features += " neon";
|
||||
#endif
|
||||
#if CV_FP16
|
||||
if (checkHardwareSupport(CV_CPU_FP16)) cpu_features += " fp16";
|
||||
#endif
|
||||
#if CV_VSX
|
||||
if (checkHardwareSupport(CV_CPU_VSX)) cpu_features += " VSX";
|
||||
#endif
|
||||
|
||||
cpu_features.erase(0, 1); // erase initial space
|
||||
|
||||
::testing::Test::RecordProperty("cv_cpu_features", cpu_features);
|
||||
if (useStdOut) std::cout << "CPU features: " << cpu_features << std::endl;
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
const char * ipp_optimization = cv::ipp::useIPP()? "enabled" : "disabled";
|
||||
::testing::Test::RecordProperty("cv_ipp_optimization", ipp_optimization);
|
||||
if (useStdOut) std::cout << "Intel(R) IPP optimization: " << ipp_optimization << std::endl;
|
||||
|
||||
cv::String ippVer = cv::ipp::getIppVersion();
|
||||
::testing::Test::RecordProperty("cv_ipp_version", ippVer);
|
||||
if(useStdOut) std::cout << "Intel(R) IPP version: " << ippVer.c_str() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void threshold( const Mat& _src, Mat& _dst,
|
||||
double thresh, double maxval, int thresh_type )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user