Skip to content

Commit

Permalink
icv: enable functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Apr 29, 2014
1 parent 5658ba0 commit b62e59a
Show file tree
Hide file tree
Showing 22 changed files with 78 additions and 100 deletions.
2 changes: 1 addition & 1 deletion modules/calib3d/src/stereosgbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi

int newVal = cvRound(_newval), maxDiff = cvRound(_maxDiff);

#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 >= 801
Ipp32s bufsize = 0;
IppiSize roisize = { img.cols, img.rows };
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s;
Expand Down
12 changes: 6 additions & 6 deletions modules/core/src/arithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions modules/core/src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*) \
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions modules/core/src/copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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*) \
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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())) &&
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions modules/core/src/dxt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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*);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -2098,6 +2099,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
setIppErrorStatus();
}
}
}
#endif

if( !real_transform )
Expand Down
16 changes: 8 additions & 8 deletions modules/core/src/mathfuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 ?
Expand Down
14 changes: 7 additions & 7 deletions modules/core/src/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand All @@ -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) \
{ \
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions modules/core/src/stat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions modules/imgproc/src/accum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit b62e59a

Please sign in to comment.