Commit 388d0ef1 authored by Andrey Pavlenko's avatar Andrey Pavlenko Committed by OpenCV Buildbot

Merge pull request #2004 from ilya-lavrenov:tapi_umat_copyto

parents bd91b395 ac030c16
......@@ -643,11 +643,10 @@ void UMat::copyTo(OutputArray _dst) const
if( _dst.kind() == _InputArray::UMAT )
{
UMat dst = _dst.getUMat();
void* srchandle = handle(ACCESS_READ);
void* dsthandle = dst.handle(ACCESS_WRITE);
if( srchandle == dsthandle && dst.offset == offset )
if( u == dst.u && dst.offset == offset )
return;
dst.ndoffset(dstofs);
dstofs[dims-1] *= esz;
CV_Assert(u->currAllocator == dst.u->currAllocator);
u->currAllocator->copy(u, dst.u, dims, sz, srcofs, step.p, dstofs, dst.step.p, false);
}
......
......@@ -103,9 +103,27 @@ OCL_TEST_P(ConvertTo, Accuracy)
}
}
typedef MatrixTestBase CopyTo;
OCL_TEST_P(CopyTo, Accuracy)
{
for (int j = 0; j < test_loop_times; j++)
{
generateTestData();
OCL_OFF(src_roi.copyTo(dst_roi));
OCL_ON(usrc_roi.copyTo(udst_roi));
OCL_EXPECT_MATS_NEAR(dst, 0);
}
}
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, ConvertTo, Combine(
OCL_ALL_DEPTHS, OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool()));
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, CopyTo, Combine(
OCL_ALL_DEPTHS, Values((MatDepth)0), OCL_ALL_CHANNELS, Bool()));
} } // namespace cvtest::ocl
#endif
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