propagated some more fixes from 2.3 branch to the trunk

This commit is contained in:
Vadim Pisarevsky
2011-06-30 12:06:26 +00:00
parent f4894d57cd
commit cc9a1bb62f
32 changed files with 564 additions and 575 deletions

View File

@@ -988,9 +988,14 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
c = src1.channels();
}
Size sz = getContinuousSize(src1, src2, dst, c);
func(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, 0);
return;
Size sz = getContinuousSize(src1, src2, dst);
size_t len = sz.width*(size_t)c;
if( len == (size_t)(int)len )
{
sz.width = (int)len;
func(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, 0);
return;
}
}
if( (kind1 == _InputArray::MATX) + (kind2 == _InputArray::MATX) == 1 ||
@@ -1045,6 +1050,9 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
NAryMatIterator it(arrays, ptrs);
size_t total = it.size, blocksize = total;
if( blocksize*c > INT_MAX )
blocksize = INT_MAX/c;
if( haveMask )
{
blocksize = std::min(blocksize, blocksize0);

View File

@@ -171,11 +171,12 @@ void Mat::copyTo( OutputArray _dst ) const
// to handle the copying 1xn matrix => nx1 std vector.
Size sz = size() == dst.size() ?
getContinuousSize(*this, dst, (int)elemSize()) :
getContinuousSize(*this, (int)elemSize());
getContinuousSize(*this, dst) :
getContinuousSize(*this);
size_t len = sz.width*elemSize();
for( ; sz.height--; sptr += step, dptr += dst.step )
memcpy( dptr, sptr, sz.width );
memcpy( dptr, sptr, len );
}
return;
}