icv: enable functions

This commit is contained in:
Alexander Alekhin
2014-04-28 19:31:18 +04:00
parent 5658ba0002
commit b62e59aac0
22 changed files with 78 additions and 100 deletions

View File

@@ -431,7 +431,7 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask )
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
{
typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
@@ -510,7 +510,7 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
{
typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
@@ -589,7 +589,7 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2,
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous()))
{
typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2,
@@ -670,7 +670,7 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst,
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && mask.isContinuous()))
{
typedef IppStatus (CV_STDCALL * ippiAddWeighted)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep,

View File

@@ -300,7 +300,7 @@ static ippiReorderFunc ippiSwapChannelsC3RTab[] =
0, (ippiReorderFunc)ippiSwapChannels_32f_C3R, 0, 0
};
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801
static ippiReorderFunc ippiSwapChannelsC4RTab[] =
{
(ippiReorderFunc)ippiSwapChannels_8u_C4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4R, 0,
@@ -3314,7 +3314,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
return;
setIppErrorStatus();
}
#if !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_X100 >= 801)
#if IPP_VERSION_X100 >= 801
else if( code == CV_RGBA2BGRA )
{
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) )
@@ -3343,7 +3343,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
_dst.create(sz, CV_8UC2);
dst = _dst.getMat();
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
#ifdef HAVE_IPP
CV_SUPPRESS_DEPRECATED_START
#if 0
if (code == CV_BGR2BGR565 && scn == 3)
@@ -3400,7 +3400,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
_dst.create(sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
#ifdef HAVE_IPP
CV_SUPPRESS_DEPRECATED_START
if (code == CV_BGR5652BGR && dcn == 3)
{
@@ -3919,7 +3919,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
_dst.create(sz, CV_MAKETYPE(depth, 3));
dst = _dst.getMat();
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
#ifdef HAVE_IPP
#if 0
if (code == CV_LBGR2Lab && scn == 3 && depth == CV_8U)
{
@@ -4012,8 +4012,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
_dst.create(sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if 0
#if defined(HAVE_IPP) && 0
if( code == CV_Lab2LBGR && dcn == 3 && depth == CV_8U)
{
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R)) )
@@ -4064,7 +4063,6 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
return;
}
#endif
#endif
if( code == CV_Lab2BGR || code == CV_Lab2RGB ||
@@ -4264,7 +4262,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
if( depth == CV_8U )
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiAlphaPremul_8u_AC4R)))
return;
setIppErrorStatus();

View File

@@ -473,7 +473,7 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi
_dst.create( src.size(), CV_32FC1 );
Mat dst = _dst.getMat();
#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 >= 801
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
int borderTypeNI = borderType & ~BORDER_ISOLATED;
bool isolated = (borderType & BORDER_ISOLATED) != 0;

View File

