mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 11:40:44 +08:00
fixed some GPU tests failing when compiled for 1.1(no doubles) and run on 1.3(with doubles)
This commit is contained in:
parent
9e48f64149
commit
0da71a01ff
@ -222,7 +222,7 @@ CV_EXPORTS bool cv::gpu::isCompatibleWith(int device)
|
||||
if (hasLessOrEqualPtxVersion(major, minor))
|
||||
return true;
|
||||
|
||||
// Check CUBIN compatibilty
|
||||
// Check CUBIN compatibility
|
||||
for (int i = minor; i >= 0; --i)
|
||||
if (hasCubinVersion(major, i))
|
||||
return true;
|
||||
|
@ -277,7 +277,10 @@ void cv::gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const Gp
|
||||
|
||||
CV_Assert(src.channels() == 1);
|
||||
CV_Assert(mask.empty() || (mask.type() == CV_8U && src.size() == mask.size()));
|
||||
CV_Assert(src.type() != CV_64F || hasNativeDoubleSupport(getDevice()));
|
||||
|
||||
bool double_ok = hasGreaterOrEqualVersion(1, 3) &&
|
||||
hasNativeDoubleSupport(getDevice());
|
||||
CV_Assert(src.type() != CV_64F || double_ok);
|
||||
|
||||
double minVal_; if (!minVal) minVal = &minVal_;
|
||||
double maxVal_; if (!maxVal) maxVal = &maxVal_;
|
||||
@ -373,7 +376,10 @@ void cv::gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point
|
||||
|
||||
CV_Assert(src.channels() == 1);
|
||||
CV_Assert(mask.empty() || (mask.type() == CV_8U && src.size() == mask.size()));
|
||||
CV_Assert(src.type() != CV_64F || hasNativeDoubleSupport(getDevice()));
|
||||
|
||||
bool double_ok = hasGreaterOrEqualVersion(1, 3) &&
|
||||
hasNativeDoubleSupport(getDevice());
|
||||
CV_Assert(src.type() != CV_64F || double_ok);
|
||||
|
||||
double minVal_; if (!minVal) minVal = &minVal_;
|
||||
double maxVal_; if (!maxVal) maxVal = &maxVal_;
|
||||
@ -452,7 +458,10 @@ int cv::gpu::countNonZero(const GpuMat& src, GpuMat& buf)
|
||||
countNonZeroCaller<double> };
|
||||
|
||||
CV_Assert(src.channels() == 1);
|
||||
CV_Assert(src.type() != CV_64F || hasNativeDoubleSupport(getDevice()));
|
||||
|
||||
bool double_ok = hasGreaterOrEqualVersion(1, 3) &&
|
||||
hasNativeDoubleSupport(getDevice());
|
||||
CV_Assert(src.type() != CV_64F || double_ok);
|
||||
|
||||
Size buf_size;
|
||||
getBufSizeRequired(src.cols, src.rows, buf_size.width, buf_size.height);
|
||||
|
@ -73,6 +73,10 @@ namespace cv { namespace gpu { namespace split_merge
|
||||
CV_Assert(src);
|
||||
CV_Assert(n > 0);
|
||||
|
||||
bool double_ok = hasGreaterOrEqualVersion(1, 3) &&
|
||||
hasNativeDoubleSupport(getDevice());
|
||||
CV_Assert(src[0].depth() != CV_64F || double_ok);
|
||||
|
||||
int depth = src[0].depth();
|
||||
Size size = src[0].size();
|
||||
|
||||
@ -112,6 +116,10 @@ namespace cv { namespace gpu { namespace split_merge
|
||||
{
|
||||
CV_Assert(dst);
|
||||
|
||||
bool double_ok = hasGreaterOrEqualVersion(1, 3) &&
|
||||
hasNativeDoubleSupport(getDevice());
|
||||
CV_Assert(src.depth() != CV_64F || double_ok);
|
||||
|
||||
int depth = src.depth();
|
||||
int num_channels = src.channels();
|
||||
Size size = src.size();
|
||||
|
@ -659,11 +659,10 @@ struct CV_GpuMinMaxTest: public CvTest
|
||||
{
|
||||
try
|
||||
{
|
||||
int depth_end;
|
||||
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
|
||||
depth_end = CV_64F;
|
||||
else
|
||||
depth_end = CV_32F;
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
int depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (int depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
@ -794,11 +793,10 @@ struct CV_GpuMinMaxLocTest: public CvTest
|
||||
{
|
||||
try
|
||||
{
|
||||
int depth_end;
|
||||
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
|
||||
depth_end = CV_64F;
|
||||
else
|
||||
depth_end = CV_32F;
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
int depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (int depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
int rows = 1, cols = 3;
|
||||
|
@ -58,7 +58,12 @@ struct CV_GpuBitwiseTest: public CvTest
|
||||
void run(int)
|
||||
{
|
||||
int rows, cols;
|
||||
for (int depth = CV_8U; depth <= CV_64F; ++depth)
|
||||
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
int depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (int depth = CV_8U; depth <= CV_32F; ++depth)
|
||||
for (int cn = 1; cn <= 4; ++cn)
|
||||
for (int attempt = 0; attempt < 3; ++attempt)
|
||||
{
|
||||
|
@ -64,6 +64,16 @@ struct CV_GpuMatchTemplateTest: CvTest
|
||||
{
|
||||
try
|
||||
{
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
if (!double_ok)
|
||||
{
|
||||
// For sqrIntegral
|
||||
ts->printf(CvTS::CONSOLE, "\nCode and device double support is required (CC >= 1.3)");
|
||||
ts->set_failed_test_info(CvTS::FAIL_GENERIC);
|
||||
return;
|
||||
}
|
||||
|
||||
Mat image, templ;
|
||||
Mat dst_gold;
|
||||
gpu::GpuMat dst;
|
||||
@ -234,6 +244,16 @@ struct CV_GpuMatchTemplateFindPatternInBlackTest: CvTest
|
||||
{
|
||||
try
|
||||
{
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
if (!double_ok)
|
||||
{
|
||||
// For sqrIntegral
|
||||
ts->printf(CvTS::CONSOLE, "\nCode and device double support is required (CC >= 1.3)");
|
||||
ts->set_failed_test_info(CvTS::FAIL_GENERIC);
|
||||
return;
|
||||
}
|
||||
|
||||
Mat image = imread(std::string(ts->get_data_path()) + "matchtemplate/black.png");
|
||||
if (image.empty())
|
||||
{
|
||||
|
@ -49,7 +49,7 @@
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Merge
|
||||
|
||||
struct CV_MergeTest : public CvTest
|
||||
@ -63,8 +63,12 @@ struct CV_MergeTest : public CvTest
|
||||
|
||||
void CV_MergeTest::can_merge(size_t rows, size_t cols)
|
||||
{
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
size_t depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
for (size_t depth = CV_8U; depth <= CV_64F; ++depth)
|
||||
for (size_t depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
vector<Mat> src;
|
||||
for (size_t i = 0; i < num_channels; ++i)
|
||||
@ -101,8 +105,12 @@ void CV_MergeTest::can_merge(size_t rows, size_t cols)
|
||||
|
||||
void CV_MergeTest::can_merge_submatrixes(size_t rows, size_t cols)
|
||||
{
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
size_t depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
for (size_t depth = CV_8U; depth <= CV_64F; ++depth)
|
||||
for (size_t depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
vector<Mat> src;
|
||||
for (size_t i = 0; i < num_channels; ++i)
|
||||
@ -158,7 +166,7 @@ void CV_MergeTest::run(int)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Split
|
||||
|
||||
struct CV_SplitTest : public CvTest
|
||||
@ -171,8 +179,12 @@ struct CV_SplitTest : public CvTest
|
||||
|
||||
void CV_SplitTest::can_split(size_t rows, size_t cols)
|
||||
{
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
size_t depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
for (size_t depth = CV_8U; depth <= CV_64F; ++depth)
|
||||
for (size_t depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
Mat src(rows, cols, CV_MAKETYPE(depth, num_channels), Scalar(1.0, 2.0, 3.0, 4.0));
|
||||
vector<Mat> dst;
|
||||
@ -209,8 +221,12 @@ void CV_SplitTest::can_split(size_t rows, size_t cols)
|
||||
|
||||
void CV_SplitTest::can_split_submatrix(size_t rows, size_t cols)
|
||||
{
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
size_t depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
for (size_t depth = CV_8U; depth <= CV_64F; ++depth)
|
||||
for (size_t depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
Mat src_data(rows * 2, cols * 2, CV_MAKETYPE(depth, num_channels), Scalar(1.0, 2.0, 3.0, 4.0));
|
||||
Mat src(src_data(Range(rows / 2, rows / 2 + rows), Range(cols / 2, cols / 2 + cols)));
|
||||
@ -264,8 +280,8 @@ void CV_SplitTest::run(int)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Split and merge
|
||||
|
||||
struct CV_SplitMergeTest : public CvTest
|
||||
@ -276,8 +292,12 @@ struct CV_SplitMergeTest : public CvTest
|
||||
};
|
||||
|
||||
void CV_SplitMergeTest::can_split_merge(size_t rows, size_t cols) {
|
||||
bool double_ok = gpu::hasGreaterOrEqualVersion(1, 3) &&
|
||||
gpu::hasNativeDoubleSupport(gpu::getDevice());
|
||||
size_t depth_end = double_ok ? CV_64F : CV_32F;
|
||||
|
||||
for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
for (size_t depth = CV_8U; depth <= CV_64F; ++depth)
|
||||
for (size_t depth = CV_8U; depth <= depth_end; ++depth)
|
||||
{
|
||||
Mat orig(rows, cols, CV_MAKETYPE(depth, num_channels), Scalar(1.0, 2.0, 3.0, 4.0));
|
||||
gpu::GpuMat dev_orig(orig);
|
||||
@ -318,12 +338,12 @@ void CV_SplitMergeTest::run(int)
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////// tests registration /////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// If we comment some tests, we may foget/miss to uncomment it after.
|
||||
// Placing all test definitions in one place
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////// tests registration /////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// If we comment some tests, we may foget/miss to uncomment it after.
|
||||
// Placing all test definitions in one place
|
||||
// makes us know about what tests are commented.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user