|
|
|
@ -307,8 +307,7 @@ UMat& UMat::operator=(const UMat& m) |
|
|
|
|
else |
|
|
|
|
copySize(m); |
|
|
|
|
allocator = m.allocator; |
|
|
|
|
if (usageFlags == USAGE_DEFAULT) |
|
|
|
|
usageFlags = m.usageFlags; |
|
|
|
|
usageFlags = m.usageFlags; |
|
|
|
|
u = m.u; |
|
|
|
|
offset = m.offset; |
|
|
|
|
} |
|
|
|
@ -332,9 +331,6 @@ void UMat::assignTo(UMat& m, int _type) const |
|
|
|
|
|
|
|
|
|
void UMat::create(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags) |
|
|
|
|
{ |
|
|
|
|
_type &= TYPE_MASK; |
|
|
|
|
if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && u ) |
|
|
|
|
return; |
|
|
|
|
int sz[] = {_rows, _cols}; |
|
|
|
|
create(2, sz, _type, _usageFlags); |
|
|
|
|
} |
|
|
|
@ -426,7 +422,9 @@ UMat& UMat::operator=(UMat&& m) |
|
|
|
|
m.step.p = m.step.buf; |
|
|
|
|
m.size.p = &m.rows; |
|
|
|
|
} |
|
|
|
|
m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0; |
|
|
|
|
m.flags = MAGIC_VAL; |
|
|
|
|
m.usageFlags = USAGE_DEFAULT; |
|
|
|
|
m.dims = m.rows = m.cols = 0; |
|
|
|
|
m.allocator = NULL; |
|
|
|
|
m.u = NULL; |
|
|
|
|
m.offset = 0; |
|
|
|
@ -600,6 +598,7 @@ UMat Mat::getUMat(AccessFlag accessFlags, UMatUsageFlags usageFlags) const |
|
|
|
|
CV_XADD(&(u->urefcount), 1); |
|
|
|
|
} |
|
|
|
|
hdr.flags = flags; |
|
|
|
|
hdr.usageFlags = usageFlags; |
|
|
|
|
setSize(hdr, dims, size.p, step.p); |
|
|
|
|
finalizeHdr(hdr); |
|
|
|
|
hdr.u = new_u; |
|
|
|
@ -610,16 +609,21 @@ UMat Mat::getUMat(AccessFlag accessFlags, UMatUsageFlags usageFlags) const |
|
|
|
|
|
|
|
|
|
void UMat::create(int d, const int* _sizes, int _type, UMatUsageFlags _usageFlags) |
|
|
|
|
{ |
|
|
|
|
this->usageFlags = _usageFlags; |
|
|
|
|
|
|
|
|
|
int i; |
|
|
|
|
CV_Assert(0 <= d && d <= CV_MAX_DIM && _sizes); |
|
|
|
|
_type = CV_MAT_TYPE(_type); |
|
|
|
|
|
|
|
|
|
if( u && (d == dims || (d == 1 && dims <= 2)) && _type == type() ) |
|
|
|
|
// if param value is USAGE_DEFAULT by implicit default param value -or- explicit value
|
|
|
|
|
// ...then don't change the existing usageFlags
|
|
|
|
|
// it is not possible to change usage from non-default to USAGE_DEFAULT through create()
|
|
|
|
|
// ...instead must construct UMat()
|
|
|
|
|
if (_usageFlags == cv::USAGE_DEFAULT) |
|
|
|
|
{ |
|
|
|
|
_usageFlags = usageFlags; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( u && (d == dims || (d == 1 && dims <= 2)) && _type == type() && _usageFlags == usageFlags ) |
|
|
|
|
{ |
|
|
|
|
if( d == 2 && rows == _sizes[0] && cols == _sizes[1] ) |
|
|
|
|
return; |
|
|
|
|
for( i = 0; i < d; i++ ) |
|
|
|
|
if( size[i] != _sizes[i] ) |
|
|
|
|
break; |
|
|
|
@ -636,6 +640,7 @@ void UMat::create(int d, const int* _sizes, int _type, UMatUsageFlags _usageFlag |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
release(); |
|
|
|
|
usageFlags = _usageFlags; |
|
|
|
|
if( d == 0 ) |
|
|
|
|
return; |
|
|
|
|
flags = (_type & CV_MAT_TYPE_MASK) | MAGIC_VAL; |
|
|
|
|