mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
core: rework getContinuousSize() for vector-col/row support
This commit is contained in:
@@ -199,11 +199,9 @@ static void binary_op( InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
func = tab[depth1];
|
||||
|
||||
Mat src1 = psrc1->getMat(), src2 = psrc2->getMat(), dst = _dst.getMat();
|
||||
if (_dst.isVector() && dst.size() != src1.size()) // https://github.com/opencv/opencv/pull/4159
|
||||
dst = dst.reshape(0, (int)dst.total());
|
||||
Size sz = getContinuousSize(src1, src2, dst);
|
||||
Size sz = getContinuousSize2D(src1, src2, dst);
|
||||
size_t len = sz.width*(size_t)cn;
|
||||
if( len == (size_t)(int)len )
|
||||
if (len < INT_MAX) // FIXIT similar code below doesn't have that check
|
||||
{
|
||||
sz.width = (int)len;
|
||||
func(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz.width, sz.height, 0);
|
||||
@@ -632,9 +630,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
usrdata, oclop, false))
|
||||
|
||||
Mat src1 = psrc1->getMat(), src2 = psrc2->getMat(), dst = _dst.getMat();
|
||||
if (_dst.isVector() && dst.size() != src1.size()) // https://github.com/opencv/opencv/pull/4159
|
||||
dst = dst.reshape(0, (int)dst.total());
|
||||
Size sz = getContinuousSize(src1, src2, dst, src1.channels());
|
||||
Size sz = getContinuousSize2D(src1, src2, dst, src1.channels());
|
||||
tab[depth1](src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz.width, sz.height, usrdata);
|
||||
return;
|
||||
}
|
||||
@@ -1283,9 +1279,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
||||
int cn = src1.channels();
|
||||
_dst.create(src1.size(), CV_8UC(cn));
|
||||
Mat dst = _dst.getMat();
|
||||
if (_dst.isVector() && dst.size() != src1.size()) // https://github.com/opencv/opencv/pull/4159
|
||||
dst = dst.reshape(0, (int)dst.total());
|
||||
Size sz = getContinuousSize(src1, src2, dst, src1.channels());
|
||||
Size sz = getContinuousSize2D(src1, src2, dst, src1.channels());
|
||||
getCmpFunc(src1.depth())(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz.width, sz.height, &op);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user