mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #7141 from lupustr3:pvlasov/instrumentation_extension
This commit is contained in:
@@ -1096,11 +1096,6 @@ enum
|
||||
FLAGS_MAPPING = 0x01,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COMMAND_RESET = 0x01,
|
||||
};
|
||||
|
||||
class CV_EXPORTS NodeData
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -369,58 +369,78 @@ static BinaryFuncC* getMinTab()
|
||||
|
||||
void cv::bitwise_and(InputArray a, InputArray b, OutputArray c, InputArray mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::and8u);
|
||||
binary_op(a, b, c, mask, &f, true, OCL_OP_AND);
|
||||
}
|
||||
|
||||
void cv::bitwise_or(InputArray a, InputArray b, OutputArray c, InputArray mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::or8u);
|
||||
binary_op(a, b, c, mask, &f, true, OCL_OP_OR);
|
||||
}
|
||||
|
||||
void cv::bitwise_xor(InputArray a, InputArray b, OutputArray c, InputArray mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::xor8u);
|
||||
binary_op(a, b, c, mask, &f, true, OCL_OP_XOR);
|
||||
}
|
||||
|
||||
void cv::bitwise_not(InputArray a, OutputArray c, InputArray mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::not8u);
|
||||
binary_op(a, a, c, mask, &f, true, OCL_OP_NOT);
|
||||
}
|
||||
|
||||
void cv::max( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
binary_op(src1, src2, dst, noArray(), getMaxTab(), false, OCL_OP_MAX );
|
||||
}
|
||||
|
||||
void cv::min( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
binary_op(src1, src2, dst, noArray(), getMinTab(), false, OCL_OP_MIN );
|
||||
}
|
||||
|
||||
void cv::max(const Mat& src1, const Mat& src2, Mat& dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), getMaxTab(), false, OCL_OP_MAX );
|
||||
}
|
||||
|
||||
void cv::min(const Mat& src1, const Mat& src2, Mat& dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), getMinTab(), false, OCL_OP_MIN );
|
||||
}
|
||||
|
||||
void cv::max(const UMat& src1, const UMat& src2, UMat& dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), getMaxTab(), false, OCL_OP_MAX );
|
||||
}
|
||||
|
||||
void cv::min(const UMat& src1, const UMat& src2, UMat& dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), getMinTab(), false, OCL_OP_MIN );
|
||||
}
|
||||
@@ -901,12 +921,16 @@ static BinaryFuncC* getAbsDiffTab()
|
||||
void cv::add( InputArray src1, InputArray src2, OutputArray dst,
|
||||
InputArray mask, int dtype )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
arithm_op(src1, src2, dst, mask, dtype, getAddTab(), false, 0, OCL_OP_ADD );
|
||||
}
|
||||
|
||||
void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
InputArray mask, int dtype )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||
if (tegra::useTegra())
|
||||
{
|
||||
@@ -965,6 +989,8 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
|
||||
void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
arithm_op(src1, src2, dst, noArray(), -1, getAbsDiffTab(), false, 0, OCL_OP_ABSDIFF);
|
||||
}
|
||||
|
||||
@@ -1016,6 +1042,8 @@ static BinaryFuncC* getRecipTab()
|
||||
void cv::multiply(InputArray src1, InputArray src2,
|
||||
OutputArray dst, double scale, int dtype)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getMulTab(),
|
||||
true, &scale, std::abs(scale - 1.0) < DBL_EPSILON ? OCL_OP_MUL : OCL_OP_MUL_SCALE);
|
||||
}
|
||||
@@ -1023,12 +1051,16 @@ void cv::multiply(InputArray src1, InputArray src2,
|
||||
void cv::divide(InputArray src1, InputArray src2,
|
||||
OutputArray dst, double scale, int dtype)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getDivTab(), true, &scale, OCL_OP_DIV_SCALE);
|
||||
}
|
||||
|
||||
void cv::divide(double scale, InputArray src2,
|
||||
OutputArray dst, int dtype)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
arithm_op(src2, src2, dst, noArray(), dtype, getRecipTab(), true, &scale, OCL_OP_RECIP_SCALE);
|
||||
}
|
||||
|
||||
@@ -1056,6 +1088,8 @@ static BinaryFuncC* getAddWeightedTab()
|
||||
void cv::addWeighted( InputArray src1, double alpha, InputArray src2,
|
||||
double beta, double gamma, OutputArray dst, int dtype )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
double scalars[] = {alpha, beta, gamma};
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getAddWeightedTab(), true, scalars, OCL_OP_ADDW);
|
||||
}
|
||||
@@ -1194,6 +1228,8 @@ static bool ocl_compare(InputArray _src1, InputArray _src2, OutputArray _dst, in
|
||||
|
||||
void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( op == CMP_LT || op == CMP_LE || op == CMP_EQ ||
|
||||
op == CMP_NE || op == CMP_GE || op == CMP_GT );
|
||||
|
||||
@@ -1889,6 +1925,8 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb,
|
||||
void cv::inRange(InputArray _src, InputArray _lowerb,
|
||||
InputArray _upperb, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(_src.dims() <= 2 && _lowerb.dims() <= 2 &&
|
||||
_upperb.dims() <= 2 && OCL_PERFORMANCE_CHECK(_dst.isUMat()),
|
||||
ocl_inRange(_src, _lowerb, _upperb, _dst))
|
||||
@@ -2274,7 +2312,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step
|
||||
CV_IPP_CHECK() \
|
||||
{ \
|
||||
fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \
|
||||
if (0 <= fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0)) \
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0)) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -2286,7 +2324,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step
|
||||
CV_IPP_CHECK() \
|
||||
{ \
|
||||
fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \
|
||||
if (0 <= fun(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height), 0)) \
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height), 0)) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -2298,7 +2336,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step
|
||||
CV_IPP_CHECK() \
|
||||
{ \
|
||||
fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \
|
||||
if (0 <= fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height))) \
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height))) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -2310,7 +2348,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step
|
||||
CV_IPP_CHECK() \
|
||||
{ \
|
||||
fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \
|
||||
if (0 <= fun(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height))) \
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height))) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -2467,7 +2505,7 @@ void sub64f( const double* src1, size_t step1,
|
||||
int i = 0; \
|
||||
for(; i < height; i++) \
|
||||
{ \
|
||||
if (0 > fun(s1, s2, d, width)) \
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(fun, s1, s2, d, width)) \
|
||||
break; \
|
||||
s1 = (type*)((uchar*)s1 + step1); \
|
||||
s2 = (type*)((uchar*)s2 + step2); \
|
||||
@@ -2684,7 +2722,7 @@ void absdiff64f( const double* src1, size_t step1,
|
||||
CV_IPP_CHECK() \
|
||||
{ \
|
||||
fixSteps(width, height, sizeof(dst[0]), step1, step2, step); (void)src2; \
|
||||
if (0 <= fun(src1, (int)step1, dst, (int)step, ippiSize(width, height))) \
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, dst, (int)step, ippiSize(width, height))) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -2750,7 +2788,7 @@ inline static IppCmpOp convert_cmp(int _cmpop)
|
||||
if( op >= 0 ) \
|
||||
{ \
|
||||
fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \
|
||||
if (0 <= fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), op)) \
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), op)) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -3023,7 +3061,7 @@ void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2,
|
||||
{ \
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON) \
|
||||
{ \
|
||||
if (fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0) >= 0) \
|
||||
if (CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0) >= 0) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
@@ -3037,7 +3075,7 @@ void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2,
|
||||
{ \
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON) \
|
||||
{ \
|
||||
if (fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height)) >= 0) \
|
||||
if (CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height)) >= 0) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return; \
|
||||
|
||||
@@ -84,6 +84,8 @@ static MergeFunc getMergeFunc(int depth)
|
||||
|
||||
void cv::split(const Mat& src, Mat* mv)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int k, depth = src.depth(), cn = src.channels();
|
||||
if( cn == 1 )
|
||||
{
|
||||
@@ -176,6 +178,8 @@ static bool ocl_split( InputArray _m, OutputArrayOfArrays _mv )
|
||||
|
||||
void cv::split(InputArray _m, OutputArrayOfArrays _mv)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(_m.dims() <= 2 && _mv.isUMatVector(),
|
||||
ocl_split(_m, _mv))
|
||||
|
||||
@@ -201,6 +205,8 @@ void cv::split(InputArray _m, OutputArrayOfArrays _mv)
|
||||
|
||||
void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( mv && n > 0 );
|
||||
|
||||
int depth = mv[0].depth();
|
||||
@@ -345,6 +351,8 @@ static bool ocl_merge( InputArrayOfArrays _mv, OutputArray _dst )
|
||||
|
||||
void cv::merge(InputArrayOfArrays _mv, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(_mv.isUMatVector() && _dst.isUMat(),
|
||||
ocl_merge(_mv, _dst))
|
||||
|
||||
@@ -439,6 +447,8 @@ static MixChannelsFunc getMixchFunc(int depth)
|
||||
|
||||
void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, const int* fromTo, size_t npairs )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( npairs == 0 )
|
||||
return;
|
||||
CV_Assert( src && nsrcs > 0 && dst && ndsts > 0 && fromTo && npairs > 0 );
|
||||
@@ -615,6 +625,8 @@ static bool ocl_mixChannels(InputArrayOfArrays _src, InputOutputArrayOfArrays _d
|
||||
void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
|
||||
const int* fromTo, size_t npairs)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if (npairs == 0 || fromTo == NULL)
|
||||
return;
|
||||
|
||||
@@ -644,6 +656,8 @@ void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
|
||||
void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
|
||||
const std::vector<int>& fromTo)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if (fromTo.empty())
|
||||
return;
|
||||
|
||||
@@ -672,6 +686,8 @@ void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
|
||||
|
||||
void cv::extractChannel(InputArray _src, OutputArray _dst, int coi)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
CV_Assert( 0 <= coi && coi < cn );
|
||||
int ch[] = { coi, 0 };
|
||||
@@ -693,6 +709,8 @@ void cv::extractChannel(InputArray _src, OutputArray _dst, int coi)
|
||||
|
||||
void cv::insertChannel(InputArray _src, InputOutputArray _dst, int coi)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype);
|
||||
int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype), dcn = CV_MAT_CN(dtype);
|
||||
CV_Assert( _src.sameSize(_dst) && sdepth == ddepth );
|
||||
@@ -4777,7 +4795,7 @@ dtype* dst, size_t dstep, Size size, double* scale) \
|
||||
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||
dtype* dst, size_t dstep, Size size, double*) \
|
||||
{ \
|
||||
CV_IPP_RUN(src && dst, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0)\
|
||||
CV_IPP_RUN(src && dst, CV_INSTRUMENT_FUN_IPP(ippiConvert_##ippFavor, src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \
|
||||
cvt_(src, sstep, dst, dstep, size); \
|
||||
}
|
||||
|
||||
@@ -4785,7 +4803,7 @@ static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||
dtype* dst, size_t dstep, Size size, double*) \
|
||||
{ \
|
||||
CV_IPP_RUN(src && dst, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0)\
|
||||
CV_IPP_RUN(src && dst, CV_INSTRUMENT_FUN_IPP(ippiConvert_##ippFavor, src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \
|
||||
cvt_(src, sstep, dst, dstep, size); \
|
||||
}
|
||||
#else
|
||||
@@ -5112,6 +5130,8 @@ static bool ocl_convertScaleAbs( InputArray _src, OutputArray _dst, double alpha
|
||||
|
||||
void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, double beta )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(),
|
||||
ocl_convertScaleAbs(_src, _dst, alpha, beta))
|
||||
|
||||
@@ -5142,6 +5162,8 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl
|
||||
|
||||
void cv::convertFp16( InputArray _src, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat();
|
||||
int ddepth = 0;
|
||||
|
||||
@@ -5184,6 +5206,8 @@ void cv::convertFp16( InputArray _src, OutputArray _dst)
|
||||
|
||||
void cv::Mat::convertTo(OutputArray _dst, int _type, double alpha, double beta) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool noScale = fabs(alpha-1) < DBL_EPSILON && fabs(beta) < DBL_EPSILON;
|
||||
|
||||
if( _type < 0 )
|
||||
@@ -5408,7 +5432,7 @@ public:
|
||||
CV_DbgAssert(lutcn == 3 || lutcn == 4);
|
||||
if (lutcn == 3)
|
||||
{
|
||||
IppStatus status = ippiCopy_8u_C3P3R(lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
|
||||
IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C3P3R, lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
|
||||
if (status < 0)
|
||||
{
|
||||
setIppErrorStatus();
|
||||
@@ -5418,7 +5442,7 @@ public:
|
||||
}
|
||||
else if (lutcn == 4)
|
||||
{
|
||||
IppStatus status = ippiCopy_8u_C4P4R(lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
|
||||
IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C4P4R, lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
|
||||
if (status < 0)
|
||||
{
|
||||
setIppErrorStatus();
|
||||
@@ -5451,7 +5475,7 @@ public:
|
||||
|
||||
if (lutcn == 3)
|
||||
{
|
||||
if (ippiLUTPalette_8u_C3R(
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiLUTPalette_8u_C3R,
|
||||
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
|
||||
ippiSize(dst.size()), lutTable, 8) >= 0)
|
||||
{
|
||||
@@ -5461,7 +5485,7 @@ public:
|
||||
}
|
||||
else if (lutcn == 4)
|
||||
{
|
||||
if (ippiLUTPalette_8u_C4R(
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiLUTPalette_8u_C4R,
|
||||
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
|
||||
ippiSize(dst.size()), lutTable, 8) >= 0)
|
||||
{
|
||||
@@ -5480,6 +5504,8 @@ private:
|
||||
|
||||
static bool ipp_lut(Mat &src, Mat &lut, Mat &dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
int lutcn = lut.channels();
|
||||
|
||||
if(src.dims > 2)
|
||||
@@ -5565,6 +5591,8 @@ private:
|
||||
|
||||
void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int cn = _src.channels(), depth = _src.depth();
|
||||
int lutcn = _lut.channels();
|
||||
|
||||
@@ -5712,6 +5740,8 @@ static bool ocl_normalize( InputArray _src, InputOutputArray _dst, InputArray _m
|
||||
void cv::normalize( InputArray _src, InputOutputArray _dst, double a, double b,
|
||||
int norm_type, int rtype, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
double scale = 1, shift = 0;
|
||||
if( norm_type == CV_MINMAX )
|
||||
{
|
||||
|
||||
+71
-51
@@ -82,7 +82,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)
|
||||
{
|
||||
CV_IPP_RUN(true, ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C1MR, _src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||
|
||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||
{
|
||||
@@ -122,7 +122,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)
|
||||
{
|
||||
CV_IPP_RUN(true, ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippiCopy_16u_C1MR, (const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||
|
||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||
{
|
||||
@@ -194,7 +194,7 @@ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask,
|
||||
static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \
|
||||
uchar* dst, size_t dstep, Size size, void*) \
|
||||
{ \
|
||||
CV_IPP_RUN(true, ippiCopy_##ippfavor((const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0)\
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippiCopy_##ippfavor, (const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0)\
|
||||
copyMask_<type>(src, sstep, mask, mstep, dst, dstep, size); \
|
||||
}
|
||||
#else
|
||||
@@ -251,6 +251,8 @@ BinaryFunc getCopyMaskFunc(size_t esz)
|
||||
/* dst = src */
|
||||
void Mat::copyTo( OutputArray _dst ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int dtype = _dst.type();
|
||||
if( _dst.fixedType() && dtype != type() )
|
||||
{
|
||||
@@ -296,7 +298,7 @@ void Mat::copyTo( OutputArray _dst ) const
|
||||
(size_t)step <= (size_t)INT_MAX &&
|
||||
(size_t)dst.step <= (size_t)INT_MAX
|
||||
,
|
||||
ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)(cols*elemSize()), rows)) >= 0
|
||||
CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C1R, sptr, (int)step, dptr, (int)dst.step, ippiSize((int)(cols*elemSize()), rows)) >= 0
|
||||
)
|
||||
|
||||
Size sz = getContinuousSize(*this, dst);
|
||||
@@ -327,6 +329,8 @@ void Mat::copyTo( OutputArray _dst ) const
|
||||
|
||||
void Mat::copyTo( OutputArray _dst, InputArray _mask ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat mask = _mask.getMat();
|
||||
if( !mask.data )
|
||||
{
|
||||
@@ -367,6 +371,8 @@ void Mat::copyTo( OutputArray _dst, InputArray _mask ) const
|
||||
|
||||
Mat& Mat::operator = (const Scalar& s)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
const Mat* arrays[] = { this };
|
||||
uchar* dptr;
|
||||
NAryMatIterator it(arrays, &dptr, 1);
|
||||
@@ -435,6 +441,8 @@ Mat& Mat::operator = (const Scalar& s)
|
||||
#if defined HAVE_IPP
|
||||
static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
int cn = src->channels(), depth0 = src->depth();
|
||||
|
||||
if (!mask.empty() && (src->dims <= 2 || (src->isContinuous() && mask.isContinuous())) &&
|
||||
@@ -460,13 +468,13 @@ static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask)
|
||||
/*if (depth0 == CV_8U)
|
||||
status = ippiSet_8u_C1MR(*(Ipp8u *)buf, (Ipp8u *)data, dstep, roisize, mask.data, mstep);
|
||||
else*/ if (depth0 == CV_16U)
|
||||
status = ippiSet_16u_C1MR(*(Ipp16u *)buf, (Ipp16u *)src->data, dstep, roisize, mask.data, mstep);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiSet_16u_C1MR, *(Ipp16u *)buf, (Ipp16u *)src->data, dstep, roisize, mask.data, mstep);
|
||||
else if (depth0 == CV_16S)
|
||||
status = ippiSet_16s_C1MR(*(Ipp16s *)buf, (Ipp16s *)src->data, dstep, roisize, mask.data, mstep);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiSet_16s_C1MR, *(Ipp16s *)buf, (Ipp16s *)src->data, dstep, roisize, mask.data, mstep);
|
||||
else if (depth0 == CV_32S)
|
||||
status = ippiSet_32s_C1MR(*(Ipp32s *)buf, (Ipp32s *)src->data, dstep, roisize, mask.data, mstep);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiSet_32s_C1MR, *(Ipp32s *)buf, (Ipp32s *)src->data, dstep, roisize, mask.data, mstep);
|
||||
else if (depth0 == CV_32F)
|
||||
status = ippiSet_32f_C1MR(*(Ipp32f *)buf, (Ipp32f *)src->data, dstep, roisize, mask.data, mstep);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiSet_32f_C1MR, *(Ipp32f *)buf, (Ipp32f *)src->data, dstep, roisize, mask.data, mstep);
|
||||
}
|
||||
else if (cn == 3 || cn == 4)
|
||||
{
|
||||
@@ -476,7 +484,7 @@ static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask)
|
||||
{ \
|
||||
typedef Ipp##ippfavor ipptype; \
|
||||
ipptype ippvalue[4] = { ((ipptype *)buf)[0], ((ipptype *)buf)[1], ((ipptype *)buf)[2], ((ipptype *)buf)[3] }; \
|
||||
status = ippiSet_##ippfavor##_C##ippcn##MR(ippvalue, (ipptype *)src->data, dstep, roisize, mask.data, mstep); \
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiSet_##ippfavor##_C##ippcn##MR, ippvalue, (ipptype *)src->data, dstep, roisize, mask.data, mstep); \
|
||||
} while ((void)0, 0)
|
||||
|
||||
#define IPP_SET_CN(ippcn) \
|
||||
@@ -515,6 +523,8 @@ static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask)
|
||||
|
||||
Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( empty() )
|
||||
return *this;
|
||||
|
||||
@@ -523,7 +533,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) );
|
||||
|
||||
CV_IPP_RUN(true, ipp_Mat_setTo((cv::Mat*)this, value, mask), *this)
|
||||
CV_IPP_RUN_FAST(ipp_Mat_setTo((cv::Mat*)this, value, mask), *this)
|
||||
|
||||
size_t esz = elemSize();
|
||||
BinaryFunc copymask = getCopyMaskFunc(esz);
|
||||
@@ -700,65 +710,67 @@ static bool ocl_flip(InputArray _src, OutputArray _dst, int flipCode )
|
||||
#if defined HAVE_IPP
|
||||
static bool ipp_flip( Mat &src, Mat &dst, int flip_mode )
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
int type = src.type();
|
||||
|
||||
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;
|
||||
ippiMirrorI ippFuncI = 0;
|
||||
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 ippiMirror = 0;
|
||||
IppiMirrorI ippiMirror_I = 0;
|
||||
|
||||
if (src.data == dst.data)
|
||||
{
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
ippFuncI =
|
||||
type == CV_8UC1 ? (ippiMirrorI)ippiMirror_8u_C1IR :
|
||||
type == CV_8UC3 ? (ippiMirrorI)ippiMirror_8u_C3IR :
|
||||
type == CV_8UC4 ? (ippiMirrorI)ippiMirror_8u_C4IR :
|
||||
type == CV_16UC1 ? (ippiMirrorI)ippiMirror_16u_C1IR :
|
||||
type == CV_16UC3 ? (ippiMirrorI)ippiMirror_16u_C3IR :
|
||||
type == CV_16UC4 ? (ippiMirrorI)ippiMirror_16u_C4IR :
|
||||
type == CV_16SC1 ? (ippiMirrorI)ippiMirror_16s_C1IR :
|
||||
type == CV_16SC3 ? (ippiMirrorI)ippiMirror_16s_C3IR :
|
||||
type == CV_16SC4 ? (ippiMirrorI)ippiMirror_16s_C4IR :
|
||||
type == CV_32SC1 ? (ippiMirrorI)ippiMirror_32s_C1IR :
|
||||
type == CV_32SC3 ? (ippiMirrorI)ippiMirror_32s_C3IR :
|
||||
type == CV_32SC4 ? (ippiMirrorI)ippiMirror_32s_C4IR :
|
||||
type == CV_32FC1 ? (ippiMirrorI)ippiMirror_32f_C1IR :
|
||||
type == CV_32FC3 ? (ippiMirrorI)ippiMirror_32f_C3IR :
|
||||
type == CV_32FC4 ? (ippiMirrorI)ippiMirror_32f_C4IR : 0;
|
||||
ippiMirror_I =
|
||||
type == CV_8UC1 ? (IppiMirrorI)ippiMirror_8u_C1IR :
|
||||
type == CV_8UC3 ? (IppiMirrorI)ippiMirror_8u_C3IR :
|
||||
type == CV_8UC4 ? (IppiMirrorI)ippiMirror_8u_C4IR :
|
||||
type == CV_16UC1 ? (IppiMirrorI)ippiMirror_16u_C1IR :
|
||||
type == CV_16UC3 ? (IppiMirrorI)ippiMirror_16u_C3IR :
|
||||
type == CV_16UC4 ? (IppiMirrorI)ippiMirror_16u_C4IR :
|
||||
type == CV_16SC1 ? (IppiMirrorI)ippiMirror_16s_C1IR :
|
||||
type == CV_16SC3 ? (IppiMirrorI)ippiMirror_16s_C3IR :
|
||||
type == CV_16SC4 ? (IppiMirrorI)ippiMirror_16s_C4IR :
|
||||
type == CV_32SC1 ? (IppiMirrorI)ippiMirror_32s_C1IR :
|
||||
type == CV_32SC3 ? (IppiMirrorI)ippiMirror_32s_C3IR :
|
||||
type == CV_32SC4 ? (IppiMirrorI)ippiMirror_32s_C4IR :
|
||||
type == CV_32FC1 ? (IppiMirrorI)ippiMirror_32f_C1IR :
|
||||
type == CV_32FC3 ? (IppiMirrorI)ippiMirror_32f_C3IR :
|
||||
type == CV_32FC4 ? (IppiMirrorI)ippiMirror_32f_C4IR : 0;
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
else
|
||||
{
|
||||
ippFunc =
|
||||
type == CV_8UC1 ? (ippiMirror)ippiMirror_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiMirror)ippiMirror_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiMirror)ippiMirror_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiMirror)ippiMirror_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiMirror)ippiMirror_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiMirror)ippiMirror_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiMirror)ippiMirror_16s_C1R :
|
||||
type == CV_16SC3 ? (ippiMirror)ippiMirror_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiMirror)ippiMirror_16s_C4R :
|
||||
type == CV_32SC1 ? (ippiMirror)ippiMirror_32s_C1R :
|
||||
type == CV_32SC3 ? (ippiMirror)ippiMirror_32s_C3R :
|
||||
type == CV_32SC4 ? (ippiMirror)ippiMirror_32s_C4R :
|
||||
type == CV_32FC1 ? (ippiMirror)ippiMirror_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiMirror)ippiMirror_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiMirror)ippiMirror_32f_C4R : 0;
|
||||
ippiMirror =
|
||||
type == CV_8UC1 ? (IppiMirror)ippiMirror_8u_C1R :
|
||||
type == CV_8UC3 ? (IppiMirror)ippiMirror_8u_C3R :
|
||||
type == CV_8UC4 ? (IppiMirror)ippiMirror_8u_C4R :
|
||||
type == CV_16UC1 ? (IppiMirror)ippiMirror_16u_C1R :
|
||||
type == CV_16UC3 ? (IppiMirror)ippiMirror_16u_C3R :
|
||||
type == CV_16UC4 ? (IppiMirror)ippiMirror_16u_C4R :
|
||||
type == CV_16SC1 ? (IppiMirror)ippiMirror_16s_C1R :
|
||||
type == CV_16SC3 ? (IppiMirror)ippiMirror_16s_C3R :
|
||||
type == CV_16SC4 ? (IppiMirror)ippiMirror_16s_C4R :
|
||||
type == CV_32SC1 ? (IppiMirror)ippiMirror_32s_C1R :
|
||||
type == CV_32SC3 ? (IppiMirror)ippiMirror_32s_C3R :
|
||||
type == CV_32SC4 ? (IppiMirror)ippiMirror_32s_C4R :
|
||||
type == CV_32FC1 ? (IppiMirror)ippiMirror_32f_C1R :
|
||||
type == CV_32FC3 ? (IppiMirror)ippiMirror_32f_C3R :
|
||||
type == CV_32FC4 ? (IppiMirror)ippiMirror_32f_C4R : 0;
|
||||
}
|
||||
IppiAxis axis = flip_mode == 0 ? ippAxsHorizontal :
|
||||
flip_mode > 0 ? ippAxsVertical : ippAxsBoth;
|
||||
IppiSize roisize = { dst.cols, dst.rows };
|
||||
|
||||
if (ippFunc != 0)
|
||||
if (ippiMirror != 0)
|
||||
{
|
||||
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0)
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiMirror, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0)
|
||||
return true;
|
||||
}
|
||||
else if (ippFuncI != 0)
|
||||
else if (ippiMirror_I != 0)
|
||||
{
|
||||
if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0)
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiMirror_I, dst.ptr(), (int)dst.step, roisize, axis) >= 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -769,6 +781,8 @@ static bool ipp_flip( Mat &src, Mat &dst, int flip_mode )
|
||||
|
||||
void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _src.dims() <= 2 );
|
||||
Size size = _src.size();
|
||||
|
||||
@@ -794,7 +808,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
||||
_dst.create( size, type );
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
CV_IPP_RUN(true, ipp_flip(src, dst, flip_mode));
|
||||
CV_IPP_RUN_FAST(ipp_flip(src, dst, flip_mode));
|
||||
|
||||
size_t esz = CV_ELEM_SIZE(type);
|
||||
|
||||
@@ -839,6 +853,8 @@ static bool ocl_repeat(InputArray _src, int ny, int nx, OutputArray _dst)
|
||||
|
||||
void repeat(InputArray _src, int ny, int nx, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _src.dims() <= 2 );
|
||||
CV_Assert( ny > 0 && nx > 0 );
|
||||
|
||||
@@ -890,6 +906,8 @@ Mat repeat(const Mat& src, int ny, int nx)
|
||||
*/
|
||||
int cv::borderInterpolate( int p, int len, int borderType )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( (unsigned)p < (unsigned)len )
|
||||
;
|
||||
else if( borderType == BORDER_REPLICATE )
|
||||
@@ -1119,6 +1137,8 @@ static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int
|
||||
void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
|
||||
int left, int right, int borderType, const Scalar& value )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 );
|
||||
|
||||
CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2,
|
||||
|
||||
+44
-22
@@ -469,53 +469,53 @@ template<> struct DFT_VecR4<float>
|
||||
static IppStatus ippsDFTFwd_CToC( const Complex<float>* src, Complex<float>* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst,
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_CToC_32fc, (const Ipp32fc*)src, (Ipp32fc*)dst,
|
||||
(const IppsDFTSpec_C_32fc*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTFwd_CToC( const Complex<double>* src, Complex<double>* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst,
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_CToC_64fc, (const Ipp64fc*)src, (Ipp64fc*)dst,
|
||||
(const IppsDFTSpec_C_64fc*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTInv_CToC( const Complex<float>* src, Complex<float>* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst,
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_CToC_32fc, (const Ipp32fc*)src, (Ipp32fc*)dst,
|
||||
(const IppsDFTSpec_C_32fc*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTInv_CToC( const Complex<double>* src, Complex<double>* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst,
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_CToC_64fc, (const Ipp64fc*)src, (Ipp64fc*)dst,
|
||||
(const IppsDFTSpec_C_64fc*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTFwd_RToPack( const float* src, float* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_RToPack_32f, src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTFwd_RToPack( const double* src, double* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_RToPack_64f, src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTInv_PackToR( const float* src, float* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_PackToR_32f, src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
|
||||
}
|
||||
|
||||
static IppStatus ippsDFTInv_PackToR( const double* src, double* dst,
|
||||
const void* spec, uchar* buf)
|
||||
{
|
||||
return ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
|
||||
return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_PackToR_64f, src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1564,6 +1564,8 @@ public:
|
||||
|
||||
virtual void operator()(const Range& range) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP();
|
||||
|
||||
IppStatus status;
|
||||
Ipp8u* pBuffer = 0;
|
||||
Ipp8u* pMemInit= 0;
|
||||
@@ -1645,6 +1647,8 @@ public:
|
||||
|
||||
virtual void operator()(const Range& range) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP();
|
||||
|
||||
IppStatus status;
|
||||
Ipp8u* pBuffer = 0;
|
||||
Ipp8u* pMemInit= 0;
|
||||
@@ -1728,30 +1732,32 @@ bool Dft_R_IPPLoop(const uchar * src, size_t src_step, uchar * dst, size_t dst_s
|
||||
|
||||
struct IPPDFT_C_Functor
|
||||
{
|
||||
IPPDFT_C_Functor(ippiDFT_C_Func _func) : func(_func){}
|
||||
IPPDFT_C_Functor(ippiDFT_C_Func _func) : ippiDFT_CToC_32fc_C1R(_func){}
|
||||
|
||||
bool operator()(const Ipp32fc* src, size_t srcStep, Ipp32fc* dst, size_t dstStep, const IppiDFTSpec_C_32fc* pDFTSpec, Ipp8u* pBuffer) const
|
||||
{
|
||||
return func ? func(src, static_cast<int>(srcStep), dst, static_cast<int>(dstStep), pDFTSpec, pBuffer) >= 0 : false;
|
||||
return ippiDFT_CToC_32fc_C1R ? CV_INSTRUMENT_FUN_IPP(ippiDFT_CToC_32fc_C1R, src, static_cast<int>(srcStep), dst, static_cast<int>(dstStep), pDFTSpec, pBuffer) >= 0 : false;
|
||||
}
|
||||
private:
|
||||
ippiDFT_C_Func func;
|
||||
ippiDFT_C_Func ippiDFT_CToC_32fc_C1R;
|
||||
};
|
||||
|
||||
struct IPPDFT_R_Functor
|
||||
{
|
||||
IPPDFT_R_Functor(ippiDFT_R_Func _func) : func(_func){}
|
||||
IPPDFT_R_Functor(ippiDFT_R_Func _func) : ippiDFT_PackToR_32f_C1R(_func){}
|
||||
|
||||
bool operator()(const Ipp32f* src, size_t srcStep, Ipp32f* dst, size_t dstStep, const IppiDFTSpec_R_32f* pDFTSpec, Ipp8u* pBuffer) const
|
||||
{
|
||||
return func ? func(src, static_cast<int>(srcStep), dst, static_cast<int>(dstStep), pDFTSpec, pBuffer) >= 0 : false;
|
||||
return ippiDFT_PackToR_32f_C1R ? CV_INSTRUMENT_FUN_IPP(ippiDFT_PackToR_32f_C1R, src, static_cast<int>(srcStep), dst, static_cast<int>(dstStep), pDFTSpec, pBuffer) >= 0 : false;
|
||||
}
|
||||
private:
|
||||
ippiDFT_R_Func func;
|
||||
ippiDFT_R_Func ippiDFT_PackToR_32f_C1R;
|
||||
};
|
||||
|
||||
static bool ippi_DFT_C_32F(const uchar * src, size_t src_step, uchar * dst, size_t dst_step, int width, int height, bool inv, int norm_flag)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
IppStatus status;
|
||||
Ipp8u* pBuffer = 0;
|
||||
Ipp8u* pMemInit= 0;
|
||||
@@ -1787,9 +1793,9 @@ static bool ippi_DFT_C_32F(const uchar * src, size_t src_step, uchar * dst, size
|
||||
}
|
||||
|
||||
if (!inv)
|
||||
status = ippiDFTFwd_CToC_32fc_C1R( (Ipp32fc*)src, static_cast<int>(src_step), (Ipp32fc*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer );
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiDFTFwd_CToC_32fc_C1R, (Ipp32fc*)src, static_cast<int>(src_step), (Ipp32fc*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer);
|
||||
else
|
||||
status = ippiDFTInv_CToC_32fc_C1R( (Ipp32fc*)src, static_cast<int>(src_step), (Ipp32fc*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer );
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiDFTInv_CToC_32fc_C1R, (Ipp32fc*)src, static_cast<int>(src_step), (Ipp32fc*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer);
|
||||
|
||||
if ( sizeBuffer > 0 )
|
||||
ippFree( pBuffer );
|
||||
@@ -1806,6 +1812,8 @@ static bool ippi_DFT_C_32F(const uchar * src, size_t src_step, uchar * dst, size
|
||||
|
||||
static bool ippi_DFT_R_32F(const uchar * src, size_t src_step, uchar * dst, size_t dst_step, int width, int height, bool inv, int norm_flag)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
IppStatus status;
|
||||
Ipp8u* pBuffer = 0;
|
||||
Ipp8u* pMemInit= 0;
|
||||
@@ -1841,9 +1849,9 @@ static bool ippi_DFT_R_32F(const uchar * src, size_t src_step, uchar * dst, size
|
||||
}
|
||||
|
||||
if (!inv)
|
||||
status = ippiDFTFwd_RToPack_32f_C1R( (float*)src, static_cast<int>(src_step), (float*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer );
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiDFTFwd_RToPack_32f_C1R, (float*)src, static_cast<int>(src_step), (float*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer);
|
||||
else
|
||||
status = ippiDFTInv_PackToR_32f_C1R( (float*)src, static_cast<int>(src_step), (float*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer );
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiDFTInv_PackToR_32f_C1R, (float*)src, static_cast<int>(src_step), (float*)dst, static_cast<int>(dst_step), pDFTSpec, pBuffer);
|
||||
|
||||
if ( sizeBuffer > 0 )
|
||||
ippFree( pBuffer );
|
||||
@@ -3318,6 +3326,8 @@ Ptr<DFT2D> DFT2D::create(int width, int height, int depth,
|
||||
|
||||
void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
#ifdef HAVE_CLAMDFFT
|
||||
CV_OCL_RUN(ocl::haveAmdFft() && ocl::Device::getDefault().type() != ocl::Device::TYPE_CPU &&
|
||||
_dst.isUMat() && _src0.dims() <= 2 && nonzero_rows == 0,
|
||||
@@ -3363,6 +3373,8 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
||||
|
||||
void cv::idft( InputArray src, OutputArray dst, int flags, int nonzero_rows )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
dft( src, dst, flags | DFT_INVERSE, nonzero_rows );
|
||||
}
|
||||
|
||||
@@ -3407,6 +3419,8 @@ static bool ocl_mulSpectrums( InputArray _srcA, InputArray _srcB,
|
||||
void cv::mulSpectrums( InputArray _srcA, InputArray _srcB,
|
||||
OutputArray _dst, int flags, bool conjB )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(_dst.isUMat() && _srcA.dims() <= 2 && _srcB.dims() <= 2,
|
||||
ocl_mulSpectrums(_srcA, _srcB, _dst, flags, conjB))
|
||||
|
||||
@@ -3795,6 +3809,8 @@ public:
|
||||
|
||||
virtual void operator()(const Range& range) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
if(*ok == false)
|
||||
return;
|
||||
|
||||
@@ -3818,7 +3834,7 @@ public:
|
||||
ippFree(pInitBuf); \
|
||||
return;
|
||||
|
||||
ippiDCTFunc ippDctFun = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R;
|
||||
ippiDCTFunc ippiDCT_32f_C1R = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R;
|
||||
ippiDCTInit ippDctInit = inv ? (ippiDCTInit)ippiDCTInvInit_32f : (ippiDCTInit)ippiDCTFwdInit_32f;
|
||||
ippiDCTGetSize ippDctGetSize = inv ? (ippiDCTGetSize)ippiDCTInvGetSize_32f : (ippiDCTGetSize)ippiDCTFwdGetSize_32f;
|
||||
|
||||
@@ -3856,7 +3872,7 @@ public:
|
||||
|
||||
for(int i = range.start; i < range.end; ++i)
|
||||
{
|
||||
if(ippDctFun((float*)(src + src_step * i), static_cast<int>(src_step), (float*)(dst + dst_step * i), static_cast<int>(dst_step), pDCTSpec, pBuffer) < 0)
|
||||
if(CV_INSTRUMENT_FUN_IPP(ippiDCT_32f_C1R, (float*)(src + src_step * i), static_cast<int>(src_step), (float*)(dst + dst_step * i), static_cast<int>(dst_step), pDCTSpec, pBuffer) < 0)
|
||||
{
|
||||
*ok = false;
|
||||
IPP_RETURN
|
||||
@@ -3925,6 +3941,8 @@ static bool DctIPPLoop(const uchar * src, size_t src_step, uchar * dst, size_t d
|
||||
|
||||
static bool ippi_DCT_32f(const uchar * src, size_t src_step, uchar * dst, size_t dst_step, int width, int height, bool inv, bool row)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
if(row)
|
||||
return DctIPPLoop(src, src_step, dst, dst_step, width, height, inv);
|
||||
else
|
||||
@@ -3948,7 +3966,7 @@ static bool ippi_DCT_32f(const uchar * src, size_t src_step, uchar * dst, size_t
|
||||
if(pInitBuf) \
|
||||
ippFree(pInitBuf); \
|
||||
|
||||
ippiDCTFunc ippDctFun = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R;
|
||||
ippiDCTFunc ippiDCT_32f_C1R = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R;
|
||||
ippiDCTInit ippDctInit = inv ? (ippiDCTInit)ippiDCTInvInit_32f : (ippiDCTInit)ippiDCTFwdInit_32f;
|
||||
ippiDCTGetSize ippDctGetSize = inv ? (ippiDCTGetSize)ippiDCTInvGetSize_32f : (ippiDCTGetSize)ippiDCTFwdGetSize_32f;
|
||||
|
||||
@@ -3978,7 +3996,7 @@ static bool ippi_DCT_32f(const uchar * src, size_t src_step, uchar * dst, size_t
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ippDctFun((float*)src, static_cast<int>(src_step), (float*)dst, static_cast<int>(dst_step), pDCTSpec, pBuffer) < 0)
|
||||
if(CV_INSTRUMENT_FUN_IPP(ippiDCT_32f_C1R, (float*)src, static_cast<int>(src_step), (float*)dst, static_cast<int>(dst_step), pDCTSpec, pBuffer) < 0)
|
||||
{
|
||||
IPP_RELEASE
|
||||
return false;
|
||||
@@ -4218,6 +4236,8 @@ Ptr<DCT2D> DCT2D::create(int width, int height, int depth, int flags)
|
||||
|
||||
void cv::dct( InputArray _src0, OutputArray _dst, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src0 = _src0.getMat(), src = src0;
|
||||
int type = src.type(), depth = src.depth();
|
||||
|
||||
@@ -4240,6 +4260,8 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags )
|
||||
|
||||
void cv::idct( InputArray src, OutputArray dst, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
dct( src, dst, flags | DCT_INVERSE );
|
||||
}
|
||||
|
||||
|
||||
@@ -259,6 +259,8 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
|
||||
|
||||
void cv::glob(String pattern, std::vector<String>& result, bool recursive)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
result.clear();
|
||||
String path, wildchart;
|
||||
|
||||
|
||||
@@ -219,6 +219,8 @@ double cv::kmeans( InputArray _data, int K,
|
||||
TermCriteria criteria, int attempts,
|
||||
int flags, OutputArray _centers )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
const int SPP_TRIALS = 3;
|
||||
Mat data0 = _data.getMat();
|
||||
bool isrow = data0.rows == 1;
|
||||
|
||||
@@ -52,21 +52,29 @@ namespace cv
|
||||
|
||||
int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
return hal::LU32f(A, astep, m, b, bstep, n);
|
||||
}
|
||||
|
||||
int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
return hal::LU64f(A, astep, m, b, bstep, n);
|
||||
}
|
||||
|
||||
bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
return hal::Cholesky32f(A, astep, m, b, bstep, n);
|
||||
}
|
||||
|
||||
bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
return hal::Cholesky64f(A, astep, m, b, bstep, n);
|
||||
}
|
||||
|
||||
@@ -746,6 +754,8 @@ SVBkSb( int m, int n, const double* w, size_t wstep,
|
||||
|
||||
double cv::determinant( InputArray _mat )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat mat = _mat.getMat();
|
||||
double result = 0;
|
||||
int type = mat.type(), rows = mat.rows;
|
||||
@@ -822,6 +832,8 @@ double cv::determinant( InputArray _mat )
|
||||
|
||||
double cv::invert( InputArray _src, OutputArray _dst, int method )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool result = false;
|
||||
Mat src = _src.getMat();
|
||||
int type = src.type();
|
||||
@@ -1080,6 +1092,8 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
||||
|
||||
bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int method )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool result = true;
|
||||
Mat src = _src.getMat(), _src2 = _src2arg.getMat();
|
||||
int type = src.type();
|
||||
@@ -1356,6 +1370,8 @@ bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int meth
|
||||
|
||||
bool cv::eigen( InputArray _src, OutputArray _evals, OutputArray _evects )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat();
|
||||
int type = src.type();
|
||||
int n = src.rows;
|
||||
@@ -1464,11 +1480,15 @@ static void _SVDcompute( InputArray _aarr, OutputArray _w,
|
||||
|
||||
void SVD::compute( InputArray a, OutputArray w, OutputArray u, OutputArray vt, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
_SVDcompute(a, w, u, vt, flags);
|
||||
}
|
||||
|
||||
void SVD::compute( InputArray a, OutputArray w, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
_SVDcompute(a, w, noArray(), noArray(), flags);
|
||||
}
|
||||
|
||||
@@ -1517,11 +1537,15 @@ void SVD::backSubst( InputArray rhs, OutputArray dst ) const
|
||||
|
||||
void cv::SVDecomp(InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
SVD::compute(src, w, u, vt, flags);
|
||||
}
|
||||
|
||||
void cv::SVBackSubst(InputArray w, InputArray u, InputArray vt, InputArray rhs, OutputArray dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
SVD::backSubst(w, u, vt, rhs, dst);
|
||||
}
|
||||
|
||||
|
||||
@@ -898,6 +898,8 @@ public:
|
||||
// National Institute of Standards and Technology (NIST).
|
||||
void compute(InputArray src)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if(isSymmetric(src)) {
|
||||
// Fall back to OpenCV for a symmetric matrix!
|
||||
cv::eigen(src, _eigenvalues, _eigenvectors);
|
||||
|
||||
@@ -101,6 +101,8 @@ static bool ocl_math_op(InputArray _src1, InputArray _src2, OutputArray _dst, in
|
||||
\* ************************************************************************** */
|
||||
float cubeRoot( float value )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
float fr;
|
||||
Cv32suf v, m;
|
||||
int ix, s;
|
||||
@@ -142,6 +144,8 @@ float cubeRoot( float value )
|
||||
|
||||
void magnitude( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = src1.type(), depth = src1.depth(), cn = src1.channels();
|
||||
CV_Assert( src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F));
|
||||
|
||||
@@ -176,6 +180,8 @@ void magnitude( InputArray src1, InputArray src2, OutputArray dst )
|
||||
|
||||
void phase( InputArray src1, InputArray src2, OutputArray dst, bool angleInDegrees )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = src1.type(), depth = src1.depth(), cn = src1.channels();
|
||||
CV_Assert( src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F));
|
||||
|
||||
@@ -260,6 +266,8 @@ static bool ocl_cartToPolar( InputArray _src1, InputArray _src2,
|
||||
void cartToPolar( InputArray src1, InputArray src2,
|
||||
OutputArray dst1, OutputArray dst2, bool angleInDegrees )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(dst1.isUMat() && dst2.isUMat(),
|
||||
ocl_cartToPolar(src1, src2, dst1, dst2, angleInDegrees))
|
||||
|
||||
@@ -492,6 +500,8 @@ static bool ocl_polarToCart( InputArray _mag, InputArray _angle,
|
||||
void polarToCart( InputArray src1, InputArray src2,
|
||||
OutputArray dst1, OutputArray dst2, bool angleInDegrees )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = src2.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
CV_Assert((depth == CV_32F || depth == CV_64F) && (src1.empty() || src1.type() == type));
|
||||
|
||||
@@ -509,14 +519,14 @@ void polarToCart( InputArray src1, InputArray src2,
|
||||
{
|
||||
if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees)
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
|
||||
typedef IppStatus (CV_STDCALL * IppsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
|
||||
void * pDstRe, void * pDstIm, int len);
|
||||
ippsPolarToCart ippFunc =
|
||||
depth == CV_32F ? (ippsPolarToCart)ippsPolarToCart_32f :
|
||||
depth == CV_64F ? (ippsPolarToCart)ippsPolarToCart_64f : 0;
|
||||
CV_Assert(ippFunc != 0);
|
||||
IppsPolarToCart ippsPolarToCart =
|
||||
depth == CV_32F ? (IppsPolarToCart)ippsPolarToCart_32f :
|
||||
depth == CV_64F ? (IppsPolarToCart)ippsPolarToCart_64f : 0;
|
||||
CV_Assert(ippsPolarToCart != 0);
|
||||
|
||||
IppStatus status = ippFunc(Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast<int>(cn * X.total()));
|
||||
IppStatus status = CV_INSTRUMENT_FUN_IPP(ippsPolarToCart, Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast<int>(cn * X.total()));
|
||||
if (status >= 0)
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
@@ -620,6 +630,8 @@ void polarToCart( InputArray src1, InputArray src2,
|
||||
|
||||
void exp( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), depth = _src.depth(), cn = _src.channels();
|
||||
CV_Assert( depth == CV_32F || depth == CV_64F );
|
||||
|
||||
@@ -651,6 +663,8 @@ void exp( InputArray _src, OutputArray _dst )
|
||||
|
||||
void log( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), depth = _src.depth(), cn = _src.channels();
|
||||
CV_Assert( depth == CV_32F || depth == CV_64F );
|
||||
|
||||
@@ -1160,6 +1174,8 @@ static void Sqrt_64f(const double* src, double* dst, int n) { hal::sqrt64f(src,
|
||||
|
||||
void pow( InputArray _src, double power, OutputArray _dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), depth = CV_MAT_DEPTH(type),
|
||||
cn = CV_MAT_CN(type), ipower = cvRound(power);
|
||||
bool is_ipower = fabs(ipower - power) < DBL_EPSILON;
|
||||
@@ -1245,12 +1261,12 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
||||
{
|
||||
int bsz = std::min(len - j, blockSize);
|
||||
|
||||
#if defined(HAVE_IPP)
|
||||
#if defined(HAVE_IPP)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
IppStatus status = depth == CV_32F ?
|
||||
ippsPowx_32f_A21((const float*)ptrs[0], (float)power, (float*)ptrs[1], bsz) :
|
||||
ippsPowx_64f_A50((const double*)ptrs[0], (double)power, (double*)ptrs[1], bsz);
|
||||
CV_INSTRUMENT_FUN_IPP(ippsPowx_32f_A21, (const float*)ptrs[0], (float)power, (float*)ptrs[1], bsz) :
|
||||
CV_INSTRUMENT_FUN_IPP(ippsPowx_64f_A50, (const double*)ptrs[0], (double)power, (double*)ptrs[1], bsz);
|
||||
|
||||
if (status >= 0)
|
||||
{
|
||||
@@ -1261,7 +1277,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
||||
}
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
@@ -1327,6 +1343,8 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
||||
|
||||
void sqrt(InputArray a, OutputArray b)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
cv::pow(a, 0.5, b);
|
||||
}
|
||||
|
||||
@@ -1412,6 +1430,8 @@ check_range_function check_range_functions[] =
|
||||
|
||||
bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double maxVal)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat();
|
||||
|
||||
if ( src.dims > 2 )
|
||||
@@ -1549,6 +1569,8 @@ static bool ocl_patchNaNs( InputOutputArray _a, float value )
|
||||
|
||||
void patchNaNs( InputOutputArray _a, double _val )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _a.depth() == CV_32F );
|
||||
|
||||
CV_OCL_RUN(_a.isUMat() && _a.dims() <= 2,
|
||||
@@ -1714,6 +1736,8 @@ CV_IMPL int cvCheckArr( const CvArr* arr, int flags,
|
||||
|
||||
int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
const int n0 = 3;
|
||||
Mat coeffs = _coeffs.getMat();
|
||||
int ctype = coeffs.type();
|
||||
@@ -1859,6 +1883,8 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
|
||||
http://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method */
|
||||
double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
typedef Complex<double> C;
|
||||
|
||||
double maxDiff = 0;
|
||||
|
||||
@@ -203,12 +203,16 @@ namespace cv { namespace hal {
|
||||
|
||||
void fastAtan32f(const float *Y, const float *X, float *angle, int len, bool angleInDegrees )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(fastAtan32f, cv_hal_fastAtan32f, Y, X, angle, len, angleInDegrees);
|
||||
atanImpl<float>(Y, X, angle, len, angleInDegrees);
|
||||
}
|
||||
|
||||
void fastAtan64f(const double *Y, const double *X, double *angle, int len, bool angleInDegrees)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(fastAtan64f, cv_hal_fastAtan64f, Y, X, angle, len, angleInDegrees);
|
||||
atanImpl<double>(Y, X, angle, len, angleInDegrees);
|
||||
}
|
||||
@@ -216,13 +220,17 @@ void fastAtan64f(const double *Y, const double *X, double *angle, int len, bool
|
||||
// deprecated
|
||||
void fastAtan2(const float *Y, const float *X, float *angle, int len, bool angleInDegrees )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
fastAtan32f(Y, X, angle, len, angleInDegrees);
|
||||
}
|
||||
|
||||
void magnitude32f(const float* x, const float* y, float* mag, int len)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(magnitude32f, cv_hal_magnitude32f, x, y, mag, len);
|
||||
CV_IPP_RUN_FAST(ippsMagnitude_32f(x, y, mag, len) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsMagnitude_32f, x, y, mag, len) >= 0);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -247,8 +255,10 @@ void magnitude32f(const float* x, const float* y, float* mag, int len)
|
||||
|
||||
void magnitude64f(const double* x, const double* y, double* mag, int len)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(magnitude64f, cv_hal_magnitude64f, x, y, mag, len);
|
||||
CV_IPP_RUN_FAST(ippsMagnitude_64f(x, y, mag, len) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsMagnitude_64f, x, y, mag, len) >= 0);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -274,8 +284,10 @@ void magnitude64f(const double* x, const double* y, double* mag, int len)
|
||||
|
||||
void invSqrt32f(const float* src, float* dst, int len)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(invSqrt32f, cv_hal_invSqrt32f, src, dst, len);
|
||||
CV_IPP_RUN_FAST(ippsInvSqrt_32f_A21(src, dst, len) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsInvSqrt_32f_A21, src, dst, len) >= 0);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -296,8 +308,10 @@ void invSqrt32f(const float* src, float* dst, int len)
|
||||
|
||||
void invSqrt64f(const double* src, double* dst, int len)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(invSqrt64f, cv_hal_invSqrt64f, src, dst, len);
|
||||
CV_IPP_RUN_FAST(ippsInvSqrt_64f_A50(src, dst, len) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsInvSqrt_64f_A50, src, dst, len) >= 0);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -314,8 +328,10 @@ void invSqrt64f(const double* src, double* dst, int len)
|
||||
|
||||
void sqrt32f(const float* src, float* dst, int len)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(sqrt32f, cv_hal_sqrt32f, src, dst, len);
|
||||
CV_IPP_RUN_FAST(ippsSqrt_32f_A21(src, dst, len) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsSqrt_32f_A21, src, dst, len) >= 0);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -336,8 +352,10 @@ void sqrt32f(const float* src, float* dst, int len)
|
||||
|
||||
void sqrt64f(const double* src, double* dst, int len)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(sqrt64f, cv_hal_sqrt64f, src, dst, len);
|
||||
CV_IPP_RUN_FAST(ippsSqrt_64f_A50(src, dst, len) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsSqrt_64f_A50, src, dst, len) >= 0);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -458,8 +476,10 @@ static const double exp_max_val = 3000.*(1 << EXPTAB_SCALE); // log10(DBL_MAX) <
|
||||
|
||||
void exp32f( const float *_x, float *y, int n )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(exp32f, cv_hal_exp32f, _x, y, n);
|
||||
CV_IPP_RUN_FAST(ippsExp_32f_A21(_x, y, n) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsExp_32f_A21, _x, y, n) >= 0);
|
||||
|
||||
static const float
|
||||
A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0),
|
||||
@@ -660,8 +680,10 @@ void exp32f( const float *_x, float *y, int n )
|
||||
|
||||
void exp64f( const double *_x, double *y, int n )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(exp64f, cv_hal_exp64f, _x, y, n);
|
||||
CV_IPP_RUN_FAST(ippsExp_64f_A50(_x, y, n) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsExp_64f_A50, _x, y, n) >= 0);
|
||||
|
||||
static const double
|
||||
A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0,
|
||||
@@ -1107,8 +1129,10 @@ static const double ln_2 = 0.69314718055994530941723212145818;
|
||||
|
||||
void log32f( const float *_x, float *y, int n )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(log32f, cv_hal_log32f, _x, y, n);
|
||||
CV_IPP_RUN_FAST(ippsLn_32f_A21(_x, y, n) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsLn_32f_A21, _x, y, n) >= 0);
|
||||
|
||||
static const float shift[] = { 0, -1.f/512 };
|
||||
static const float
|
||||
@@ -1254,8 +1278,10 @@ void log32f( const float *_x, float *y, int n )
|
||||
|
||||
void log64f( const double *x, double *y, int n )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CALL_HAL(log64f, cv_hal_log64f, x, y, n);
|
||||
CV_IPP_RUN_FAST(ippsLn_64f_A50(x, y, n) >= 0);
|
||||
CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsLn_64f_A50, x, y, n) >= 0);
|
||||
|
||||
static const double shift[] = { 0, -1./512 };
|
||||
static const double
|
||||
|
||||
@@ -868,6 +868,8 @@ static bool ocl_gemm( InputArray matA, InputArray matB, double alpha,
|
||||
static void gemmImpl( Mat A, Mat B, double alpha,
|
||||
Mat C, double beta, Mat D, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
const int block_lin_size = 128;
|
||||
const int block_size = block_lin_size * block_lin_size;
|
||||
|
||||
@@ -2082,6 +2084,8 @@ static TransformFunc getDiagTransformFunc(int depth)
|
||||
|
||||
void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat(), m = _mtx.getMat();
|
||||
int depth = src.depth(), scn = src.channels(), dcn = m.rows;
|
||||
CV_Assert( scn == m.cols || scn + 1 == m.cols );
|
||||
@@ -2260,6 +2264,8 @@ perspectiveTransform_64f(const double* src, double* dst, const double* m, int le
|
||||
|
||||
void cv::perspectiveTransform( InputArray _src, OutputArray _dst, InputArray _mtx )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat(), m = _mtx.getMat();
|
||||
int depth = src.depth(), scn = src.channels(), dcn = m.rows-1;
|
||||
CV_Assert( scn + 1 == m.cols );
|
||||
@@ -2454,6 +2460,8 @@ static bool ocl_scaleAdd( InputArray _src1, double alpha, InputArray _src2, Outp
|
||||
|
||||
void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray _dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src1.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
CV_Assert( type == _src2.type() );
|
||||
|
||||
@@ -2499,6 +2507,8 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray
|
||||
|
||||
void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, int flags, int ctype )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( data && nsamples > 0 );
|
||||
Size size = data[0].size();
|
||||
int sz = size.width * size.height, esz = (int)data[0].elemSize();
|
||||
@@ -2539,6 +2549,8 @@ void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean,
|
||||
|
||||
void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mean, int flags, int ctype )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if(_src.kind() == _InputArray::STD_VECTOR_MAT)
|
||||
{
|
||||
std::vector<cv::Mat> src;
|
||||
@@ -2626,6 +2638,8 @@ void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray
|
||||
|
||||
double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat v1 = _v1.getMat(), v2 = _v2.getMat(), icovar = _icovar.getMat();
|
||||
int type = v1.type(), depth = v1.depth();
|
||||
Size sz = v1.size();
|
||||
@@ -2916,6 +2930,8 @@ typedef void (*MulTransposedFunc)(const Mat& src, Mat& dst, const Mat& delta, do
|
||||
void cv::mulTransposed( InputArray _src, OutputArray _dst, bool ata,
|
||||
InputArray _delta, double scale, int dtype )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat(), delta = _delta.getMat();
|
||||
const int gemm_level = 100; // boundary above which GEMM is faster.
|
||||
int stype = src.type();
|
||||
@@ -3059,9 +3075,9 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len)
|
||||
#if ARITHM_USE_IPP && IPP_DISABLE_BLOCK
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])),
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_8u64f_C1R, (src1, (int)(len*sizeof(src1[0])),
|
||||
src2, (int)(len*sizeof(src2[0])),
|
||||
ippiSize(len, 1), &r))
|
||||
ippiSize(len, 1), &r)))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return r;
|
||||
@@ -3258,7 +3274,7 @@ static double dotProd_16u(const ushort* src1, const ushort* src2, int len)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
double r = 0;
|
||||
if (0 <= ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_16u64f_C1R, src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return r;
|
||||
@@ -3275,7 +3291,7 @@ static double dotProd_16s(const short* src1, const short* src2, int len)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
double r = 0;
|
||||
if (0 <= ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_16s64f_C1R, src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return r;
|
||||
@@ -3292,7 +3308,7 @@ static double dotProd_32s(const int* src1, const int* src2, int len)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
double r = 0;
|
||||
if (0 <= ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_32s64f_C1R, src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return r;
|
||||
@@ -3311,7 +3327,7 @@ static double dotProd_32f(const float* src1, const float* src2, int len)
|
||||
#if (ARITHM_USE_IPP == 1)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
if (0 <= ippsDotProd_32f64f(src1, src2, len, &r))
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(ippsDotProd_32f64f, src1, src2, len, &r))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return r;
|
||||
@@ -3349,7 +3365,7 @@ static double dotProd_64f(const double* src1, const double* src2, int len)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
double r = 0;
|
||||
if (0 <= ippsDotProd_64f(src1, src2, len, &r))
|
||||
if (0 <= CV_INSTRUMENT_FUN_IPP(ippsDotProd_64f, src1, src2, len, &r))
|
||||
{
|
||||
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||
return r;
|
||||
@@ -3378,6 +3394,8 @@ static DotProdFunc getDotProdFunc(int depth)
|
||||
|
||||
double Mat::dot(InputArray _mat) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat mat = _mat.getMat();
|
||||
int cn = channels();
|
||||
DotProdFunc func = getDotProdFunc(depth());
|
||||
|
||||
@@ -333,6 +333,8 @@ void MatOp::augAssignXor(const MatExpr& expr, Mat& m) const
|
||||
|
||||
void MatOp::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( this == e2.op )
|
||||
{
|
||||
double alpha = 1, beta = 1;
|
||||
@@ -364,6 +366,8 @@ void MatOp::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
|
||||
void MatOp::add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m1;
|
||||
expr1.op->assign(expr1, m1);
|
||||
MatOp_AddEx::makeExpr(res, m1, Mat(), 1, 0, s);
|
||||
@@ -372,6 +376,8 @@ void MatOp::add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const
|
||||
|
||||
void MatOp::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( this == e2.op )
|
||||
{
|
||||
double alpha = 1, beta = -1;
|
||||
@@ -403,6 +409,8 @@ void MatOp::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
|
||||
void MatOp::subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m;
|
||||
expr.op->assign(expr, m);
|
||||
MatOp_AddEx::makeExpr(res, m, Mat(), -1, 0, s);
|
||||
@@ -411,6 +419,8 @@ void MatOp::subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const
|
||||
|
||||
void MatOp::multiply(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double scale) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( this == e2.op )
|
||||
{
|
||||
Mat m1, m2;
|
||||
@@ -462,6 +472,8 @@ void MatOp::multiply(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double
|
||||
|
||||
void MatOp::multiply(const MatExpr& expr, double s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m;
|
||||
expr.op->assign(expr, m);
|
||||
MatOp_AddEx::makeExpr(res, m, Mat(), s, 0);
|
||||
@@ -470,6 +482,8 @@ void MatOp::multiply(const MatExpr& expr, double s, MatExpr& res) const
|
||||
|
||||
void MatOp::divide(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double scale) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( this == e2.op )
|
||||
{
|
||||
if( isReciprocal(e1) && isReciprocal(e2) )
|
||||
@@ -510,6 +524,8 @@ void MatOp::divide(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double sc
|
||||
|
||||
void MatOp::divide(double s, const MatExpr& expr, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m;
|
||||
expr.op->assign(expr, m);
|
||||
MatOp_Bin::makeExpr(res, '/', m, Mat(), s);
|
||||
@@ -518,6 +534,8 @@ void MatOp::divide(double s, const MatExpr& expr, MatExpr& res) const
|
||||
|
||||
void MatOp::abs(const MatExpr& expr, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m;
|
||||
expr.op->assign(expr, m);
|
||||
MatOp_Bin::makeExpr(res, 'a', m, Mat());
|
||||
@@ -526,6 +544,8 @@ void MatOp::abs(const MatExpr& expr, MatExpr& res) const
|
||||
|
||||
void MatOp::transpose(const MatExpr& expr, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m;
|
||||
expr.op->assign(expr, m);
|
||||
MatOp_T::makeExpr(res, m, 1);
|
||||
@@ -590,6 +610,8 @@ Size MatOp::size(const MatExpr& expr) const
|
||||
|
||||
int MatOp::type(const MatExpr& expr) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
return !expr.a.empty() ? expr.a.type() : expr.b.empty() ? expr.b.type() : expr.c.type();
|
||||
}
|
||||
|
||||
@@ -1038,6 +1060,8 @@ MatExpr operator > (double s, const Mat& a)
|
||||
|
||||
MatExpr min(const Mat& a, const Mat& b)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'm', a, b);
|
||||
return e;
|
||||
@@ -1045,6 +1069,8 @@ MatExpr min(const Mat& a, const Mat& b)
|
||||
|
||||
MatExpr min(const Mat& a, double s)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'n', a, s);
|
||||
return e;
|
||||
@@ -1052,6 +1078,8 @@ MatExpr min(const Mat& a, double s)
|
||||
|
||||
MatExpr min(double s, const Mat& a)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'n', a, s);
|
||||
return e;
|
||||
@@ -1059,6 +1087,8 @@ MatExpr min(double s, const Mat& a)
|
||||
|
||||
MatExpr max(const Mat& a, const Mat& b)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'M', a, b);
|
||||
return e;
|
||||
@@ -1066,6 +1096,8 @@ MatExpr max(const Mat& a, const Mat& b)
|
||||
|
||||
MatExpr max(const Mat& a, double s)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'N', a, s);
|
||||
return e;
|
||||
@@ -1073,6 +1105,8 @@ MatExpr max(const Mat& a, double s)
|
||||
|
||||
MatExpr max(double s, const Mat& a)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'N', a, s);
|
||||
return e;
|
||||
@@ -1150,6 +1184,8 @@ MatExpr operator ~(const Mat& a)
|
||||
|
||||
MatExpr abs(const Mat& a)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Bin::makeExpr(e, 'a', a, Scalar());
|
||||
return e;
|
||||
@@ -1157,6 +1193,8 @@ MatExpr abs(const Mat& a)
|
||||
|
||||
MatExpr abs(const MatExpr& e)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr en;
|
||||
e.op->abs(e, en);
|
||||
return en;
|
||||
@@ -1179,6 +1217,8 @@ Size MatExpr::size() const
|
||||
|
||||
int MatExpr::type() const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( isInitializer(*this) )
|
||||
return a.type();
|
||||
if( isCmp(*this) )
|
||||
@@ -1261,6 +1301,8 @@ void MatOp_AddEx::assign(const MatExpr& e, Mat& m, int _type) const
|
||||
|
||||
void MatOp_AddEx::add(const MatExpr& e, const Scalar& s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.s += s;
|
||||
}
|
||||
@@ -1268,6 +1310,8 @@ void MatOp_AddEx::add(const MatExpr& e, const Scalar& s, MatExpr& res) const
|
||||
|
||||
void MatOp_AddEx::subtract(const Scalar& s, const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.alpha = -res.alpha;
|
||||
res.beta = -res.beta;
|
||||
@@ -1276,6 +1320,8 @@ void MatOp_AddEx::subtract(const Scalar& s, const MatExpr& e, MatExpr& res) cons
|
||||
|
||||
void MatOp_AddEx::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.alpha *= s;
|
||||
res.beta *= s;
|
||||
@@ -1284,6 +1330,8 @@ void MatOp_AddEx::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
|
||||
void MatOp_AddEx::divide(double s, const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( isScaled(e) )
|
||||
MatOp_Bin::makeExpr(res, '/', e.a, Mat(), s/e.alpha);
|
||||
else
|
||||
@@ -1293,6 +1341,8 @@ void MatOp_AddEx::divide(double s, const MatExpr& e, MatExpr& res) const
|
||||
|
||||
void MatOp_AddEx::transpose(const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( isScaled(e) )
|
||||
MatOp_T::makeExpr(res, e.a, e.alpha);
|
||||
else
|
||||
@@ -1301,6 +1351,8 @@ void MatOp_AddEx::transpose(const MatExpr& e, MatExpr& res) const
|
||||
|
||||
void MatOp_AddEx::abs(const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( (!e.b.data || e.beta == 0) && fabs(e.alpha) == 1 )
|
||||
MatOp_Bin::makeExpr(res, 'a', e.a, -e.s*e.alpha);
|
||||
else if( e.b.data && e.alpha + e.beta == 0 && e.alpha*e.beta == -1 )
|
||||
@@ -1361,6 +1413,8 @@ void MatOp_Bin::assign(const MatExpr& e, Mat& m, int _type) const
|
||||
|
||||
void MatOp_Bin::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( e.flags == '*' || e.flags == '/' )
|
||||
{
|
||||
res = e;
|
||||
@@ -1372,6 +1426,8 @@ void MatOp_Bin::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
|
||||
void MatOp_Bin::divide(double s, const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( e.flags == '/' && (!e.b.data || e.beta == 0) )
|
||||
MatOp_AddEx::makeExpr(res, e.a, Mat(), s/e.alpha, 0);
|
||||
else
|
||||
@@ -1427,12 +1483,16 @@ void MatOp_T::assign(const MatExpr& e, Mat& m, int _type) const
|
||||
|
||||
void MatOp_T::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.alpha *= s;
|
||||
}
|
||||
|
||||
void MatOp_T::transpose(const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( e.alpha == 1 )
|
||||
MatOp_Identity::makeExpr(res, e.a);
|
||||
else
|
||||
@@ -1457,6 +1517,8 @@ void MatOp_GEMM::assign(const MatExpr& e, Mat& m, int _type) const
|
||||
|
||||
void MatOp_GEMM::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool i1 = isIdentity(e1), i2 = isIdentity(e2);
|
||||
double alpha1 = i1 ? 1 : e1.alpha, alpha2 = i2 ? 1 : e2.alpha;
|
||||
|
||||
@@ -1474,6 +1536,8 @@ void MatOp_GEMM::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
|
||||
void MatOp_GEMM::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool i1 = isIdentity(e1), i2 = isIdentity(e2);
|
||||
double alpha1 = i1 ? 1 : e1.alpha, alpha2 = i2 ? 1 : e2.alpha;
|
||||
|
||||
@@ -1491,6 +1555,8 @@ void MatOp_GEMM::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) co
|
||||
|
||||
void MatOp_GEMM::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.alpha *= s;
|
||||
res.beta *= s;
|
||||
@@ -1498,6 +1564,8 @@ void MatOp_GEMM::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
|
||||
void MatOp_GEMM::transpose(const MatExpr& e, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.flags = (!(e.flags & CV_GEMM_A_T) ? CV_GEMM_B_T : 0) |
|
||||
(!(e.flags & CV_GEMM_B_T) ? CV_GEMM_A_T : 0) |
|
||||
@@ -1577,6 +1645,8 @@ void MatOp_Initializer::assign(const MatExpr& e, Mat& m, int _type) const
|
||||
|
||||
void MatOp_Initializer::multiply(const MatExpr& e, double s, MatExpr& res) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
res = e;
|
||||
res.alpha *= s;
|
||||
}
|
||||
@@ -1595,6 +1665,8 @@ inline void MatOp_Initializer::makeExpr(MatExpr& res, int method, int ndims, con
|
||||
|
||||
MatExpr Mat::t() const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_T::makeExpr(e, *this);
|
||||
return e;
|
||||
@@ -1602,6 +1674,8 @@ MatExpr Mat::t() const
|
||||
|
||||
MatExpr Mat::inv(int method) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Invert::makeExpr(e, method, *this);
|
||||
return e;
|
||||
@@ -1610,6 +1684,8 @@ MatExpr Mat::inv(int method) const
|
||||
|
||||
MatExpr Mat::mul(InputArray m, double scale) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
if(m.kind() == _InputArray::EXPR)
|
||||
{
|
||||
@@ -1623,6 +1699,8 @@ MatExpr Mat::mul(InputArray m, double scale) const
|
||||
|
||||
MatExpr Mat::zeros(int rows, int cols, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, '0', Size(cols, rows), type);
|
||||
return e;
|
||||
@@ -1630,6 +1708,8 @@ MatExpr Mat::zeros(int rows, int cols, int type)
|
||||
|
||||
MatExpr Mat::zeros(Size size, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, '0', size, type);
|
||||
return e;
|
||||
@@ -1637,6 +1717,8 @@ MatExpr Mat::zeros(Size size, int type)
|
||||
|
||||
MatExpr Mat::zeros(int ndims, const int* sizes, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, '0', ndims, sizes, type);
|
||||
return e;
|
||||
@@ -1644,6 +1726,8 @@ MatExpr Mat::zeros(int ndims, const int* sizes, int type)
|
||||
|
||||
MatExpr Mat::ones(int rows, int cols, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, '1', Size(cols, rows), type);
|
||||
return e;
|
||||
@@ -1651,6 +1735,8 @@ MatExpr Mat::ones(int rows, int cols, int type)
|
||||
|
||||
MatExpr Mat::ones(Size size, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, '1', size, type);
|
||||
return e;
|
||||
@@ -1658,6 +1744,8 @@ MatExpr Mat::ones(Size size, int type)
|
||||
|
||||
MatExpr Mat::ones(int ndims, const int* sizes, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, '1', ndims, sizes, type);
|
||||
return e;
|
||||
@@ -1665,6 +1753,8 @@ MatExpr Mat::ones(int ndims, const int* sizes, int type)
|
||||
|
||||
MatExpr Mat::eye(int rows, int cols, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, 'I', Size(cols, rows), type);
|
||||
return e;
|
||||
@@ -1672,6 +1762,8 @@ MatExpr Mat::eye(int rows, int cols, int type)
|
||||
|
||||
MatExpr Mat::eye(Size size, int type)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
MatExpr e;
|
||||
MatOp_Initializer::makeExpr(e, 'I', size, type);
|
||||
return e;
|
||||
|
||||
+106
-68
@@ -130,6 +130,8 @@ void MatAllocator::copy(UMatData* usrc, UMatData* udst, int dims, const size_t s
|
||||
const size_t srcofs[], const size_t srcstep[],
|
||||
const size_t dstofs[], const size_t dststep[], bool /*sync*/) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if(!usrc || !udst)
|
||||
return;
|
||||
int isz[CV_MAX_DIM];
|
||||
@@ -1056,6 +1058,8 @@ int Mat::checkVector(int _elemChannels, int _depth, bool _requireContinuous) con
|
||||
|
||||
void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int i, depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
CV_Assert(cn <= 4);
|
||||
switch(depth)
|
||||
@@ -2802,6 +2806,8 @@ InputOutputArray noArray() { return _none; }
|
||||
|
||||
void cv::hconcat(const Mat* src, size_t nsrc, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( nsrc == 0 || !src )
|
||||
{
|
||||
_dst.release();
|
||||
@@ -2829,12 +2835,16 @@ void cv::hconcat(const Mat* src, size_t nsrc, OutputArray _dst)
|
||||
|
||||
void cv::hconcat(InputArray src1, InputArray src2, OutputArray dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src[] = {src1.getMat(), src2.getMat()};
|
||||
hconcat(src, 2, dst);
|
||||
}
|
||||
|
||||
void cv::hconcat(InputArray _src, OutputArray dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<Mat> src;
|
||||
_src.getMatVector(src);
|
||||
hconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
|
||||
@@ -2842,6 +2852,8 @@ void cv::hconcat(InputArray _src, OutputArray dst)
|
||||
|
||||
void cv::vconcat(const Mat* src, size_t nsrc, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( nsrc == 0 || !src )
|
||||
{
|
||||
_dst.release();
|
||||
@@ -2869,12 +2881,16 @@ void cv::vconcat(const Mat* src, size_t nsrc, OutputArray _dst)
|
||||
|
||||
void cv::vconcat(InputArray src1, InputArray src2, OutputArray dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src[] = {src1.getMat(), src2.getMat()};
|
||||
vconcat(src, 2, dst);
|
||||
}
|
||||
|
||||
void cv::vconcat(InputArray _src, OutputArray dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<Mat> src;
|
||||
_src.getMatVector(src);
|
||||
vconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
|
||||
@@ -2924,6 +2940,8 @@ static bool ocl_setIdentity( InputOutputArray _m, const Scalar& s )
|
||||
|
||||
void cv::setIdentity( InputOutputArray _m, const Scalar& s )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _m.dims() <= 2 );
|
||||
|
||||
CV_OCL_RUN(_m.isUMat(),
|
||||
@@ -2969,6 +2987,8 @@ void cv::setIdentity( InputOutputArray _m, const Scalar& s )
|
||||
|
||||
cv::Scalar cv::trace( InputArray _m )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m = _m.getMat();
|
||||
CV_Assert( m.dims <= 2 );
|
||||
int i, type = m.type();
|
||||
@@ -3170,62 +3190,64 @@ static bool ocl_transpose( InputArray _src, OutputArray _dst )
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_transpose( Mat &src, Mat &dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
int type = src.type();
|
||||
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;
|
||||
ippiTransposeI ippFuncI = 0;
|
||||
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 ippiTranspose = 0;
|
||||
IppiTransposeI ippiTranspose_I = 0;
|
||||
|
||||
if (dst.data == src.data && dst.cols == dst.rows)
|
||||
{
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
ippFuncI =
|
||||
type == CV_8UC1 ? (ippiTransposeI)ippiTranspose_8u_C1IR :
|
||||
type == CV_8UC3 ? (ippiTransposeI)ippiTranspose_8u_C3IR :
|
||||
type == CV_8UC4 ? (ippiTransposeI)ippiTranspose_8u_C4IR :
|
||||
type == CV_16UC1 ? (ippiTransposeI)ippiTranspose_16u_C1IR :
|
||||
type == CV_16UC3 ? (ippiTransposeI)ippiTranspose_16u_C3IR :
|
||||
type == CV_16UC4 ? (ippiTransposeI)ippiTranspose_16u_C4IR :
|
||||
type == CV_16SC1 ? (ippiTransposeI)ippiTranspose_16s_C1IR :
|
||||
type == CV_16SC3 ? (ippiTransposeI)ippiTranspose_16s_C3IR :
|
||||
type == CV_16SC4 ? (ippiTransposeI)ippiTranspose_16s_C4IR :
|
||||
type == CV_32SC1 ? (ippiTransposeI)ippiTranspose_32s_C1IR :
|
||||
type == CV_32SC3 ? (ippiTransposeI)ippiTranspose_32s_C3IR :
|
||||
type == CV_32SC4 ? (ippiTransposeI)ippiTranspose_32s_C4IR :
|
||||
type == CV_32FC1 ? (ippiTransposeI)ippiTranspose_32f_C1IR :
|
||||
type == CV_32FC3 ? (ippiTransposeI)ippiTranspose_32f_C3IR :
|
||||
type == CV_32FC4 ? (ippiTransposeI)ippiTranspose_32f_C4IR : 0;
|
||||
ippiTranspose_I =
|
||||
type == CV_8UC1 ? (IppiTransposeI)ippiTranspose_8u_C1IR :
|
||||
type == CV_8UC3 ? (IppiTransposeI)ippiTranspose_8u_C3IR :
|
||||
type == CV_8UC4 ? (IppiTransposeI)ippiTranspose_8u_C4IR :
|
||||
type == CV_16UC1 ? (IppiTransposeI)ippiTranspose_16u_C1IR :
|
||||
type == CV_16UC3 ? (IppiTransposeI)ippiTranspose_16u_C3IR :
|
||||
type == CV_16UC4 ? (IppiTransposeI)ippiTranspose_16u_C4IR :
|
||||
type == CV_16SC1 ? (IppiTransposeI)ippiTranspose_16s_C1IR :
|
||||
type == CV_16SC3 ? (IppiTransposeI)ippiTranspose_16s_C3IR :
|
||||
type == CV_16SC4 ? (IppiTransposeI)ippiTranspose_16s_C4IR :
|
||||
type == CV_32SC1 ? (IppiTransposeI)ippiTranspose_32s_C1IR :
|
||||
type == CV_32SC3 ? (IppiTransposeI)ippiTranspose_32s_C3IR :
|
||||
type == CV_32SC4 ? (IppiTransposeI)ippiTranspose_32s_C4IR :
|
||||
type == CV_32FC1 ? (IppiTransposeI)ippiTranspose_32f_C1IR :
|
||||
type == CV_32FC3 ? (IppiTransposeI)ippiTranspose_32f_C3IR :
|
||||
type == CV_32FC4 ? (IppiTransposeI)ippiTranspose_32f_C4IR : 0;
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
else
|
||||
{
|
||||
ippFunc =
|
||||
type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiTranspose)ippiTranspose_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiTranspose)ippiTranspose_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiTranspose)ippiTranspose_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiTranspose)ippiTranspose_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiTranspose)ippiTranspose_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiTranspose)ippiTranspose_16s_C1R :
|
||||
type == CV_16SC3 ? (ippiTranspose)ippiTranspose_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiTranspose)ippiTranspose_16s_C4R :
|
||||
type == CV_32SC1 ? (ippiTranspose)ippiTranspose_32s_C1R :
|
||||
type == CV_32SC3 ? (ippiTranspose)ippiTranspose_32s_C3R :
|
||||
type == CV_32SC4 ? (ippiTranspose)ippiTranspose_32s_C4R :
|
||||
type == CV_32FC1 ? (ippiTranspose)ippiTranspose_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiTranspose)ippiTranspose_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0;
|
||||
ippiTranspose =
|
||||
type == CV_8UC1 ? (IppiTranspose)ippiTranspose_8u_C1R :
|
||||
type == CV_8UC3 ? (IppiTranspose)ippiTranspose_8u_C3R :
|
||||
type == CV_8UC4 ? (IppiTranspose)ippiTranspose_8u_C4R :
|
||||
type == CV_16UC1 ? (IppiTranspose)ippiTranspose_16u_C1R :
|
||||
type == CV_16UC3 ? (IppiTranspose)ippiTranspose_16u_C3R :
|
||||
type == CV_16UC4 ? (IppiTranspose)ippiTranspose_16u_C4R :
|
||||
type == CV_16SC1 ? (IppiTranspose)ippiTranspose_16s_C1R :
|
||||
type == CV_16SC3 ? (IppiTranspose)ippiTranspose_16s_C3R :
|
||||
type == CV_16SC4 ? (IppiTranspose)ippiTranspose_16s_C4R :
|
||||
type == CV_32SC1 ? (IppiTranspose)ippiTranspose_32s_C1R :
|
||||
type == CV_32SC3 ? (IppiTranspose)ippiTranspose_32s_C3R :
|
||||
type == CV_32SC4 ? (IppiTranspose)ippiTranspose_32s_C4R :
|
||||
type == CV_32FC1 ? (IppiTranspose)ippiTranspose_32f_C1R :
|
||||
type == CV_32FC3 ? (IppiTranspose)ippiTranspose_32f_C3R :
|
||||
type == CV_32FC4 ? (IppiTranspose)ippiTranspose_32f_C4R : 0;
|
||||
}
|
||||
|
||||
IppiSize roiSize = { src.cols, src.rows };
|
||||
if (ippFunc != 0)
|
||||
if (ippiTranspose != 0)
|
||||
{
|
||||
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiTranspose, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||
return true;
|
||||
}
|
||||
else if (ippFuncI != 0)
|
||||
else if (ippiTranspose_I != 0)
|
||||
{
|
||||
if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiTranspose_I, dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -3237,6 +3259,8 @@ static bool ipp_transpose( Mat &src, Mat &dst )
|
||||
|
||||
void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), esz = CV_ELEM_SIZE(type);
|
||||
CV_Assert( _src.dims() <= 2 && esz <= 32 );
|
||||
|
||||
@@ -3261,7 +3285,7 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
return;
|
||||
}
|
||||
|
||||
CV_IPP_RUN(true, ipp_transpose(src, dst))
|
||||
CV_IPP_RUN_FAST(ipp_transpose(src, dst))
|
||||
|
||||
if( dst.data == src.data )
|
||||
{
|
||||
@@ -3283,6 +3307,8 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
|
||||
void cv::completeSymm( InputOutputArray _m, bool LtoR )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat m = _m.getMat();
|
||||
size_t step = m.step, esz = m.elemSize();
|
||||
CV_Assert( m.dims <= 2 && m.rows == m.cols );
|
||||
@@ -3458,43 +3484,43 @@ static inline bool ipp_reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat
|
||||
|
||||
IppiSize roisize = { srcmat.size().width, 1 };
|
||||
|
||||
typedef IppStatus (CV_STDCALL * ippiSum)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum);
|
||||
typedef IppStatus (CV_STDCALL * ippiSumHint)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum, IppHintAlgorithm hint);
|
||||
ippiSum ippFunc = 0;
|
||||
ippiSumHint ippFuncHint = 0;
|
||||
typedef IppStatus (CV_STDCALL * IppiSum)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum);
|
||||
typedef IppStatus (CV_STDCALL * IppiSumHint)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum, IppHintAlgorithm hint);
|
||||
IppiSum ippiSum = 0;
|
||||
IppiSumHint ippiSumHint = 0;
|
||||
|
||||
if(ddepth == CV_64F)
|
||||
{
|
||||
ippFunc =
|
||||
stype == CV_8UC1 ? (ippiSum)ippiSum_8u_C1R :
|
||||
stype == CV_8UC3 ? (ippiSum)ippiSum_8u_C3R :
|
||||
stype == CV_8UC4 ? (ippiSum)ippiSum_8u_C4R :
|
||||
stype == CV_16UC1 ? (ippiSum)ippiSum_16u_C1R :
|
||||
stype == CV_16UC3 ? (ippiSum)ippiSum_16u_C3R :
|
||||
stype == CV_16UC4 ? (ippiSum)ippiSum_16u_C4R :
|
||||
stype == CV_16SC1 ? (ippiSum)ippiSum_16s_C1R :
|
||||
stype == CV_16SC3 ? (ippiSum)ippiSum_16s_C3R :
|
||||
stype == CV_16SC4 ? (ippiSum)ippiSum_16s_C4R : 0;
|
||||
ippFuncHint =
|
||||
stype == CV_32FC1 ? (ippiSumHint)ippiSum_32f_C1R :
|
||||
stype == CV_32FC3 ? (ippiSumHint)ippiSum_32f_C3R :
|
||||
stype == CV_32FC4 ? (ippiSumHint)ippiSum_32f_C4R : 0;
|
||||
ippiSum =
|
||||
stype == CV_8UC1 ? (IppiSum)ippiSum_8u_C1R :
|
||||
stype == CV_8UC3 ? (IppiSum)ippiSum_8u_C3R :
|
||||
stype == CV_8UC4 ? (IppiSum)ippiSum_8u_C4R :
|
||||
stype == CV_16UC1 ? (IppiSum)ippiSum_16u_C1R :
|
||||
stype == CV_16UC3 ? (IppiSum)ippiSum_16u_C3R :
|
||||
stype == CV_16UC4 ? (IppiSum)ippiSum_16u_C4R :
|
||||
stype == CV_16SC1 ? (IppiSum)ippiSum_16s_C1R :
|
||||
stype == CV_16SC3 ? (IppiSum)ippiSum_16s_C3R :
|
||||
stype == CV_16SC4 ? (IppiSum)ippiSum_16s_C4R : 0;
|
||||
ippiSumHint =
|
||||
stype == CV_32FC1 ? (IppiSumHint)ippiSum_32f_C1R :
|
||||
stype == CV_32FC3 ? (IppiSumHint)ippiSum_32f_C3R :
|
||||
stype == CV_32FC4 ? (IppiSumHint)ippiSum_32f_C4R : 0;
|
||||
}
|
||||
|
||||
if(ippFunc)
|
||||
if(ippiSum)
|
||||
{
|
||||
for(int y = 0; y < srcmat.size().height; y++)
|
||||
{
|
||||
if(ippFunc(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y)) < 0)
|
||||
if(CV_INSTRUMENT_FUN_IPP(ippiSum, srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y)) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(ippFuncHint)
|
||||
else if(ippiSumHint)
|
||||
{
|
||||
for(int y = 0; y < srcmat.size().height; y++)
|
||||
{
|
||||
if(ippFuncHint(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y), ippAlgHintAccurate) < 0)
|
||||
if(CV_INSTRUMENT_FUN_IPP(ippiSumHint, srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y), ippAlgHintAccurate) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -3505,7 +3531,7 @@ static inline bool ipp_reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat
|
||||
|
||||
static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& dstmat)
|
||||
{
|
||||
CV_IPP_RUN(true, ipp_reduceSumC_8u16u16s32f_64f(srcmat, dstmat));
|
||||
CV_IPP_RUN_FAST(ipp_reduceSumC_8u16u16s32f_64f(srcmat, dstmat));
|
||||
|
||||
cv::ReduceFunc func = 0;
|
||||
|
||||
@@ -3555,7 +3581,7 @@ static inline bool ipp_reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat&
|
||||
IppiSize roisize = ippiSize(srcmat.size().width, 1);\
|
||||
for(int y = 0; y < srcmat.size().height; y++)\
|
||||
{\
|
||||
if(ippi##optype##_##favor##_C1R(srcmat.ptr<IppType>(y), sstep, roisize, dstmat.ptr<IppType>(y)) < 0)\
|
||||
if(CV_INSTRUMENT_FUN_IPP(ippi##optype##_##favor##_C1R, srcmat.ptr<IppType>(y), sstep, roisize, dstmat.ptr<IppType>(y)) < 0)\
|
||||
return false;\
|
||||
}\
|
||||
return true;\
|
||||
@@ -3564,7 +3590,7 @@ static inline bool ipp_reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat&
|
||||
} \
|
||||
static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstmat) \
|
||||
{ \
|
||||
CV_IPP_RUN(true, ipp_reduce##optype##C##favor(srcmat, dstmat)); \
|
||||
CV_IPP_RUN_FAST(ipp_reduce##optype##C##favor(srcmat, dstmat)); \
|
||||
cv::reduceC_ < type1, type2, cv::Op##optype < type2 > >(srcmat, dstmat); \
|
||||
}
|
||||
#endif
|
||||
@@ -3704,6 +3730,8 @@ static bool ocl_reduce(InputArray _src, OutputArray _dst,
|
||||
|
||||
void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _src.dims() <= 2 );
|
||||
int op0 = op;
|
||||
int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype);
|
||||
@@ -3948,7 +3976,7 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
|
||||
}
|
||||
|
||||
#ifdef USE_IPP_SORT
|
||||
if (!ippSortFunc || ippSortFunc(ptr, len) < 0)
|
||||
if (!ippSortFunc || CV_INSTRUMENT_FUN_IPP(ippSortFunc, ptr, len) < 0)
|
||||
#endif
|
||||
{
|
||||
#ifdef USE_IPP_SORT
|
||||
@@ -3959,7 +3987,7 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
|
||||
if( sortDescending )
|
||||
{
|
||||
#ifdef USE_IPP_SORT
|
||||
if (!ippFlipFunc || ippFlipFunc(ptr, len) < 0)
|
||||
if (!ippFlipFunc || CV_INSTRUMENT_FUN_IPP(ippFlipFunc, ptr, len) < 0)
|
||||
#endif
|
||||
{
|
||||
#ifdef USE_IPP_SORT
|
||||
@@ -4120,6 +4148,8 @@ typedef void (*SortFunc)(const Mat& src, Mat& dst, int flags);
|
||||
|
||||
void cv::sort( InputArray _src, OutputArray _dst, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
static SortFunc tab[] =
|
||||
{
|
||||
sort_<uchar>, sort_<schar>, sort_<ushort>, sort_<short>,
|
||||
@@ -4135,6 +4165,8 @@ void cv::sort( InputArray _src, OutputArray _dst, int flags )
|
||||
|
||||
void cv::sortIdx( InputArray _src, OutputArray _dst, int flags )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
static SortFunc tab[] =
|
||||
{
|
||||
sortIdx_<uchar>, sortIdx_<schar>, sortIdx_<ushort>, sortIdx_<short>,
|
||||
@@ -5341,6 +5373,8 @@ SparseMatConstIterator& SparseMatConstIterator::operator ++()
|
||||
|
||||
double norm( const SparseMat& src, int normType )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
SparseMatConstIterator it = src.begin();
|
||||
|
||||
size_t i, N = src.nzcount();
|
||||
@@ -5390,6 +5424,8 @@ double norm( const SparseMat& src, int normType )
|
||||
|
||||
void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _minidx, int* _maxidx )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
SparseMatConstIterator it = src.begin();
|
||||
size_t i, N = src.nzcount(), d = src.hdr ? src.hdr->dims : 0;
|
||||
int type = src.type();
|
||||
@@ -5453,6 +5489,8 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
|
||||
|
||||
void normalize( const SparseMat& src, SparseMat& dst, double a, int norm_type )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
double scale = 1;
|
||||
if( norm_type == CV_L2 || norm_type == CV_L1 || norm_type == CV_C )
|
||||
{
|
||||
|
||||
@@ -109,6 +109,8 @@ LUImpl(_Tp* A, size_t astep, int m, _Tp* b, size_t bstep, int n, _Tp eps)
|
||||
|
||||
int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int output;
|
||||
CALL_HAL_RET(LU32f, cv_hal_LU32f, output, A, astep, m, b, bstep, n)
|
||||
output = LUImpl(A, astep, m, b, bstep, n, FLT_EPSILON*10);
|
||||
@@ -118,6 +120,8 @@ int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n)
|
||||
|
||||
int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int output;
|
||||
CALL_HAL_RET(LU64f, cv_hal_LU64f, output, A, astep, m, b, bstep, n)
|
||||
output = LUImpl(A, astep, m, b, bstep, n, DBL_EPSILON*100);
|
||||
@@ -205,6 +209,8 @@ CholImpl(_Tp* A, size_t astep, int m, _Tp* b, size_t bstep, int n)
|
||||
|
||||
bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool output;
|
||||
CALL_HAL_RET(Cholesky32f, cv_hal_Cholesky32f, output, A, astep, m, b, bstep, n)
|
||||
return CholImpl(A, astep, m, b, bstep, n);
|
||||
@@ -212,6 +218,8 @@ bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n)
|
||||
|
||||
bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool output;
|
||||
CALL_HAL_RET(Cholesky64f, cv_hal_Cholesky64f, output, A, astep, m, b, bstep, n)
|
||||
return CholImpl(A, astep, m, b, bstep, n);
|
||||
|
||||
@@ -351,6 +351,8 @@ Mat PCA::backProject(InputArray data) const
|
||||
void cv::PCACompute(InputArray data, InputOutputArray mean,
|
||||
OutputArray eigenvectors, int maxComponents)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
PCA pca;
|
||||
pca(data, mean, 0, maxComponents);
|
||||
pca.mean.copyTo(mean);
|
||||
@@ -360,6 +362,8 @@ void cv::PCACompute(InputArray data, InputOutputArray mean,
|
||||
void cv::PCACompute(InputArray data, InputOutputArray mean,
|
||||
OutputArray eigenvectors, double retainedVariance)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
PCA pca;
|
||||
pca(data, mean, 0, retainedVariance);
|
||||
pca.mean.copyTo(mean);
|
||||
@@ -369,6 +373,8 @@ void cv::PCACompute(InputArray data, InputOutputArray mean,
|
||||
void cv::PCAProject(InputArray data, InputArray mean,
|
||||
InputArray eigenvectors, OutputArray result)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
PCA pca;
|
||||
pca.mean = mean.getMat();
|
||||
pca.eigenvectors = eigenvectors.getMat();
|
||||
@@ -378,6 +384,8 @@ void cv::PCAProject(InputArray data, InputArray mean,
|
||||
void cv::PCABackProject(InputArray data, InputArray mean,
|
||||
InputArray eigenvectors, OutputArray result)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
PCA pca;
|
||||
pca.mean = mean.getMat();
|
||||
pca.eigenvectors = eigenvectors.getMat();
|
||||
|
||||
@@ -5823,6 +5823,8 @@ FileStorage::~FileStorage()
|
||||
|
||||
bool FileStorage::open(const String& filename, int flags, const String& encoding)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
release();
|
||||
fs.reset(cvOpenFileStorage( filename.c_str(), 0, flags,
|
||||
!encoding.empty() ? encoding.c_str() : 0));
|
||||
@@ -5860,6 +5862,8 @@ FileNode FileStorage::root(int streamidx) const
|
||||
|
||||
FileStorage& operator << (FileStorage& fs, const String& str)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED,
|
||||
VALUE_EXPECTED = FileStorage::VALUE_EXPECTED,
|
||||
INSIDE_MAP = FileStorage::INSIDE_MAP };
|
||||
|
||||
@@ -742,11 +742,15 @@ void cv::setRNGSeed(int seed)
|
||||
|
||||
void cv::randu(InputOutputArray dst, InputArray low, InputArray high)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
theRNG().fill(dst, RNG::UNIFORM, low, high);
|
||||
}
|
||||
|
||||
void cv::randn(InputOutputArray dst, InputArray mean, InputArray stddev)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
theRNG().fill(dst, RNG::NORMAL, mean, stddev);
|
||||
}
|
||||
|
||||
@@ -793,6 +797,8 @@ typedef void (*RandShuffleFunc)( Mat& dst, RNG& rng, double iterFactor );
|
||||
|
||||
void cv::randShuffle( InputOutputArray _dst, double iterFactor, RNG* _rng )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
RandShuffleFunc tab[] =
|
||||
{
|
||||
0,
|
||||
|
||||
+98
-65
@@ -1137,6 +1137,8 @@ static bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_sum(Mat &src, Scalar &_res)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
int cn = src.channels();
|
||||
size_t total_size = src.total();
|
||||
@@ -1147,12 +1149,12 @@ static bool ipp_sum(Mat &src, Scalar &_res)
|
||||
int type = src.type();
|
||||
typedef IppStatus (CV_STDCALL* ippiSumFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm);
|
||||
typedef IppStatus (CV_STDCALL* ippiSumFuncNoHint)(const void*, int, IppiSize, double *);
|
||||
ippiSumFuncHint ippFuncHint =
|
||||
ippiSumFuncHint ippiSumHint =
|
||||
type == CV_32FC1 ? (ippiSumFuncHint)ippiSum_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiSumFuncHint)ippiSum_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiSumFuncHint)ippiSum_32f_C4R :
|
||||
0;
|
||||
ippiSumFuncNoHint ippFuncNoHint =
|
||||
ippiSumFuncNoHint ippiSum =
|
||||
type == CV_8UC1 ? (ippiSumFuncNoHint)ippiSum_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiSumFuncNoHint)ippiSum_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiSumFuncNoHint)ippiSum_8u_C4R :
|
||||
@@ -1163,12 +1165,13 @@ static bool ipp_sum(Mat &src, Scalar &_res)
|
||||
type == CV_16SC3 ? (ippiSumFuncNoHint)ippiSum_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiSumFuncNoHint)ippiSum_16s_C4R :
|
||||
0;
|
||||
CV_Assert(!ippFuncHint || !ippFuncNoHint);
|
||||
if( ippFuncHint || ippFuncNoHint )
|
||||
CV_Assert(!ippiSumHint || !ippiSum);
|
||||
if( ippiSumHint || ippiSum )
|
||||
{
|
||||
Ipp64f res[4];
|
||||
IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) :
|
||||
ippFuncNoHint(src.ptr(), (int)src.step[0], sz, res);
|
||||
IppStatus ret = ippiSumHint ?
|
||||
CV_INSTRUMENT_FUN_IPP(ippiSumHint, src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) :
|
||||
CV_INSTRUMENT_FUN_IPP(ippiSum, src.ptr(), (int)src.step[0], sz, res);
|
||||
if( ret >= 0 )
|
||||
{
|
||||
for( int i = 0; i < cn; i++ )
|
||||
@@ -1188,6 +1191,8 @@ static bool ipp_sum(Mat &src, Scalar &_res)
|
||||
|
||||
cv::Scalar cv::sum( InputArray _src )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
#if defined HAVE_OPENCL || defined HAVE_IPP
|
||||
Scalar _res;
|
||||
#endif
|
||||
@@ -1299,6 +1304,8 @@ namespace cv {
|
||||
|
||||
static bool ipp_countNonZero( Mat &src, int &res )
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
Ipp32s count = 0;
|
||||
IppStatus status = ippStsNoErr;
|
||||
|
||||
@@ -1313,9 +1320,9 @@ static bool ipp_countNonZero( Mat &src, int &res )
|
||||
}
|
||||
|
||||
if (depth == CV_8U)
|
||||
status = ippiCountInRange_8u_C1R((const Ipp8u *)src.data, srcstep, roiSize, &count, 0, 0);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiCountInRange_8u_C1R, (const Ipp8u *)src.data, srcstep, roiSize, &count, 0, 0);
|
||||
else if (depth == CV_32F)
|
||||
status = ippiCountInRange_32f_C1R((const Ipp32f *)src.data, srcstep, roiSize, &count, 0, 0);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiCountInRange_32f_C1R, (const Ipp32f *)src.data, srcstep, roiSize, &count, 0, 0);
|
||||
|
||||
if (status >= 0)
|
||||
{
|
||||
@@ -1330,6 +1337,8 @@ static bool ipp_countNonZero( Mat &src, int &res )
|
||||
|
||||
int cv::countNonZero( InputArray _src )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), cn = CV_MAT_CN(type);
|
||||
CV_Assert( cn == 1 );
|
||||
|
||||
@@ -1365,6 +1374,8 @@ namespace cv
|
||||
{
|
||||
static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret )
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||
@@ -1375,32 +1386,32 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret )
|
||||
if( !mask.empty() )
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||
ippiMaskMeanFuncC1 ippFuncC1 =
|
||||
ippiMaskMeanFuncC1 ippiMean_C1MR =
|
||||
type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR :
|
||||
type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR :
|
||||
type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR :
|
||||
0;
|
||||
if( ippFuncC1 )
|
||||
if( ippiMean_C1MR )
|
||||
{
|
||||
Ipp64f res;
|
||||
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiMean_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 )
|
||||
{
|
||||
ret = Scalar(res);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||
ippiMaskMeanFuncC3 ippFuncC3 =
|
||||
ippiMaskMeanFuncC3 ippiMean_C3MR =
|
||||
type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR :
|
||||
type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR :
|
||||
type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR :
|
||||
0;
|
||||
if( ippFuncC3 )
|
||||
if( ippiMean_C3MR )
|
||||
{
|
||||
Ipp64f res1, res2, res3;
|
||||
if( ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &res1) >= 0 &&
|
||||
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 &&
|
||||
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiMean_C3MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &res1) >= 0 &&
|
||||
CV_INSTRUMENT_FUN_IPP(ippiMean_C3MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 &&
|
||||
CV_INSTRUMENT_FUN_IPP(ippiMean_C3MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 )
|
||||
{
|
||||
ret = Scalar(res1, res2, res3);
|
||||
return true;
|
||||
@@ -1411,12 +1422,12 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret )
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMeanFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm);
|
||||
typedef IppStatus (CV_STDCALL* ippiMeanFuncNoHint)(const void*, int, IppiSize, double *);
|
||||
ippiMeanFuncHint ippFuncHint =
|
||||
ippiMeanFuncHint ippiMeanHint =
|
||||
type == CV_32FC1 ? (ippiMeanFuncHint)ippiMean_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiMeanFuncHint)ippiMean_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiMeanFuncHint)ippiMean_32f_C4R :
|
||||
0;
|
||||
ippiMeanFuncNoHint ippFuncNoHint =
|
||||
ippiMeanFuncNoHint ippiMean =
|
||||
type == CV_8UC1 ? (ippiMeanFuncNoHint)ippiMean_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiMeanFuncNoHint)ippiMean_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiMeanFuncNoHint)ippiMean_8u_C4R :
|
||||
@@ -1428,12 +1439,12 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret )
|
||||
type == CV_16SC4 ? (ippiMeanFuncNoHint)ippiMean_16s_C4R :
|
||||
0;
|
||||
// Make sure only zero or one version of the function pointer is valid
|
||||
CV_Assert(!ippFuncHint || !ippFuncNoHint);
|
||||
if( ippFuncHint || ippFuncNoHint )
|
||||
CV_Assert(!ippiMeanHint || !ippiMean);
|
||||
if( ippiMeanHint || ippiMean )
|
||||
{
|
||||
Ipp64f res[4];
|
||||
IppStatus status = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) :
|
||||
ippFuncNoHint(src.ptr(), (int)src.step[0], sz, res);
|
||||
IppStatus status = ippiMeanHint ? CV_INSTRUMENT_FUN_IPP(ippiMeanHint, src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) :
|
||||
CV_INSTRUMENT_FUN_IPP(ippiMean, src.ptr(), (int)src.step[0], sz, res);
|
||||
if( status >= 0 )
|
||||
{
|
||||
for( int i = 0; i < src.channels(); i++ )
|
||||
@@ -1453,6 +1464,8 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret )
|
||||
|
||||
cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8U );
|
||||
|
||||
@@ -2216,6 +2229,8 @@ 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)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
#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();
|
||||
@@ -2230,7 +2245,7 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx
|
||||
IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *);
|
||||
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
ippiMaskMinMaxIndxFuncC1 ippFuncC1 =
|
||||
ippiMaskMinMaxIndxFuncC1 ippiMinMaxIndx_C1MR =
|
||||
type == CV_8UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1MR :
|
||||
#if IPP_VERSION_X100 < 900
|
||||
type == CV_8SC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1MR :
|
||||
@@ -2239,11 +2254,11 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx
|
||||
type == CV_32FC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1MR : 0;
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
|
||||
if( ippFuncC1 )
|
||||
if( ippiMinMaxIndx_C1MR )
|
||||
{
|
||||
Ipp32f min, max;
|
||||
IppiPoint minp, maxp;
|
||||
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiMinMaxIndx_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
|
||||
{
|
||||
if( minVal )
|
||||
*minVal = (double)min;
|
||||
@@ -2270,7 +2285,7 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx
|
||||
typedef IppStatus (CV_STDCALL* ippiMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *);
|
||||
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
ippiMinMaxIndxFuncC1 ippFuncC1 =
|
||||
ippiMinMaxIndxFuncC1 ippiMinMaxIndx_C1R =
|
||||
#if IPP_VERSION_X100 != 900 // bug in 9.0.0 avx2 optimization
|
||||
depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R :
|
||||
#endif
|
||||
@@ -2286,11 +2301,11 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx
|
||||
0;
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
|
||||
if( ippFuncC1 )
|
||||
if( ippiMinMaxIndx_C1R )
|
||||
{
|
||||
Ipp32f min, max;
|
||||
IppiPoint minp, maxp;
|
||||
if( ippFuncC1(src.ptr(), (int)src.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiMinMaxIndx_C1R, src.ptr(), (int)src.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
|
||||
{
|
||||
if( minVal )
|
||||
*minVal = (double)min;
|
||||
@@ -2324,6 +2339,8 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
||||
double* maxVal, int* minIdx, int* maxIdx,
|
||||
InputArray _mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
CV_Assert( (cn == 1 && (_mask.empty() || _mask.type() == CV_8U)) ||
|
||||
(cn > 1 && _mask.empty() && !minIdx && !maxIdx) );
|
||||
@@ -2386,6 +2403,8 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
||||
void cv::minMaxLoc( InputArray _img, double* minVal, double* maxVal,
|
||||
Point* minLoc, Point* maxLoc, InputArray mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(_img.dims() <= 2);
|
||||
|
||||
minMaxIdx(_img, minVal, maxVal, (int*)minLoc, (int*)maxLoc, mask);
|
||||
@@ -2665,6 +2684,8 @@ 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)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
int cn = src.channels();
|
||||
size_t total_size = src.total();
|
||||
@@ -2680,7 +2701,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
if( !mask.empty() )
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||
ippiMaskNormFuncC1 ippFuncC1 =
|
||||
ippiMaskNormFuncC1 ippiNorm_C1MR =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8u_C1MR :
|
||||
#if IPP_VERSION_X100 < 900
|
||||
@@ -2705,10 +2726,10 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_16u_C1MR :
|
||||
type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_32f_C1MR :
|
||||
0) : 0;
|
||||
if( ippFuncC1 )
|
||||
if( ippiNorm_C1MR )
|
||||
{
|
||||
Ipp64f norm;
|
||||
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNorm_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||
{
|
||||
result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm);
|
||||
return true;
|
||||
@@ -2716,7 +2737,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
}
|
||||
#if IPP_DISABLE_BLOCK
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||
ippiMaskNormFuncC3 ippFuncC3 =
|
||||
ippiMaskNormFuncC3 ippiNorm_C3CMR =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8u_C3CMR :
|
||||
#if IPP_VERSION_X100 < 900
|
||||
@@ -2741,12 +2762,12 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_16u_C3CMR :
|
||||
type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_32f_C3CMR :
|
||||
0) : 0;
|
||||
if( ippFuncC3 )
|
||||
if( ippiNorm_C3CMR )
|
||||
{
|
||||
Ipp64f norm1, norm2, norm3;
|
||||
if( ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 &&
|
||||
ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 &&
|
||||
ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0)
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, (src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1)) >= 0 &&
|
||||
CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, (src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2)) >= 0 &&
|
||||
CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, (src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3)) >= 0)
|
||||
{
|
||||
Ipp64f norm =
|
||||
normType == NORM_INF ? std::max(std::max(norm1, norm2), norm3) :
|
||||
@@ -2763,7 +2784,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint);
|
||||
typedef IppStatus (CV_STDCALL* ippiNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *);
|
||||
ippiNormFuncHint ippFuncHint =
|
||||
ippiNormFuncHint ippiNormHint =
|
||||
normType == NORM_L1 ?
|
||||
(type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L1_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L1_32f_C3R :
|
||||
@@ -2774,7 +2795,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L2_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiNormFuncHint)ippiNorm_L2_32f_C4R :
|
||||
0) : 0;
|
||||
ippiNormFuncNoHint ippFuncNoHint =
|
||||
ippiNormFuncNoHint ippiNorm =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C3R :
|
||||
@@ -2814,12 +2835,12 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C4R :
|
||||
0) : 0;
|
||||
// Make sure only zero or one version of the function pointer is valid
|
||||
CV_Assert(!ippFuncHint || !ippFuncNoHint);
|
||||
if( ippFuncHint || ippFuncNoHint )
|
||||
CV_Assert(!ippiNormHint || !ippiNorm);
|
||||
if( ippiNormHint || ippiNorm )
|
||||
{
|
||||
Ipp64f norm_array[4];
|
||||
IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, norm_array, ippAlgHintAccurate) :
|
||||
ippFuncNoHint(src.ptr(), (int)src.step[0], sz, norm_array);
|
||||
IppStatus ret = ippiNormHint ? CV_INSTRUMENT_FUN_IPP(ippiNormHint, src.ptr(), (int)src.step[0], sz, norm_array, ippAlgHintAccurate) :
|
||||
CV_INSTRUMENT_FUN_IPP(ippiNorm, src.ptr(), (int)src.step[0], sz, norm_array);
|
||||
if( ret >= 0 )
|
||||
{
|
||||
Ipp64f norm = (normType == NORM_L2 || normType == NORM_L2SQR) ? norm_array[0] * norm_array[0] : norm_array[0];
|
||||
@@ -2847,6 +2868,8 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
|
||||
double cv::norm( InputArray _src, int normType, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
normType &= NORM_TYPE_MASK;
|
||||
CV_Assert( normType == NORM_INF || normType == NORM_L1 ||
|
||||
normType == NORM_L2 || normType == NORM_L2SQR ||
|
||||
@@ -3067,6 +3090,8 @@ namespace cv
|
||||
{
|
||||
static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArray _mask, double &result)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
#if IPP_VERSION_X100 >= 700
|
||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
||||
|
||||
@@ -3087,7 +3112,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
if( !mask.empty() )
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskNormRelFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||
ippiMaskNormRelFuncC1 ippFuncC1 =
|
||||
ippiMaskNormRelFuncC1 ippiNormDiff_C1MR =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_8u_C1MR :
|
||||
#if IPP_VERSION_X100 < 900
|
||||
@@ -3116,10 +3141,10 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_16u_C1MR :
|
||||
type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_32f_C1MR :
|
||||
0) : 0;
|
||||
if( ippFuncC1 )
|
||||
if( ippiNormDiff_C1MR )
|
||||
{
|
||||
Ipp64f norm;
|
||||
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C1MR, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||
{
|
||||
result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm);
|
||||
return true;
|
||||
@@ -3130,7 +3155,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiNormRelFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||
typedef IppStatus (CV_STDCALL* ippiNormRelFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint);
|
||||
ippiNormRelFuncNoHint ippFuncNoHint =
|
||||
ippiNormRelFuncNoHint ippiNormDiff =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R :
|
||||
type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R :
|
||||
@@ -3147,26 +3172,26 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R :
|
||||
type == CV_16SC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16s_C1R :
|
||||
0) : 0;
|
||||
ippiNormRelFuncHint ippFuncHint =
|
||||
ippiNormRelFuncHint ippiNormDiffHint =
|
||||
normType == NORM_L1 ?
|
||||
(type == CV_32FC1 ? (ippiNormRelFuncHint)ippiNormRel_L1_32f_C1R :
|
||||
0) :
|
||||
normType == NORM_L2 || normType == NORM_L2SQR ?
|
||||
(type == CV_32FC1 ? (ippiNormRelFuncHint)ippiNormRel_L2_32f_C1R :
|
||||
0) : 0;
|
||||
if (ippFuncNoHint)
|
||||
if (ippiNormDiff)
|
||||
{
|
||||
Ipp64f norm;
|
||||
if( ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 )
|
||||
{
|
||||
result = (double)norm;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ippFuncHint)
|
||||
if (ippiNormDiffHint)
|
||||
{
|
||||
Ipp64f norm;
|
||||
if( ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNormDiffHint, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 )
|
||||
{
|
||||
result = (double)norm;
|
||||
return true;
|
||||
@@ -3194,7 +3219,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
if( !mask.empty() )
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||
ippiMaskNormDiffFuncC1 ippFuncC1 =
|
||||
ippiMaskNormDiffFuncC1 ippiNormDiff_C1MR =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_8u_C1MR :
|
||||
#if IPP_VERSION_X100 < 900
|
||||
@@ -3221,10 +3246,10 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_16u_C1MR :
|
||||
type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_32f_C1MR :
|
||||
0) : 0;
|
||||
if( ippFuncC1 )
|
||||
if( ippiNormDiff_C1MR )
|
||||
{
|
||||
Ipp64f norm;
|
||||
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C1MR, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||
{
|
||||
result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm);
|
||||
return true;
|
||||
@@ -3232,7 +3257,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
}
|
||||
#ifndef __APPLE__
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC3)(const void *, int, const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||
ippiMaskNormDiffFuncC3 ippFuncC3 =
|
||||
ippiMaskNormDiffFuncC3 ippiNormDiff_C3CMR =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_8u_C3CMR :
|
||||
#if IPP_VERSION_X100 < 900
|
||||
@@ -3257,12 +3282,12 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_16u_C3CMR :
|
||||
type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_32f_C3CMR :
|
||||
0) : 0;
|
||||
if( ippFuncC3 )
|
||||
if( ippiNormDiff_C3CMR )
|
||||
{
|
||||
Ipp64f norm1, norm2, norm3;
|
||||
if( ippFuncC3(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 &&
|
||||
ippFuncC3(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 &&
|
||||
ippFuncC3(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0)
|
||||
if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C3CMR, src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 &&
|
||||
CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C3CMR, src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 &&
|
||||
CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C3CMR, src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0)
|
||||
{
|
||||
Ipp64f norm =
|
||||
normType == NORM_INF ? std::max(std::max(norm1, norm2), norm3) :
|
||||
@@ -3279,7 +3304,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint);
|
||||
typedef IppStatus (CV_STDCALL* ippiNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||
ippiNormDiffFuncHint ippFuncHint =
|
||||
ippiNormDiffFuncHint ippiNormDiffHint =
|
||||
normType == NORM_L1 ?
|
||||
(type == CV_32FC1 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C3R :
|
||||
@@ -3290,7 +3315,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C4R :
|
||||
0) : 0;
|
||||
ippiNormDiffFuncNoHint ippFuncNoHint =
|
||||
ippiNormDiffFuncNoHint ippiNormDiff =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C3R :
|
||||
@@ -3332,12 +3357,12 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C4R :
|
||||
0) : 0;
|
||||
// Make sure only zero or one version of the function pointer is valid
|
||||
CV_Assert(!ippFuncHint || !ippFuncNoHint);
|
||||
if( ippFuncHint || ippFuncNoHint )
|
||||
CV_Assert(!ippiNormDiffHint || !ippiNormDiff);
|
||||
if( ippiNormDiffHint || ippiNormDiff )
|
||||
{
|
||||
Ipp64f norm_array[4];
|
||||
IppStatus ret = ippFuncHint ? ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array, ippAlgHintAccurate) :
|
||||
ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array);
|
||||
IppStatus ret = ippiNormDiffHint ? CV_INSTRUMENT_FUN_IPP(ippiNormDiffHint, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array, ippAlgHintAccurate) :
|
||||
CV_INSTRUMENT_FUN_IPP(ippiNormDiff, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array);
|
||||
if( ret >= 0 )
|
||||
{
|
||||
Ipp64f norm = (normType == NORM_L2 || normType == NORM_L2SQR) ? norm_array[0] * norm_array[0] : norm_array[0];
|
||||
@@ -3366,6 +3391,8 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
|
||||
double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _src1.sameSize(_src2) && _src1.type() == _src2.type() );
|
||||
|
||||
#if defined HAVE_OPENCL || defined HAVE_IPP
|
||||
@@ -3750,6 +3777,8 @@ void cv::batchDistance( InputArray _src1, InputArray _src2,
|
||||
int normType, int K, InputArray _mask,
|
||||
int update, bool crosscheck )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
||||
int type = src1.type();
|
||||
CV_Assert( type == src2.type() && src1.cols == src2.cols &&
|
||||
@@ -3859,6 +3888,8 @@ void cv::batchDistance( InputArray _src1, InputArray _src2,
|
||||
|
||||
void cv::findNonZero( InputArray _src, OutputArray _idx )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat src = _src.getMat();
|
||||
CV_Assert( src.type() == CV_8UC1 );
|
||||
int n = countNonZero(src);
|
||||
@@ -3885,6 +3916,8 @@ void cv::findNonZero( InputArray _src, OutputArray _idx )
|
||||
|
||||
double cv::PSNR(InputArray _src1, InputArray _src2)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( _src1.depth() == CV_8U );
|
||||
double diff = std::sqrt(norm(_src1, _src2, NORM_L2SQR)/(_src1.total()*_src1.channels()));
|
||||
return 20*log10(255./(diff+DBL_EPSILON));
|
||||
|
||||
@@ -63,6 +63,8 @@ size_t KeyPoint::hash() const
|
||||
void KeyPoint::convert(const std::vector<KeyPoint>& keypoints, std::vector<Point2f>& points2f,
|
||||
const std::vector<int>& keypointIndexes)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( keypointIndexes.empty() )
|
||||
{
|
||||
points2f.resize( keypoints.size() );
|
||||
@@ -89,6 +91,8 @@ void KeyPoint::convert(const std::vector<KeyPoint>& keypoints, std::vector<Point
|
||||
void KeyPoint::convert( const std::vector<Point2f>& points2f, std::vector<KeyPoint>& keypoints,
|
||||
float size, float response, int octave, int class_id )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
keypoints.resize(points2f.size());
|
||||
for( size_t i = 0; i < points2f.size(); i++ )
|
||||
keypoints[i] = KeyPoint(points2f[i], size, -1, response, octave, class_id);
|
||||
|
||||
@@ -773,6 +773,8 @@ void UMat::ndoffset(size_t* ofs) const
|
||||
|
||||
void UMat::copyTo(OutputArray _dst) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int dtype = _dst.type();
|
||||
if( _dst.fixedType() && dtype != type() )
|
||||
{
|
||||
@@ -816,6 +818,8 @@ void UMat::copyTo(OutputArray _dst) const
|
||||
|
||||
void UMat::copyTo(OutputArray _dst, InputArray _mask) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( _mask.empty() )
|
||||
{
|
||||
copyTo(_dst);
|
||||
@@ -863,6 +867,8 @@ void UMat::copyTo(OutputArray _dst, InputArray _mask) const
|
||||
|
||||
void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool noScale = std::fabs(alpha - 1) < DBL_EPSILON && std::fabs(beta) < DBL_EPSILON;
|
||||
int stype = type(), cn = CV_MAT_CN(stype);
|
||||
|
||||
@@ -924,6 +930,8 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con
|
||||
|
||||
UMat& UMat::setTo(InputArray _value, InputArray _mask)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
bool haveMask = !_mask.empty();
|
||||
#ifdef HAVE_OPENCL
|
||||
int tp = type(), cn = CV_MAT_CN(tp), d = CV_MAT_DEPTH(tp);
|
||||
@@ -1062,6 +1070,8 @@ static bool ocl_dot( InputArray _src1, InputArray _src2, double & res )
|
||||
|
||||
double UMat::dot(InputArray m) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(m.sameSize(*this) && m.type() == type());
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
Reference in New Issue
Block a user