refactored gpu module
This commit is contained in:
@@ -57,6 +57,9 @@ CV_EXPORTS int cv::gpu::getNumberOfSMs(int /*device*/) { throw_nogpu(); return 0
|
||||
CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t& /*free*/, size_t& /*total*/) { throw_nogpu(); }
|
||||
CV_EXPORTS bool cv::gpu::hasNativeDoubleSupport(int /*device*/) { throw_nogpu(); return false; }
|
||||
CV_EXPORTS bool cv::gpu::hasAtomicsSupport(int /*device*/) { throw_nogpu(); return false; }
|
||||
CV_EXPORTS bool cv::gpu::ptxVersionIs(int major, int minor) { throw_nogpu(); return false; }
|
||||
CV_EXPORTS bool cv::gpu::ptxVersionIsLessOrEqual(int major, int minor) { throw_nogpu(); return false; }
|
||||
CV_EXPORTS bool cv::gpu::ptxVersionIsGreaterOrEqual(int major, int minor) { throw_nogpu(); return false; }
|
||||
|
||||
|
||||
#else /* !defined (HAVE_CUDA) */
|
||||
@@ -133,33 +136,6 @@ CV_EXPORTS bool cv::gpu::hasAtomicsSupport(int device)
|
||||
|
||||
namespace
|
||||
{
|
||||
struct ComparerEqual
|
||||
{
|
||||
bool operator()(int lhs1, int lhs2, int rhs1, int rhs2) const
|
||||
{
|
||||
return lhs1 == rhs1 && lhs2 == rhs2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct ComparerLessOrEqual
|
||||
{
|
||||
bool operator()(int lhs1, int lhs2, int rhs1, int rhs2) const
|
||||
{
|
||||
return lhs1 < rhs1 || (lhs1 == rhs1 && lhs2 <= rhs2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct ComparerGreaterOrEqual
|
||||
{
|
||||
bool operator()(int lhs1, int lhs2, int rhs1, int rhs2) const
|
||||
{
|
||||
return lhs1 > rhs1 || (lhs1 == rhs1 && lhs2 >= rhs2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Comparer>
|
||||
bool checkPtxVersion(int major, int minor, Comparer cmp)
|
||||
{
|
||||
@@ -194,18 +170,39 @@ namespace
|
||||
|
||||
CV_EXPORTS bool cv::gpu::ptxVersionIs(int major, int minor)
|
||||
{
|
||||
struct ComparerEqual
|
||||
{
|
||||
bool operator()(int lhs1, int lhs2, int rhs1, int rhs2) const
|
||||
{
|
||||
return lhs1 == rhs1 && lhs2 == rhs2;
|
||||
}
|
||||
};
|
||||
return checkPtxVersion(major, minor, ComparerEqual());
|
||||
}
|
||||
|
||||
|
||||
CV_EXPORTS bool cv::gpu::ptxVersionIsLessOrEqual(int major, int minor)
|
||||
{
|
||||
struct ComparerLessOrEqual
|
||||
{
|
||||
bool operator()(int lhs1, int lhs2, int rhs1, int rhs2) const
|
||||
{
|
||||
return lhs1 < rhs1 || (lhs1 == rhs1 && lhs2 <= rhs2);
|
||||
}
|
||||
};
|
||||
return checkPtxVersion(major, minor, ComparerLessOrEqual());
|
||||
}
|
||||
|
||||
|
||||
CV_EXPORTS bool cv::gpu::ptxVersionIsGreaterOrEqual(int major, int minor)
|
||||
{
|
||||
struct ComparerGreaterOrEqual
|
||||
{
|
||||
bool operator()(int lhs1, int lhs2, int rhs1, int rhs2) const
|
||||
{
|
||||
return lhs1 > rhs1 || (lhs1 == rhs1 && lhs2 >= rhs2);
|
||||
}
|
||||
};
|
||||
return checkPtxVersion(major, minor, ComparerGreaterOrEqual());
|
||||
}
|
||||
|
||||
|
@@ -234,21 +234,21 @@ struct CV_GpuMatchTemplateFindPatternInBlackTest: CvTest
|
||||
{
|
||||
try
|
||||
{
|
||||
Mat image = imread(std::string(ts->get_data_path()) + "matchtemplate/black.jpg");
|
||||
Mat image = imread(std::string(ts->get_data_path()) + "matchtemplate/black.png");
|
||||
if (image.empty())
|
||||
{
|
||||
ts->printf(CvTS::CONSOLE, "can't open file '%s'", (std::string(ts->get_data_path())
|
||||
+ "matchtemplate/black.jpg").c_str());
|
||||
ts->set_failed_test_info(CvTS::FAIL_INVALID_TEST_DATA);
|
||||
+ "matchtemplate/black.png").c_str());
|
||||
ts->set_failed_test_info(CvTS::FAIL_MISSING_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
Mat pattern = imread(std::string(ts->get_data_path()) + "matchtemplate/cat.jpg");
|
||||
Mat pattern = imread(std::string(ts->get_data_path()) + "matchtemplate/cat.png");
|
||||
if (pattern.empty())
|
||||
{
|
||||
ts->printf(CvTS::CONSOLE, "can't open file '%s'", (std::string(ts->get_data_path())
|
||||
+ "matchtemplate/cat.jpg").c_str());
|
||||
ts->set_failed_test_info(CvTS::FAIL_INVALID_TEST_DATA);
|
||||
+ "matchtemplate/cat.png").c_str());
|
||||
ts->set_failed_test_info(CvTS::FAIL_MISSING_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user