Commit 56745b54 authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

refactored gpu tests a little

parent c104cdce
...@@ -680,18 +680,29 @@ struct CV_GpuMinMaxTest: public CvTest ...@@ -680,18 +680,29 @@ struct CV_GpuMinMaxTest: public CvTest
void run(int) void run(int)
{ {
int depth_end; try
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F; {
for (int depth = CV_8U; depth <= depth_end; ++depth) int depth_end;
{ if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
for (int i = 0; i < 3; ++i) depth_end = CV_64F;
else
depth_end = CV_32F;
for (int depth = CV_8U; depth <= depth_end; ++depth)
{ {
int rows = 1 + rand() % 1000; for (int i = 0; i < 3; ++i)
int cols = 1 + rand() % 1000; {
test(rows, cols, 1, depth); int rows = 1 + rand() % 1000;
test_masked(rows, cols, 1, depth); int cols = 1 + rand() % 1000;
test(rows, cols, 1, depth);
test_masked(rows, cols, 1, depth);
}
} }
} }
catch (const Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts)) throw;
return;
}
} }
void test(int rows, int cols, int cn, int depth) void test(int rows, int cols, int cn, int depth)
...@@ -804,19 +815,30 @@ struct CV_GpuMinMaxLocTest: public CvTest ...@@ -804,19 +815,30 @@ struct CV_GpuMinMaxLocTest: public CvTest
void run(int) void run(int)
{ {
int depth_end; try
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F; {
for (int depth = CV_8U; depth <= depth_end; ++depth) int depth_end;
{ if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
int rows = 1, cols = 3; depth_end = CV_64F;
test(rows, cols, depth); else
for (int i = 0; i < 4; ++i) depth_end = CV_32F;
for (int depth = CV_8U; depth <= depth_end; ++depth)
{ {
int rows = 1 + rand() % 1000; int rows = 1, cols = 3;
int cols = 1 + rand() % 1000;
test(rows, cols, depth); test(rows, cols, depth);
for (int i = 0; i < 4; ++i)
{
int rows = 1 + rand() % 1000;
int cols = 1 + rand() % 1000;
test(rows, cols, depth);
}
} }
} }
catch (const Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts)) throw;
return;
}
} }
void test(int rows, int cols, int depth) void test(int rows, int cols, int depth)
...@@ -875,18 +897,28 @@ struct CV_GpuCountNonZeroTest: CvTest ...@@ -875,18 +897,28 @@ struct CV_GpuCountNonZeroTest: CvTest
void run(int) void run(int)
{ {
srand(0); try
int depth_end; {
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F; int depth_end;
for (int depth = CV_8U; depth <= CV_32F; ++depth) if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
{ depth_end = CV_64F;
for (int i = 0; i < 4; ++i) else
depth_end = CV_32F;
for (int depth = CV_8U; depth <= CV_32F; ++depth)
{ {
int rows = 1 + rand() % 1000; for (int i = 0; i < 4; ++i)
int cols = 1 + rand() % 1000; {
test(rows, cols, depth); int rows = 1 + rand() % 1000;
int cols = 1 + rand() % 1000;
test(rows, cols, depth);
}
} }
} }
catch (const Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts)) throw;
return;
}
} }
void test(int rows, int cols, int depth) void test(int rows, int cols, int depth)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment