cv::medianBlur

This commit is contained in:
Ilya Lavrenov 2014-04-04 15:52:13 +04:00
parent ed1ca00bf6
commit c6f208e1c8
2 changed files with 39 additions and 5 deletions

View File

@ -4013,8 +4013,9 @@ private:
double *M; double *M;
}; };
/*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 IPP_VERSION_MINOR >= 1 /*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
class IPPWarpAffineInvoker : class IPPWarpAffineInvoker :
public ParallelLoopBody public ParallelLoopBody
{ {
@ -4215,7 +4216,7 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
const int AB_SCALE = 1 << AB_BITS; const int AB_SCALE = 1 << AB_BITS;
/* /*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 IPP_VERSION_MINOR >= 1 #if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) && if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
( cn == 1 || cn == 3 || cn == 4 ) && ( cn == 1 || cn == 3 || cn == 4 ) &&
@ -4380,7 +4381,7 @@ private:
Scalar borderValue; Scalar borderValue;
}; };
/* /*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1 #if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
class IPPWarpPerspectiveInvoker : class IPPWarpPerspectiveInvoker :
public ParallelLoopBody public ParallelLoopBody

View File

@ -1948,13 +1948,46 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
return; return;
} }
CV_OCL_RUN(_src0.dims() <= 2 && _dst.isUMat(), CV_OCL_RUN(_dst.isUMat(),
ocl_medianFilter(_src0,_dst, ksize)) ocl_medianFilter(_src0,_dst, ksize))
Mat src0 = _src0.getMat(); Mat src0 = _src0.getMat();
_dst.create( src0.size(), src0.type() ); _dst.create( src0.size(), src0.type() );
Mat dst = _dst.getMat(); Mat dst = _dst.getMat();
#ifdef HAVE_IPP
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
do \
{ \
if (ippiFilterMedianBorderGetBufferSize(dstRoiSize, maskSize, \
ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \
{ \
Ipp8u * buffer = (Ipp8u *)ippMalloc(bufSize); \
IppStatus status = ippiFilterMedianBorder_##flavor((const ippType *)src0.data, (int)src0.step, \
(ippType *)dst.data, (int)dst.step, dstRoiSize, maskSize, \
ippBorderRepl, (ippType)0, buffer); \
ippiFree(buffer); \
if (status >= 0) \
return; \
} \
} \
while ((void)0, 0)
Ipp32s bufSize;
IppiSize dstRoiSize = ippiSize(dst.cols, dst.rows), maskSize = ippiSize(ksize, ksize);
int type = src0.type();
if (type == CV_8UC1)
IPP_FILTER_MEDIAN_BORDER(Ipp8u, ipp8u, 8u_C1R);
else if (type == CV_16UC1)
IPP_FILTER_MEDIAN_BORDER(Ipp16u, ipp16u, 16u_C1R);
else if (type == CV_16SC1)
IPP_FILTER_MEDIAN_BORDER(Ipp16s, ipp16s, 16s_C1R);
else if (type == CV_32FC1)
IPP_FILTER_MEDIAN_BORDER(Ipp32f, ipp32f, 32f_C1R);
#undef IPP_FILTER_MEDIAN_BORDER
#endif
#ifdef HAVE_TEGRA_OPTIMIZATION #ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::medianBlur(src0, dst, ksize)) if (tegra::medianBlur(src0, dst, ksize))
return; return;