|
|
|
@ -771,14 +771,14 @@ UMat& UMat::setTo(InputArray _value, InputArray _mask) |
|
|
|
|
{ |
|
|
|
|
bool haveMask = !_mask.empty(); |
|
|
|
|
#ifdef HAVE_OPENCL |
|
|
|
|
int tp = type(), cn = CV_MAT_CN(tp), depth = CV_MAT_DEPTH(tp); |
|
|
|
|
int tp = type(), cn = CV_MAT_CN(tp), d = CV_MAT_DEPTH(tp); |
|
|
|
|
|
|
|
|
|
if( dims <= 2 && cn <= 4 && CV_MAT_DEPTH(tp) < CV_64F && ocl::useOpenCL() ) |
|
|
|
|
{ |
|
|
|
|
Mat value = _value.getMat(); |
|
|
|
|
CV_Assert( checkScalar(value, type(), _value.kind(), _InputArray::UMAT) ); |
|
|
|
|
int kercn = haveMask || cn == 3 ? cn : std::max(cn, ocl::predictOptimalVectorWidth(*this)), |
|
|
|
|
kertp = CV_MAKE_TYPE(depth, kercn); |
|
|
|
|
kertp = CV_MAKE_TYPE(d, kercn); |
|
|
|
|
|
|
|
|
|
double buf[16] = { 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0 }; |
|
|
|
@ -787,13 +787,13 @@ UMat& UMat::setTo(InputArray _value, InputArray _mask) |
|
|
|
|
int scalarcn = kercn == 3 ? 4 : kercn, rowsPerWI = ocl::Device::getDefault().isIntel() ? 4 : 1; |
|
|
|
|
String opts = format("-D dstT=%s -D rowsPerWI=%d -D dstST=%s -D dstT1=%s -D cn=%d", |
|
|
|
|
ocl::memopTypeToStr(kertp), rowsPerWI, |
|
|
|
|
ocl::memopTypeToStr(CV_MAKETYPE(depth, scalarcn)), |
|
|
|
|
ocl::memopTypeToStr(depth), kercn); |
|
|
|
|
ocl::memopTypeToStr(CV_MAKETYPE(d, scalarcn)), |
|
|
|
|
ocl::memopTypeToStr(d), kercn); |
|
|
|
|
|
|
|
|
|
ocl::Kernel setK(haveMask ? "setMask" : "set", ocl::core::copyset_oclsrc, opts); |
|
|
|
|
if( !setK.empty() ) |
|
|
|
|
{ |
|
|
|
|
ocl::KernelArg scalararg(0, 0, 0, 0, buf, CV_ELEM_SIZE(depth) * scalarcn); |
|
|
|
|
ocl::KernelArg scalararg(0, 0, 0, 0, buf, CV_ELEM_SIZE(d) * scalarcn); |
|
|
|
|
UMat mask; |
|
|
|
|
|
|
|
|
|
if( haveMask ) |
|
|
|
|