Commit 0319120a authored by Alexander Mordvintsev's avatar Alexander Mordvintsev

fix: ippiFilterMedianBorder sometimes crash when doing in-place filtering

parent 4689426a
...@@ -2163,7 +2163,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) ...@@ -2163,7 +2163,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \ ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \
{ \ { \
Ipp8u * buffer = ippsMalloc_8u(bufSize); \ Ipp8u * buffer = ippsMalloc_8u(bufSize); \
IppStatus status = ippiFilterMedianBorder_##flavor(src0.ptr<ippType>(), (int)src0.step, \ IppStatus status = ippiFilterMedianBorder_##flavor(src.ptr<ippType>(), (int)src.step, \
dst.ptr<ippType>(), (int)dst.step, dstRoiSize, maskSize, \ dst.ptr<ippType>(), (int)dst.step, dstRoiSize, maskSize, \
ippBorderRepl, (ippType)0, buffer); \ ippBorderRepl, (ippType)0, buffer); \
ippsFree(buffer); \ ippsFree(buffer); \
...@@ -2178,6 +2178,11 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) ...@@ -2178,6 +2178,11 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
{ {
Ipp32s bufSize; Ipp32s bufSize;
IppiSize dstRoiSize = ippiSize(dst.cols, dst.rows), maskSize = ippiSize(ksize, ksize); IppiSize dstRoiSize = ippiSize(dst.cols, dst.rows), maskSize = ippiSize(ksize, ksize);
Mat src;
if( dst.data != src0.data )
src = src0;
else
src0.copyTo(src);
int type = src0.type(); int type = src0.type();
if (type == CV_8UC1) if (type == CV_8UC1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment