1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Instrumentation for OpenCV API regions and IPP functions;

This commit is contained in:
Pavel Vlasov
2016-08-18 09:53:00 +03:00
parent 680ca88ce0
commit 30a6cee2fe
133 changed files with 1691 additions and 456 deletions
+47 -9
View File
@@ -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; \