Some IPP functions were encapsulated;
Minor changes to IPP implementations;
This commit is contained in:
@@ -47,16 +47,16 @@
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
#define USE_IPP_CANNY 1
|
||||
#else
|
||||
#undef USE_IPP_CANNY
|
||||
#define USE_IPP_CANNY 0
|
||||
#endif
|
||||
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
#ifdef USE_IPP_CANNY
|
||||
#ifdef HAVE_IPP
|
||||
static bool ippCanny(const Mat& _src, Mat& _dst, float low, float high)
|
||||
{
|
||||
#if USE_IPP_CANNY
|
||||
int size = 0, size1 = 0;
|
||||
IppiSize roi = { _src.cols, _src.rows };
|
||||
|
||||
@@ -90,6 +90,10 @@ static bool ippCanny(const Mat& _src, Mat& _dst, float low, float high)
|
||||
_dst.ptr(), (int)_dst.step, roi, low, high, buffer) < 0 )
|
||||
return false;
|
||||
return true;
|
||||
#else
|
||||
CV_UNUSED(_src); CV_UNUSED(_dst); CV_UNUSED(low); CV_UNUSED(high);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -610,20 +614,7 @@ void cv::Canny( InputArray _src, OutputArray _dst,
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef USE_IPP_CANNY
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
if( aperture_size == 3 && !L2gradient && 1 == cn )
|
||||
{
|
||||
if (ippCanny(src, dst, (float)low_thresh, (float)high_thresh))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return;
|
||||
}
|
||||
setIppErrorStatus();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
CV_IPP_RUN(USE_IPP_CANNY && (aperture_size == 3 && !L2gradient && 1 == cn), ippCanny(src, dst, (float)low_thresh, (float)high_thresh))
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
|
||||
|
@@ -603,11 +603,7 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
|
||||
ocl_cornerMinEigenValVecs(_src, _dst, blockSize, ksize, 0.0, borderType, MINEIGENVAL))
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
int kerSize = ksize;
|
||||
if (ksize < 0)
|
||||
{
|
||||
kerSize = 3;
|
||||
}
|
||||
int kerSize = (ksize < 0)?3:ksize;
|
||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||
#endif
|
||||
|
@@ -183,15 +183,12 @@ cv::Ptr<cv::FilterEngine> cv::createDerivFilter(int srcType, int dstType,
|
||||
kx, ky, Point(-1,-1), 0, borderType );
|
||||
}
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
|
||||
#define IPP_RETURN_ERROR {setIppErrorStatus(); return false;}
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
namespace cv
|
||||
{
|
||||
#if IPP_VERSION_X100 >= 801
|
||||
static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType)
|
||||
{
|
||||
#if IPP_VERSION_X100 >= 801
|
||||
if ((0 > dx) || (0 > dy) || (1 != dx + dy))
|
||||
return false;
|
||||
if (fabs(delta) > FLT_EPSILON)
|
||||
@@ -233,19 +230,19 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
if (horz)
|
||||
{
|
||||
if (0 > ippiFilterScharrHorizMaskBorderGetBufferSize(roiSize, ippMskSize3x3, ipp8u, ipp16s, 1, &bufferSize))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
sts = ippiFilterScharrHorizMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 > ippiFilterScharrVertMaskBorderGetBufferSize(roiSize, ippMskSize3x3, ipp8u, ipp16s, 1, &bufferSize))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
sts = ippiFilterScharrVertMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
@@ -256,19 +253,19 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
if (horz)
|
||||
{
|
||||
if (0 > ippiFilterScharrHorizMaskBorderGetBufferSize(roiSize, ippMskSize3x3, ipp16s, ipp16s, 1, &bufferSize))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
sts = ippiFilterScharrHorizMaskBorder_16s_C1R(src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 > ippiFilterScharrVertMaskBorderGetBufferSize(roiSize, ippMskSize3x3, ipp16s, ipp16s, 1, &bufferSize))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
sts = ippiFilterScharrVertMaskBorder_16s_C1R(src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
@@ -279,134 +276,34 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
if (horz)
|
||||
{
|
||||
if (0 > ippiFilterScharrHorizMaskBorderGetBufferSize(roiSize, ippMskSize3x3, ipp32f, ipp32f, 1, &bufferSize))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
sts = ippiFilterScharrHorizMaskBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 > ippiFilterScharrVertMaskBorderGetBufferSize(roiSize, ippMskSize3x3, ipp32f, ipp32f, 1, &bufferSize))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
sts = ippiFilterScharrVertMaskBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
if (sts < 0)
|
||||
IPP_RETURN_ERROR;
|
||||
return false;;
|
||||
|
||||
if (FLT_EPSILON < fabs(scale - 1.0))
|
||||
sts = ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roiSize);
|
||||
}
|
||||
return (0 <= sts);
|
||||
}
|
||||
#elif IPP_VERSION_X100 >= 700
|
||||
static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType)
|
||||
{
|
||||
if (BORDER_REPLICATE != borderType)
|
||||
return false;
|
||||
if ((0 > dx) || (0 > dy) || (1 != dx + dy))
|
||||
return false;
|
||||
if (fabs(delta) > FLT_EPSILON)
|
||||
return false;
|
||||
|
||||
Mat src = _src.getMat(), dst = _dst.getMat();
|
||||
|
||||
int bufSize = 0;
|
||||
cv::AutoBuffer<char> buffer;
|
||||
IppiSize roi = ippiSize(src.cols, src.rows);
|
||||
|
||||
if( ddepth < 0 )
|
||||
ddepth = src.depth();
|
||||
|
||||
dst.create( src.size(), CV_MAKETYPE(ddepth, src.channels()) );
|
||||
|
||||
switch(src.type())
|
||||
{
|
||||
case CV_8UC1:
|
||||
{
|
||||
if(scale != 1)
|
||||
return false;
|
||||
|
||||
switch(dst.type())
|
||||
{
|
||||
case CV_16S:
|
||||
{
|
||||
if ((dx == 1) && (dy == 0))
|
||||
{
|
||||
if (0 > ippiFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
return (0 <= ippiFilterScharrVertBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer));
|
||||
}
|
||||
if ((dx == 0) && (dy == 1))
|
||||
{
|
||||
if (0 > ippiFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
return (0 <= ippiFilterScharrHorizBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
case CV_32FC1:
|
||||
{
|
||||
switch(dst.type())
|
||||
{
|
||||
case CV_32FC1:
|
||||
{
|
||||
if ((dx == 1) && (dy == 0))
|
||||
{
|
||||
if (0 > ippiFilterScharrVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterScharrVertBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (scale != 1)
|
||||
/* IPP is fast, so MulC produce very little perf degradation.*/
|
||||
//ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
if ((dx == 0) && (dy == 1))
|
||||
{
|
||||
if (0 > ippiFilterScharrHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterScharrHorizBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
|
||||
if (scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
CV_UNUSED(_src); CV_UNUSED(_dst); CV_UNUSED(ddepth); CV_UNUSED(dx); CV_UNUSED(dy); CV_UNUSED(scale); CV_UNUSED(delta); CV_UNUSED(borderType);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType)
|
||||
{
|
||||
@@ -423,58 +320,61 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
if ( ddepth < 0 )
|
||||
ddepth = src.depth();
|
||||
|
||||
IppiSize roi = {src.cols, src.rows};
|
||||
IppiMaskSize kernel = (IppiMaskSize)(ksize*10+ksize);
|
||||
|
||||
if (src.type() == CV_8U && dst.type() == CV_16S && scale == 1)
|
||||
{
|
||||
if ((dx == 1) && (dy == 0))
|
||||
{
|
||||
if (0 > ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelNegVertBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((dx == 0) && (dy == 1))
|
||||
{
|
||||
if (0 > ippiFilterSobelHorizGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelHorizBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_IPP_ICV_ONLY)
|
||||
if ((dx == 2) && (dy == 0))
|
||||
{
|
||||
if (0 > ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelVertSecondBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((dx == 0) && (dy == 2))
|
||||
{
|
||||
if (0 > ippiFilterSobelHorizSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelHorizSecondGetBufferSize_8u16s_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -485,14 +385,14 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
#if 0
|
||||
if ((dx == 1) && (dy == 0))
|
||||
{
|
||||
if (0 > ippiFilterSobelNegVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), &bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelNegVertGetBufferSize_32f_C1R(roi, kernel, &bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelNegVertBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
@@ -500,13 +400,13 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
|
||||
if ((dx == 0) && (dy == 1))
|
||||
{
|
||||
if (0 > ippiFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelHorizGetBufferSize_32f_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
if (0 > ippiFilterSobelHorizBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
@@ -515,14 +415,14 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
#if !defined(HAVE_IPP_ICV_ONLY)
|
||||
if((dx == 2) && (dy == 0))
|
||||
{
|
||||
if (0 > ippiFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelVertSecondGetBufferSize_32f_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelVertSecondBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
@@ -530,14 +430,14 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
|
||||
if((dx == 0) && (dy == 2))
|
||||
{
|
||||
if (0 > ippiFilterSobelHorizSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
if (0 > ippiFilterSobelHorizSecondGetBufferSize_32f_C1R(roi, kernel,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return false;
|
||||
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
@@ -547,41 +447,22 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#ifdef HAVE_IPP
|
||||
|
||||
static bool ipp_sobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType)
|
||||
{
|
||||
if (ksize < 0)
|
||||
{
|
||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (0 < ksize)
|
||||
{
|
||||
if (IPPDerivSobel(_src, _dst, ddepth, dx, dy, ksize, scale, delta, borderType))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
static bool ipp_scharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType)
|
||||
{
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
@@ -604,10 +485,8 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
CV_IPP_RUN(true, ipp_sobel(_src, _dst, ddepth, dx, dy, ksize, scale, delta, borderType));
|
||||
|
||||
|
||||
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
||||
|
||||
Mat kx, ky;
|
||||
@@ -643,9 +522,7 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
CV_IPP_RUN(true, ipp_scharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType));
|
||||
|
||||
CV_IPP_RUN(true, IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType));
|
||||
|
||||
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
||||
|
||||
|
@@ -1200,7 +1200,6 @@ public:
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||
|
||||
for (int i = 0; i < histSize; ++i)
|
||||
CV_XADD((int *)(hist->data + i * hist->step), *(int *)(phist.data + i * phist.step));
|
||||
@@ -1256,7 +1255,6 @@ static bool ipp_calchist(const Mat* images, int nimages, const int* channels,
|
||||
if (ok)
|
||||
{
|
||||
ihist.convertTo(hist, CV_32F);
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1375,7 +1375,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
|
||||
}
|
||||
|
||||
|
||||
#if 0 //#ifdef HAVE_IPP
|
||||
#ifdef HAVE_IPP
|
||||
namespace cv
|
||||
{
|
||||
static bool ipp_buildpyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel, int borderType )
|
||||
@@ -1508,13 +1508,8 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
|
||||
|
||||
int i=1;
|
||||
|
||||
#if (IPP_VERSION_X100 >= 801 && 0)
|
||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||
CV_IPP_RUN(((IPP_VERSION_X100 >= 801 && 0) && (borderTypeNI == BORDER_DEFAULT && (!_src.isSubmatrix() || isolated))),
|
||||
CV_IPP_RUN(((IPP_VERSION_X100 >= 801 && 0) && ((borderType & ~BORDER_ISOLATED) == BORDER_DEFAULT && (!_src.isSubmatrix() || ((borderType & BORDER_ISOLATED) != 0)))),
|
||||
ipp_buildpyramid( _src, _dst, maxlevel, borderType));
|
||||
#endif
|
||||
|
||||
|
||||
for( ; i <= maxlevel; i++ )
|
||||
pyrDown( _dst.getMatRef(i-1), _dst.getMatRef(i), Size(), borderType );
|
||||
|
@@ -1668,6 +1668,7 @@ static bool ipp_GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
double sigma1, double sigma2,
|
||||
int borderType )
|
||||
{
|
||||
#if IPP_VERSION_X100 >= 801
|
||||
int type = _src.type();
|
||||
Size size = _src.size();
|
||||
|
||||
@@ -1742,10 +1743,7 @@ static bool ipp_GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
ippFree(pBuffer);
|
||||
|
||||
if(status >= 0)
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef IPP_FILTER_GAUSS_C1
|
||||
#undef IPP_FILTER_GAUSS_CN
|
||||
@@ -1753,6 +1751,9 @@ static bool ipp_GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
CV_UNUSED(_src); CV_UNUSED(_dst); CV_UNUSED(ksize); CV_UNUSED(sigma1); CV_UNUSED(sigma2); CV_UNUSED(borderType);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1788,10 +1789,8 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
CV_IPP_RUN(true, ipp_GaussianBlur( _src, _dst, ksize, sigma1, sigma2, borderType));
|
||||
|
||||
|
||||
Mat kx, ky;
|
||||
createGaussianKernels(kx, ky, type, ksize, sigma1, sigma2);
|
||||
sepFilter2D(_src, _dst, CV_MAT_DEPTH(type), kx, ky, Point(-1,-1), 0, borderType );
|
||||
@@ -2754,6 +2753,8 @@ static bool ipp_medianFilter( InputArray _src0, OutputArray _dst, int ksize )
|
||||
IPP_FILTER_MEDIAN_BORDER(Ipp32f, ipp32f, 32f_C1R);
|
||||
}
|
||||
#undef IPP_FILTER_MEDIAN_BORDER
|
||||
#else
|
||||
CV_UNUSED(_src0); CV_UNUSED(_dst); CV_UNUSED(ksize);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user