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

@@ -705,7 +705,7 @@ static void max64f( const double* src1, size_t step1,
const double* src2, size_t step2,
double* dst, size_t step, Size sz, void* )
{
#if ARITHM_USE_IPP == 1 && !defined HAVE_IPP_ICV_ONLY
#if ARITHM_USE_IPP == 1
double* s1 = (double*)src1;
double* s2 = (double*)src2;
double* d = dst;
@@ -826,7 +826,7 @@ static void min64f( const double* src1, size_t step1,
const double* src2, size_t step2,
double* dst, size_t step, Size sz, void* )
{
#if ARITHM_USE_IPP == 1 && !defined HAVE_IPP_ICV_ONLY
#if ARITHM_USE_IPP == 1
double* s1 = (double*)src1;
double* s2 = (double*)src2;
double* d = dst;
@@ -2014,7 +2014,7 @@ static void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t st
uchar* dst, size_t step, Size sz, void* scale)
{
float fscale = (float)*(const double*)scale;
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (std::fabs(fscale - 1) <= FLT_EPSILON)
{
if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
@@ -2035,7 +2035,7 @@ static void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t
ushort* dst, size_t step, Size sz, void* scale)
{
float fscale = (float)*(const double*)scale;
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (std::fabs(fscale - 1) <= FLT_EPSILON)
{
if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
@@ -2050,7 +2050,7 @@ static void mul16s( const short* src1, size_t step1, const short* src2, size_t s
short* dst, size_t step, Size sz, void* scale)
{
float fscale = (float)*(const double*)scale;
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (std::fabs(fscale - 1) <= FLT_EPSILON)
{
if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
@@ -2071,7 +2071,7 @@ static void mul32f( const float* src1, size_t step1, const float* src2, size_t s
float* dst, size_t step, Size sz, void* scale)
{
float fscale = (float)*(const double*)scale;
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (std::fabs(fscale - 1) <= FLT_EPSILON)
{
if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)

View File

@@ -1079,7 +1079,7 @@ dtype* dst, size_t dstep, Size size, double* scale) \
cvtScale_(src, sstep, dst, dstep, size, (wtype)scale[0], (wtype)scale[1]); \
}
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
#define DEF_CVT_FUNC_F(suffix, stype, dtype, ippFavor) \
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
dtype* dst, size_t dstep, Size size, double*) \
@@ -1564,7 +1564,7 @@ static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
#endif
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
namespace ipp {
#if 0 // there are no performance benefits (PR #2653)
@@ -1781,7 +1781,7 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
{
bool ok = false;
Ptr<ParallelLoopBody> body;
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
#if 0 // there are no performance benefits (PR #2653)
if (lutcn == 1)

View File

@@ -81,7 +81,7 @@ copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, ucha
template<> void
copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size)
{
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
return;
setIppErrorStatus();
@@ -117,7 +117,7 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
template<> void
copyMask_<ushort>(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size)
{
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
return;
setIppErrorStatus();
@@ -177,7 +177,7 @@ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask,
copyMask_<type>(src, sstep, mask, mstep, dst, dstep, size); \
}
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
#define DEF_COPY_MASK_F(suffix, type, ippfavor, ipptype) \
static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \
uchar* dst, size_t dstep, Size size, void*) \
@@ -281,7 +281,7 @@ void Mat::copyTo( OutputArray _dst ) const
Size sz = getContinuousSize(*this, dst);
size_t len = sz.width*elemSize();
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0)
return;
setIppErrorStatus();
@@ -419,7 +419,7 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
CV_Assert( checkScalar(value, type(), _value.kind(), _InputArray::MAT ));
CV_Assert( mask.empty() || (mask.type() == CV_8U && size == mask.size) );
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
int cn = channels(), depth0 = depth();
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) &&
@@ -681,7 +681,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
Mat dst = _dst.getMat();
size_t esz = CV_ELEM_SIZE(type);
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip);
typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip);
ippiMirror ippFunc = 0;

View File

@@ -53,7 +53,7 @@ namespace cv
# pragma warning(disable: 4748)
#endif
#if IPP_VERSION_X100 >= 701 && !defined(HAVE_IPP_ICV_ONLY)
#if IPP_VERSION_X100 >= 701
#define USE_IPP_DFT 1
#else
#undef USE_IPP_DFT
@@ -1478,7 +1478,7 @@ typedef IppStatus (CV_STDCALL* IppDFTInitFunc)(int, int, IppHintAlgorithm, void*
namespace cv
{
#if defined USE_IPP_DFT && !defined HAVE_IPP_ICV_ONLY
#if defined USE_IPP_DFT
typedef IppStatus (CV_STDCALL* ippiDFT_C_Func)(const Ipp32fc*, int, Ipp32fc*, int, const IppiDFTSpec_C_32fc*, Ipp8u*);
typedef IppStatus (CV_STDCALL* ippiDFT_R_Func)(const Ipp32f* , int, Ipp32f* , int, const IppiDFTSpec_R_32f* , Ipp8u*);
@@ -2063,9 +2063,10 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
Mat dst = _dst.getMat();
#if defined USE_IPP_DFT && !defined HAVE_IPP_ICV_ONLY
#if defined USE_IPP_DFT
if ((src.depth() == CV_32F) && (src.total()>(int)(1<<6)) && nonzero_rows == 0)
{
if ((flags & DFT_ROWS) == 0)
{
if (!real_transform)
@@ -2098,6 +2099,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
setIppErrorStatus();
}
}
}
#endif
if( !real_transform )

View File

@@ -237,7 +237,7 @@ float cubeRoot( float value )
static void Magnitude_32f(const float* x, const float* y, float* mag, int len)
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
IppStatus status = ippsMagnitude_32f(x, y, mag, len);
if (status >= 0)
return;
@@ -270,7 +270,7 @@ static void Magnitude_32f(const float* x, const float* y, float* mag, int len)
static void Magnitude_64f(const double* x, const double* y, double* mag, int len)
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
IppStatus status = ippsMagnitude_64f(x, y, mag, len);
if (status >= 0)
return;
@@ -304,7 +304,7 @@ static void Magnitude_64f(const double* x, const double* y, double* mag, int len
static void InvSqrt_32f(const float* src, float* dst, int len)
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (ippsInvSqrt_32f_A21(src, dst, len) >= 0)
return;
setIppErrorStatus();
@@ -353,7 +353,7 @@ static void InvSqrt_64f(const double* src, double* dst, int len)
static void Sqrt_32f(const float* src, float* dst, int len)
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (ippsSqrt_32f_A21(src, dst, len) >= 0)
return;
setIppErrorStatus();
@@ -387,7 +387,7 @@ static void Sqrt_32f(const float* src, float* dst, int len)
static void Sqrt_64f(const double* src, double* dst, int len)
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (ippsSqrt_64f_A50(src, dst, len) >= 0)
return;
setIppErrorStatus();
@@ -759,7 +759,7 @@ void polarToCart( InputArray src1, InputArray src2,
dst2.create( Angle.dims, Angle.size, type );
Mat X = dst1.getMat(), Y = dst2.getMat();
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees)
{
typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
@@ -2170,7 +2170,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
_src.copyTo(_dst);
return;
case 2:
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) || (_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) ))
{
Mat src = _src.getMat();
@@ -2243,7 +2243,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
}
else
{
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
#if defined(HAVE_IPP)
if (src.isContinuous() && dst.isContinuous())
{
IppStatus status = depth == CV_32F ?

View File

@@ -3019,7 +3019,7 @@ void cv::transpose( InputArray _src, OutputArray _dst )
return;
}
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP
typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize);
typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize);
ippiTranspose ippFunc = 0;
@@ -3268,7 +3268,7 @@ typedef void (*ReduceFunc)( const Mat& src, Mat& dst );
#define reduceMinR32f reduceR_<float, float, OpMin<float> >
#define reduceMinR64f reduceR_<double,double,OpMin<double> >
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 > 0
static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& dstmat)
{
@@ -3342,7 +3342,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
#define reduceSumC32f32f reduceC_<float, float, OpAdd<float> >
#define reduceSumC64f64f reduceC_<double,double,OpAdd<double> >
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 > 0
#define reduceSumC8u64f reduceSumC_8u16u16s32f_64f
#define reduceSumC16u64f reduceSumC_8u16u16s32f_64f
#define reduceSumC16s64f reduceSumC_8u16u16s32f_64f
@@ -3354,7 +3354,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
#define reduceSumC32f64f reduceC_<float, double,OpAdd<double> >
#endif
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 > 0
#define REDUCE_OP(favor, optype, type1, type2) \
static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstmat) \
{ \
@@ -3378,7 +3378,7 @@ static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstm
}
#endif
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 > 0
REDUCE_OP(8u, Max, uchar, uchar)
REDUCE_OP(16u, Max, ushort, ushort)
REDUCE_OP(16s, Max, short, short)
@@ -3391,7 +3391,7 @@ REDUCE_OP(32f, Max, float, float)
#endif
#define reduceMaxC64f reduceC_<double,double,OpMax<double> >
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 > 0
REDUCE_OP(8u, Min, uchar, uchar)
REDUCE_OP(16u, Min, ushort, ushort)
REDUCE_OP(16s, Min, short, short)
@@ -3614,7 +3614,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
namespace cv
{
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 > 0
#define USE_IPP_SORT
typedef IppStatus (CV_STDCALL *IppSortFunc)(void *, int);

View File

@@ -1383,9 +1383,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
CV_SUPPRESS_DEPRECATED_START
ippiMaskMinMaxIndxFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1MR :
#ifndef HAVE_IPP_ICV_ONLY
type == CV_8SC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1MR :
#endif
type == CV_16UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1MR :
type == CV_32FC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1MR : 0;
CV_SUPPRESS_DEPRECATED_END
@@ -1424,9 +1422,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
CV_SUPPRESS_DEPRECATED_START
ippiMinMaxIndxFuncC1 ippFuncC1 =
depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R :
#ifndef HAVE_IPP_ICV_ONLY
depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R :
#endif
depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R :
depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : 0;
CV_SUPPRESS_DEPRECATED_END