fixed many bugs related to Mat::getUMat(), asynchronous kernel execution etc. Also, played a bit with ocl::cvtColor vs cv::cvtColor performance

This commit is contained in:
Vadim Pisarevsky
2013-12-01 03:12:19 +04:00
parent daefe6983f
commit 6da5d21331
10 changed files with 401 additions and 208 deletions

View File

@@ -200,3 +200,40 @@ void CV_UMatTest::run( int /* start_from */)
}
TEST(Core_UMat, base) { CV_UMatTest test; test.safe_run(); }
TEST(Core_UMat, simple)
{
{
int a[3] = { 1, 2, 3 };
Mat m = Mat(1, 1, CV_32SC3, a);
UMat u = m.getUMat(ACCESS_READ);
EXPECT_NE((void*)NULL, u.u);
}
{
Mat m(10, 10, CV_8UC1), ref;
for (int y = 0; y < m.rows; ++y)
{
uchar * const ptr = m.ptr<uchar>(y);
for (int x = 0; x < m.cols; ++x)
ptr[x] = x + y * 2;
}
ref = m.clone();
Rect r(1, 1, 8, 8);
ref(r).setTo(17);
{
UMat um = m(r).getUMat(ACCESS_WRITE);
um.setTo(17);
}
double err = norm(m, ref, NORM_INF);
if(err > 0)
{
std::cout << "m: " << m << std::endl;
std::cout << "ref: " << ref << std::endl;
}
EXPECT_EQ(err, 0.);
}
}