disabled IPP functions that slower than OpenCV

This commit is contained in:
Ilya Lavrenov
2014-04-24 14:15:37 +04:00
parent e1b5a547cc
commit d16e0b377f
9 changed files with 49 additions and 50 deletions

View File

@@ -3977,22 +3977,20 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
setIppErrorStatus();
}
else
#endif
if (code == CV_LRGB2Lab && scn == 3 && depth == CV_8U)
if (code == CV_LRGB2Lab && scn == 3 && depth == CV_8U) // slower than OpenCV
{
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth)))
return;
setIppErrorStatus();
}
else if (code == CV_LRGB2Lab && scn == 4 && depth == CV_8U)
else if (code == CV_LRGB2Lab && scn == 4 && depth == CV_8U) // slower than OpenCV
{
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth)))
return;
setIppErrorStatus();
}
#if 0
else if (code == CV_LRGB2Luv && scn == 3)
{
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGBToLUVTab[depth])))
@@ -4054,7 +4052,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) && 0
#if defined HAVE_IPP && 0
if( code == CV_Lab2LBGR && dcn == 3 && depth == CV_8U)
{
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R)) )

View File

@@ -526,7 +526,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
#if IPP_VERSION_X100 >= 801 && 0
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;
@@ -563,10 +563,8 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi
if (status >= 0)
return;
setIppErrorStatus();
}
else
setIppErrorStatus();
setIppErrorStatus();
}
#endif

View File

@@ -2085,10 +2085,8 @@ static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize,
cn);
k.create("resizeSampler", ocl::imgproc::resize_oclsrc, compileOpts);
if(k.empty())
{
if (k.empty())
useSampler = false;
}
else
{
// Convert the input into an OpenCL image type, using normalized channel data types
@@ -2397,6 +2395,12 @@ 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;
int iscale_x = saturate_cast<int>(scale_x);
int iscale_y = saturate_cast<int>(scale_y);
bool is_area_fast = std::abs(scale_x - iscale_x) < DBL_EPSILON &&
std::abs(scale_y - iscale_y) < DBL_EPSILON;
#if IPP_VERSION_X100 >= 701
#define IPP_RESIZE_EPS 1e-10
@@ -2404,7 +2408,8 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
double ey = fabs((double)dsize.height / src.rows - inv_scale_y) / inv_scale_y;
if ( ((ex < IPP_RESIZE_EPS && ey < IPP_RESIZE_EPS && depth != CV_64F) || (ex == 0 && ey == 0 && depth == CV_64F)) &&
(interpolation == INTER_LINEAR || interpolation == INTER_CUBIC))
(interpolation == INTER_LINEAR || interpolation == INTER_CUBIC) &&
!(interpolation == INTER_LINEAR && is_area_fast && iscale_x == 2 && iscale_y == 2 && depth == CV_8U))
{
int mode = -1;
if (interpolation == INTER_LINEAR && src.rows >= 2 && src.cols >= 2)
@@ -2435,12 +2440,6 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
}
{
int iscale_x = saturate_cast<int>(scale_x);
int iscale_y = saturate_cast<int>(scale_y);
bool is_area_fast = std::abs(scale_x - iscale_x) < DBL_EPSILON &&
std::abs(scale_y - iscale_y) < DBL_EPSILON;
// in case of scale_x && scale_y is equal to 2
// INTER_AREA (fast) also is equal to INTER_LINEAR
if( interpolation == INTER_LINEAR && is_area_fast && iscale_x == 2 && iscale_y == 2 )

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
#if IPP_VERSION_X100 >= 801 && 0
if (!binary)
{
IppiSize roi = { mat.cols, mat.rows };

View File

@@ -508,7 +508,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
return;
#endif
#if IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801 && 0
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 IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801 && 0
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 IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801 && 0
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated))
@@ -668,17 +668,20 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_8u_C1R;
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_8u_C1R;
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_8u_C1R;
} else if (type == CV_8UC3)
}
else if (type == CV_8UC3)
{
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_8u_C3R;
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_8u_C3R;
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_8u_C3R;
} else if (type == CV_32FC1)
}
else if (type == CV_32FC1)
{
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_32f_C1R;
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_32f_C1R;
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_32f_C1R;
} else if (type == CV_32FC3)
}
else if (type == CV_32FC3)
{
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_32f_C3R;
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_32f_C3R;
@@ -722,10 +725,10 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
}
}
pyrFreeFunc(gPyr->pState);
} else
{
setIppErrorStatus();
}
else
setIppErrorStatus();
ippiPyramidFree(gPyr);
}
}