IPP_VERSION_X100 was changed to:
IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR*10 + IPP_VERSION_UPDATE to manage changes between updates more easily. IPP_DISABLE_BLOCK was added to ease tracking of disabled IPP functions;
This commit is contained in:
@@ -191,9 +191,16 @@ CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int un
|
||||
\****************************************************************************************/
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
# include "ipp.h"
|
||||
#include "ipp.h"
|
||||
|
||||
# define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR)
|
||||
#ifndef IPP_VERSION_UPDATE // prior to 7.1
|
||||
#define IPP_VERSION_UPDATE 0
|
||||
#endif
|
||||
|
||||
#define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR*10 + IPP_VERSION_UPDATE)
|
||||
|
||||
// General define for ipp function disabling
|
||||
#define IPP_DISABLE_BLOCK 0
|
||||
|
||||
#ifdef CV_MALLOC_ALIGN
|
||||
#undef CV_MALLOC_ALIGN
|
||||
@@ -235,7 +242,7 @@ static inline IppDataType ippiGetDataType(int depth)
|
||||
}
|
||||
|
||||
#else
|
||||
# define IPP_VERSION_X100 0
|
||||
#define IPP_VERSION_X100 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IPP_ICV_ONLY
|
||||
|
||||
@@ -5682,7 +5682,7 @@ static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
|
||||
#if defined(HAVE_IPP)
|
||||
namespace ipp {
|
||||
|
||||
#if 0 // there are no performance benefits (PR #2653)
|
||||
#if IPP_DISABLE_BLOCK // there are no performance benefits (PR #2653)
|
||||
class IppLUTParallelBody_LUTC1 : public ParallelLoopBody
|
||||
{
|
||||
public:
|
||||
@@ -5850,7 +5850,7 @@ static bool ipp_lut(Mat &src, Mat &lut, Mat &dst)
|
||||
Ptr<ParallelLoopBody> body;
|
||||
|
||||
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
|
||||
#if 0 // there are no performance benefits (PR #2653)
|
||||
#if IPP_DISABLE_BLOCK // there are no performance benefits (PR #2653)
|
||||
if (lutcn == 1)
|
||||
{
|
||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTC1(src, lut, dst, &ok);
|
||||
|
||||
@@ -377,7 +377,7 @@ Mat& Mat::operator = (const Scalar& s)
|
||||
|
||||
if( is[0] == 0 && is[1] == 0 && is[2] == 0 && is[3] == 0 )
|
||||
{
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && 0
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && IPP_DISABLE_BLOCK
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
if (dims <= 2 || isContinuous())
|
||||
@@ -1157,7 +1157,7 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
|
||||
|
||||
borderType &= ~BORDER_ISOLATED;
|
||||
|
||||
#if defined HAVE_IPP && 0
|
||||
#if defined HAVE_IPP && IPP_DISABLE_BLOCK
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst,
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace cv
|
||||
# pragma warning(disable: 4748)
|
||||
#endif
|
||||
|
||||
#if IPP_VERSION_X100 >= 701
|
||||
#if IPP_VERSION_X100 >= 710
|
||||
#define USE_IPP_DFT 1
|
||||
#else
|
||||
#undef USE_IPP_DFT
|
||||
|
||||
@@ -2916,7 +2916,7 @@ dotProd_(const T* src1, const T* src2, int len)
|
||||
static double dotProd_8u(const uchar* src1, const uchar* src2, int len)
|
||||
{
|
||||
double r = 0;
|
||||
#if ARITHM_USE_IPP && 0
|
||||
#if ARITHM_USE_IPP && IPP_DISABLE_BLOCK
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])),
|
||||
|
||||
@@ -3782,18 +3782,24 @@ static IppSortFunc getSortFunc(int depth, bool sortDescending)
|
||||
{
|
||||
if (!sortDescending)
|
||||
return depth == CV_8U ? (IppSortFunc)ippsSortAscend_8u_I :
|
||||
/*depth == CV_16U ? (IppSortFunc)ippsSortAscend_16u_I :
|
||||
#if IPP_DISABLE_BLOCK
|
||||
depth == CV_16U ? (IppSortFunc)ippsSortAscend_16u_I :
|
||||
depth == CV_16S ? (IppSortFunc)ippsSortAscend_16s_I :
|
||||
depth == CV_32S ? (IppSortFunc)ippsSortAscend_32s_I :
|
||||
depth == CV_32F ? (IppSortFunc)ippsSortAscend_32f_I :
|
||||
depth == CV_64F ? (IppSortFunc)ippsSortAscend_64f_I :*/ 0;
|
||||
depth == CV_64F ? (IppSortFunc)ippsSortAscend_64f_I :
|
||||
#endif
|
||||
0;
|
||||
else
|
||||
return depth == CV_8U ? (IppSortFunc)ippsSortDescend_8u_I :
|
||||
/*depth == CV_16U ? (IppSortFunc)ippsSortDescend_16u_I :
|
||||
#if IPP_DISABLE_BLOCK
|
||||
depth == CV_16U ? (IppSortFunc)ippsSortDescend_16u_I :
|
||||
depth == CV_16S ? (IppSortFunc)ippsSortDescend_16s_I :
|
||||
depth == CV_32S ? (IppSortFunc)ippsSortDescend_32s_I :
|
||||
depth == CV_32F ? (IppSortFunc)ippsSortDescend_32f_I :
|
||||
depth == CV_64F ? (IppSortFunc)ippsSortDescend_64f_I :*/ 0;
|
||||
depth == CV_64F ? (IppSortFunc)ippsSortDescend_64f_I :
|
||||
#endif
|
||||
0;
|
||||
}
|
||||
|
||||
static IppFlipFunc getFlipFunc(int depth)
|
||||
@@ -3908,7 +3914,7 @@ public:
|
||||
const _Tp* arr;
|
||||
};
|
||||
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
|
||||
typedef IppStatus (CV_STDCALL *IppSortIndexFunc)(void *, int *, int);
|
||||
|
||||
@@ -3955,7 +3961,7 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
|
||||
bptr = (T*)buf;
|
||||
_iptr = (int*)ibuf;
|
||||
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
int depth = src.depth();
|
||||
IppSortIndexFunc ippFunc = 0;
|
||||
IppFlipFunc ippFlipFunc = 0;
|
||||
@@ -3984,27 +3990,27 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
|
||||
for( j = 0; j < len; j++ )
|
||||
iptr[j] = j;
|
||||
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
if (sortRows || !ippFunc || ippFunc(ptr, iptr, len) < 0)
|
||||
#endif
|
||||
{
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
std::sort( iptr, iptr + len, LessThanIdx<T>(ptr) );
|
||||
if( sortDescending )
|
||||
{
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
if (!ippFlipFunc || ippFlipFunc(iptr, len) < 0)
|
||||
#endif
|
||||
{
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
for( j = 0; j < len/2; j++ )
|
||||
std::swap(iptr[j], iptr[len-1-j]);
|
||||
}
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
else
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
@@ -4012,7 +4018,7 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined USE_IPP_SORT && 0
|
||||
#if defined USE_IPP_SORT && IPP_DISABLE_BLOCK
|
||||
else
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
|
||||
@@ -206,7 +206,7 @@ extern volatile bool USE_AVX2;
|
||||
|
||||
enum { BLOCK_SIZE = 1024 };
|
||||
|
||||
#if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7)
|
||||
#if defined HAVE_IPP && (IPP_VERSION_X100 >= 700)
|
||||
#define ARITHM_USE_IPP 1
|
||||
#else
|
||||
#define ARITHM_USE_IPP 0
|
||||
|
||||
@@ -1141,7 +1141,7 @@ static bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_sum(Mat &src, Scalar &_res)
|
||||
{
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
int cn = src.channels();
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||
@@ -1203,7 +1203,7 @@ cv::Scalar cv::sum( InputArray _src )
|
||||
#endif
|
||||
|
||||
Mat src = _src.getMat();
|
||||
CV_IPP_RUN(IPP_VERSION_MAJOR >= 7, ipp_sum(src, _res), _res);
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_sum(src, _res), _res);
|
||||
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
SumFunc func = getSumFunc(depth);
|
||||
@@ -1645,7 +1645,7 @@ namespace cv
|
||||
{
|
||||
static bool ipp_meanStdDev(Mat& src, OutputArray _mean, OutputArray _sdv, Mat& mask)
|
||||
{
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
int cn = src.channels();
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||
@@ -1717,7 +1717,7 @@ static bool ipp_meanStdDev(Mat& src, OutputArray _mean, OutputArray _sdv, Mat& m
|
||||
ippiMeanStdDevFuncC1 ippFuncC1 =
|
||||
type == CV_8UC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_8u_C1R :
|
||||
type == CV_16UC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_16u_C1R :
|
||||
#if (IPP_VERSION_X100 >= 801)
|
||||
#if (IPP_VERSION_X100 >= 810)
|
||||
type == CV_32FC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_32f_C1R ://Aug 2013: bug in IPP 7.1, 8.0
|
||||
#endif
|
||||
0;
|
||||
@@ -1761,7 +1761,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8UC1 );
|
||||
|
||||
CV_IPP_RUN(IPP_VERSION_MAJOR >= 7, ipp_meanStdDev(src, _mean, _sdv, mask));
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_meanStdDev(src, _mean, _sdv, mask));
|
||||
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
|
||||
@@ -2217,7 +2217,7 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx, int* maxIdx, Mat &mask)
|
||||
{
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||
@@ -2325,7 +2325,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
||||
ocl_minMaxIdx(_src, minVal, maxVal, minIdx, maxIdx, _mask))
|
||||
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
CV_IPP_RUN(IPP_VERSION_MAJOR >= 7, ipp_minMaxIdx(src, minVal, maxVal, minIdx, maxIdx, mask))
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_minMaxIdx(src, minVal, maxVal, minIdx, maxIdx, mask))
|
||||
|
||||
MinMaxIdxFunc func = getMinmaxTab(depth);
|
||||
CV_Assert( func != 0 );
|
||||
@@ -2658,7 +2658,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
{
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
int cn = src.channels();
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||
@@ -2701,7 +2701,8 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||
#if IPP_DISABLED_BLOCK
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||
ippiMaskNormFuncC3 ippFuncC3 =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8u_C3CMR :
|
||||
@@ -2736,7 +2737,8 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2762,7 +2764,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C1R :
|
||||
#if (IPP_VERSION_X100 >= 801)
|
||||
#if (IPP_VERSION_X100 >= 810)
|
||||
type == CV_16SC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768
|
||||
type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768
|
||||
#endif
|
||||
@@ -2842,7 +2844,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
||||
#endif
|
||||
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
CV_IPP_RUN(IPP_VERSION_MAJOR >= 7, ipp_norm(src, normType, mask, _result), _result);
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_norm(src, normType, mask, _result), _result);
|
||||
|
||||
int depth = src.depth(), cn = src.channels();
|
||||
if( src.isContinuous() && mask.empty() )
|
||||
@@ -3046,7 +3048,7 @@ namespace cv
|
||||
{
|
||||
static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArray _mask, double &result)
|
||||
{
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
||||
|
||||
if( normType & CV_RELATIVE )
|
||||
@@ -3260,7 +3262,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R :
|
||||
#if (IPP_VERSION_X100 >= 801)
|
||||
#if (IPP_VERSION_X100 >= 810)
|
||||
type == CV_16SC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768
|
||||
type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768
|
||||
#endif
|
||||
@@ -3275,7 +3277,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C4R :
|
||||
#if !(IPP_VERSION_X100 == 802 && (!defined(IPP_VERSION_UPDATE) || IPP_VERSION_UPDATE <= 1)) // Oct 2014: Accuracy issue with IPP 8.2 / 8.2.1
|
||||
#if !(IPP_VERSION_X100 == 820 || IPP_VERSION_X100 == 821) // Oct 2014: Accuracy issue with IPP 8.2 / 8.2.1
|
||||
type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C1R :
|
||||
#endif
|
||||
type == CV_16SC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C3R :
|
||||
@@ -3339,7 +3341,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
||||
_result)
|
||||
#endif
|
||||
|
||||
CV_IPP_RUN(IPP_VERSION_MAJOR >= 7, ipp_norm(_src1, _src2, normType, _mask, _result), _result);
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_norm(_src1, _src2, normType, _mask, _result), _result);
|
||||
|
||||
if( normType & CV_RELATIVE )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user