@@ -189,13 +189,9 @@ cv::Ptr<cv::FilterEngine> cv::createDerivFilter(int srcType, int dstType,
namespace cv
{
#if (IPP_VERSION_X100 >= 801)
#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 defined(HAVE_IPP_ICV_ONLY)
(void)_src; (void)_dst; (void)ddepth; (void)dx; (void)dy; (void)scale; (void)delta; (void)borderType;
return false;
#else
if ((0 > dx) || (0 > dy) || (1 != dx + dy))
return false;
if (fabs(delta) > FLT_EPSILON)
@@ -306,9 +302,8 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
sts = ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, roiSize);
}
return (0 <= sts);
#endif
}
#elif (IPP_VERSION_MAJOR >= 7)
#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)
@@ -363,9 +358,6 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
}
}
case CV_32FC1:
#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R
return false;
#else
{
switch(dst.type())
{
@@ -410,7 +402,6 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
return false;
}
}
#endif
default:
return false;
}
@@ -460,9 +451,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
return true;
}
#if defined(HAVE_IPP_ICV_ONLY)
return false;
#else
#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))
@@ -493,9 +482,6 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
if (src.type() == CV_32F && dst.type() == CV_32F)
{
#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R
return false;
#else
#if 0
if ((dx == 1) && (dy == 0))
{
@@ -526,6 +512,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
return true;
}
#endif
#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))
@@ -585,7 +572,7 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
}
#endif
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
#ifdef HAVE_IPP
if (ksize < 0)
{
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
@@ -713,7 +700,7 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
ddepth = sdepth;
_dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#ifdef HAVE_IPP
if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)))
{

View File

@@ -688,7 +688,7 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst)
_dst.create( src.size(), CV_8UC1);
Mat dst = _dst.getMat();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined HAVE_IPP_ICV_ONLY
#ifdef HAVE_IPP
IppiSize roi = { src.cols, src.rows };
Ipp32s pMetrics[2] = { 1, 2 }; //L1, 3x3 mask
if (ippiDistanceTransform_3x3_8u_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<uchar>(), (int)dst.step, roi, pMetrics)>=0)
@@ -734,7 +734,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
if( maskSize == CV_DIST_MASK_PRECISE )
{
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
#ifdef HAVE_IPP
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
{
IppStatus status;
@@ -773,7 +773,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
{
if( maskSize == CV_DIST_MASK_3 )
{
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined HAVE_IPP_ICV_ONLY
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
IppiSize roi = { src.cols, src.rows };
if (ippiDistanceTransform_3x3_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
return;

View File

@@ -1175,7 +1175,7 @@ calcHist_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
}
}
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#ifdef HAVE_IPP
class IPPCalcHistInvoker :
public ParallelLoopBody
@@ -1232,7 +1232,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
Mat hist = _hist.getMat(), ihist = hist;
ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S;
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#ifdef HAVE_IPP
if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels &&
channels[0] == 0 && mask.empty() && images[0].dims <= 2 &&
!accumulate && uniform)

View File

@@ -1911,7 +1911,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE; \
getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE;
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701
#if IPP_VERSION_X100 >= 701
class IPPresizeInvoker :
public ParallelLoopBody
{
@@ -2395,7 +2395,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
double scale_x = 1./inv_scale_x, scale_y = 1./inv_scale_y;
int k, sx, sy, dx, dy;
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701
#if IPP_VERSION_X100 >= 701
#define IPP_RESIZE_EPS 1e-10
double ex = fabs((double)dsize.width / src.cols - inv_scale_x) / inv_scale_x;

View File

@@ -462,7 +462,7 @@ cv::Moments cv::moments( InputArray _src, bool binary )
if( cn > 1 )
CV_Error( CV_StsBadArg, "Invalid image type (must be single-channel)" );
#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 >= 801
if (!binary)
{
IppiSize roi = { mat.cols, mat.rows };

View File

@@ -1228,9 +1228,6 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
}
else
{
#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiFilterMin*/ippiFilterMax*
return false;
#else
IppiPoint point = {anchor.x, anchor.y};
#define IPP_MORPH_CASE(cvtype, flavor, data_type) \
@@ -1262,7 +1259,6 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8
return false; /// It disables false positive warning in GCC 4.8.2
#endif
#endif
}
}

View File

@@ -508,7 +508,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
return;
#endif
#if (defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
#if IPP_VERSION_X100 >= 801
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size((src.cols + 1)/2, (src.rows + 1)/2))
@@ -577,7 +577,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
return;
#endif
#if (defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
#if IPP_VERSION_X100 >= 801
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size(src.cols*2, src.rows*2))
@@ -648,7 +648,7 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
int i=1;
#if (defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
#if IPP_VERSION_X100 >= 801
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated))

View File

@@ -858,7 +858,7 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
return;
#endif
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
int ippBorderType = borderType & ~BORDER_ISOLATED;
Point ocvAnchor, ippAnchor;
ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x;
@@ -885,7 +885,6 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
(int)dst.step, roiSize, maskSize, \
(IppiBorderType)ippBorderType, borderValue, buffer); \
ippsFree(buffer); \
printf("%s %d %d\n", ippGetStatusString(status), (int)src.step, (int)dst.step); \
if (status >= 0) \
return; \
} \
@@ -2025,7 +2024,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
_dst.create( src0.size(), src0.type() );
Mat dst = _dst.getMat();
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
do \
{ \
@@ -2274,7 +2273,7 @@ private:
float *space_weight, *color_weight;
};
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined(HAVE_IPP_ICV_ONLY)
#if defined (HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && 0
class IPPBilateralFilter_8u_Invoker :
public ParallelLoopBody
{

View File

@@ -341,7 +341,7 @@ static bool ocl_matchTemplate( InputArray _img, InputArray _templ, OutputArray _
#endif
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
typedef IppStatus (CV_STDCALL * ippimatchTemplate)(const void*, int, IppiSize, const void*, int, IppiSize, Ipp32f* , int , IppEnum , Ipp8u*);
@@ -633,7 +633,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
return;
#endif
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (method == CV_TM_SQDIFF && cn == 1)
{
if (ipp_sqrDistance(img, templ, result))
@@ -642,7 +642,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
}
#endif
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (cn == 1)
{
if (!ipp_crossCorr(img, templ, result))

View File

@@ -68,7 +68,7 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
return;
#endif
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
IppiSize sz = { roi.width, roi.height };
switch( type )
{
@@ -309,7 +309,7 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
return;
#endif
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
IppiSize sz = { roi.width, roi.height };
switch( type )
{
@@ -503,7 +503,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
return;
#endif
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
IppiSize sz = { roi.width, roi.height };
switch( type )
{
@@ -683,7 +683,7 @@ getThreshVal_Otsu_8u( const Mat& _src )
step = size.width;
}
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801 && !defined(HAVE_IPP_ICV_ONLY)
IppiSize srcSize = { size.width, size.height };
Ipp8u thresh;
CV_SUPPRESS_DEPRECATED_START