From: Maksim Shabunin Date: Fri, 3 Nov 2017 14:57:08 +0000 (+0300) Subject: Do not reset step for single-row Mat created on user data X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~401^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb136ebba66864a572ff0bc52fedca3cc5ed6090;p=platform%2Fupstream%2Fopencv.git Do not reset step for single-row Mat created on user data --- diff --git a/modules/core/include/opencv2/core/mat.inl.hpp b/modules/core/include/opencv2/core/mat.inl.hpp index 2d79130..dbd9584 100644 --- a/modules/core/include/opencv2/core/mat.inl.hpp +++ b/modules/core/include/opencv2/core/mat.inl.hpp @@ -508,7 +508,6 @@ Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step) } else { - if( rows == 1 ) _step = minstep; CV_DbgAssert( _step >= minstep ); if (_step % esz1 != 0) @@ -516,7 +515,8 @@ Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step) CV_Error(Error::BadStep, "Step must be a multiple of esz1"); } - flags |= _step == minstep ? CONTINUOUS_FLAG : 0; + if (_step == minstep || rows == 1) + flags |= CONTINUOUS_FLAG; } step[0] = _step; step[1] = esz; @@ -541,7 +541,6 @@ Mat::Mat(Size _sz, int _type, void* _data, size_t _step) } else { - if( rows == 1 ) _step = minstep; CV_DbgAssert( _step >= minstep ); if (_step % esz1 != 0) @@ -549,7 +548,8 @@ Mat::Mat(Size _sz, int _type, void* _data, size_t _step) CV_Error(Error::BadStep, "Step must be a multiple of esz1"); } - flags |= _step == minstep ? CONTINUOUS_FLAG : 0; + if (_step == minstep || rows == 1) + flags |= CONTINUOUS_FLAG; } step[0] = _step; step[1] = esz;