refactored gpu tests a little

This commit is contained in:
Alexey Spizhevoy 2010-11-29 14:23:30 +00:00
parent c104cdce96
commit 56745b5400

View File

@ -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)
try
{
for (int i = 0; i < 3; ++i)
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)
try
{
int rows = 1, cols = 3;
test(rows, cols, depth);
for (int i = 0; i < 4; ++i)
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)
try
{
for (int i = 0; i < 4; ++i)
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)