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
void run(int)
{
int depth_end;
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)
{
for (int i = 0; i < 3; ++i)
try
{
int depth_end;
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 rows = 1 + rand() % 1000;
int cols = 1 + rand() % 1000;
test(rows, cols, 1, depth);
test_masked(rows, cols, 1, depth);
for (int i = 0; i < 3; ++i)
{
int rows = 1 + rand() % 1000;
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)
......@@ -804,19 +815,30 @@ struct CV_GpuMinMaxLocTest: public CvTest
void run(int)
{
int depth_end;
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 rows = 1, cols = 3;
test(rows, cols, depth);
for (int i = 0; i < 4; ++i)
try
{
int depth_end;
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 rows = 1 + rand() % 1000;
int cols = 1 + rand() % 1000;
int rows = 1, cols = 3;
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)
......@@ -875,18 +897,28 @@ struct CV_GpuCountNonZeroTest: CvTest
void run(int)
{
srand(0);
int depth_end;
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F;
for (int depth = CV_8U; depth <= CV_32F; ++depth)
{
for (int i = 0; i < 4; ++i)
try
{
int depth_end;
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
depth_end = CV_64F;
else
depth_end = CV_32F;
for (int depth = CV_8U; depth <= CV_32F; ++depth)
{
int rows = 1 + rand() % 1000;
int cols = 1 + rand() % 1000;
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)
......
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