Skip to content

Commit

Permalink
cv::scaleAdd
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Apr 8, 2014
1 parent fd3a6f0 commit c735594
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 29 deletions.
2 changes: 2 additions & 0 deletions cmake/OpenCVFindIPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ macro(ipp_set_variables _LATEST_VERSION)
set(IPPCC "cc") # color conversion
set(IPPCV "cv") # computer vision
set(IPPVM "vm") # vector math
set(IPPM "m") # matrix math

list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPM}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
Expand Down
19 changes: 8 additions & 11 deletions modules/core/src/matmul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2220,19 +2220,16 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray

ScaleAddFunc func = depth == CV_32F ? (ScaleAddFunc)scaleAdd_32f : (ScaleAddFunc)scaleAdd_64f;

if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
if (src1.isContinuous() && src2.isContinuous() && dst.isContinuous())
{
size_t len = src1.total()*cn;
//#ifdef HAVE_IPP
// if (depth == CV_32F)
// {
// IppStatus status = ippmSaxpy_vava_32f((const Ipp32f *)src1.data, 1, 0, falpha,
// (const Ipp32f *)src2.data, 1, 0, (Ipp32f *)dst.data, 1, 0, (int)len, 1);
// printf("%s\n", ippGetStatusString(status));
// if (status >= 0)
// return;
// }
//#endif
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
if (depth == CV_32F &&
ippmSaxpy_vava_32f((const Ipp32f *)src1.data, (int)src1.step, sizeof(Ipp32f), falpha,
(const Ipp32f *)src2.data, (int)src2.step, sizeof(Ipp32f),
(Ipp32f *)dst.data, (int)dst.step, sizeof(Ipp32f), len, 1) >= 0)
return;
#endif
func(src1.data, src2.data, dst.data, (int)len, palpha);
return;
}
Expand Down
16 changes: 12 additions & 4 deletions modules/core/src/stat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,10 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
dcn_stddev = (int)stddev.total();
pstddev = (Ipp64f *)stddev.data;
}
for( int k = cn; k < dcn_mean; k++ )
pmean[k] = 0;
for( int k = cn; k < dcn_stddev; k++ )
pstddev[k] = 0;
for( int c = cn; c < dcn_mean; c++ )
pmean[c] = 0;
for( int c = cn; c < dcn_stddev; c++ )
pstddev[c] = 0;
IppiSize sz = { cols, rows };
int type = src.type();
if( !mask.empty() )
Expand Down Expand Up @@ -2114,7 +2114,11 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C3R :
type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C4R :
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C1R :
<<<<<<< HEAD
#if (IPP_VERSION_X100 >= 801)
=======
#if IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
>>>>>>> cv::scaleAdd
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
Expand Down Expand Up @@ -2546,7 +2550,11 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C3R :
type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C4R :
type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R :
<<<<<<< HEAD
#if (IPP_VERSION_X100 >= 801)
=======
#if IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
>>>>>>> cv::scaleAdd
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
Expand Down
10 changes: 7 additions & 3 deletions modules/imgproc/src/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ static ippiReorderFunc ippiSwapChannelsC3RTab[] =
0, (ippiReorderFunc)ippiSwapChannels_32f_C3R, 0, 0
};

#if (IPP_VERSION_X100 >= 801)
#if IPP_VERSION_X100 >= 801
static ippiReorderFunc ippiSwapChannelsC4RTab[] =
{
(ippiReorderFunc)ippiSwapChannels_8u_C4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4R, 0,
Expand Down Expand Up @@ -3254,7 +3254,11 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) )
return;
}
<<<<<<< HEAD
#if (IPP_VERSION_X100 >= 801)
=======
#if IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
>>>>>>> cv::scaleAdd
else if( code == CV_RGBA2BGRA )
{
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) )
Expand Down Expand Up @@ -3315,7 +3319,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
CV_Assert( scn == 3 || scn == 4 );
_dst.create(sz, CV_MAKETYPE(depth, 1));
dst = _dst.getMat();
/**/

#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
/*
if( code == CV_BGR2GRAY )
Expand All @@ -3341,7 +3345,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
return;
}
#endif
/**/

bidx = code == CV_BGR2GRAY || code == CV_BGRA2GRAY ? 0 : 2;

if( depth == CV_8U )
Expand Down
15 changes: 5 additions & 10 deletions modules/imgproc/src/imgwarp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4015,7 +4015,7 @@ class WarpAffineInvoker :


/*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
class IPPWarpAffineInvoker :
public ParallelLoopBody
{
Expand Down Expand Up @@ -4045,15 +4045,10 @@ class IPPWarpAffineInvoker :
}
}

////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
// Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
IppStatus status = func( src.data, srcsize, (int)src.step[0], srcroi, dst.data,
(int)dst.step[0], dstroi, coeffs, mode );
<<<<<<< HEAD
printf("%d\n", status);
if( status != ippStsNoErr)
=======
if( status < 0)
>>>>>>> cv::blur
*ok = false;
}
private:
Expand Down Expand Up @@ -4220,7 +4215,7 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
const int AB_SCALE = 1 << AB_BITS;

/*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
( cn == 1 || cn == 3 || cn == 4 ) &&
Expand Down Expand Up @@ -4386,7 +4381,7 @@ class WarpPerspectiveInvoker :
};

/*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
class IPPWarpPerspectiveInvoker :
public ParallelLoopBody
{
Expand Down Expand Up @@ -4469,7 +4464,7 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
#endif

/*
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
(cn == 1 || cn == 3 || cn == 4) &&
Expand Down
4 changes: 4 additions & 0 deletions modules/imgproc/src/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,11 @@ class MorphologyRunner : public ParallelLoopBody
Scalar borderValue;
};

<<<<<<< HEAD
#if IPP_VERSION_X100 >= 801
=======
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 10 + IPP_VERSION_MINOR >= 81
>>>>>>> cv::scaleAdd
static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kernel,
const Size& ksize, const Point &anchor, bool rectKernel)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/imgproc/src/smooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
_dst.create( src0.size(), src0.type() );
Mat dst = _dst.getMat();

#ifdef HAVE_IPP
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
do \
{ \
Expand Down

0 comments on commit c735594

Please sign in to comment.