Merge pull request #3332 from lupustr3:pvlasov/implementation_detector
This commit is contained in:
commit
af1d29db83
@ -222,6 +222,11 @@ OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors"
|
|||||||
OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 )
|
OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 )
|
||||||
OCV_OPTION(ENABLE_WINRT_MODE_NATIVE "Build with Windows Runtime native C++ support" OFF IF WIN32 )
|
OCV_OPTION(ENABLE_WINRT_MODE_NATIVE "Build with Windows Runtime native C++ support" OFF IF WIN32 )
|
||||||
OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
|
OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
|
||||||
|
OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
|
||||||
|
|
||||||
|
if(ENABLE_IMPL_COLLECTION)
|
||||||
|
add_definitions(-DCV_COLLECT_IMPL_DATA)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
@ -925,6 +925,7 @@ public:
|
|||||||
filterSpeckles(disparr.getMat(), FILTERED, params.speckleWindowSize, params.speckleRange, slidingSumBuf);
|
filterSpeckles(disparr.getMat(), FILTERED, params.speckleWindowSize, params.speckleRange, slidingSumBuf);
|
||||||
if (dtype == CV_32F)
|
if (dtype == CV_32F)
|
||||||
disparr.getUMat().convertTo(disparr, CV_32FC1, 1./(1 << DISPARITY_SHIFT), 0);
|
disparr.getUMat().convertTo(disparr, CV_32FC1, 1./(1 << DISPARITY_SHIFT), 0);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1085,28 +1085,34 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi
|
|||||||
int newVal = cvRound(_newval), maxDiff = cvRound(_maxDiff);
|
int newVal = cvRound(_newval), maxDiff = cvRound(_maxDiff);
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801
|
#if IPP_VERSION_X100 >= 801
|
||||||
Ipp32s bufsize = 0;
|
CV_IPP_CHECK()
|
||||||
IppiSize roisize = { img.cols, img.rows };
|
|
||||||
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s;
|
|
||||||
|
|
||||||
if (!__buf.needed() && (type == CV_8UC1 || type == CV_16SC1))
|
|
||||||
{
|
{
|
||||||
IppStatus status = ippiMarkSpecklesGetBufferSize(roisize, datatype, CV_MAT_CN(type), &bufsize);
|
Ipp32s bufsize = 0;
|
||||||
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
IppiSize roisize = { img.cols, img.rows };
|
||||||
|
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s;
|
||||||
|
|
||||||
if ((int)status >= 0)
|
if (!__buf.needed() && (type == CV_8UC1 || type == CV_16SC1))
|
||||||
{
|
{
|
||||||
if (type == CV_8UC1)
|
IppStatus status = ippiMarkSpecklesGetBufferSize(roisize, datatype, CV_MAT_CN(type), &bufsize);
|
||||||
status = ippiMarkSpeckles_8u_C1IR(img.ptr<Ipp8u>(), (int)img.step, roisize,
|
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
||||||
(Ipp8u)newVal, maxSpeckleSize, (Ipp8u)maxDiff, ippiNormL1, buffer);
|
|
||||||
else
|
|
||||||
status = ippiMarkSpeckles_16s_C1IR(img.ptr<Ipp16s>(), (int)img.step, roisize,
|
|
||||||
(Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status >= 0)
|
if ((int)status >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (type == CV_8UC1)
|
||||||
|
status = ippiMarkSpeckles_8u_C1IR(img.ptr<Ipp8u>(), (int)img.step, roisize,
|
||||||
|
(Ipp8u)newVal, maxSpeckleSize, (Ipp8u)maxDiff, ippiNormL1, buffer);
|
||||||
|
else
|
||||||
|
status = ippiMarkSpeckles_16s_C1IR(img.ptr<Ipp16s>(), (int)img.step, roisize,
|
||||||
|
(Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -566,6 +566,8 @@ CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, con
|
|||||||
int line = 0);
|
int line = 0);
|
||||||
CV_EXPORTS int getIppStatus();
|
CV_EXPORTS int getIppStatus();
|
||||||
CV_EXPORTS String getIppErrorLocation();
|
CV_EXPORTS String getIppErrorLocation();
|
||||||
|
CV_EXPORTS bool useIPP();
|
||||||
|
CV_EXPORTS void setUseIPP(bool flag);
|
||||||
|
|
||||||
} // ipp
|
} // ipp
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||||
// Third party copyrights are property of their respective owners.
|
// Third party copyrights are property of their respective owners.
|
||||||
|
|
||||||
|
#include "opencv2/core/utility.hpp"
|
||||||
//#define CV_OPENCL_RUN_ASSERT
|
//#define CV_OPENCL_RUN_ASSERT
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
@ -16,6 +17,7 @@
|
|||||||
{ \
|
{ \
|
||||||
printf("%s: OpenCL implementation is running\n", CV_Func); \
|
printf("%s: OpenCL implementation is running\n", CV_Func); \
|
||||||
fflush(stdout); \
|
fflush(stdout); \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL); \
|
||||||
return __VA_ARGS__; \
|
return __VA_ARGS__; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
@ -29,14 +31,24 @@
|
|||||||
{ \
|
{ \
|
||||||
if (cv::ocl::useOpenCL() && (condition)) \
|
if (cv::ocl::useOpenCL() && (condition)) \
|
||||||
{ \
|
{ \
|
||||||
CV_Assert(func); \
|
if(func) \
|
||||||
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
CV_Error(cv::Error::StsAssert, #func); \
|
||||||
|
} \
|
||||||
return __VA_ARGS__; \
|
return __VA_ARGS__; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define CV_OCL_RUN_(condition, func, ...) \
|
#define CV_OCL_RUN_(condition, func, ...) \
|
||||||
if (cv::ocl::useOpenCL() && (condition) && func) \
|
if (cv::ocl::useOpenCL() && (condition) && func) \
|
||||||
return __VA_ARGS__;
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL); \
|
||||||
|
return __VA_ARGS__; \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -254,6 +254,9 @@ static inline IppDataType ippiGetDataType(int depth)
|
|||||||
# define IPP_VERSION_X100 0
|
# define IPP_VERSION_X100 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define CV_IPP_CHECK_COND (cv::ipp::useIPP())
|
||||||
|
#define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
|
||||||
|
|
||||||
#ifndef IPPI_CALL
|
#ifndef IPPI_CALL
|
||||||
# define IPPI_CALL(func) CV_Assert((func) >= 0)
|
# define IPPI_CALL(func) CV_Assert((func) >= 0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +53,30 @@
|
|||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays
|
||||||
|
CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays
|
||||||
|
// Get stored implementation flags and fucntions names arrays
|
||||||
|
// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which fucntion
|
||||||
|
CV_EXPORTS int getImpl(std::vector<int> &impl, std::vector<String> &funName);
|
||||||
|
|
||||||
|
CV_EXPORTS bool useCollection(); // return implementation colelction state
|
||||||
|
CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state
|
||||||
|
|
||||||
|
#define CV_IMPL_PLAIN 0x01 // native CPU OpenCV implementation
|
||||||
|
#define CV_IMPL_OCL 0x02 // OpenCL implementation
|
||||||
|
#define CV_IMPL_IPP 0x04 // IPP implementation
|
||||||
|
#define CV_IMPL_MT 0x10 // multithreaded implementation
|
||||||
|
|
||||||
|
#define CV_IMPL_ADD(impl) \
|
||||||
|
if(cv::useCollection()) \
|
||||||
|
{ \
|
||||||
|
cv::addImpl(impl, CV_Func); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define CV_IMPL_ADD(impl)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Automatically Allocated Buffer Class
|
Automatically Allocated Buffer Class
|
||||||
|
|
||||||
|
@ -562,10 +562,16 @@ static void add8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpAdd<uchar>, IF_SIMD(VAdd<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpAdd<uchar>, IF_SIMD(VAdd<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -582,10 +588,16 @@ static void add16u( const ushort* src1, size_t step1,
|
|||||||
ushort* dst, size_t step, Size sz, void* )
|
ushort* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<ushort, OpAdd<ushort>, IF_SIMD(VAdd<ushort>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<ushort, OpAdd<ushort>, IF_SIMD(VAdd<ushort>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -595,10 +607,16 @@ static void add16s( const short* src1, size_t step1,
|
|||||||
short* dst, size_t step, Size sz, void* )
|
short* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<short, OpAdd<short>, IF_SIMD(VAdd<short>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<short, OpAdd<short>, IF_SIMD(VAdd<short>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -615,10 +633,16 @@ static void add32f( const float* src1, size_t step1,
|
|||||||
float* dst, size_t step, Size sz, void* )
|
float* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp32<float, OpAdd<float>, IF_SIMD(VAdd<float>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp32<float, OpAdd<float>, IF_SIMD(VAdd<float>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -635,10 +659,16 @@ static void sub8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpSub<uchar>, IF_SIMD(VSub<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpSub<uchar>, IF_SIMD(VSub<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -655,10 +685,16 @@ static void sub16u( const ushort* src1, size_t step1,
|
|||||||
ushort* dst, size_t step, Size sz, void* )
|
ushort* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<ushort, OpSub<ushort>, IF_SIMD(VSub<ushort>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<ushort, OpSub<ushort>, IF_SIMD(VSub<ushort>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -668,10 +704,16 @@ static void sub16s( const short* src1, size_t step1,
|
|||||||
short* dst, size_t step, Size sz, void* )
|
short* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<short, OpSub<short>, IF_SIMD(VSub<short>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<short, OpSub<short>, IF_SIMD(VSub<short>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -688,10 +730,16 @@ static void sub32f( const float* src1, size_t step1,
|
|||||||
float* dst, size_t step, Size sz, void* )
|
float* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp32<float, OpSub<float>, IF_SIMD(VSub<float>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp32<float, OpSub<float>, IF_SIMD(VSub<float>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -711,22 +759,28 @@ static void max8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
uchar* s1 = (uchar*)src1;
|
CV_IPP_CHECK()
|
||||||
uchar* s2 = (uchar*)src2;
|
|
||||||
uchar* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMaxEvery_8u(s1, s2, d, sz.width))
|
uchar* s1 = (uchar*)src1;
|
||||||
break;
|
uchar* s2 = (uchar*)src2;
|
||||||
s1 += step1;
|
uchar* d = dst;
|
||||||
s2 += step2;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d += step;
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMaxEvery_8u(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 += step1;
|
||||||
|
s2 += step2;
|
||||||
|
d += step;
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp<uchar, OpMax<uchar>, IF_SIMD(VMax<uchar>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp<uchar, OpMax<uchar>, IF_SIMD(VMax<uchar>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -743,22 +797,28 @@ static void max16u( const ushort* src1, size_t step1,
|
|||||||
ushort* dst, size_t step, Size sz, void* )
|
ushort* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
ushort* s1 = (ushort*)src1;
|
CV_IPP_CHECK()
|
||||||
ushort* s2 = (ushort*)src2;
|
|
||||||
ushort* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMaxEvery_16u(s1, s2, d, sz.width))
|
ushort* s1 = (ushort*)src1;
|
||||||
break;
|
ushort* s2 = (ushort*)src2;
|
||||||
s1 = (ushort*)((uchar*)s1 + step1);
|
ushort* d = dst;
|
||||||
s2 = (ushort*)((uchar*)s2 + step2);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d = (ushort*)((uchar*)d + step);
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMaxEvery_16u(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 = (ushort*)((uchar*)s1 + step1);
|
||||||
|
s2 = (ushort*)((uchar*)s2 + step2);
|
||||||
|
d = (ushort*)((uchar*)d + step);
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp<ushort, OpMax<ushort>, IF_SIMD(VMax<ushort>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp<ushort, OpMax<ushort>, IF_SIMD(VMax<ushort>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -782,22 +842,28 @@ static void max32f( const float* src1, size_t step1,
|
|||||||
float* dst, size_t step, Size sz, void* )
|
float* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
float* s1 = (float*)src1;
|
CV_IPP_CHECK()
|
||||||
float* s2 = (float*)src2;
|
|
||||||
float* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMaxEvery_32f(s1, s2, d, sz.width))
|
float* s1 = (float*)src1;
|
||||||
break;
|
float* s2 = (float*)src2;
|
||||||
s1 = (float*)((uchar*)s1 + step1);
|
float* d = dst;
|
||||||
s2 = (float*)((uchar*)s2 + step2);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d = (float*)((uchar*)d + step);
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMaxEvery_32f(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 = (float*)((uchar*)s1 + step1);
|
||||||
|
s2 = (float*)((uchar*)s2 + step2);
|
||||||
|
d = (float*)((uchar*)d + step);
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp32<float, OpMax<float>, IF_SIMD(VMax<float>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp32<float, OpMax<float>, IF_SIMD(VMax<float>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -807,22 +873,28 @@ static void max64f( const double* src1, size_t step1,
|
|||||||
double* dst, size_t step, Size sz, void* )
|
double* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if ARITHM_USE_IPP == 1
|
#if ARITHM_USE_IPP == 1
|
||||||
double* s1 = (double*)src1;
|
CV_IPP_CHECK()
|
||||||
double* s2 = (double*)src2;
|
|
||||||
double* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMaxEvery_64f(s1, s2, d, sz.width))
|
double* s1 = (double*)src1;
|
||||||
break;
|
double* s2 = (double*)src2;
|
||||||
s1 = (double*)((uchar*)s1 + step1);
|
double* d = dst;
|
||||||
s2 = (double*)((uchar*)s2 + step2);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d = (double*)((uchar*)d + step);
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMaxEvery_64f(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 = (double*)((uchar*)s1 + step1);
|
||||||
|
s2 = (double*)((uchar*)s2 + step2);
|
||||||
|
d = (double*)((uchar*)d + step);
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp64<double, OpMax<double>, IF_SIMD(VMax<double>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp64<double, OpMax<double>, IF_SIMD(VMax<double>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -832,22 +904,28 @@ static void min8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
uchar* s1 = (uchar*)src1;
|
CV_IPP_CHECK()
|
||||||
uchar* s2 = (uchar*)src2;
|
|
||||||
uchar* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMinEvery_8u(s1, s2, d, sz.width))
|
uchar* s1 = (uchar*)src1;
|
||||||
break;
|
uchar* s2 = (uchar*)src2;
|
||||||
s1 += step1;
|
uchar* d = dst;
|
||||||
s2 += step2;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d += step;
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMinEvery_8u(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 += step1;
|
||||||
|
s2 += step2;
|
||||||
|
d += step;
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp<uchar, OpMin<uchar>, IF_SIMD(VMin<uchar>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp<uchar, OpMin<uchar>, IF_SIMD(VMin<uchar>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -864,22 +942,28 @@ static void min16u( const ushort* src1, size_t step1,
|
|||||||
ushort* dst, size_t step, Size sz, void* )
|
ushort* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
ushort* s1 = (ushort*)src1;
|
CV_IPP_CHECK()
|
||||||
ushort* s2 = (ushort*)src2;
|
|
||||||
ushort* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMinEvery_16u(s1, s2, d, sz.width))
|
ushort* s1 = (ushort*)src1;
|
||||||
break;
|
ushort* s2 = (ushort*)src2;
|
||||||
s1 = (ushort*)((uchar*)s1 + step1);
|
ushort* d = dst;
|
||||||
s2 = (ushort*)((uchar*)s2 + step2);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d = (ushort*)((uchar*)d + step);
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMinEvery_16u(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 = (ushort*)((uchar*)s1 + step1);
|
||||||
|
s2 = (ushort*)((uchar*)s2 + step2);
|
||||||
|
d = (ushort*)((uchar*)d + step);
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp<ushort, OpMin<ushort>, IF_SIMD(VMin<ushort>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp<ushort, OpMin<ushort>, IF_SIMD(VMin<ushort>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -903,22 +987,28 @@ static void min32f( const float* src1, size_t step1,
|
|||||||
float* dst, size_t step, Size sz, void* )
|
float* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
float* s1 = (float*)src1;
|
CV_IPP_CHECK()
|
||||||
float* s2 = (float*)src2;
|
|
||||||
float* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMinEvery_32f(s1, s2, d, sz.width))
|
float* s1 = (float*)src1;
|
||||||
break;
|
float* s2 = (float*)src2;
|
||||||
s1 = (float*)((uchar*)s1 + step1);
|
float* d = dst;
|
||||||
s2 = (float*)((uchar*)s2 + step2);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d = (float*)((uchar*)d + step);
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMinEvery_32f(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 = (float*)((uchar*)s1 + step1);
|
||||||
|
s2 = (float*)((uchar*)s2 + step2);
|
||||||
|
d = (float*)((uchar*)d + step);
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp32<float, OpMin<float>, IF_SIMD(VMin<float>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp32<float, OpMin<float>, IF_SIMD(VMin<float>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -928,22 +1018,28 @@ static void min64f( const double* src1, size_t step1,
|
|||||||
double* dst, size_t step, Size sz, void* )
|
double* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if ARITHM_USE_IPP == 1
|
#if ARITHM_USE_IPP == 1
|
||||||
double* s1 = (double*)src1;
|
CV_IPP_CHECK()
|
||||||
double* s2 = (double*)src2;
|
|
||||||
double* d = dst;
|
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
|
||||||
int i = 0;
|
|
||||||
for(; i < sz.height; i++)
|
|
||||||
{
|
{
|
||||||
if (0 > ippsMinEvery_64f(s1, s2, d, sz.width))
|
double* s1 = (double*)src1;
|
||||||
break;
|
double* s2 = (double*)src2;
|
||||||
s1 = (double*)((uchar*)s1 + step1);
|
double* d = dst;
|
||||||
s2 = (double*)((uchar*)s2 + step2);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
d = (double*)((uchar*)d + step);
|
int i = 0;
|
||||||
|
for(; i < sz.height; i++)
|
||||||
|
{
|
||||||
|
if (0 > ippsMinEvery_64f(s1, s2, d, sz.width))
|
||||||
|
break;
|
||||||
|
s1 = (double*)((uchar*)s1 + step1);
|
||||||
|
s2 = (double*)((uchar*)s2 + step2);
|
||||||
|
d = (double*)((uchar*)d + step);
|
||||||
|
}
|
||||||
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
vBinOp64<double, OpMin<double>, IF_SIMD(VMin<double>)>(src1, step1, src2, step2, dst, step, sz);
|
vBinOp64<double, OpMin<double>, IF_SIMD(VMin<double>)>(src1, step1, src2, step2, dst, step, sz);
|
||||||
}
|
}
|
||||||
@ -953,10 +1049,16 @@ static void absdiff8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpAbsDiff<uchar>, IF_SIMD(VAbsDiff<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpAbsDiff<uchar>, IF_SIMD(VAbsDiff<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -973,10 +1075,16 @@ static void absdiff16u( const ushort* src1, size_t step1,
|
|||||||
ushort* dst, size_t step, Size sz, void* )
|
ushort* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<ushort, OpAbsDiff<ushort>, IF_SIMD(VAbsDiff<ushort>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<ushort, OpAbsDiff<ushort>, IF_SIMD(VAbsDiff<ushort>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -1000,10 +1108,16 @@ static void absdiff32f( const float* src1, size_t step1,
|
|||||||
float* dst, size_t step, Size sz, void* )
|
float* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp32<float, OpAbsDiff<float>, IF_SIMD(VAbsDiff<float>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp32<float, OpAbsDiff<float>, IF_SIMD(VAbsDiff<float>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -1021,10 +1135,16 @@ static void and8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpAnd<uchar>, IF_SIMD(VAnd<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpAnd<uchar>, IF_SIMD(VAnd<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -1034,10 +1154,16 @@ static void or8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpOr<uchar>, IF_SIMD(VOr<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpOr<uchar>, IF_SIMD(VOr<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -1047,10 +1173,16 @@ static void xor8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
setIppErrorStatus();
|
if (0 <= ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpXor<uchar>, IF_SIMD(VXor<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpXor<uchar>, IF_SIMD(VXor<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -1060,10 +1192,16 @@ static void not8u( const uchar* src1, size_t step1,
|
|||||||
uchar* dst, size_t step, Size sz, void* )
|
uchar* dst, size_t step, Size sz, void* )
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void)src2;
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
{
|
||||||
return;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void)src2;
|
||||||
setIppErrorStatus();
|
if (0 <= ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(vBinOp<uchar, OpNot<uchar>, IF_SIMD(VNot<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
(vBinOp<uchar, OpNot<uchar>, IF_SIMD(VNot<uchar>)>(src1, step1, src2, step2, dst, step, sz));
|
||||||
}
|
}
|
||||||
@ -2376,11 +2514,17 @@ static void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t st
|
|||||||
{
|
{
|
||||||
float fscale = (float)*(const double*)scale;
|
float fscale = (float)*(const double*)scale;
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
@ -2397,11 +2541,17 @@ static void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t
|
|||||||
{
|
{
|
||||||
float fscale = (float)*(const double*)scale;
|
float fscale = (float)*(const double*)scale;
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
@ -2412,11 +2562,17 @@ static void mul16s( const short* src1, size_t step1, const short* src2, size_t s
|
|||||||
{
|
{
|
||||||
float fscale = (float)*(const double*)scale;
|
float fscale = (float)*(const double*)scale;
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
@ -2433,11 +2589,17 @@ static void mul32f( const float* src1, size_t step1, const float* src2, size_t s
|
|||||||
{
|
{
|
||||||
float fscale = (float)*(const double*)scale;
|
float fscale = (float)*(const double*)scale;
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
@ -3185,13 +3347,19 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste
|
|||||||
uchar* dst, size_t step, Size size, void* _cmpop)
|
uchar* dst, size_t step, Size size, void* _cmpop)
|
||||||
{
|
{
|
||||||
#if ARITHM_USE_IPP
|
#if ARITHM_USE_IPP
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
CV_IPP_CHECK()
|
||||||
if( op >= 0 )
|
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if (0 <= ippiCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
if( op >= 0 )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
||||||
|
if (0 <= ippiCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//vz optimized cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
//vz optimized cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||||
@ -3284,13 +3452,19 @@ static void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t
|
|||||||
uchar* dst, size_t step, Size size, void* _cmpop)
|
uchar* dst, size_t step, Size size, void* _cmpop)
|
||||||
{
|
{
|
||||||
#if ARITHM_USE_IPP
|
#if ARITHM_USE_IPP
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
CV_IPP_CHECK()
|
||||||
if( op >= 0 )
|
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if (0 <= ippiCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
if( op >= 0 )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
||||||
|
if (0 <= ippiCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||||
@ -3300,13 +3474,19 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st
|
|||||||
uchar* dst, size_t step, Size size, void* _cmpop)
|
uchar* dst, size_t step, Size size, void* _cmpop)
|
||||||
{
|
{
|
||||||
#if ARITHM_USE_IPP
|
#if ARITHM_USE_IPP
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
CV_IPP_CHECK()
|
||||||
if( op > 0 )
|
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if (0 <= ippiCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
if( op > 0 )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
||||||
|
if (0 <= ippiCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//vz optimized cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
//vz optimized cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||||
@ -3438,13 +3618,19 @@ static void cmp32f(const float* src1, size_t step1, const float* src2, size_t st
|
|||||||
uchar* dst, size_t step, Size size, void* _cmpop)
|
uchar* dst, size_t step, Size size, void* _cmpop)
|
||||||
{
|
{
|
||||||
#if ARITHM_USE_IPP
|
#if ARITHM_USE_IPP
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
CV_IPP_CHECK()
|
||||||
if( op >= 0 )
|
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if (0 <= ippiCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
if( op >= 0 )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
||||||
|
if (0 <= ippiCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||||
|
@ -2989,11 +2989,17 @@ dtype* dst, size_t dstep, Size size, double* scale) \
|
|||||||
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*) \
|
dtype* dst, size_t dstep, Size size, double*) \
|
||||||
{ \
|
{ \
|
||||||
if (src && dst)\
|
CV_IPP_CHECK()\
|
||||||
{\
|
{\
|
||||||
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \
|
if (src && dst)\
|
||||||
return; \
|
{\
|
||||||
setIppErrorStatus(); \
|
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \
|
||||||
|
{\
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)\
|
||||||
|
return; \
|
||||||
|
}\
|
||||||
|
setIppErrorStatus(); \
|
||||||
|
}\
|
||||||
}\
|
}\
|
||||||
cvt_(src, sstep, dst, dstep, size); \
|
cvt_(src, sstep, dst, dstep, size); \
|
||||||
}
|
}
|
||||||
@ -3002,11 +3008,17 @@ 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, \
|
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||||
dtype* dst, size_t dstep, Size size, double*) \
|
dtype* dst, size_t dstep, Size size, double*) \
|
||||||
{ \
|
{ \
|
||||||
if (src && dst)\
|
CV_IPP_CHECK()\
|
||||||
{\
|
{\
|
||||||
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \
|
if (src && dst)\
|
||||||
return; \
|
{\
|
||||||
setIppErrorStatus(); \
|
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \
|
||||||
|
{\
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)\
|
||||||
|
return; \
|
||||||
|
}\
|
||||||
|
setIppErrorStatus(); \
|
||||||
|
}\
|
||||||
}\
|
}\
|
||||||
cvt_(src, sstep, dst, dstep, size); \
|
cvt_(src, sstep, dst, dstep, size); \
|
||||||
}
|
}
|
||||||
@ -3524,6 +3536,7 @@ public:
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
*ok = false;
|
*ok = false;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
IppLUTParallelBody_LUTC1(const IppLUTParallelBody_LUTC1&);
|
IppLUTParallelBody_LUTC1(const IppLUTParallelBody_LUTC1&);
|
||||||
@ -3567,6 +3580,7 @@ public:
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
}
|
}
|
||||||
else if (lutcn == 4)
|
else if (lutcn == 4)
|
||||||
{
|
{
|
||||||
@ -3576,6 +3590,7 @@ public:
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
*ok = true;
|
*ok = true;
|
||||||
@ -3605,14 +3620,20 @@ public:
|
|||||||
if (ippiLUTPalette_8u_C3R(
|
if (ippiLUTPalette_8u_C3R(
|
||||||
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
|
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
|
||||||
ippiSize(dst.size()), lutTable, 8) >= 0)
|
ippiSize(dst.size()), lutTable, 8) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (lutcn == 4)
|
else if (lutcn == 4)
|
||||||
{
|
{
|
||||||
if (ippiLUTPalette_8u_C4R(
|
if (ippiLUTPalette_8u_C4R(
|
||||||
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
|
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
|
||||||
ippiSize(dst.size()), lutTable, 8) >= 0)
|
ippiSize(dst.size()), lutTable, 8) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
*ok = false;
|
*ok = false;
|
||||||
@ -3690,19 +3711,22 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
Ptr<ParallelLoopBody> body;
|
Ptr<ParallelLoopBody> body;
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
|
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
|
||||||
#if 0 // there are no performance benefits (PR #2653)
|
#if 0 // there are no performance benefits (PR #2653)
|
||||||
if (lutcn == 1)
|
if (lutcn == 1)
|
||||||
{
|
{
|
||||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTC1(src, lut, dst, &ok);
|
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTC1(src, lut, dst, &ok);
|
||||||
body.reset(p);
|
body.reset(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if ((lutcn == 3 || lutcn == 4) && elemSize1 == 1)
|
if ((lutcn == 3 || lutcn == 4) && elemSize1 == 1)
|
||||||
{
|
{
|
||||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTCN(src, lut, dst, &ok);
|
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTCN(src, lut, dst, &ok);
|
||||||
body.reset(p);
|
body.reset(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (body == NULL || ok == false)
|
if (body == NULL || ok == false)
|
||||||
|
@ -82,9 +82,15 @@ template<> void
|
|||||||
copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size)
|
copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size)
|
||||||
{
|
{
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||||
@ -126,9 +132,15 @@ template<> void
|
|||||||
copyMask_<ushort>(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size)
|
copyMask_<ushort>(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size)
|
||||||
{
|
{
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||||
@ -201,9 +213,15 @@ 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, \
|
static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \
|
||||||
uchar* dst, size_t dstep, Size size, void*) \
|
uchar* dst, size_t dstep, Size size, void*) \
|
||||||
{ \
|
{ \
|
||||||
if (ippiCopy_##ippfavor((const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0) \
|
CV_IPP_CHECK()\
|
||||||
return; \
|
{\
|
||||||
setIppErrorStatus(); \
|
if (ippiCopy_##ippfavor((const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0) \
|
||||||
|
{\
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);\
|
||||||
|
return;\
|
||||||
|
}\
|
||||||
|
setIppErrorStatus(); \
|
||||||
|
}\
|
||||||
copyMask_<type>(src, sstep, mask, mstep, dst, dstep, size); \
|
copyMask_<type>(src, sstep, mask, mstep, dst, dstep, size); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -301,9 +319,15 @@ void Mat::copyTo( OutputArray _dst ) const
|
|||||||
size_t len = sz.width*elemSize();
|
size_t len = sz.width*elemSize();
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0)
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( ; sz.height--; sptr += step, dptr += dst.step )
|
for( ; sz.height--; sptr += step, dptr += dst.step )
|
||||||
@ -380,23 +404,32 @@ Mat& Mat::operator = (const Scalar& s)
|
|||||||
if( is[0] == 0 && is[1] == 0 && is[2] == 0 && is[3] == 0 )
|
if( is[0] == 0 && is[1] == 0 && is[2] == 0 && is[3] == 0 )
|
||||||
{
|
{
|
||||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && 0
|
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && 0
|
||||||
if (dims <= 2 || isContinuous())
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
IppiSize roisize = { cols, rows };
|
if (dims <= 2 || isContinuous())
|
||||||
if (isContinuous())
|
|
||||||
{
|
{
|
||||||
roisize.width = (int)total();
|
IppiSize roisize = { cols, rows };
|
||||||
roisize.height = 1;
|
if (isContinuous())
|
||||||
|
{
|
||||||
|
roisize.width = (int)total();
|
||||||
|
roisize.height = 1;
|
||||||
|
|
||||||
if (ippsZero_8u(data, static_cast<int>(roisize.width * elemSize())) >= 0)
|
if (ippsZero_8u(data, static_cast<int>(roisize.width * elemSize())) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
|
roisize.width *= (int)elemSize();
|
||||||
|
|
||||||
|
if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)
|
||||||
return *this;
|
return *this;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
roisize.width *= (int)elemSize();
|
|
||||||
|
|
||||||
if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
|
|
||||||
return *this;
|
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -439,77 +472,83 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
|||||||
CV_Assert( mask.empty() || (mask.type() == CV_8U && size == mask.size) );
|
CV_Assert( mask.empty() || (mask.type() == CV_8U && size == mask.size) );
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
int cn = channels(), depth0 = depth();
|
CV_IPP_CHECK()
|
||||||
|
|
||||||
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) &&
|
|
||||||
(/*depth0 == CV_8U ||*/ depth0 == CV_16U || depth0 == CV_16S || depth0 == CV_32S || depth0 == CV_32F) &&
|
|
||||||
(cn == 1 || cn == 3 || cn == 4))
|
|
||||||
{
|
{
|
||||||
uchar _buf[32];
|
int cn = channels(), depth0 = depth();
|
||||||
void * buf = _buf;
|
|
||||||
convertAndUnrollScalar( value, type(), _buf, 1 );
|
|
||||||
|
|
||||||
IppStatus status = (IppStatus)-1;
|
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) &&
|
||||||
IppiSize roisize = { cols, rows };
|
(/*depth0 == CV_8U ||*/ depth0 == CV_16U || depth0 == CV_16S || depth0 == CV_32S || depth0 == CV_32F) &&
|
||||||
int mstep = (int)mask.step[0], dstep = (int)step[0];
|
(cn == 1 || cn == 3 || cn == 4))
|
||||||
|
{
|
||||||
|
uchar _buf[32];
|
||||||
|
void * buf = _buf;
|
||||||
|
convertAndUnrollScalar( value, type(), _buf, 1 );
|
||||||
|
|
||||||
if (isContinuous() && mask.isContinuous())
|
IppStatus status = (IppStatus)-1;
|
||||||
{
|
IppiSize roisize = { cols, rows };
|
||||||
roisize.width = (int)total();
|
int mstep = (int)mask.step[0], dstep = (int)step[0];
|
||||||
roisize.height = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cn == 1)
|
if (isContinuous() && mask.isContinuous())
|
||||||
{
|
{
|
||||||
/*if (depth0 == CV_8U)
|
roisize.width = (int)total();
|
||||||
status = ippiSet_8u_C1MR(*(Ipp8u *)buf, (Ipp8u *)data, dstep, roisize, mask.data, mstep);
|
roisize.height = 1;
|
||||||
else*/ if (depth0 == CV_16U)
|
}
|
||||||
status = ippiSet_16u_C1MR(*(Ipp16u *)buf, (Ipp16u *)data, dstep, roisize, mask.data, mstep);
|
|
||||||
else if (depth0 == CV_16S)
|
if (cn == 1)
|
||||||
status = ippiSet_16s_C1MR(*(Ipp16s *)buf, (Ipp16s *)data, dstep, roisize, mask.data, mstep);
|
{
|
||||||
else if (depth0 == CV_32S)
|
/*if (depth0 == CV_8U)
|
||||||
status = ippiSet_32s_C1MR(*(Ipp32s *)buf, (Ipp32s *)data, dstep, roisize, mask.data, mstep);
|
status = ippiSet_8u_C1MR(*(Ipp8u *)buf, (Ipp8u *)data, dstep, roisize, mask.data, mstep);
|
||||||
else if (depth0 == CV_32F)
|
else*/ if (depth0 == CV_16U)
|
||||||
status = ippiSet_32f_C1MR(*(Ipp32f *)buf, (Ipp32f *)data, dstep, roisize, mask.data, mstep);
|
status = ippiSet_16u_C1MR(*(Ipp16u *)buf, (Ipp16u *)data, dstep, roisize, mask.data, mstep);
|
||||||
}
|
else if (depth0 == CV_16S)
|
||||||
else if (cn == 3 || cn == 4)
|
status = ippiSet_16s_C1MR(*(Ipp16s *)buf, (Ipp16s *)data, dstep, roisize, mask.data, mstep);
|
||||||
{
|
else if (depth0 == CV_32S)
|
||||||
|
status = ippiSet_32s_C1MR(*(Ipp32s *)buf, (Ipp32s *)data, dstep, roisize, mask.data, mstep);
|
||||||
|
else if (depth0 == CV_32F)
|
||||||
|
status = ippiSet_32f_C1MR(*(Ipp32f *)buf, (Ipp32f *)data, dstep, roisize, mask.data, mstep);
|
||||||
|
}
|
||||||
|
else if (cn == 3 || cn == 4)
|
||||||
|
{
|
||||||
#define IPP_SET(ippfavor, ippcn) \
|
#define IPP_SET(ippfavor, ippcn) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
typedef Ipp##ippfavor ipptype; \
|
typedef Ipp##ippfavor ipptype; \
|
||||||
ipptype ippvalue[4] = { ((ipptype *)buf)[0], ((ipptype *)buf)[1], ((ipptype *)buf)[2], ((ipptype *)buf)[3] }; \
|
ipptype ippvalue[4] = { ((ipptype *)buf)[0], ((ipptype *)buf)[1], ((ipptype *)buf)[2], ((ipptype *)buf)[3] }; \
|
||||||
status = ippiSet_##ippfavor##_C##ippcn##MR(ippvalue, (ipptype *)data, dstep, roisize, mask.data, mstep); \
|
status = ippiSet_##ippfavor##_C##ippcn##MR(ippvalue, (ipptype *)data, dstep, roisize, mask.data, mstep); \
|
||||||
} while ((void)0, 0)
|
} while ((void)0, 0)
|
||||||
|
|
||||||
#define IPP_SET_CN(ippcn) \
|
#define IPP_SET_CN(ippcn) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if (cn == ippcn) \
|
|
||||||
{ \
|
{ \
|
||||||
/*if (depth0 == CV_8U) \
|
if (cn == ippcn) \
|
||||||
IPP_SET(8u, ippcn); \
|
{ \
|
||||||
else*/ if (depth0 == CV_16U) \
|
/*if (depth0 == CV_8U) \
|
||||||
IPP_SET(16u, ippcn); \
|
IPP_SET(8u, ippcn); \
|
||||||
else if (depth0 == CV_16S) \
|
else*/ if (depth0 == CV_16U) \
|
||||||
IPP_SET(16s, ippcn); \
|
IPP_SET(16u, ippcn); \
|
||||||
else if (depth0 == CV_32S) \
|
else if (depth0 == CV_16S) \
|
||||||
IPP_SET(32s, ippcn); \
|
IPP_SET(16s, ippcn); \
|
||||||
else if (depth0 == CV_32F) \
|
else if (depth0 == CV_32S) \
|
||||||
IPP_SET(32f, ippcn); \
|
IPP_SET(32s, ippcn); \
|
||||||
} \
|
else if (depth0 == CV_32F) \
|
||||||
} while ((void)0, 0)
|
IPP_SET(32f, ippcn); \
|
||||||
|
} \
|
||||||
|
} while ((void)0, 0)
|
||||||
|
|
||||||
IPP_SET_CN(3);
|
IPP_SET_CN(3);
|
||||||
IPP_SET_CN(4);
|
IPP_SET_CN(4);
|
||||||
|
|
||||||
#undef IPP_SET_CN
|
#undef IPP_SET_CN
|
||||||
#undef IPP_SET
|
#undef IPP_SET
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
return *this;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -714,66 +753,75 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
|||||||
size_t esz = CV_ELEM_SIZE(type);
|
size_t esz = CV_ELEM_SIZE(type);
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip);
|
CV_IPP_CHECK()
|
||||||
typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip);
|
{
|
||||||
ippiMirror ippFunc = 0;
|
typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip);
|
||||||
ippiMirrorI ippFuncI = 0;
|
typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip);
|
||||||
|
ippiMirror ippFunc = 0;
|
||||||
|
ippiMirrorI ippFuncI = 0;
|
||||||
|
|
||||||
if (src.data == dst.data)
|
if (src.data == dst.data)
|
||||||
{
|
{
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
ippFuncI =
|
ippFuncI =
|
||||||
type == CV_8UC1 ? (ippiMirrorI)ippiMirror_8u_C1IR :
|
type == CV_8UC1 ? (ippiMirrorI)ippiMirror_8u_C1IR :
|
||||||
type == CV_8UC3 ? (ippiMirrorI)ippiMirror_8u_C3IR :
|
type == CV_8UC3 ? (ippiMirrorI)ippiMirror_8u_C3IR :
|
||||||
type == CV_8UC4 ? (ippiMirrorI)ippiMirror_8u_C4IR :
|
type == CV_8UC4 ? (ippiMirrorI)ippiMirror_8u_C4IR :
|
||||||
type == CV_16UC1 ? (ippiMirrorI)ippiMirror_16u_C1IR :
|
type == CV_16UC1 ? (ippiMirrorI)ippiMirror_16u_C1IR :
|
||||||
type == CV_16UC3 ? (ippiMirrorI)ippiMirror_16u_C3IR :
|
type == CV_16UC3 ? (ippiMirrorI)ippiMirror_16u_C3IR :
|
||||||
type == CV_16UC4 ? (ippiMirrorI)ippiMirror_16u_C4IR :
|
type == CV_16UC4 ? (ippiMirrorI)ippiMirror_16u_C4IR :
|
||||||
type == CV_16SC1 ? (ippiMirrorI)ippiMirror_16s_C1IR :
|
type == CV_16SC1 ? (ippiMirrorI)ippiMirror_16s_C1IR :
|
||||||
type == CV_16SC3 ? (ippiMirrorI)ippiMirror_16s_C3IR :
|
type == CV_16SC3 ? (ippiMirrorI)ippiMirror_16s_C3IR :
|
||||||
type == CV_16SC4 ? (ippiMirrorI)ippiMirror_16s_C4IR :
|
type == CV_16SC4 ? (ippiMirrorI)ippiMirror_16s_C4IR :
|
||||||
type == CV_32SC1 ? (ippiMirrorI)ippiMirror_32s_C1IR :
|
type == CV_32SC1 ? (ippiMirrorI)ippiMirror_32s_C1IR :
|
||||||
type == CV_32SC3 ? (ippiMirrorI)ippiMirror_32s_C3IR :
|
type == CV_32SC3 ? (ippiMirrorI)ippiMirror_32s_C3IR :
|
||||||
type == CV_32SC4 ? (ippiMirrorI)ippiMirror_32s_C4IR :
|
type == CV_32SC4 ? (ippiMirrorI)ippiMirror_32s_C4IR :
|
||||||
type == CV_32FC1 ? (ippiMirrorI)ippiMirror_32f_C1IR :
|
type == CV_32FC1 ? (ippiMirrorI)ippiMirror_32f_C1IR :
|
||||||
type == CV_32FC3 ? (ippiMirrorI)ippiMirror_32f_C3IR :
|
type == CV_32FC3 ? (ippiMirrorI)ippiMirror_32f_C3IR :
|
||||||
type == CV_32FC4 ? (ippiMirrorI)ippiMirror_32f_C4IR : 0;
|
type == CV_32FC4 ? (ippiMirrorI)ippiMirror_32f_C4IR : 0;
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ippFunc =
|
ippFunc =
|
||||||
type == CV_8UC1 ? (ippiMirror)ippiMirror_8u_C1R :
|
type == CV_8UC1 ? (ippiMirror)ippiMirror_8u_C1R :
|
||||||
type == CV_8UC3 ? (ippiMirror)ippiMirror_8u_C3R :
|
type == CV_8UC3 ? (ippiMirror)ippiMirror_8u_C3R :
|
||||||
type == CV_8UC4 ? (ippiMirror)ippiMirror_8u_C4R :
|
type == CV_8UC4 ? (ippiMirror)ippiMirror_8u_C4R :
|
||||||
type == CV_16UC1 ? (ippiMirror)ippiMirror_16u_C1R :
|
type == CV_16UC1 ? (ippiMirror)ippiMirror_16u_C1R :
|
||||||
type == CV_16UC3 ? (ippiMirror)ippiMirror_16u_C3R :
|
type == CV_16UC3 ? (ippiMirror)ippiMirror_16u_C3R :
|
||||||
type == CV_16UC4 ? (ippiMirror)ippiMirror_16u_C4R :
|
type == CV_16UC4 ? (ippiMirror)ippiMirror_16u_C4R :
|
||||||
type == CV_16SC1 ? (ippiMirror)ippiMirror_16s_C1R :
|
type == CV_16SC1 ? (ippiMirror)ippiMirror_16s_C1R :
|
||||||
type == CV_16SC3 ? (ippiMirror)ippiMirror_16s_C3R :
|
type == CV_16SC3 ? (ippiMirror)ippiMirror_16s_C3R :
|
||||||
type == CV_16SC4 ? (ippiMirror)ippiMirror_16s_C4R :
|
type == CV_16SC4 ? (ippiMirror)ippiMirror_16s_C4R :
|
||||||
type == CV_32SC1 ? (ippiMirror)ippiMirror_32s_C1R :
|
type == CV_32SC1 ? (ippiMirror)ippiMirror_32s_C1R :
|
||||||
type == CV_32SC3 ? (ippiMirror)ippiMirror_32s_C3R :
|
type == CV_32SC3 ? (ippiMirror)ippiMirror_32s_C3R :
|
||||||
type == CV_32SC4 ? (ippiMirror)ippiMirror_32s_C4R :
|
type == CV_32SC4 ? (ippiMirror)ippiMirror_32s_C4R :
|
||||||
type == CV_32FC1 ? (ippiMirror)ippiMirror_32f_C1R :
|
type == CV_32FC1 ? (ippiMirror)ippiMirror_32f_C1R :
|
||||||
type == CV_32FC3 ? (ippiMirror)ippiMirror_32f_C3R :
|
type == CV_32FC3 ? (ippiMirror)ippiMirror_32f_C3R :
|
||||||
type == CV_32FC4 ? (ippiMirror)ippiMirror_32f_C4R : 0;
|
type == CV_32FC4 ? (ippiMirror)ippiMirror_32f_C4R : 0;
|
||||||
}
|
}
|
||||||
IppiAxis axis = flip_mode == 0 ? ippAxsHorizontal :
|
IppiAxis axis = flip_mode == 0 ? ippAxsHorizontal :
|
||||||
flip_mode > 0 ? ippAxsVertical : ippAxsBoth;
|
flip_mode > 0 ? ippAxsVertical : ippAxsBoth;
|
||||||
IppiSize roisize = { dst.cols, dst.rows };
|
IppiSize roisize = { dst.cols, dst.rows };
|
||||||
|
|
||||||
if (ippFunc != 0)
|
if (ippFunc != 0)
|
||||||
{
|
{
|
||||||
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0)
|
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
}
|
return;
|
||||||
else if (ippFuncI != 0)
|
}
|
||||||
{
|
setIppErrorStatus();
|
||||||
if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0)
|
}
|
||||||
return;
|
else if (ippFuncI != 0)
|
||||||
setIppErrorStatus();
|
{
|
||||||
|
if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1135,111 +1183,117 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
|
|||||||
borderType &= ~BORDER_ISOLATED;
|
borderType &= ~BORDER_ISOLATED;
|
||||||
|
|
||||||
#if defined HAVE_IPP && 0
|
#if defined HAVE_IPP && 0
|
||||||
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst,
|
CV_IPP_CHECK()
|
||||||
int dstStep, IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth);
|
|
||||||
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorderI)(const void * pSrc, int srcDstStep, IppiSize srcRoiSize, IppiSize dstRoiSize,
|
|
||||||
int topBorderHeight, int leftborderwidth);
|
|
||||||
typedef IppStatus (CV_STDCALL * ippiCopyConstBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst, int dstStep,
|
|
||||||
IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth, void * value);
|
|
||||||
|
|
||||||
IppiSize srcRoiSize = { src.cols, src.rows }, dstRoiSize = { dst.cols, dst.rows };
|
|
||||||
ippiCopyMakeBorder ippFunc = 0;
|
|
||||||
ippiCopyMakeBorderI ippFuncI = 0;
|
|
||||||
ippiCopyConstBorder ippFuncConst = 0;
|
|
||||||
bool inplace = dst.datastart == src.datastart;
|
|
||||||
|
|
||||||
if (borderType == BORDER_CONSTANT)
|
|
||||||
{
|
{
|
||||||
ippFuncConst =
|
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst,
|
||||||
// type == CV_8UC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_8u_C1R : bug in IPP 8.1
|
int dstStep, IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth);
|
||||||
type == CV_16UC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_16u_C1R :
|
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorderI)(const void * pSrc, int srcDstStep, IppiSize srcRoiSize, IppiSize dstRoiSize,
|
||||||
// type == CV_16SC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_16s_C1R : bug in IPP 8.1
|
int topBorderHeight, int leftborderwidth);
|
||||||
// type == CV_32SC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_32s_C1R : bug in IPP 8.1
|
typedef IppStatus (CV_STDCALL * ippiCopyConstBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst, int dstStep,
|
||||||
// type == CV_32FC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_32f_C1R : bug in IPP 8.1
|
IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth, void * value);
|
||||||
type == CV_8UC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_8u_C3R :
|
|
||||||
type == CV_16UC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_16u_C3R :
|
|
||||||
type == CV_16SC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_16s_C3R :
|
|
||||||
type == CV_32SC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_32s_C3R :
|
|
||||||
type == CV_32FC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_32f_C3R :
|
|
||||||
type == CV_8UC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_8u_C4R :
|
|
||||||
type == CV_16UC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_16u_C4R :
|
|
||||||
type == CV_16SC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_16s_C4R :
|
|
||||||
type == CV_32SC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_32s_C4R :
|
|
||||||
type == CV_32FC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_32f_C4R : 0;
|
|
||||||
}
|
|
||||||
else if (borderType == BORDER_WRAP)
|
|
||||||
{
|
|
||||||
if (inplace)
|
|
||||||
{
|
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
|
||||||
ippFuncI =
|
|
||||||
type == CV_32SC1 ? (ippiCopyMakeBorderI)ippiCopyWrapBorder_32s_C1IR :
|
|
||||||
type == CV_32FC1 ? (ippiCopyMakeBorderI)ippiCopyWrapBorder_32s_C1IR : 0;
|
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ippFunc =
|
|
||||||
type == CV_32SC1 ? (ippiCopyMakeBorder)ippiCopyWrapBorder_32s_C1R :
|
|
||||||
type == CV_32FC1 ? (ippiCopyMakeBorder)ippiCopyWrapBorder_32s_C1R : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (borderType == BORDER_REPLICATE)
|
|
||||||
{
|
|
||||||
if (inplace)
|
|
||||||
{
|
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
|
||||||
ippFuncI =
|
|
||||||
type == CV_8UC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_8u_C1IR :
|
|
||||||
type == CV_16UC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16u_C1IR :
|
|
||||||
type == CV_16SC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16s_C1IR :
|
|
||||||
type == CV_32SC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32s_C1IR :
|
|
||||||
type == CV_32FC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32f_C1IR :
|
|
||||||
type == CV_8UC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_8u_C3IR :
|
|
||||||
type == CV_16UC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16u_C3IR :
|
|
||||||
type == CV_16SC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16s_C3IR :
|
|
||||||
type == CV_32SC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32s_C3IR :
|
|
||||||
type == CV_32FC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32f_C3IR :
|
|
||||||
type == CV_8UC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_8u_C4IR :
|
|
||||||
type == CV_16UC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16u_C4IR :
|
|
||||||
type == CV_16SC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16s_C4IR :
|
|
||||||
type == CV_32SC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32s_C4IR :
|
|
||||||
type == CV_32FC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32f_C4IR : 0;
|
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ippFunc =
|
|
||||||
type == CV_8UC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_8u_C1R :
|
|
||||||
type == CV_16UC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16u_C1R :
|
|
||||||
type == CV_16SC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16s_C1R :
|
|
||||||
type == CV_32SC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32s_C1R :
|
|
||||||
type == CV_32FC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32f_C1R :
|
|
||||||
type == CV_8UC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_8u_C3R :
|
|
||||||
type == CV_16UC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16u_C3R :
|
|
||||||
type == CV_16SC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16s_C3R :
|
|
||||||
type == CV_32SC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32s_C3R :
|
|
||||||
type == CV_32FC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32f_C3R :
|
|
||||||
type == CV_8UC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_8u_C4R :
|
|
||||||
type == CV_16UC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16u_C4R :
|
|
||||||
type == CV_16SC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16s_C4R :
|
|
||||||
type == CV_32SC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32s_C4R :
|
|
||||||
type == CV_32FC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32f_C4R : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ippFunc || ippFuncI || ippFuncConst)
|
IppiSize srcRoiSize = { src.cols, src.rows }, dstRoiSize = { dst.cols, dst.rows };
|
||||||
{
|
ippiCopyMakeBorder ippFunc = 0;
|
||||||
uchar scbuf[32];
|
ippiCopyMakeBorderI ippFuncI = 0;
|
||||||
scalarToRawData(value, scbuf, type);
|
ippiCopyConstBorder ippFuncConst = 0;
|
||||||
|
bool inplace = dst.datastart == src.datastart;
|
||||||
|
|
||||||
if ( (ippFunc && ippFunc(src.data, (int)src.step, srcRoiSize, dst.data, (int)dst.step, dstRoiSize, top, left) >= 0) ||
|
if (borderType == BORDER_CONSTANT)
|
||||||
(ippFuncI && ippFuncI(src.data, (int)src.step, srcRoiSize, dstRoiSize, top, left) >= 0) ||
|
{
|
||||||
(ippFuncConst && ippFuncConst(src.data, (int)src.step, srcRoiSize, dst.data, (int)dst.step,
|
ippFuncConst =
|
||||||
dstRoiSize, top, left, scbuf) >= 0))
|
// type == CV_8UC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_8u_C1R : bug in IPP 8.1
|
||||||
return;
|
type == CV_16UC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_16u_C1R :
|
||||||
|
// type == CV_16SC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_16s_C1R : bug in IPP 8.1
|
||||||
|
// type == CV_32SC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_32s_C1R : bug in IPP 8.1
|
||||||
|
// type == CV_32FC1 ? (ippiCopyConstBorder)ippiCopyConstBorder_32f_C1R : bug in IPP 8.1
|
||||||
|
type == CV_8UC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_8u_C3R :
|
||||||
|
type == CV_16UC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_16u_C3R :
|
||||||
|
type == CV_16SC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_16s_C3R :
|
||||||
|
type == CV_32SC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_32s_C3R :
|
||||||
|
type == CV_32FC3 ? (ippiCopyConstBorder)ippiCopyConstBorder_32f_C3R :
|
||||||
|
type == CV_8UC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_8u_C4R :
|
||||||
|
type == CV_16UC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_16u_C4R :
|
||||||
|
type == CV_16SC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_16s_C4R :
|
||||||
|
type == CV_32SC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_32s_C4R :
|
||||||
|
type == CV_32FC4 ? (ippiCopyConstBorder)ippiCopyConstBorder_32f_C4R : 0;
|
||||||
|
}
|
||||||
|
else if (borderType == BORDER_WRAP)
|
||||||
|
{
|
||||||
|
if (inplace)
|
||||||
|
{
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
ippFuncI =
|
||||||
|
type == CV_32SC1 ? (ippiCopyMakeBorderI)ippiCopyWrapBorder_32s_C1IR :
|
||||||
|
type == CV_32FC1 ? (ippiCopyMakeBorderI)ippiCopyWrapBorder_32s_C1IR : 0;
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ippFunc =
|
||||||
|
type == CV_32SC1 ? (ippiCopyMakeBorder)ippiCopyWrapBorder_32s_C1R :
|
||||||
|
type == CV_32FC1 ? (ippiCopyMakeBorder)ippiCopyWrapBorder_32s_C1R : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (borderType == BORDER_REPLICATE)
|
||||||
|
{
|
||||||
|
if (inplace)
|
||||||
|
{
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
ippFuncI =
|
||||||
|
type == CV_8UC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_8u_C1IR :
|
||||||
|
type == CV_16UC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16u_C1IR :
|
||||||
|
type == CV_16SC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16s_C1IR :
|
||||||
|
type == CV_32SC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32s_C1IR :
|
||||||
|
type == CV_32FC1 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32f_C1IR :
|
||||||
|
type == CV_8UC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_8u_C3IR :
|
||||||
|
type == CV_16UC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16u_C3IR :
|
||||||
|
type == CV_16SC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16s_C3IR :
|
||||||
|
type == CV_32SC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32s_C3IR :
|
||||||
|
type == CV_32FC3 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32f_C3IR :
|
||||||
|
type == CV_8UC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_8u_C4IR :
|
||||||
|
type == CV_16UC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16u_C4IR :
|
||||||
|
type == CV_16SC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_16s_C4IR :
|
||||||
|
type == CV_32SC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32s_C4IR :
|
||||||
|
type == CV_32FC4 ? (ippiCopyMakeBorderI)ippiCopyReplicateBorder_32f_C4IR : 0;
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ippFunc =
|
||||||
|
type == CV_8UC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_8u_C1R :
|
||||||
|
type == CV_16UC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16u_C1R :
|
||||||
|
type == CV_16SC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16s_C1R :
|
||||||
|
type == CV_32SC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32s_C1R :
|
||||||
|
type == CV_32FC1 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32f_C1R :
|
||||||
|
type == CV_8UC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_8u_C3R :
|
||||||
|
type == CV_16UC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16u_C3R :
|
||||||
|
type == CV_16SC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16s_C3R :
|
||||||
|
type == CV_32SC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32s_C3R :
|
||||||
|
type == CV_32FC3 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32f_C3R :
|
||||||
|
type == CV_8UC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_8u_C4R :
|
||||||
|
type == CV_16UC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16u_C4R :
|
||||||
|
type == CV_16SC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_16s_C4R :
|
||||||
|
type == CV_32SC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32s_C4R :
|
||||||
|
type == CV_32FC4 ? (ippiCopyMakeBorder)ippiCopyReplicateBorder_32f_C4R : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setIppErrorStatus();
|
if (ippFunc || ippFuncI || ippFuncConst)
|
||||||
|
{
|
||||||
|
uchar scbuf[32];
|
||||||
|
scalarToRawData(value, scbuf, type);
|
||||||
|
|
||||||
|
if ( (ippFunc && ippFunc(src.data, (int)src.step, srcRoiSize, dst.data, (int)dst.step, dstRoiSize, top, left) >= 0) ||
|
||||||
|
(ippFuncI && ippFuncI(src.data, (int)src.step, srcRoiSize, dstRoiSize, top, left) >= 0) ||
|
||||||
|
(ippFuncConst && ippFuncConst(src.data, (int)src.step, srcRoiSize, dst.data, (int)dst.step,
|
||||||
|
dstRoiSize, top, left, scbuf) >= 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -554,12 +554,18 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
|
|||||||
if( !inv )
|
if( !inv )
|
||||||
{
|
{
|
||||||
if (ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf ) >= 0)
|
if (ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf ) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ippsDFTInv_CToC( src, dst, spec, (uchar*)buf ) >= 0)
|
if (ippsDFTInv_CToC( src, dst, spec, (uchar*)buf ) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
@ -997,6 +1003,7 @@ RealDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab,
|
|||||||
if( (n & 1) == 0 )
|
if( (n & 1) == 0 )
|
||||||
dst[n] = 0;
|
dst[n] = 0;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
@ -1124,7 +1131,12 @@ CCSIDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab,
|
|||||||
if( spec )
|
if( spec )
|
||||||
{
|
{
|
||||||
if (ippsDFTInv_PackToR( src, dst, spec, (uchar*)buf ) >=0)
|
if (ippsDFTInv_PackToR( src, dst, spec, (uchar*)buf ) >=0)
|
||||||
goto finalize;
|
{
|
||||||
|
if( complex_input )
|
||||||
|
((T*)src)[0] = (T)save_s1;
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
@ -1249,10 +1261,6 @@ CCSIDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab,
|
|||||||
dst[j+1] = t1;
|
dst[j+1] = t1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_IPP_DFT
|
|
||||||
finalize:
|
|
||||||
#endif
|
|
||||||
if( complex_input )
|
if( complex_input )
|
||||||
((T*)src)[0] = (T)save_s1;
|
((T*)src)[0] = (T)save_s1;
|
||||||
}
|
}
|
||||||
@ -1556,6 +1564,7 @@ public:
|
|||||||
ippFree( pBuffer );
|
ippFree( pBuffer );
|
||||||
|
|
||||||
ippFree( pDFTSpec );
|
ippFree( pDFTSpec );
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1629,6 +1638,7 @@ public:
|
|||||||
ippFree( pBuffer );
|
ippFree( pBuffer );
|
||||||
|
|
||||||
ippFree( pDFTSpec );
|
ippFree( pDFTSpec );
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1727,8 +1737,13 @@ static bool ippi_DFT_C_32F(const Mat& src, Mat& dst, bool inv, int norm_flag)
|
|||||||
|
|
||||||
ippFree( pDFTSpec );
|
ippFree( pDFTSpec );
|
||||||
|
|
||||||
return status >= 0;
|
if(status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool ippi_DFT_R_32F(const Mat& src, Mat& dst, bool inv, int norm_flag)
|
static bool ippi_DFT_R_32F(const Mat& src, Mat& dst, bool inv, int norm_flag)
|
||||||
{
|
{
|
||||||
@ -1776,7 +1791,12 @@ static bool ippi_DFT_R_32F(const Mat& src, Mat& dst, bool inv, int norm_flag)
|
|||||||
|
|
||||||
ippFree( pDFTSpec );
|
ippFree( pDFTSpec );
|
||||||
|
|
||||||
return status >= 0;
|
if(status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -2455,39 +2475,53 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined USE_IPP_DFT
|
#if defined USE_IPP_DFT
|
||||||
|
CV_IPP_CHECK()
|
||||||
if ((src.depth() == CV_32F) && (src.total()>(int)(1<<6)) && nonzero_rows == 0)
|
|
||||||
{
|
{
|
||||||
if ((flags & DFT_ROWS) == 0)
|
if ((src.depth() == CV_32F) && (src.total()>(int)(1<<6)) && nonzero_rows == 0)
|
||||||
{
|
{
|
||||||
if (src.channels() == 2 && !(inv && (flags & DFT_REAL_OUTPUT)))
|
if ((flags & DFT_ROWS) == 0)
|
||||||
{
|
{
|
||||||
if (ippi_DFT_C_32F(src, dst, inv, ipp_norm_flag))
|
if (src.channels() == 2 && !(inv && (flags & DFT_REAL_OUTPUT)))
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippi_DFT_C_32F(src, dst, inv, ipp_norm_flag))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
|
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
||||||
|
{
|
||||||
|
if (ippi_DFT_R_32F(src, dst, inv, ipp_norm_flag))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
else
|
||||||
{
|
{
|
||||||
if (ippi_DFT_R_32F(src, dst, inv, ipp_norm_flag))
|
if (src.channels() == 2 && !(inv && (flags & DFT_REAL_OUTPUT)))
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
ippiDFT_C_Func ippiFunc = inv ? (ippiDFT_C_Func)ippiDFTInv_CToC_32fc_C1R : (ippiDFT_C_Func)ippiDFTFwd_CToC_32fc_C1R;
|
||||||
}
|
if (Dft_C_IPPLoop(src, dst, IPPDFT_C_Functor(ippiFunc),ipp_norm_flag))
|
||||||
}
|
{
|
||||||
else
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
{
|
return;
|
||||||
if (src.channels() == 2 && !(inv && (flags & DFT_REAL_OUTPUT)))
|
}
|
||||||
{
|
setIppErrorStatus();
|
||||||
ippiDFT_C_Func ippiFunc = inv ? (ippiDFT_C_Func)ippiDFTInv_CToC_32fc_C1R : (ippiDFT_C_Func)ippiDFTFwd_CToC_32fc_C1R;
|
}
|
||||||
if (Dft_C_IPPLoop(src, dst, IPPDFT_C_Functor(ippiFunc),ipp_norm_flag))
|
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
ippiDFT_R_Func ippiFunc = inv ? (ippiDFT_R_Func)ippiDFTInv_PackToR_32f_C1R : (ippiDFT_R_Func)ippiDFTFwd_RToPack_32f_C1R;
|
||||||
}
|
if (Dft_R_IPPLoop(src, dst, IPPDFT_R_Functor(ippiFunc),ipp_norm_flag))
|
||||||
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
{
|
||||||
{
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
ippiDFT_R_Func ippiFunc = inv ? (ippiDFT_R_Func)ippiDFTInv_PackToR_32f_C1R : (ippiDFT_R_Func)ippiDFTFwd_RToPack_32f_C1R;
|
return;
|
||||||
if (Dft_R_IPPLoop(src, dst, IPPDFT_R_Functor(ippiFunc),ipp_norm_flag))
|
}
|
||||||
return;
|
setIppErrorStatus();
|
||||||
setIppErrorStatus();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2538,7 +2572,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
|
|
||||||
spec = 0;
|
spec = 0;
|
||||||
#ifdef USE_IPP_DFT
|
#ifdef USE_IPP_DFT
|
||||||
if( len*count >= 64 ) // use IPP DFT if available
|
if( CV_IPP_CHECK_COND && (len*count >= 64) ) // use IPP DFT if available
|
||||||
{
|
{
|
||||||
int specsize=0, initsize=0, worksize=0;
|
int specsize=0, initsize=0, worksize=0;
|
||||||
IppDFTGetSizeFunc getSizeFunc = 0;
|
IppDFTGetSizeFunc getSizeFunc = 0;
|
||||||
@ -3432,12 +3466,18 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags )
|
|||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
bool row = (flags & DCT_ROWS) != 0;
|
CV_IPP_CHECK()
|
||||||
if (src.type() == CV_32F)
|
|
||||||
{
|
{
|
||||||
if(ippi_DCT_32f(src,dst,inv, row))
|
bool row = (flags & DCT_ROWS) != 0;
|
||||||
return;
|
if (src.type() == CV_32F)
|
||||||
setIppErrorStatus();
|
{
|
||||||
|
if(ippi_DCT_32f(src,dst,inv, row))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -240,10 +240,16 @@ float cubeRoot( float value )
|
|||||||
static void Magnitude_32f(const float* x, const float* y, float* mag, int len)
|
static void Magnitude_32f(const float* x, const float* y, float* mag, int len)
|
||||||
{
|
{
|
||||||
#if defined HAVE_IPP && 0
|
#if defined HAVE_IPP && 0
|
||||||
IppStatus status = ippsMagnitude_32f(x, y, mag, len);
|
CV_IPP_CHECK()
|
||||||
if (status >= 0)
|
{
|
||||||
return;
|
IppStatus status = ippsMagnitude_32f(x, y, mag, len);
|
||||||
setIppErrorStatus();
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -286,10 +292,16 @@ static void Magnitude_32f(const float* x, const float* y, float* mag, int len)
|
|||||||
static void Magnitude_64f(const double* x, const double* y, double* mag, int len)
|
static void Magnitude_64f(const double* x, const double* y, double* mag, int len)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
IppStatus status = ippsMagnitude_64f(x, y, mag, len);
|
CV_IPP_CHECK()
|
||||||
if (status >= 0)
|
{
|
||||||
return;
|
IppStatus status = ippsMagnitude_64f(x, y, mag, len);
|
||||||
setIppErrorStatus();
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -320,9 +332,15 @@ static void Magnitude_64f(const double* x, const double* y, double* mag, int len
|
|||||||
static void InvSqrt_32f(const float* src, float* dst, int len)
|
static void InvSqrt_32f(const float* src, float* dst, int len)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (ippsInvSqrt_32f_A21(src, dst, len) >= 0)
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippsInvSqrt_32f_A21(src, dst, len) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -380,9 +398,15 @@ static void InvSqrt_64f(const double* src, double* dst, int len)
|
|||||||
static void Sqrt_32f(const float* src, float* dst, int len)
|
static void Sqrt_32f(const float* src, float* dst, int len)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (ippsSqrt_32f_A21(src, dst, len) >= 0)
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippsSqrt_32f_A21(src, dst, len) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -414,9 +438,15 @@ static void Sqrt_32f(const float* src, float* dst, int len)
|
|||||||
static void Sqrt_64f(const double* src, double* dst, int len)
|
static void Sqrt_64f(const double* src, double* dst, int len)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (ippsSqrt_64f_A50(src, dst, len) >= 0)
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippsSqrt_64f_A50(src, dst, len) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -790,19 +820,25 @@ void polarToCart( InputArray src1, InputArray src2,
|
|||||||
Mat X = dst1.getMat(), Y = dst2.getMat();
|
Mat X = dst1.getMat(), Y = dst2.getMat();
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
|
if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees)
|
||||||
void * pDstRe, void * pDstIm, int len);
|
{
|
||||||
ippsPolarToCart ippFunc =
|
typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
|
||||||
depth == CV_32F ? (ippsPolarToCart)ippsPolarToCart_32f :
|
void * pDstRe, void * pDstIm, int len);
|
||||||
depth == CV_64F ? (ippsPolarToCart)ippsPolarToCart_64f : 0;
|
ippsPolarToCart ippFunc =
|
||||||
CV_Assert(ippFunc != 0);
|
depth == CV_32F ? (ippsPolarToCart)ippsPolarToCart_32f :
|
||||||
|
depth == CV_64F ? (ippsPolarToCart)ippsPolarToCart_64f : 0;
|
||||||
|
CV_Assert(ippFunc != 0);
|
||||||
|
|
||||||
IppStatus status = ippFunc(Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast<int>(cn * X.total()));
|
IppStatus status = ippFunc(Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast<int>(cn * X.total()));
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1353,17 +1389,29 @@ static void Exp_64f( const double *_x, double *y, int n )
|
|||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
static void Exp_32f_ipp(const float *x, float *y, int n)
|
static void Exp_32f_ipp(const float *x, float *y, int n)
|
||||||
{
|
{
|
||||||
if (0 <= ippsExp_32f_A21(x, y, n))
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (0 <= ippsExp_32f_A21(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
Exp_32f(x, y, n);
|
Exp_32f(x, y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Exp_64f_ipp(const double *x, double *y, int n)
|
static void Exp_64f_ipp(const double *x, double *y, int n)
|
||||||
{
|
{
|
||||||
if (0 <= ippsExp_64f_A50(x, y, n))
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (0 <= ippsExp_64f_A50(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
Exp_64f(x, y, n);
|
Exp_64f(x, y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2013,17 +2061,29 @@ static void Log_64f( const double *x, double *y, int n )
|
|||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
static void Log_32f_ipp(const float *x, float *y, int n)
|
static void Log_32f_ipp(const float *x, float *y, int n)
|
||||||
{
|
{
|
||||||
if (0 <= ippsLn_32f_A21(x, y, n))
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (0 <= ippsLn_32f_A21(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
Log_32f(x, y, n);
|
Log_32f(x, y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Log_64f_ipp(const double *x, double *y, int n)
|
static void Log_64f_ipp(const double *x, double *y, int n)
|
||||||
{
|
{
|
||||||
if (0 <= ippsLn_64f_A50(x, y, n))
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (0 <= ippsLn_64f_A50(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
Log_64f(x, y, n);
|
Log_64f(x, y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2216,28 +2276,34 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
|||||||
return;
|
return;
|
||||||
case 2:
|
case 2:
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) ||
|
CV_IPP_CHECK()
|
||||||
(_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) ))
|
|
||||||
{
|
{
|
||||||
Mat src = _src.getMat();
|
if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) ||
|
||||||
_dst.create( src.dims, src.size, type );
|
(_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) ))
|
||||||
Mat dst = _dst.getMat();
|
|
||||||
|
|
||||||
Size size = src.size();
|
|
||||||
int srcstep = (int)src.step, dststep = (int)dst.step, esz = CV_ELEM_SIZE(type);
|
|
||||||
if (src.isContinuous() && dst.isContinuous())
|
|
||||||
{
|
{
|
||||||
size.width = (int)src.total();
|
Mat src = _src.getMat();
|
||||||
size.height = 1;
|
_dst.create( src.dims, src.size, type );
|
||||||
srcstep = dststep = (int)src.total() * esz;
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
|
Size size = src.size();
|
||||||
|
int srcstep = (int)src.step, dststep = (int)dst.step, esz = CV_ELEM_SIZE(type);
|
||||||
|
if (src.isContinuous() && dst.isContinuous())
|
||||||
|
{
|
||||||
|
size.width = (int)src.total();
|
||||||
|
size.height = 1;
|
||||||
|
srcstep = dststep = (int)src.total() * esz;
|
||||||
|
}
|
||||||
|
size.width *= cn;
|
||||||
|
|
||||||
|
IppStatus status = ippiSqr_32f_C1R(src.ptr<Ipp32f>(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
size.width *= cn;
|
|
||||||
|
|
||||||
IppStatus status = ippiSqr_32f_C1R(src.ptr<Ipp32f>(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
|
||||||
|
|
||||||
if (status >= 0)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (same)
|
if (same)
|
||||||
@ -2288,15 +2354,21 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (src.isContinuous() && dst.isContinuous())
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
IppStatus status = depth == CV_32F ?
|
if (src.isContinuous() && dst.isContinuous())
|
||||||
ippsPowx_32f_A21(src.ptr<Ipp32f>(), (Ipp32f)power, dst.ptr<Ipp32f>(), (Ipp32s)(src.total() * cn)) :
|
{
|
||||||
ippsPowx_64f_A50(src.ptr<Ipp64f>(), power, dst.ptr<Ipp64f>(), (Ipp32s)(src.total() * cn));
|
IppStatus status = depth == CV_32F ?
|
||||||
|
ippsPowx_32f_A21(src.ptr<Ipp32f>(), (Ipp32f)power, dst.ptr<Ipp32f>(), (Ipp32s)(src.total() * cn)) :
|
||||||
|
ippsPowx_64f_A50(src.ptr<Ipp64f>(), power, dst.ptr<Ipp64f>(), (Ipp32s)(src.total() * cn));
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2821,11 +2821,17 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len)
|
|||||||
{
|
{
|
||||||
double r = 0;
|
double r = 0;
|
||||||
#if ARITHM_USE_IPP && 0
|
#if ARITHM_USE_IPP && 0
|
||||||
if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])),
|
CV_IPP_CHECK()
|
||||||
src2, (int)(len*sizeof(src2[0])),
|
{
|
||||||
ippiSize(len, 1), &r))
|
if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])),
|
||||||
return r;
|
src2, (int)(len*sizeof(src2[0])),
|
||||||
setIppErrorStatus();
|
ippiSize(len, 1), &r))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -2968,10 +2974,16 @@ static double dotProd_8s(const schar* src1, const schar* src2, int len)
|
|||||||
static double dotProd_16u(const ushort* src1, const ushort* src2, int len)
|
static double dotProd_16u(const ushort* src1, const ushort* src2, int len)
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
double r = 0;
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
{
|
||||||
return r;
|
double r = 0;
|
||||||
setIppErrorStatus();
|
if (0 <= 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;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return dotProd_(src1, src2, len);
|
return dotProd_(src1, src2, len);
|
||||||
}
|
}
|
||||||
@ -2979,10 +2991,16 @@ static double dotProd_16u(const ushort* src1, const ushort* src2, int len)
|
|||||||
static double dotProd_16s(const short* src1, const short* src2, int len)
|
static double dotProd_16s(const short* src1, const short* src2, int len)
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
double r = 0;
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
{
|
||||||
return r;
|
double r = 0;
|
||||||
setIppErrorStatus();
|
if (0 <= 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;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return dotProd_(src1, src2, len);
|
return dotProd_(src1, src2, len);
|
||||||
}
|
}
|
||||||
@ -2990,10 +3008,16 @@ static double dotProd_16s(const short* src1, const short* src2, int len)
|
|||||||
static double dotProd_32s(const int* src1, const int* src2, int len)
|
static double dotProd_32s(const int* src1, const int* src2, int len)
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
double r = 0;
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
{
|
||||||
return r;
|
double r = 0;
|
||||||
setIppErrorStatus();
|
if (0 <= 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;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return dotProd_(src1, src2, len);
|
return dotProd_(src1, src2, len);
|
||||||
}
|
}
|
||||||
@ -3004,9 +3028,15 @@ static double dotProd_32f(const float* src1, const float* src2, int len)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
if (0 <= ippsDotProd_32f64f(src1, src2, len, &r))
|
CV_IPP_CHECK()
|
||||||
return r;
|
{
|
||||||
setIppErrorStatus();
|
if (0 <= ippsDotProd_32f64f(src1, src2, len, &r))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#elif CV_NEON
|
#elif CV_NEON
|
||||||
int len0 = len & -4, blockSize0 = (1 << 13), blockSize;
|
int len0 = len & -4, blockSize0 = (1 << 13), blockSize;
|
||||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
||||||
@ -3035,10 +3065,16 @@ static double dotProd_32f(const float* src1, const float* src2, int len)
|
|||||||
static double dotProd_64f(const double* src1, const double* src2, int len)
|
static double dotProd_64f(const double* src1, const double* src2, int len)
|
||||||
{
|
{
|
||||||
#if (ARITHM_USE_IPP == 1)
|
#if (ARITHM_USE_IPP == 1)
|
||||||
double r = 0;
|
CV_IPP_CHECK()
|
||||||
if (0 <= ippsDotProd_64f(src1, src2, len, &r))
|
{
|
||||||
return r;
|
double r = 0;
|
||||||
setIppErrorStatus();
|
if (0 <= ippsDotProd_64f(src1, src2, len, &r))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return dotProd_(src1, src2, len);
|
return dotProd_(src1, src2, len);
|
||||||
}
|
}
|
||||||
|
@ -3066,64 +3066,73 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize);
|
CV_IPP_CHECK()
|
||||||
typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize);
|
{
|
||||||
ippiTranspose ippFunc = 0;
|
typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize);
|
||||||
ippiTransposeI ippFuncI = 0;
|
typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize);
|
||||||
|
ippiTranspose ippFunc = 0;
|
||||||
|
ippiTransposeI ippFuncI = 0;
|
||||||
|
|
||||||
if (dst.data == src.data && dst.cols == dst.rows)
|
if (dst.data == src.data && dst.cols == dst.rows)
|
||||||
{
|
{
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
ippFuncI =
|
ippFuncI =
|
||||||
type == CV_8UC1 ? (ippiTransposeI)ippiTranspose_8u_C1IR :
|
type == CV_8UC1 ? (ippiTransposeI)ippiTranspose_8u_C1IR :
|
||||||
type == CV_8UC3 ? (ippiTransposeI)ippiTranspose_8u_C3IR :
|
type == CV_8UC3 ? (ippiTransposeI)ippiTranspose_8u_C3IR :
|
||||||
type == CV_8UC4 ? (ippiTransposeI)ippiTranspose_8u_C4IR :
|
type == CV_8UC4 ? (ippiTransposeI)ippiTranspose_8u_C4IR :
|
||||||
type == CV_16UC1 ? (ippiTransposeI)ippiTranspose_16u_C1IR :
|
type == CV_16UC1 ? (ippiTransposeI)ippiTranspose_16u_C1IR :
|
||||||
type == CV_16UC3 ? (ippiTransposeI)ippiTranspose_16u_C3IR :
|
type == CV_16UC3 ? (ippiTransposeI)ippiTranspose_16u_C3IR :
|
||||||
type == CV_16UC4 ? (ippiTransposeI)ippiTranspose_16u_C4IR :
|
type == CV_16UC4 ? (ippiTransposeI)ippiTranspose_16u_C4IR :
|
||||||
type == CV_16SC1 ? (ippiTransposeI)ippiTranspose_16s_C1IR :
|
type == CV_16SC1 ? (ippiTransposeI)ippiTranspose_16s_C1IR :
|
||||||
type == CV_16SC3 ? (ippiTransposeI)ippiTranspose_16s_C3IR :
|
type == CV_16SC3 ? (ippiTransposeI)ippiTranspose_16s_C3IR :
|
||||||
type == CV_16SC4 ? (ippiTransposeI)ippiTranspose_16s_C4IR :
|
type == CV_16SC4 ? (ippiTransposeI)ippiTranspose_16s_C4IR :
|
||||||
type == CV_32SC1 ? (ippiTransposeI)ippiTranspose_32s_C1IR :
|
type == CV_32SC1 ? (ippiTransposeI)ippiTranspose_32s_C1IR :
|
||||||
type == CV_32SC3 ? (ippiTransposeI)ippiTranspose_32s_C3IR :
|
type == CV_32SC3 ? (ippiTransposeI)ippiTranspose_32s_C3IR :
|
||||||
type == CV_32SC4 ? (ippiTransposeI)ippiTranspose_32s_C4IR :
|
type == CV_32SC4 ? (ippiTransposeI)ippiTranspose_32s_C4IR :
|
||||||
type == CV_32FC1 ? (ippiTransposeI)ippiTranspose_32f_C1IR :
|
type == CV_32FC1 ? (ippiTransposeI)ippiTranspose_32f_C1IR :
|
||||||
type == CV_32FC3 ? (ippiTransposeI)ippiTranspose_32f_C3IR :
|
type == CV_32FC3 ? (ippiTransposeI)ippiTranspose_32f_C3IR :
|
||||||
type == CV_32FC4 ? (ippiTransposeI)ippiTranspose_32f_C4IR : 0;
|
type == CV_32FC4 ? (ippiTransposeI)ippiTranspose_32f_C4IR : 0;
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ippFunc =
|
ippFunc =
|
||||||
type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R :
|
type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R :
|
||||||
type == CV_8UC3 ? (ippiTranspose)ippiTranspose_8u_C3R :
|
type == CV_8UC3 ? (ippiTranspose)ippiTranspose_8u_C3R :
|
||||||
type == CV_8UC4 ? (ippiTranspose)ippiTranspose_8u_C4R :
|
type == CV_8UC4 ? (ippiTranspose)ippiTranspose_8u_C4R :
|
||||||
type == CV_16UC1 ? (ippiTranspose)ippiTranspose_16u_C1R :
|
type == CV_16UC1 ? (ippiTranspose)ippiTranspose_16u_C1R :
|
||||||
type == CV_16UC3 ? (ippiTranspose)ippiTranspose_16u_C3R :
|
type == CV_16UC3 ? (ippiTranspose)ippiTranspose_16u_C3R :
|
||||||
type == CV_16UC4 ? (ippiTranspose)ippiTranspose_16u_C4R :
|
type == CV_16UC4 ? (ippiTranspose)ippiTranspose_16u_C4R :
|
||||||
type == CV_16SC1 ? (ippiTranspose)ippiTranspose_16s_C1R :
|
type == CV_16SC1 ? (ippiTranspose)ippiTranspose_16s_C1R :
|
||||||
type == CV_16SC3 ? (ippiTranspose)ippiTranspose_16s_C3R :
|
type == CV_16SC3 ? (ippiTranspose)ippiTranspose_16s_C3R :
|
||||||
type == CV_16SC4 ? (ippiTranspose)ippiTranspose_16s_C4R :
|
type == CV_16SC4 ? (ippiTranspose)ippiTranspose_16s_C4R :
|
||||||
type == CV_32SC1 ? (ippiTranspose)ippiTranspose_32s_C1R :
|
type == CV_32SC1 ? (ippiTranspose)ippiTranspose_32s_C1R :
|
||||||
type == CV_32SC3 ? (ippiTranspose)ippiTranspose_32s_C3R :
|
type == CV_32SC3 ? (ippiTranspose)ippiTranspose_32s_C3R :
|
||||||
type == CV_32SC4 ? (ippiTranspose)ippiTranspose_32s_C4R :
|
type == CV_32SC4 ? (ippiTranspose)ippiTranspose_32s_C4R :
|
||||||
type == CV_32FC1 ? (ippiTranspose)ippiTranspose_32f_C1R :
|
type == CV_32FC1 ? (ippiTranspose)ippiTranspose_32f_C1R :
|
||||||
type == CV_32FC3 ? (ippiTranspose)ippiTranspose_32f_C3R :
|
type == CV_32FC3 ? (ippiTranspose)ippiTranspose_32f_C3R :
|
||||||
type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0;
|
type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IppiSize roiSize = { src.cols, src.rows };
|
IppiSize roiSize = { src.cols, src.rows };
|
||||||
if (ippFunc != 0)
|
if (ippFunc != 0)
|
||||||
{
|
{
|
||||||
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0)
|
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
}
|
return;
|
||||||
else if (ippFuncI != 0)
|
}
|
||||||
{
|
setIppErrorStatus();
|
||||||
if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0)
|
}
|
||||||
return;
|
else if (ippFuncI != 0)
|
||||||
setIppErrorStatus();
|
{
|
||||||
|
if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3353,27 +3362,32 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
|
|||||||
}
|
}
|
||||||
CV_Assert(!(ippFunc && ippFuncHint) && func);
|
CV_Assert(!(ippFunc && ippFuncHint) && func);
|
||||||
|
|
||||||
if (ippFunc)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
for (int y = 0; y < size.height; ++y)
|
if (ippFunc)
|
||||||
if (ippFunc(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y)) < 0)
|
{
|
||||||
{
|
for (int y = 0; y < size.height; ++y)
|
||||||
setIppErrorStatus();
|
if (ippFunc(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y)) < 0)
|
||||||
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
{
|
||||||
func(srcmat.rowRange(y, y + 1), dstroi);
|
setIppErrorStatus();
|
||||||
}
|
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
||||||
return;
|
func(srcmat.rowRange(y, y + 1), dstroi);
|
||||||
}
|
}
|
||||||
else if (ippFuncHint)
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
{
|
return;
|
||||||
for (int y = 0; y < size.height; ++y)
|
}
|
||||||
if (ippFuncHint(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y), ippAlgHintAccurate) < 0)
|
else if (ippFuncHint)
|
||||||
{
|
{
|
||||||
setIppErrorStatus();
|
for (int y = 0; y < size.height; ++y)
|
||||||
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
if (ippFuncHint(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y), ippAlgHintAccurate) < 0)
|
||||||
func(srcmat.rowRange(y, y + 1), dstroi);
|
{
|
||||||
}
|
setIppErrorStatus();
|
||||||
return;
|
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
||||||
|
func(srcmat.rowRange(y, y + 1), dstroi);
|
||||||
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func(srcmat, dstmat);
|
func(srcmat, dstmat);
|
||||||
@ -3409,7 +3423,7 @@ static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstm
|
|||||||
IppiSize roisize = ippiSize(size.width, 1);\
|
IppiSize roisize = ippiSize(size.width, 1);\
|
||||||
int sstep = (int)srcmat.step; \
|
int sstep = (int)srcmat.step; \
|
||||||
\
|
\
|
||||||
if (srcmat.channels() == 1) \
|
if (CV_IPP_CHECK_COND && (srcmat.channels() == 1)) \
|
||||||
{ \
|
{ \
|
||||||
for (int y = 0; y < size.height; ++y) \
|
for (int y = 0; y < size.height; ++y) \
|
||||||
if (ippi##optype##_##favor##_C1R(srcmat.ptr<IppType>(y), sstep, roisize, dstmat.ptr<IppType>(y)) < 0) \
|
if (ippi##optype##_##favor##_C1R(srcmat.ptr<IppType>(y), sstep, roisize, dstmat.ptr<IppType>(y)) < 0) \
|
||||||
@ -3418,6 +3432,10 @@ static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstm
|
|||||||
cv::Mat dstroi = dstmat.rowRange(y, y + 1); \
|
cv::Mat dstroi = dstmat.rowRange(y, y + 1); \
|
||||||
cv::reduceC_ < type1, type2, cv::Op##optype < type2 > >(srcmat.rowRange(y, y + 1), dstroi); \
|
cv::reduceC_ < type1, type2, cv::Op##optype < type2 > >(srcmat.rowRange(y, y + 1), dstroi); \
|
||||||
} \
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);\
|
||||||
|
} \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
cv::reduceC_ < type1, type2, cv::Op##optype < type2 > >(srcmat, dstmat); \
|
cv::reduceC_ < type1, type2, cv::Op##optype < type2 > >(srcmat, dstmat); \
|
||||||
@ -3768,8 +3786,13 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
|
|||||||
|
|
||||||
#ifdef USE_IPP_SORT
|
#ifdef USE_IPP_SORT
|
||||||
int depth = src.depth();
|
int depth = src.depth();
|
||||||
IppSortFunc ippSortFunc = getSortFunc(depth, sortDescending);
|
IppSortFunc ippSortFunc = 0;
|
||||||
IppFlipFunc ippFlipFunc = getFlipFunc(depth);
|
IppFlipFunc ippFlipFunc = 0;
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
|
ippSortFunc = getSortFunc(depth, sortDescending);
|
||||||
|
ippFlipFunc = getFlipFunc(depth);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( i = 0; i < n; i++ )
|
for( i = 0; i < n; i++ )
|
||||||
@ -3812,8 +3835,20 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
|
|||||||
for( j = 0; j < len/2; j++ )
|
for( j = 0; j < len/2; j++ )
|
||||||
std::swap(ptr[j], ptr[len-1-j]);
|
std::swap(ptr[j], ptr[len-1-j]);
|
||||||
}
|
}
|
||||||
|
#ifdef USE_IPP_SORT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef USE_IPP_SORT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !sortRows )
|
if( !sortRows )
|
||||||
for( j = 0; j < len; j++ )
|
for( j = 0; j < len; j++ )
|
||||||
@ -3878,8 +3913,13 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
|
|||||||
|
|
||||||
#if defined USE_IPP_SORT && 0
|
#if defined USE_IPP_SORT && 0
|
||||||
int depth = src.depth();
|
int depth = src.depth();
|
||||||
IppSortIndexFunc ippFunc = getSortIndexFunc(depth, sortDescending);
|
IppSortIndexFunc ippFunc = 0;
|
||||||
IppFlipFunc ippFlipFunc = getFlipFunc(depth);
|
IppFlipFunc ippFlipFunc = 0;
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
|
ippFunc = getSortIndexFunc(depth, sortDescending);
|
||||||
|
ippFlipFunc = getFlipFunc(depth);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( i = 0; i < n; i++ )
|
for( i = 0; i < n; i++ )
|
||||||
@ -3920,8 +3960,20 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
|
|||||||
for( j = 0; j < len/2; j++ )
|
for( j = 0; j < len/2; j++ )
|
||||||
std::swap(iptr[j], iptr[len-1-j]);
|
std::swap(iptr[j], iptr[len-1-j]);
|
||||||
}
|
}
|
||||||
|
#if defined USE_IPP_SORT && 0
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined USE_IPP_SORT && 0
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !sortRows )
|
if( !sortRows )
|
||||||
for( j = 0; j < len; j++ )
|
for( j = 0; j < len; j++ )
|
||||||
|
@ -2893,6 +2893,9 @@ bool Kernel::create(const char* kname, const Program& prog)
|
|||||||
p->release();
|
p->release();
|
||||||
p = 0;
|
p = 0;
|
||||||
}
|
}
|
||||||
|
#ifdef CV_OPENCL_RUN_ASSERT // check kernel compilation fails
|
||||||
|
CV_Assert(p);
|
||||||
|
#endif
|
||||||
return p != 0;
|
return p != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3523,6 +3526,10 @@ protected:
|
|||||||
entry.clBuffer_ = clCreateBuffer((cl_context)ctx.ptr(), CL_MEM_READ_WRITE, entry.capacity_, 0, &retval);
|
entry.clBuffer_ = clCreateBuffer((cl_context)ctx.ptr(), CL_MEM_READ_WRITE, entry.capacity_, 0, &retval);
|
||||||
CV_Assert(retval == CL_SUCCESS);
|
CV_Assert(retval == CL_SUCCESS);
|
||||||
CV_Assert(entry.clBuffer_ != NULL);
|
CV_Assert(entry.clBuffer_ != NULL);
|
||||||
|
if(retval == CL_SUCCESS)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
|
}
|
||||||
LOG_BUFFER_POOL("OpenCL allocate %lld (0x%llx) bytes: %p\n",
|
LOG_BUFFER_POOL("OpenCL allocate %lld (0x%llx) bytes: %p\n",
|
||||||
(long long)entry.capacity_, (long long)entry.capacity_, entry.clBuffer_);
|
(long long)entry.capacity_, (long long)entry.capacity_, entry.clBuffer_);
|
||||||
}
|
}
|
||||||
@ -3747,6 +3754,7 @@ public:
|
|||||||
CL_MEM_READ_WRITE|createFlags, total, 0, &retval);
|
CL_MEM_READ_WRITE|createFlags, total, 0, &retval);
|
||||||
if( !handle || retval != CL_SUCCESS )
|
if( !handle || retval != CL_SUCCESS )
|
||||||
return defaultAllocate(dims, sizes, type, data, step, flags, usageFlags);
|
return defaultAllocate(dims, sizes, type, data, step, flags, usageFlags);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL)
|
||||||
}
|
}
|
||||||
UMatData* u = new UMatData(this);
|
UMatData* u = new UMatData(this);
|
||||||
u->data = 0;
|
u->data = 0;
|
||||||
@ -4187,20 +4195,24 @@ public:
|
|||||||
CV_Assert(dst->refcount == 0);
|
CV_Assert(dst->refcount == 0);
|
||||||
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
|
|
||||||
|
cl_int retval;
|
||||||
if( iscontinuous )
|
if( iscontinuous )
|
||||||
{
|
{
|
||||||
CV_Assert( clEnqueueCopyBuffer(q, (cl_mem)src->handle, (cl_mem)dst->handle,
|
CV_Assert( (retval = clEnqueueCopyBuffer(q, (cl_mem)src->handle, (cl_mem)dst->handle,
|
||||||
srcrawofs, dstrawofs, total, 0, 0, 0) == CL_SUCCESS );
|
srcrawofs, dstrawofs, total, 0, 0, 0)) == CL_SUCCESS );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cl_int retval;
|
|
||||||
CV_Assert( (retval = clEnqueueCopyBufferRect(q, (cl_mem)src->handle, (cl_mem)dst->handle,
|
CV_Assert( (retval = clEnqueueCopyBufferRect(q, (cl_mem)src->handle, (cl_mem)dst->handle,
|
||||||
new_srcofs, new_dstofs, new_sz,
|
new_srcofs, new_dstofs, new_sz,
|
||||||
new_srcstep[0], new_srcstep[1],
|
new_srcstep[0], new_srcstep[1],
|
||||||
new_dststep[0], new_dststep[1],
|
new_dststep[0], new_dststep[1],
|
||||||
0, 0, 0)) == CL_SUCCESS );
|
0, 0, 0)) == CL_SUCCESS );
|
||||||
}
|
}
|
||||||
|
if(retval == CL_SUCCESS)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL)
|
||||||
|
}
|
||||||
|
|
||||||
dst->markHostCopyObsolete(true);
|
dst->markHostCopyObsolete(true);
|
||||||
dst->markDeviceCopyObsolete(false);
|
dst->markDeviceCopyObsolete(false);
|
||||||
|
@ -233,13 +233,25 @@ void convertAndUnrollScalar( const Mat& sc, int buftype, uchar* scbuf, size_t bl
|
|||||||
|
|
||||||
struct CoreTLSData
|
struct CoreTLSData
|
||||||
{
|
{
|
||||||
CoreTLSData() : device(0), useOpenCL(-1)
|
CoreTLSData() : device(0), useOpenCL(-1), useIPP(-1), useCollection(false)
|
||||||
{}
|
{
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
implFlags = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
RNG rng;
|
RNG rng;
|
||||||
int device;
|
int device;
|
||||||
ocl::Queue oclQueue;
|
ocl::Queue oclQueue;
|
||||||
int useOpenCL; // 1 - use, 0 - do not use, -1 - auto/not initialized
|
int useOpenCL; // 1 - use, 0 - do not use, -1 - auto/not initialized
|
||||||
|
int useIPP; // 1 - use, 0 - do not use, -1 - auto/not initialized
|
||||||
|
bool useCollection; // enable/disable impl data collection
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
int implFlags;
|
||||||
|
std::vector<int> implCode;
|
||||||
|
std::vector<String> implFun;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TLSData<CoreTLSData> coreTlsData;
|
extern TLSData<CoreTLSData> coreTlsData;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1059,6 +1059,51 @@ TLSStorage::~TLSStorage()
|
|||||||
|
|
||||||
TLSData<CoreTLSData> coreTlsData;
|
TLSData<CoreTLSData> coreTlsData;
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
void setImpl(int flags)
|
||||||
|
{
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
data->implFlags = flags;
|
||||||
|
data->implCode.clear();
|
||||||
|
data->implFun.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void addImpl(int flag, const char* func)
|
||||||
|
{
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
data->implFlags |= flag;
|
||||||
|
if(func) // use lazy collection if name was not specified
|
||||||
|
{
|
||||||
|
size_t index = data->implCode.size();
|
||||||
|
if(!index || (data->implCode[index-1] != flag || data->implFun[index-1].compare(func))) // avoid duplicates
|
||||||
|
{
|
||||||
|
data->implCode.push_back(flag);
|
||||||
|
data->implFun.push_back(func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int getImpl(std::vector<int> &impl, std::vector<String> &funName)
|
||||||
|
{
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
impl = data->implCode;
|
||||||
|
funName = data->implFun;
|
||||||
|
return data->implFlags; // return actual flags for lazy collection
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useCollection()
|
||||||
|
{
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
return data->useCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setUseCollection(bool flag)
|
||||||
|
{
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
data->useCollection = flag;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ipp
|
namespace ipp
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1084,6 +1129,35 @@ String getIppErrorLocation()
|
|||||||
return format("%s:%d %s", filename ? filename : "", linen, funcname ? funcname : "");
|
return format("%s:%d %s", filename ? filename : "", linen, funcname ? funcname : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useIPP()
|
||||||
|
{
|
||||||
|
#ifdef HAVE_IPP
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
if(data->useIPP < 0)
|
||||||
|
{
|
||||||
|
const char* pIppEnv = getenv("OPENCV_IPP");
|
||||||
|
if(pIppEnv && (cv::String(pIppEnv) == "disabled"))
|
||||||
|
data->useIPP = false;
|
||||||
|
else
|
||||||
|
data->useIPP = true;
|
||||||
|
}
|
||||||
|
return (data->useIPP > 0);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void setUseIPP(bool flag)
|
||||||
|
{
|
||||||
|
CoreTLSData* data = coreTlsData.get();
|
||||||
|
#ifdef HAVE_IPP
|
||||||
|
data->useIPP = flag;
|
||||||
|
#else
|
||||||
|
(void)flag;
|
||||||
|
data->useIPP = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ipp
|
} // namespace ipp
|
||||||
|
|
||||||
} // namespace cv
|
} // namespace cv
|
||||||
|
@ -697,7 +697,10 @@ void UMat::copyTo(OutputArray _dst, InputArray _mask) const
|
|||||||
|
|
||||||
size_t globalsize[2] = { cols, rows };
|
size_t globalsize[2] = { cols, rows };
|
||||||
if (k.run(2, globalsize, NULL, false))
|
if (k.run(2, globalsize, NULL, false))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -753,7 +756,10 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con
|
|||||||
|
|
||||||
size_t globalsize[2] = { dst.cols * cn, (dst.rows + rowsPerWI - 1) / rowsPerWI };
|
size_t globalsize[2] = { dst.cols * cn, (dst.rows + rowsPerWI - 1) / rowsPerWI };
|
||||||
if (k.run(2, globalsize, NULL, false))
|
if (k.run(2, globalsize, NULL, false))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -802,7 +808,10 @@ UMat& UMat::setTo(InputArray _value, InputArray _mask)
|
|||||||
|
|
||||||
size_t globalsize[] = { cols, (rows + rowsPerWI - 1) / rowsPerWI };
|
size_t globalsize[] = { cols, (rows + rowsPerWI - 1) / rowsPerWI };
|
||||||
if( setK.run(2, globalsize, NULL, false) )
|
if( setK.run(2, globalsize, NULL, false) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return *this;
|
return *this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -332,7 +332,10 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
|
|||||||
{
|
{
|
||||||
if( ocl::useOpenCL() && _img.isUMat() && type == FastFeatureDetector::TYPE_9_16 &&
|
if( ocl::useOpenCL() && _img.isUMat() && type == FastFeatureDetector::TYPE_9_16 &&
|
||||||
ocl_FAST(_img, keypoints, threshold, nonmax_suppression, 10000))
|
ocl_FAST(_img, keypoints, threshold, nonmax_suppression, 10000))
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case FastFeatureDetector::TYPE_5_8:
|
case FastFeatureDetector::TYPE_5_8:
|
||||||
|
@ -943,12 +943,18 @@ void BFMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<std::vec
|
|||||||
if(trainDescCollection.empty())
|
if(trainDescCollection.empty())
|
||||||
{
|
{
|
||||||
if(ocl_match(_queryDescriptors, utrainDescCollection[0], matches, normType))
|
if(ocl_match(_queryDescriptors, utrainDescCollection[0], matches, normType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ocl_match(_queryDescriptors, trainDescCollection[0], matches, normType))
|
if(ocl_match(_queryDescriptors, trainDescCollection[0], matches, normType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -956,12 +962,18 @@ void BFMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<std::vec
|
|||||||
if(trainDescCollection.empty())
|
if(trainDescCollection.empty())
|
||||||
{
|
{
|
||||||
if(ocl_knnMatch(_queryDescriptors, utrainDescCollection[0], matches, knn, normType, compactResult) )
|
if(ocl_knnMatch(_queryDescriptors, utrainDescCollection[0], matches, knn, normType, compactResult) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ocl_knnMatch(_queryDescriptors, trainDescCollection[0], matches, knn, normType, compactResult) )
|
if(ocl_knnMatch(_queryDescriptors, trainDescCollection[0], matches, knn, normType, compactResult) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1073,12 +1085,18 @@ void BFMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vector<std::
|
|||||||
if (trainDescCollection.empty())
|
if (trainDescCollection.empty())
|
||||||
{
|
{
|
||||||
if(ocl_radiusMatch(_queryDescriptors, utrainDescCollection[0], matches, maxDistance, normType, compactResult) )
|
if(ocl_radiusMatch(_queryDescriptors, utrainDescCollection[0], matches, maxDistance, normType, compactResult) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ocl_radiusMatch(_queryDescriptors, trainDescCollection[0], matches, maxDistance, normType, compactResult) )
|
if (ocl_radiusMatch(_queryDescriptors, trainDescCollection[0], matches, maxDistance, normType, compactResult) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,6 +823,7 @@ static void computeKeyPoints(const Mat& imagePyramid,
|
|||||||
uresponses, nkeypoints, 7, HARRIS_K );
|
uresponses, nkeypoints, 7, HARRIS_K );
|
||||||
if( useOCL )
|
if( useOCL )
|
||||||
{
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
uresponses.copyTo(responses);
|
uresponses.copyTo(responses);
|
||||||
for( i = 0; i < nkeypoints; i++ )
|
for( i = 0; i < nkeypoints; i++ )
|
||||||
allKeypoints[i].response = responses.at<float>(i);
|
allKeypoints[i].response = responses.at<float>(i);
|
||||||
@ -867,6 +868,7 @@ static void computeKeyPoints(const Mat& imagePyramid,
|
|||||||
|
|
||||||
if( useOCL )
|
if( useOCL )
|
||||||
{
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
uresponses.copyTo(responses);
|
uresponses.copyTo(responses);
|
||||||
for( i = 0; i < nkeypoints; i++ )
|
for( i = 0; i < nkeypoints; i++ )
|
||||||
allKeypoints[i].angle = responses.at<float>(i);
|
allKeypoints[i].angle = responses.at<float>(i);
|
||||||
@ -1110,6 +1112,10 @@ void ORB::operator()( InputArray _image, InputArray _mask, std::vector<KeyPoint>
|
|||||||
useOCL = ocl_computeOrbDescriptors(uimagePyramid, ulayerInfo,
|
useOCL = ocl_computeOrbDescriptors(uimagePyramid, ulayerInfo,
|
||||||
ukeypoints, udescriptors, upattern,
|
ukeypoints, udescriptors, upattern,
|
||||||
nkeypoints, dsize, WTA_K);
|
nkeypoints, dsize, WTA_K);
|
||||||
|
if(useOCL)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !useOCL )
|
if( !useOCL )
|
||||||
|
@ -856,54 +856,60 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask )
|
|||||||
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst,
|
|
||||||
int srcDstStep, IppiSize roiSize);
|
|
||||||
ippiAdd ippFunc = 0;
|
|
||||||
ippiAddMask ippFuncMask = 0;
|
|
||||||
|
|
||||||
if (mask.empty())
|
|
||||||
{
|
{
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
||||||
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAdd)ippiAdd_8u32f_C1IR :
|
typedef IppStatus (CV_STDCALL * ippiAddMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst,
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAdd)ippiAdd_16u32f_C1IR :
|
int srcDstStep, IppiSize roiSize);
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAdd)ippiAdd_32f_C1IR : 0;
|
ippiAdd ippFunc = 0;
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
ippiAddMask ippFuncMask = 0;
|
||||||
}
|
|
||||||
else if (scn == 1)
|
|
||||||
{
|
|
||||||
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddMask)ippiAdd_8u32f_C1IMR :
|
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddMask)ippiAdd_16u32f_C1IMR :
|
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddMask)ippiAdd_32f_C1IMR : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ippFunc || ippFuncMask)
|
|
||||||
{
|
|
||||||
IppStatus status = ippStsNoErr;
|
|
||||||
|
|
||||||
Size size = src.size();
|
|
||||||
int srcstep = (int)src.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
|
||||||
if (src.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
|
||||||
{
|
|
||||||
srcstep = static_cast<int>(src.total() * src.elemSize());
|
|
||||||
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
|
||||||
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
|
||||||
size.width = static_cast<int>(src.total());
|
|
||||||
size.height = 1;
|
|
||||||
}
|
|
||||||
size.width *= scn;
|
|
||||||
|
|
||||||
if (mask.empty())
|
if (mask.empty())
|
||||||
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
{
|
||||||
else
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAdd)ippiAdd_8u32f_C1IR :
|
||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAdd)ippiAdd_16u32f_C1IR :
|
||||||
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAdd)ippiAdd_32f_C1IR : 0;
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
|
else if (scn == 1)
|
||||||
|
{
|
||||||
|
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddMask)ippiAdd_8u32f_C1IMR :
|
||||||
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddMask)ippiAdd_16u32f_C1IMR :
|
||||||
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddMask)ippiAdd_32f_C1IMR : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (ippFunc || ippFuncMask)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
IppStatus status = ippStsNoErr;
|
||||||
|
|
||||||
|
Size size = src.size();
|
||||||
|
int srcstep = (int)src.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
||||||
|
if (src.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
||||||
|
{
|
||||||
|
srcstep = static_cast<int>(src.total() * src.elemSize());
|
||||||
|
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
||||||
|
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
||||||
|
size.width = static_cast<int>(src.total());
|
||||||
|
size.height = 1;
|
||||||
|
}
|
||||||
|
size.width *= scn;
|
||||||
|
|
||||||
|
if (mask.empty())
|
||||||
|
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
else
|
||||||
|
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
||||||
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -935,52 +941,58 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m
|
|||||||
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddSquareMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst,
|
|
||||||
int srcDstStep, IppiSize roiSize);
|
|
||||||
ippiAddSquare ippFunc = 0;
|
|
||||||
ippiAddSquareMask ippFuncMask = 0;
|
|
||||||
|
|
||||||
if (mask.empty())
|
|
||||||
{
|
{
|
||||||
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_8u32f_C1IR :
|
typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_16u32f_C1IR :
|
typedef IppStatus (CV_STDCALL * ippiAddSquareMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst,
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_32f_C1IR : 0;
|
int srcDstStep, IppiSize roiSize);
|
||||||
}
|
ippiAddSquare ippFunc = 0;
|
||||||
else if (scn == 1)
|
ippiAddSquareMask ippFuncMask = 0;
|
||||||
{
|
|
||||||
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_8u32f_C1IMR :
|
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_16u32f_C1IMR :
|
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_32f_C1IMR : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ippFunc || ippFuncMask)
|
|
||||||
{
|
|
||||||
IppStatus status = ippStsNoErr;
|
|
||||||
|
|
||||||
Size size = src.size();
|
|
||||||
int srcstep = (int)src.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
|
||||||
if (src.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
|
||||||
{
|
|
||||||
srcstep = static_cast<int>(src.total() * src.elemSize());
|
|
||||||
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
|
||||||
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
|
||||||
size.width = static_cast<int>(src.total());
|
|
||||||
size.height = 1;
|
|
||||||
}
|
|
||||||
size.width *= scn;
|
|
||||||
|
|
||||||
if (mask.empty())
|
if (mask.empty())
|
||||||
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
{
|
||||||
else
|
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_8u32f_C1IR :
|
||||||
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_16u32f_C1IR :
|
||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_32f_C1IR : 0;
|
||||||
|
}
|
||||||
|
else if (scn == 1)
|
||||||
|
{
|
||||||
|
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_8u32f_C1IMR :
|
||||||
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_16u32f_C1IMR :
|
||||||
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_32f_C1IMR : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (ippFunc || ippFuncMask)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
IppStatus status = ippStsNoErr;
|
||||||
|
|
||||||
|
Size size = src.size();
|
||||||
|
int srcstep = (int)src.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
||||||
|
if (src.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
||||||
|
{
|
||||||
|
srcstep = static_cast<int>(src.total() * src.elemSize());
|
||||||
|
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
||||||
|
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
||||||
|
size.width = static_cast<int>(src.total());
|
||||||
|
size.height = 1;
|
||||||
|
}
|
||||||
|
size.width *= scn;
|
||||||
|
|
||||||
|
if (mask.empty())
|
||||||
|
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
else
|
||||||
|
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
||||||
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1014,55 +1026,61 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2,
|
|||||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous()))
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2,
|
if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous()))
|
||||||
int src2Step, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize);
|
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddProductMask)(const void * pSrc1, int src1Step, const void * pSrc2, int src2Step,
|
|
||||||
const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize);
|
|
||||||
ippiAddProduct ippFunc = 0;
|
|
||||||
ippiAddProductMask ippFuncMask = 0;
|
|
||||||
|
|
||||||
if (mask.empty())
|
|
||||||
{
|
{
|
||||||
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_8u32f_C1IR :
|
typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2,
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_16u32f_C1IR :
|
int src2Step, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize);
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_32f_C1IR : 0;
|
typedef IppStatus (CV_STDCALL * ippiAddProductMask)(const void * pSrc1, int src1Step, const void * pSrc2, int src2Step,
|
||||||
}
|
const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize);
|
||||||
else if (scn == 1)
|
ippiAddProduct ippFunc = 0;
|
||||||
{
|
ippiAddProductMask ippFuncMask = 0;
|
||||||
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_8u32f_C1IMR :
|
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_16u32f_C1IMR :
|
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_32f_C1IMR : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ippFunc || ippFuncMask)
|
|
||||||
{
|
|
||||||
IppStatus status = ippStsNoErr;
|
|
||||||
|
|
||||||
Size size = src1.size();
|
|
||||||
int src1step = (int)src1.step, src2step = (int)src2.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
|
||||||
if (src1.isContinuous() && src2.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
|
||||||
{
|
|
||||||
src1step = static_cast<int>(src1.total() * src1.elemSize());
|
|
||||||
src2step = static_cast<int>(src2.total() * src2.elemSize());
|
|
||||||
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
|
||||||
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
|
||||||
size.width = static_cast<int>(src1.total());
|
|
||||||
size.height = 1;
|
|
||||||
}
|
|
||||||
size.width *= scn;
|
|
||||||
|
|
||||||
if (mask.empty())
|
if (mask.empty())
|
||||||
status = ippFunc(src1.ptr(), src1step, src2.ptr(), src2step, dst.ptr<Ipp32f>(),
|
{
|
||||||
dststep, ippiSize(size.width, size.height));
|
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_8u32f_C1IR :
|
||||||
else
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_16u32f_C1IR :
|
||||||
status = ippFuncMask(src1.ptr(), src1step, src2.ptr(), src2step, mask.ptr<Ipp8u>(), maskstep,
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_32f_C1IR : 0;
|
||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
}
|
||||||
|
else if (scn == 1)
|
||||||
|
{
|
||||||
|
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_8u32f_C1IMR :
|
||||||
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_16u32f_C1IMR :
|
||||||
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_32f_C1IMR : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (ippFunc || ippFuncMask)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
IppStatus status = ippStsNoErr;
|
||||||
|
|
||||||
|
Size size = src1.size();
|
||||||
|
int src1step = (int)src1.step, src2step = (int)src2.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
||||||
|
if (src1.isContinuous() && src2.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
||||||
|
{
|
||||||
|
src1step = static_cast<int>(src1.total() * src1.elemSize());
|
||||||
|
src2step = static_cast<int>(src2.total() * src2.elemSize());
|
||||||
|
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
||||||
|
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
||||||
|
size.width = static_cast<int>(src1.total());
|
||||||
|
size.height = 1;
|
||||||
|
}
|
||||||
|
size.width *= scn;
|
||||||
|
|
||||||
|
if (mask.empty())
|
||||||
|
status = ippFunc(src1.ptr(), src1step, src2.ptr(), src2step, dst.ptr<Ipp32f>(),
|
||||||
|
dststep, ippiSize(size.width, size.height));
|
||||||
|
else
|
||||||
|
status = ippFuncMask(src1.ptr(), src1step, src2.ptr(), src2step, mask.ptr<Ipp8u>(), maskstep,
|
||||||
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1095,54 +1113,60 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst,
|
|||||||
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat();
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && mask.isContinuous()))
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddWeighted)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep,
|
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && mask.isContinuous()))
|
||||||
IppiSize roiSize, Ipp32f alpha);
|
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddWeightedMask)(const void * pSrc, int srcStep, const Ipp8u * pMask,
|
|
||||||
int maskStep, Ipp32f * pSrcDst,
|
|
||||||
int srcDstStep, IppiSize roiSize, Ipp32f alpha);
|
|
||||||
ippiAddWeighted ippFunc = 0;
|
|
||||||
ippiAddWeightedMask ippFuncMask = 0;
|
|
||||||
|
|
||||||
if (mask.empty())
|
|
||||||
{
|
{
|
||||||
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_8u32f_C1IR :
|
typedef IppStatus (CV_STDCALL * ippiAddWeighted)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep,
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_16u32f_C1IR :
|
IppiSize roiSize, Ipp32f alpha);
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_32f_C1IR : 0;
|
typedef IppStatus (CV_STDCALL * ippiAddWeightedMask)(const void * pSrc, int srcStep, const Ipp8u * pMask,
|
||||||
}
|
int maskStep, Ipp32f * pSrcDst,
|
||||||
else if (scn == 1)
|
int srcDstStep, IppiSize roiSize, Ipp32f alpha);
|
||||||
{
|
ippiAddWeighted ippFunc = 0;
|
||||||
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_8u32f_C1IMR :
|
ippiAddWeightedMask ippFuncMask = 0;
|
||||||
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_16u32f_C1IMR :
|
|
||||||
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_32f_C1IMR : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ippFunc || ippFuncMask)
|
|
||||||
{
|
|
||||||
IppStatus status = ippStsNoErr;
|
|
||||||
|
|
||||||
Size size = src.size();
|
|
||||||
int srcstep = (int)src.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
|
||||||
if (src.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
|
||||||
{
|
|
||||||
srcstep = static_cast<int>(src.total() * src.elemSize());
|
|
||||||
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
|
||||||
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
|
||||||
size.width = static_cast<int>((int)src.total());
|
|
||||||
size.height = 1;
|
|
||||||
}
|
|
||||||
size.width *= scn;
|
|
||||||
|
|
||||||
if (mask.empty())
|
if (mask.empty())
|
||||||
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
{
|
||||||
else
|
ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_8u32f_C1IR :
|
||||||
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_16u32f_C1IR :
|
||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_32f_C1IR : 0;
|
||||||
|
}
|
||||||
|
else if (scn == 1)
|
||||||
|
{
|
||||||
|
ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_8u32f_C1IMR :
|
||||||
|
sdepth == CV_16U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_16u32f_C1IMR :
|
||||||
|
sdepth == CV_32F && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_32f_C1IMR : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (ippFunc || ippFuncMask)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
IppStatus status = ippStsNoErr;
|
||||||
|
|
||||||
|
Size size = src.size();
|
||||||
|
int srcstep = (int)src.step, dststep = (int)dst.step, maskstep = (int)mask.step;
|
||||||
|
if (src.isContinuous() && dst.isContinuous() && mask.isContinuous())
|
||||||
|
{
|
||||||
|
srcstep = static_cast<int>(src.total() * src.elemSize());
|
||||||
|
dststep = static_cast<int>(dst.total() * dst.elemSize());
|
||||||
|
maskstep = static_cast<int>(mask.total() * mask.elemSize());
|
||||||
|
size.width = static_cast<int>((int)src.total());
|
||||||
|
size.height = 1;
|
||||||
|
}
|
||||||
|
size.width *= scn;
|
||||||
|
|
||||||
|
if (mask.empty())
|
||||||
|
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||||
|
else
|
||||||
|
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
||||||
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -265,11 +265,17 @@ void cv::Canny( InputArray _src, OutputArray _dst,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_IPP_CANNY
|
#ifdef USE_IPP_CANNY
|
||||||
if( aperture_size == 3 && !L2gradient && 1 == cn )
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (ippCanny(src, dst, (float)low_thresh, (float)high_thresh))
|
if( aperture_size == 3 && !L2gradient && 1 == cn )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
if (ippCanny(src, dst, (float)low_thresh, (float)high_thresh))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -404,7 +404,10 @@ namespace
|
|||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
if (useOpenCL && clahe::calcLut(_srcForLut, ulut_, tilesX_, tilesY_, tileSize, clipLimit, lutScale) )
|
if (useOpenCL && clahe::calcLut(_srcForLut, ulut_, tilesX_, tilesY_, tileSize, clipLimit, lutScale) )
|
||||||
if( clahe::transform(_src, _dst, ulut_, tilesX_, tilesY_, tileSize) )
|
if( clahe::transform(_src, _dst, ulut_, tilesX_, tilesY_, tileSize) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cv::Mat src = _src.getMat();
|
cv::Mat src = _src.getMat();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -472,56 +472,62 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
|
|||||||
_dst.create( src.size(), CV_32FC1 );
|
_dst.create( src.size(), CV_32FC1 );
|
||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
#if defined(HAVE_IPP) && (IPP_VERSION_MAJOR >= 8)
|
#if defined(HAVE_IPP) && (IPP_VERSION_MAJOR >= 8)
|
||||||
typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
|
CV_IPP_CHECK()
|
||||||
typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
|
|
||||||
IppiKernelType kerType;
|
|
||||||
int kerSize = ksize;
|
|
||||||
if (ksize < 0)
|
|
||||||
{
|
{
|
||||||
kerType = ippKernelScharr;
|
typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
|
||||||
kerSize = 3;
|
typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
|
||||||
} else
|
IppiKernelType kerType;
|
||||||
{
|
int kerSize = ksize;
|
||||||
kerType = ippKernelSobel;
|
if (ksize < 0)
|
||||||
}
|
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
if ((borderTypeNI == BORDER_REPLICATE && (!src.isSubmatrix() || isolated)) &&
|
|
||||||
(kerSize == 3 || kerSize == 5) && (blockSize == 3 || blockSize == 5))
|
|
||||||
{
|
|
||||||
ippiMinEigenValGetBufferSize getBufferSizeFunc = 0;
|
|
||||||
ippiMinEigenVal minEigenValFunc = 0;
|
|
||||||
float norm_coef = 0.f;
|
|
||||||
|
|
||||||
if (src.type() == CV_8UC1)
|
|
||||||
{
|
{
|
||||||
getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_8u32f_C1R;
|
kerType = ippKernelScharr;
|
||||||
minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_8u32f_C1R;
|
kerSize = 3;
|
||||||
norm_coef = 1.f / 255.f;
|
} else
|
||||||
} else if (src.type() == CV_32FC1)
|
|
||||||
{
|
{
|
||||||
getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_32f_C1R;
|
kerType = ippKernelSobel;
|
||||||
minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_32f_C1R;
|
|
||||||
norm_coef = 255.f;
|
|
||||||
}
|
}
|
||||||
norm_coef = kerType == ippKernelSobel ? norm_coef : norm_coef / 2.45f;
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
if (getBufferSizeFunc && minEigenValFunc)
|
if ((borderTypeNI == BORDER_REPLICATE && (!src.isSubmatrix() || isolated)) &&
|
||||||
|
(kerSize == 3 || kerSize == 5) && (blockSize == 3 || blockSize == 5))
|
||||||
{
|
{
|
||||||
int bufferSize;
|
ippiMinEigenValGetBufferSize getBufferSizeFunc = 0;
|
||||||
IppiSize srcRoi = { src.cols, src.rows };
|
ippiMinEigenVal minEigenValFunc = 0;
|
||||||
IppStatus ok = getBufferSizeFunc(srcRoi, kerSize, blockSize, &bufferSize);
|
float norm_coef = 0.f;
|
||||||
if (ok >= 0)
|
|
||||||
|
if (src.type() == CV_8UC1)
|
||||||
{
|
{
|
||||||
AutoBuffer<uchar> buffer(bufferSize);
|
getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_8u32f_C1R;
|
||||||
ok = minEigenValFunc(src.ptr(), (int) src.step, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer);
|
minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_8u32f_C1R;
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
norm_coef = 1.f / 255.f;
|
||||||
if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi);
|
} else if (src.type() == CV_32FC1)
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
{
|
||||||
if (ok >= 0)
|
getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_32f_C1R;
|
||||||
return;
|
minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_32f_C1R;
|
||||||
|
norm_coef = 255.f;
|
||||||
|
}
|
||||||
|
norm_coef = kerType == ippKernelSobel ? norm_coef : norm_coef / 2.45f;
|
||||||
|
|
||||||
|
if (getBufferSizeFunc && minEigenValFunc)
|
||||||
|
{
|
||||||
|
int bufferSize;
|
||||||
|
IppiSize srcRoi = { src.cols, src.rows };
|
||||||
|
IppStatus ok = getBufferSizeFunc(srcRoi, kerSize, blockSize, &bufferSize);
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
AutoBuffer<uchar> buffer(bufferSize);
|
||||||
|
ok = minEigenValFunc(src.ptr(), (int) src.step, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer);
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi);
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -538,44 +544,50 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi
|
|||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && 0
|
#if IPP_VERSION_X100 >= 801 && 0
|
||||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
CV_IPP_CHECK()
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
|
||||||
|
|
||||||
if ( (ksize == 3 || ksize == 5) && (type == CV_8UC1 || type == CV_32FC1) &&
|
|
||||||
(borderTypeNI == BORDER_CONSTANT || borderTypeNI == BORDER_REPLICATE) && cn == 1 && (!src.isSubmatrix() || isolated) )
|
|
||||||
{
|
{
|
||||||
IppiSize roisize = { src.cols, src.rows };
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
IppiMaskSize masksize = ksize == 5 ? ippMskSize5x5 : ippMskSize3x3;
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp32f;
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
Ipp32s bufsize = 0;
|
|
||||||
|
|
||||||
double scale = (double)(1 << ((ksize > 0 ? ksize : 3) - 1)) * blockSize;
|
if ( (ksize == 3 || ksize == 5) && (type == CV_8UC1 || type == CV_32FC1) &&
|
||||||
if (ksize < 0)
|
(borderTypeNI == BORDER_CONSTANT || borderTypeNI == BORDER_REPLICATE) && cn == 1 && (!src.isSubmatrix() || isolated) )
|
||||||
scale *= 2.0;
|
|
||||||
if (depth == CV_8U)
|
|
||||||
scale *= 255.0;
|
|
||||||
scale = std::pow(scale, -4.0);
|
|
||||||
|
|
||||||
if (ippiHarrisCornerGetBufferSize(roisize, masksize, blockSize, datatype, cn, &bufsize) >= 0)
|
|
||||||
{
|
{
|
||||||
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
IppiSize roisize = { src.cols, src.rows };
|
||||||
IppiDifferentialKernel filterType = ksize > 0 ? ippFilterSobel : ippFilterScharr;
|
IppiMaskSize masksize = ksize == 5 ? ippMskSize5x5 : ippMskSize3x3;
|
||||||
IppiBorderType borderTypeIpp = borderTypeNI == BORDER_CONSTANT ? ippBorderConst : ippBorderRepl;
|
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp32f;
|
||||||
IppStatus status = (IppStatus)-1;
|
Ipp32s bufsize = 0;
|
||||||
|
|
||||||
|
double scale = (double)(1 << ((ksize > 0 ? ksize : 3) - 1)) * blockSize;
|
||||||
|
if (ksize < 0)
|
||||||
|
scale *= 2.0;
|
||||||
if (depth == CV_8U)
|
if (depth == CV_8U)
|
||||||
status = ippiHarrisCorner_8u32f_C1R((const Ipp8u *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize,
|
scale *= 255.0;
|
||||||
filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer);
|
scale = std::pow(scale, -4.0);
|
||||||
else if (depth == CV_32F)
|
|
||||||
status = ippiHarrisCorner_32f_C1R((const Ipp32f *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize,
|
|
||||||
filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer);
|
|
||||||
ippsFree(buffer);
|
|
||||||
|
|
||||||
if (status >= 0)
|
if (ippiHarrisCornerGetBufferSize(roisize, masksize, blockSize, datatype, cn, &bufsize) >= 0)
|
||||||
return;
|
{
|
||||||
|
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
||||||
|
IppiDifferentialKernel filterType = ksize > 0 ? ippFilterSobel : ippFilterScharr;
|
||||||
|
IppiBorderType borderTypeIpp = borderTypeNI == BORDER_CONSTANT ? ippBorderConst : ippBorderRepl;
|
||||||
|
IppStatus status = (IppStatus)-1;
|
||||||
|
|
||||||
|
if (depth == CV_8U)
|
||||||
|
status = ippiHarrisCorner_8u32f_C1R((const Ipp8u *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize,
|
||||||
|
filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer);
|
||||||
|
else if (depth == CV_32F)
|
||||||
|
status = ippiHarrisCorner_32f_C1R((const Ipp32f *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize,
|
||||||
|
filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer);
|
||||||
|
ippsFree(buffer);
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -573,15 +573,24 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
if (ksize < 0)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
if (ksize < 0)
|
||||||
return;
|
{
|
||||||
}
|
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||||
else if (0 < ksize)
|
{
|
||||||
{
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
if (IPPDerivSobel(_src, _dst, ddepth, dx, dy, ksize, scale, delta, borderType))
|
return;
|
||||||
return;
|
}
|
||||||
|
}
|
||||||
|
else if (0 < ksize)
|
||||||
|
{
|
||||||
|
if (IPPDerivSobel(_src, _dst, ddepth, dx, dy, ksize, scale, delta, borderType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
||||||
@ -620,8 +629,14 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
|
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
||||||
|
|
||||||
@ -793,62 +808,68 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
|||||||
_dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
|
_dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
|
CV_IPP_CHECK()
|
||||||
((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)) && !ocl::useOpenCL())
|
|
||||||
{
|
{
|
||||||
int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
|
if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
|
||||||
bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
|
((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)) && !ocl::useOpenCL())
|
||||||
bool floatDelta = std::fabs(delta - idelta) > DBL_EPSILON, needDelta = delta != 0;
|
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
Mat src = _src.getMat(), dst = _dst.getMat();
|
|
||||||
|
|
||||||
if (src.data != dst.data)
|
|
||||||
{
|
{
|
||||||
Ipp32s bufsize;
|
int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
|
||||||
IppStatus status = (IppStatus)-1;
|
bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
|
||||||
IppiSize roisize = { src.cols, src.rows };
|
bool floatDelta = std::fabs(delta - idelta) > DBL_EPSILON, needDelta = delta != 0;
|
||||||
IppiMaskSize masksize = ksize == 3 ? ippMskSize3x3 : ippMskSize5x5;
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
IppiBorderType borderTypeIpp = ippiGetBorderType(borderTypeNI);
|
Mat src = _src.getMat(), dst = _dst.getMat();
|
||||||
|
|
||||||
|
if (src.data != dst.data)
|
||||||
|
{
|
||||||
|
Ipp32s bufsize;
|
||||||
|
IppStatus status = (IppStatus)-1;
|
||||||
|
IppiSize roisize = { src.cols, src.rows };
|
||||||
|
IppiMaskSize masksize = ksize == 3 ? ippMskSize3x3 : ippMskSize5x5;
|
||||||
|
IppiBorderType borderTypeIpp = ippiGetBorderType(borderTypeNI);
|
||||||
|
|
||||||
#define IPP_FILTER_LAPLACIAN(ippsrctype, ippdsttype, ippfavor) \
|
#define IPP_FILTER_LAPLACIAN(ippsrctype, ippdsttype, ippfavor) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if (borderTypeIpp >= 0 && ippiFilterLaplacianGetBufferSize_##ippfavor##_C1R(roisize, masksize, &bufsize) >= 0) \
|
|
||||||
{ \
|
{ \
|
||||||
Ipp8u * buffer = ippsMalloc_8u(bufsize); \
|
if (borderTypeIpp >= 0 && ippiFilterLaplacianGetBufferSize_##ippfavor##_C1R(roisize, masksize, &bufsize) >= 0) \
|
||||||
status = ippiFilterLaplacianBorder_##ippfavor##_C1R(src.ptr<ippsrctype>(), (int)src.step, dst.ptr<ippdsttype>(), \
|
{ \
|
||||||
(int)dst.step, roisize, masksize, borderTypeIpp, 0, buffer); \
|
Ipp8u * buffer = ippsMalloc_8u(bufsize); \
|
||||||
ippsFree(buffer); \
|
status = ippiFilterLaplacianBorder_##ippfavor##_C1R(src.ptr<ippsrctype>(), (int)src.step, dst.ptr<ippdsttype>(), \
|
||||||
} \
|
(int)dst.step, roisize, masksize, borderTypeIpp, 0, buffer); \
|
||||||
} while ((void)0, 0)
|
ippsFree(buffer); \
|
||||||
|
} \
|
||||||
|
} while ((void)0, 0)
|
||||||
|
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
if (sdepth == CV_8U && ddepth == CV_16S && !floatScale && !floatDelta)
|
if (sdepth == CV_8U && ddepth == CV_16S && !floatScale && !floatDelta)
|
||||||
{
|
{
|
||||||
IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s);
|
IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s);
|
||||||
|
|
||||||
if (needScale && status >= 0)
|
if (needScale && status >= 0)
|
||||||
status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||||
if (needDelta && status >= 0)
|
if (needDelta && status >= 0)
|
||||||
status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||||
|
}
|
||||||
|
else if (sdepth == CV_32F && ddepth == CV_32F)
|
||||||
|
{
|
||||||
|
IPP_FILTER_LAPLACIAN(Ipp32f, Ipp32f, 32f);
|
||||||
|
|
||||||
|
if (needScale && status >= 0)
|
||||||
|
status = ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||||
|
if (needDelta && status >= 0)
|
||||||
|
status = ippiAddC_32f_C1IR((Ipp32f)delta, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||||
|
}
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
|
||||||
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (sdepth == CV_32F && ddepth == CV_32F)
|
|
||||||
{
|
|
||||||
IPP_FILTER_LAPLACIAN(Ipp32f, Ipp32f, 32f);
|
|
||||||
|
|
||||||
if (needScale && status >= 0)
|
|
||||||
status = ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
|
||||||
if (needDelta && status >= 0)
|
|
||||||
status = ippiAddC_32f_C1IR((Ipp32f)delta, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
|
||||||
}
|
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
|
|
||||||
if (status >= 0)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#undef IPP_FILTER_LAPLACIAN
|
#undef IPP_FILTER_LAPLACIAN
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
|
@ -688,13 +688,19 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst)
|
|||||||
_dst.create( src.size(), CV_8UC1);
|
_dst.create( src.size(), CV_8UC1);
|
||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize roi = { src.cols, src.rows };
|
IppiSize roi = { src.cols, src.rows };
|
||||||
Ipp32s pMetrics[2] = { 1, 2 }; //L1, 3x3 mask
|
Ipp32s pMetrics[2] = { 1, 2 }; //L1, 3x3 mask
|
||||||
if (ippiDistanceTransform_3x3_8u_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<uchar>(), (int)dst.step, roi, pMetrics)>=0)
|
if (ippiDistanceTransform_3x3_8u_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<uchar>(), (int)dst.step, roi, pMetrics)>=0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
#endif
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
distanceATS_L1_8u(src, dst);
|
distanceATS_L1_8u(src, dst);
|
||||||
}
|
}
|
||||||
@ -735,22 +741,28 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
IppStatus status;
|
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
|
||||||
IppiSize roi = { src.cols, src.rows };
|
|
||||||
Ipp8u *pBuffer;
|
|
||||||
int bufSize=0;
|
|
||||||
|
|
||||||
status = ippiTrueDistanceTransformGetBufferSize_8u32f_C1R(roi, &bufSize);
|
|
||||||
if (status>=0)
|
|
||||||
{
|
{
|
||||||
pBuffer = (Ipp8u *)ippMalloc( bufSize );
|
IppStatus status;
|
||||||
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
|
IppiSize roi = { src.cols, src.rows };
|
||||||
ippFree( pBuffer );
|
Ipp8u *pBuffer;
|
||||||
|
int bufSize=0;
|
||||||
|
|
||||||
|
status = ippiTrueDistanceTransformGetBufferSize_8u32f_C1R(roi, &bufSize);
|
||||||
if (status>=0)
|
if (status>=0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
pBuffer = (Ipp8u *)ippMalloc( bufSize );
|
||||||
|
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
|
||||||
|
ippFree( pBuffer );
|
||||||
|
if (status>=0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -773,23 +785,35 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
|||||||
{
|
{
|
||||||
if( maskSize == CV_DIST_MASK_3 )
|
if( maskSize == CV_DIST_MASK_3 )
|
||||||
{
|
{
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize roi = { src.cols, src.rows };
|
IppiSize roi = { src.cols, src.rows };
|
||||||
if (ippiDistanceTransform_3x3_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
|
if (ippiDistanceTransform_3x3_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
#endif
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
distanceTransform_3x3(src, temp, dst, _mask);
|
distanceTransform_3x3(src, temp, dst, _mask);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
IppiSize roi = { src.cols, src.rows };
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
|
IppiSize roi = { src.cols, src.rows };
|
||||||
if (ippiDistanceTransform_5x5_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
|
if (ippiDistanceTransform_5x5_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
#endif
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
distanceTransform_5x5(src, temp, dst, _mask);
|
distanceTransform_5x5(src, temp, dst, _mask);
|
||||||
}
|
}
|
||||||
|
@ -1423,9 +1423,12 @@ struct RowVec_32f
|
|||||||
int operator()(const uchar* _src, uchar* _dst, int width, int cn) const
|
int operator()(const uchar* _src, uchar* _dst, int width, int cn) const
|
||||||
{
|
{
|
||||||
#if defined USE_IPP_SEP_FILTERS && 0
|
#if defined USE_IPP_SEP_FILTERS && 0
|
||||||
int ret = ippiOperator(_src, _dst, width, cn);
|
CV_IPP_CHECK()
|
||||||
if (ret > 0)
|
{
|
||||||
return ret;
|
int ret = ippiOperator(_src, _dst, width, cn);
|
||||||
|
if (ret > 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
int _ksize = kernel.rows + kernel.cols - 1;
|
int _ksize = kernel.rows + kernel.cols - 1;
|
||||||
const float* src0 = (const float*)_src;
|
const float* src0 = (const float*)_src;
|
||||||
@ -1494,6 +1497,7 @@ private:
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return width - _ksize + 1;
|
return width - _ksize + 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3743,67 +3747,73 @@ void cv::filter2D( InputArray _src, OutputArray _dst, int ddepth,
|
|||||||
Point anchor = normalizeAnchor(anchor0, kernel.size());
|
Point anchor = normalizeAnchor(anchor0, kernel.size());
|
||||||
|
|
||||||
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
|
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
|
||||||
typedef IppStatus (CV_STDCALL * ippiFilterBorder)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize dstRoiSize,
|
CV_IPP_CHECK()
|
||||||
IppiBorderType border, const void * borderValue,
|
|
||||||
const IppiFilterBorderSpec* pSpec, Ipp8u* pBuffer);
|
|
||||||
|
|
||||||
int stype = src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype),
|
|
||||||
ktype = kernel.type(), kdepth = CV_MAT_DEPTH(ktype);
|
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
|
||||||
Point ippAnchor(kernel.cols >> 1, kernel.rows >> 1);
|
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
IppiBorderType ippBorderType = ippiGetBorderType(borderTypeNI);
|
|
||||||
|
|
||||||
if (borderTypeNI == BORDER_CONSTANT || borderTypeNI == BORDER_REPLICATE)
|
|
||||||
{
|
{
|
||||||
ippiFilterBorder ippFunc =
|
typedef IppStatus (CV_STDCALL * ippiFilterBorder)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize dstRoiSize,
|
||||||
stype == CV_8UC1 ? (ippiFilterBorder)ippiFilterBorder_8u_C1R :
|
IppiBorderType border, const void * borderValue,
|
||||||
stype == CV_8UC3 ? (ippiFilterBorder)ippiFilterBorder_8u_C3R :
|
const IppiFilterBorderSpec* pSpec, Ipp8u* pBuffer);
|
||||||
stype == CV_8UC4 ? (ippiFilterBorder)ippiFilterBorder_8u_C4R :
|
|
||||||
stype == CV_16UC1 ? (ippiFilterBorder)ippiFilterBorder_16u_C1R :
|
|
||||||
stype == CV_16UC3 ? (ippiFilterBorder)ippiFilterBorder_16u_C3R :
|
|
||||||
stype == CV_16UC4 ? (ippiFilterBorder)ippiFilterBorder_16u_C4R :
|
|
||||||
stype == CV_16SC1 ? (ippiFilterBorder)ippiFilterBorder_16s_C1R :
|
|
||||||
stype == CV_16SC3 ? (ippiFilterBorder)ippiFilterBorder_16s_C3R :
|
|
||||||
stype == CV_16SC4 ? (ippiFilterBorder)ippiFilterBorder_16s_C4R :
|
|
||||||
stype == CV_32FC1 ? (ippiFilterBorder)ippiFilterBorder_32f_C1R :
|
|
||||||
stype == CV_32FC3 ? (ippiFilterBorder)ippiFilterBorder_32f_C3R :
|
|
||||||
stype == CV_32FC4 ? (ippiFilterBorder)ippiFilterBorder_32f_C4R : 0;
|
|
||||||
|
|
||||||
if (sdepth == ddepth && (ktype == CV_16SC1 || ktype == CV_32FC1) &&
|
int stype = src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype),
|
||||||
ippFunc && (int)ippBorderType >= 0 && (!src.isSubmatrix() || isolated) &&
|
ktype = kernel.type(), kdepth = CV_MAT_DEPTH(ktype);
|
||||||
std::fabs(delta - 0) < DBL_EPSILON && ippAnchor == anchor && dst.data != src.data)
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
|
Point ippAnchor(kernel.cols >> 1, kernel.rows >> 1);
|
||||||
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
|
IppiBorderType ippBorderType = ippiGetBorderType(borderTypeNI);
|
||||||
|
|
||||||
|
if (borderTypeNI == BORDER_CONSTANT || borderTypeNI == BORDER_REPLICATE)
|
||||||
{
|
{
|
||||||
IppiSize kernelSize = { kernel.cols, kernel.rows }, dstRoiSize = { dst.cols, dst.rows };
|
ippiFilterBorder ippFunc =
|
||||||
IppDataType dataType = ippiGetDataType(ddepth), kernelType = ippiGetDataType(kdepth);
|
stype == CV_8UC1 ? (ippiFilterBorder)ippiFilterBorder_8u_C1R :
|
||||||
Ipp32s specSize = 0, bufsize = 0;
|
stype == CV_8UC3 ? (ippiFilterBorder)ippiFilterBorder_8u_C3R :
|
||||||
IppStatus status = (IppStatus)-1;
|
stype == CV_8UC4 ? (ippiFilterBorder)ippiFilterBorder_8u_C4R :
|
||||||
|
stype == CV_16UC1 ? (ippiFilterBorder)ippiFilterBorder_16u_C1R :
|
||||||
|
stype == CV_16UC3 ? (ippiFilterBorder)ippiFilterBorder_16u_C3R :
|
||||||
|
stype == CV_16UC4 ? (ippiFilterBorder)ippiFilterBorder_16u_C4R :
|
||||||
|
stype == CV_16SC1 ? (ippiFilterBorder)ippiFilterBorder_16s_C1R :
|
||||||
|
stype == CV_16SC3 ? (ippiFilterBorder)ippiFilterBorder_16s_C3R :
|
||||||
|
stype == CV_16SC4 ? (ippiFilterBorder)ippiFilterBorder_16s_C4R :
|
||||||
|
stype == CV_32FC1 ? (ippiFilterBorder)ippiFilterBorder_32f_C1R :
|
||||||
|
stype == CV_32FC3 ? (ippiFilterBorder)ippiFilterBorder_32f_C3R :
|
||||||
|
stype == CV_32FC4 ? (ippiFilterBorder)ippiFilterBorder_32f_C4R : 0;
|
||||||
|
|
||||||
if ((status = ippiFilterBorderGetSize(kernelSize, dstRoiSize, dataType, kernelType, cn, &specSize, &bufsize)) >= 0)
|
if (sdepth == ddepth && (ktype == CV_16SC1 || ktype == CV_32FC1) &&
|
||||||
|
ippFunc && (int)ippBorderType >= 0 && (!src.isSubmatrix() || isolated) &&
|
||||||
|
std::fabs(delta - 0) < DBL_EPSILON && ippAnchor == anchor && dst.data != src.data)
|
||||||
{
|
{
|
||||||
IppiFilterBorderSpec * spec = (IppiFilterBorderSpec *)ippMalloc(specSize);
|
IppiSize kernelSize = { kernel.cols, kernel.rows }, dstRoiSize = { dst.cols, dst.rows };
|
||||||
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
IppDataType dataType = ippiGetDataType(ddepth), kernelType = ippiGetDataType(kdepth);
|
||||||
Ipp32f borderValue[4] = { 0, 0, 0, 0 };
|
Ipp32s specSize = 0, bufsize = 0;
|
||||||
|
IppStatus status = (IppStatus)-1;
|
||||||
|
|
||||||
Mat reversedKernel;
|
if ((status = ippiFilterBorderGetSize(kernelSize, dstRoiSize, dataType, kernelType, cn, &specSize, &bufsize)) >= 0)
|
||||||
flip(kernel, reversedKernel, -1);
|
|
||||||
|
|
||||||
if ((kdepth == CV_32F && (status = ippiFilterBorderInit_32f((const Ipp32f *)reversedKernel.data, kernelSize,
|
|
||||||
dataType, cn, ippRndFinancial, spec)) >= 0 ) ||
|
|
||||||
(kdepth == CV_16S && (status = ippiFilterBorderInit_16s((const Ipp16s *)reversedKernel.data,
|
|
||||||
kernelSize, 0, dataType, cn, ippRndFinancial, spec)) >= 0))
|
|
||||||
{
|
{
|
||||||
status = ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, dstRoiSize,
|
IppiFilterBorderSpec * spec = (IppiFilterBorderSpec *)ippMalloc(specSize);
|
||||||
ippBorderType, borderValue, spec, buffer);
|
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
||||||
|
Ipp32f borderValue[4] = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
Mat reversedKernel;
|
||||||
|
flip(kernel, reversedKernel, -1);
|
||||||
|
|
||||||
|
if ((kdepth == CV_32F && (status = ippiFilterBorderInit_32f((const Ipp32f *)reversedKernel.data, kernelSize,
|
||||||
|
dataType, cn, ippRndFinancial, spec)) >= 0 ) ||
|
||||||
|
(kdepth == CV_16S && (status = ippiFilterBorderInit_16s((const Ipp16s *)reversedKernel.data,
|
||||||
|
kernelSize, 0, dataType, cn, ippRndFinancial, spec)) >= 0))
|
||||||
|
{
|
||||||
|
status = ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, dstRoiSize,
|
||||||
|
ippBorderType, borderValue, spec, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
ippsFree(buffer);
|
||||||
|
ippsFree(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
ippsFree(buffer);
|
if (status >= 0)
|
||||||
ippsFree(spec);
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1200,6 +1200,7 @@ public:
|
|||||||
*ok = false;
|
*ok = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
|
||||||
for (int i = 0; i < histSize; ++i)
|
for (int i = 0; i < histSize; ++i)
|
||||||
CV_XADD((int *)(hist->data + i * hist->step), *(int *)(phist.data + i * phist.step));
|
CV_XADD((int *)(hist->data + i * hist->step), *(int *)(phist.data + i * phist.step));
|
||||||
@ -1233,29 +1234,33 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
|
|||||||
ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S;
|
ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S;
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels &&
|
CV_IPP_CHECK()
|
||||||
channels[0] == 0 && mask.empty() && images[0].dims <= 2 &&
|
|
||||||
!accumulate && uniform)
|
|
||||||
{
|
{
|
||||||
ihist.setTo(Scalar::all(0));
|
if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels &&
|
||||||
AutoBuffer<Ipp32s> levels(histSize[0] + 1);
|
channels[0] == 0 && mask.empty() && images[0].dims <= 2 &&
|
||||||
|
!accumulate && uniform)
|
||||||
bool ok = true;
|
|
||||||
const Mat & src = images[0];
|
|
||||||
int nstripes = std::min<int>(8, static_cast<int>(src.total() / (1 << 16)));
|
|
||||||
#ifdef HAVE_CONCURRENCY
|
|
||||||
nstripes = 1;
|
|
||||||
#endif
|
|
||||||
IPPCalcHistInvoker invoker(src, ihist, levels, histSize[0] + 1, (Ipp32s)ranges[0][0], (Ipp32s)ranges[0][1], &ok);
|
|
||||||
Range range(0, src.rows);
|
|
||||||
parallel_for_(range, invoker, nstripes);
|
|
||||||
|
|
||||||
if (ok)
|
|
||||||
{
|
{
|
||||||
ihist.convertTo(hist, CV_32F);
|
ihist.setTo(Scalar::all(0));
|
||||||
return;
|
AutoBuffer<Ipp32s> levels(histSize[0] + 1);
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
const Mat & src = images[0];
|
||||||
|
int nstripes = std::min<int>(8, static_cast<int>(src.total() / (1 << 16)));
|
||||||
|
#ifdef HAVE_CONCURRENCY
|
||||||
|
nstripes = 1;
|
||||||
|
#endif
|
||||||
|
IPPCalcHistInvoker invoker(src, ihist, levels, histSize[0] + 1, (Ipp32s)ranges[0][0], (Ipp32s)ranges[0][1], &ok);
|
||||||
|
Range range(0, src.rows);
|
||||||
|
parallel_for_(range, invoker, nstripes);
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
ihist.convertTo(hist, CV_32F);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -100,25 +100,29 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
|
|||||||
int numrho = cvRound(((width + height) * 2 + 1) / rho);
|
int numrho = cvRound(((width + height) * 2 + 1) / rho);
|
||||||
|
|
||||||
#if (0 && defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
|
#if (0 && defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
|
||||||
IppiSize srcSize = { width, height };
|
CV_IPP_CHECK()
|
||||||
IppPointPolar delta = { rho, theta };
|
|
||||||
IppPointPolar dstRoi[2] = {{(Ipp32f) -(width + height), (Ipp32f) min_theta},{(Ipp32f) (width + height), (Ipp32f) max_theta}};
|
|
||||||
int bufferSize;
|
|
||||||
int nz = countNonZero(img);
|
|
||||||
int ipp_linesMax = std::min(linesMax, nz*numangle/threshold);
|
|
||||||
int linesCount = 0;
|
|
||||||
lines.resize(ipp_linesMax);
|
|
||||||
IppStatus ok = ippiHoughLineGetSize_8u_C1R(srcSize, delta, ipp_linesMax, &bufferSize);
|
|
||||||
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
|
||||||
if (ok >= 0) ok = ippiHoughLine_Region_8u32f_C1R(image, step, srcSize, (IppPointPolar*) &lines[0], dstRoi, ipp_linesMax, &linesCount, delta, threshold, buffer);
|
|
||||||
ippsFree(buffer);
|
|
||||||
if (ok >= 0)
|
|
||||||
{
|
{
|
||||||
lines.resize(linesCount);
|
IppiSize srcSize = { width, height };
|
||||||
return;
|
IppPointPolar delta = { rho, theta };
|
||||||
|
IppPointPolar dstRoi[2] = {{(Ipp32f) -(width + height), (Ipp32f) min_theta},{(Ipp32f) (width + height), (Ipp32f) max_theta}};
|
||||||
|
int bufferSize;
|
||||||
|
int nz = countNonZero(img);
|
||||||
|
int ipp_linesMax = std::min(linesMax, nz*numangle/threshold);
|
||||||
|
int linesCount = 0;
|
||||||
|
lines.resize(ipp_linesMax);
|
||||||
|
IppStatus ok = ippiHoughLineGetSize_8u_C1R(srcSize, delta, ipp_linesMax, &bufferSize);
|
||||||
|
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
||||||
|
if (ok >= 0) ok = ippiHoughLine_Region_8u32f_C1R(image, step, srcSize, (IppPointPolar*) &lines[0], dstRoi, ipp_linesMax, &linesCount, delta, threshold, buffer);
|
||||||
|
ippsFree(buffer);
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
lines.resize(linesCount);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lines.clear();
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
lines.clear();
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AutoBuffer<int> _accum((numangle+2) * (numrho+2));
|
AutoBuffer<int> _accum((numangle+2) * (numrho+2));
|
||||||
@ -429,28 +433,32 @@ HoughLinesProbabilistic( Mat& image,
|
|||||||
int numrho = cvRound(((width + height) * 2 + 1) / rho);
|
int numrho = cvRound(((width + height) * 2 + 1) / rho);
|
||||||
|
|
||||||
#if (0 && defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
|
#if (0 && defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801)
|
||||||
IppiSize srcSize = { width, height };
|
CV_IPP_CHECK()
|
||||||
IppPointPolar delta = { rho, theta };
|
|
||||||
IppiHoughProbSpec* pSpec;
|
|
||||||
int bufferSize, specSize;
|
|
||||||
int ipp_linesMax = std::min(linesMax, numangle*numrho);
|
|
||||||
int linesCount = 0;
|
|
||||||
lines.resize(ipp_linesMax);
|
|
||||||
IppStatus ok = ippiHoughProbLineGetSize_8u_C1R(srcSize, delta, &specSize, &bufferSize);
|
|
||||||
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
|
||||||
pSpec = (IppiHoughProbSpec*) malloc(specSize);
|
|
||||||
if (ok >= 0) ok = ippiHoughProbLineInit_8u32f_C1R(srcSize, delta, ippAlgHintNone, pSpec);
|
|
||||||
if (ok >= 0) ok = ippiHoughProbLine_8u32f_C1R(image.data, image.step, srcSize, threshold, lineLength, lineGap, (IppiPoint*) &lines[0], ipp_linesMax, &linesCount, buffer, pSpec);
|
|
||||||
|
|
||||||
free(pSpec);
|
|
||||||
ippsFree(buffer);
|
|
||||||
if (ok >= 0)
|
|
||||||
{
|
{
|
||||||
lines.resize(linesCount);
|
IppiSize srcSize = { width, height };
|
||||||
return;
|
IppPointPolar delta = { rho, theta };
|
||||||
|
IppiHoughProbSpec* pSpec;
|
||||||
|
int bufferSize, specSize;
|
||||||
|
int ipp_linesMax = std::min(linesMax, numangle*numrho);
|
||||||
|
int linesCount = 0;
|
||||||
|
lines.resize(ipp_linesMax);
|
||||||
|
IppStatus ok = ippiHoughProbLineGetSize_8u_C1R(srcSize, delta, &specSize, &bufferSize);
|
||||||
|
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
||||||
|
pSpec = (IppiHoughProbSpec*) malloc(specSize);
|
||||||
|
if (ok >= 0) ok = ippiHoughProbLineInit_8u32f_C1R(srcSize, delta, ippAlgHintNone, pSpec);
|
||||||
|
if (ok >= 0) ok = ippiHoughProbLine_8u32f_C1R(image.data, image.step, srcSize, threshold, lineLength, lineGap, (IppiPoint*) &lines[0], ipp_linesMax, &linesCount, buffer, pSpec);
|
||||||
|
|
||||||
|
free(pSpec);
|
||||||
|
ippsFree(buffer);
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
lines.resize(linesCount);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lines.clear();
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
lines.clear();
|
|
||||||
setIppErrorStatus();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Mat accum = Mat::zeros( numangle, numrho, CV_32SC1 );
|
Mat accum = Mat::zeros( numangle, numrho, CV_32SC1 );
|
||||||
|
@ -2271,6 +2271,10 @@ public:
|
|||||||
|
|
||||||
if( func( pSrc, (int)src.step[0], pDst, (int)dst.step[0], dstOffset, dstSize, ippBorderRepl, 0, pSpec, bufptr ) < 0 )
|
if( func( pSrc, (int)src.step[0], pDst, (int)dst.step[0], dstOffset, dstSize, ippBorderRepl, 0, pSpec, bufptr ) < 0 )
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
const Mat & src;
|
const Mat & src;
|
||||||
@ -2694,35 +2698,41 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
|
|||||||
std::abs(scale_y - iscale_y) < DBL_EPSILON;
|
std::abs(scale_y - iscale_y) < DBL_EPSILON;
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 701
|
#if IPP_VERSION_X100 >= 701
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
#define IPP_RESIZE_EPS 1e-10
|
#define IPP_RESIZE_EPS 1e-10
|
||||||
|
|
||||||
double ex = fabs((double)dsize.width / src.cols - inv_scale_x) / inv_scale_x;
|
double ex = fabs((double)dsize.width / src.cols - inv_scale_x) / inv_scale_x;
|
||||||
double ey = fabs((double)dsize.height / src.rows - inv_scale_y) / inv_scale_y;
|
double ey = fabs((double)dsize.height / src.rows - inv_scale_y) / inv_scale_y;
|
||||||
|
|
||||||
if ( ((ex < IPP_RESIZE_EPS && ey < IPP_RESIZE_EPS && depth != CV_64F) || (ex == 0 && ey == 0 && depth == CV_64F)) &&
|
if ( ((ex < IPP_RESIZE_EPS && ey < IPP_RESIZE_EPS && depth != CV_64F) || (ex == 0 && ey == 0 && depth == CV_64F)) &&
|
||||||
(interpolation == INTER_LINEAR || interpolation == INTER_CUBIC) &&
|
(interpolation == INTER_LINEAR || interpolation == INTER_CUBIC) &&
|
||||||
!(interpolation == INTER_LINEAR && is_area_fast && iscale_x == 2 && iscale_y == 2 && depth == CV_8U))
|
!(interpolation == INTER_LINEAR && is_area_fast && iscale_x == 2 && iscale_y == 2 && depth == CV_8U))
|
||||||
{
|
|
||||||
int mode = -1;
|
|
||||||
if (interpolation == INTER_LINEAR && src.rows >= 2 && src.cols >= 2)
|
|
||||||
mode = ippLinear;
|
|
||||||
else if (interpolation == INTER_CUBIC && src.rows >= 4 && src.cols >= 4)
|
|
||||||
mode = ippCubic;
|
|
||||||
|
|
||||||
if( mode >= 0 && (cn == 1 || cn == 3 || cn == 4) &&
|
|
||||||
(depth == CV_16U || depth == CV_16S || depth == CV_32F ||
|
|
||||||
(depth == CV_64F && mode == ippLinear)))
|
|
||||||
{
|
{
|
||||||
bool ok = true;
|
int mode = -1;
|
||||||
Range range(0, src.rows);
|
if (interpolation == INTER_LINEAR && src.rows >= 2 && src.cols >= 2)
|
||||||
IPPresizeInvoker invoker(src, dst, inv_scale_x, inv_scale_y, mode, &ok);
|
mode = ippLinear;
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
else if (interpolation == INTER_CUBIC && src.rows >= 4 && src.cols >= 4)
|
||||||
if( ok )
|
mode = ippCubic;
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
if( mode >= 0 && (cn == 1 || cn == 3 || cn == 4) &&
|
||||||
|
(depth == CV_16U || depth == CV_16S || depth == CV_32F ||
|
||||||
|
(depth == CV_64F && mode == ippLinear)))
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
Range range(0, src.rows);
|
||||||
|
IPPresizeInvoker invoker(src, dst, inv_scale_x, inv_scale_y, mode, &ok);
|
||||||
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
|
if( ok )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#undef IPP_RESIZE_EPS
|
#undef IPP_RESIZE_EPS
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( interpolation == INTER_NEAREST )
|
if( interpolation == INTER_NEAREST )
|
||||||
@ -4033,6 +4043,10 @@ public:
|
|||||||
map1.ptr<Ipp32f>(), (int)map1.step, map2.ptr<Ipp32f>(), (int)map2.step,
|
map1.ptr<Ipp32f>(), (int)map1.step, map2.ptr<Ipp32f>(), (int)map2.step,
|
||||||
dstRoi.ptr(), (int)dstRoi.step, dstRoiSize, ippInterpolation) < 0)
|
dstRoi.ptr(), (int)dstRoi.step, dstRoiSize, ippInterpolation) < 0)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -4102,36 +4116,42 @@ void cv::remap( InputArray _src, OutputArray _dst,
|
|||||||
int type = src.type(), depth = CV_MAT_DEPTH(type);
|
int type = src.type(), depth = CV_MAT_DEPTH(type);
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 0 && !defined HAVE_IPP_ICV_ONLY && 0
|
#if IPP_VERSION_X100 >= 0 && !defined HAVE_IPP_ICV_ONLY && 0
|
||||||
if ((interpolation == INTER_LINEAR || interpolation == INTER_CUBIC || interpolation == INTER_NEAREST) &&
|
CV_IPP_CHECK()
|
||||||
map1.type() == CV_32FC1 && map2.type() == CV_32FC1 &&
|
|
||||||
(borderType == BORDER_CONSTANT || borderType == BORDER_TRANSPARENT))
|
|
||||||
{
|
{
|
||||||
int ippInterpolation =
|
if ((interpolation == INTER_LINEAR || interpolation == INTER_CUBIC || interpolation == INTER_NEAREST) &&
|
||||||
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
map1.type() == CV_32FC1 && map2.type() == CV_32FC1 &&
|
||||||
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR : IPPI_INTER_CUBIC;
|
(borderType == BORDER_CONSTANT || borderType == BORDER_TRANSPARENT))
|
||||||
|
|
||||||
ippiRemap ippFunc =
|
|
||||||
type == CV_8UC1 ? (ippiRemap)ippiRemap_8u_C1R :
|
|
||||||
type == CV_8UC3 ? (ippiRemap)ippiRemap_8u_C3R :
|
|
||||||
type == CV_8UC4 ? (ippiRemap)ippiRemap_8u_C4R :
|
|
||||||
type == CV_16UC1 ? (ippiRemap)ippiRemap_16u_C1R :
|
|
||||||
type == CV_16UC3 ? (ippiRemap)ippiRemap_16u_C3R :
|
|
||||||
type == CV_16UC4 ? (ippiRemap)ippiRemap_16u_C4R :
|
|
||||||
type == CV_32FC1 ? (ippiRemap)ippiRemap_32f_C1R :
|
|
||||||
type == CV_32FC3 ? (ippiRemap)ippiRemap_32f_C3R :
|
|
||||||
type == CV_32FC4 ? (ippiRemap)ippiRemap_32f_C4R : 0;
|
|
||||||
|
|
||||||
if (ippFunc)
|
|
||||||
{
|
{
|
||||||
bool ok;
|
int ippInterpolation =
|
||||||
IPPRemapInvoker invoker(src, dst, map1, map2, ippFunc, ippInterpolation,
|
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
||||||
borderType, borderValue, &ok);
|
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR : IPPI_INTER_CUBIC;
|
||||||
Range range(0, dst.rows);
|
|
||||||
parallel_for_(range, invoker, dst.total() / (double)(1 << 16));
|
|
||||||
|
|
||||||
if (ok)
|
ippiRemap ippFunc =
|
||||||
return;
|
type == CV_8UC1 ? (ippiRemap)ippiRemap_8u_C1R :
|
||||||
setIppErrorStatus();
|
type == CV_8UC3 ? (ippiRemap)ippiRemap_8u_C3R :
|
||||||
|
type == CV_8UC4 ? (ippiRemap)ippiRemap_8u_C4R :
|
||||||
|
type == CV_16UC1 ? (ippiRemap)ippiRemap_16u_C1R :
|
||||||
|
type == CV_16UC3 ? (ippiRemap)ippiRemap_16u_C3R :
|
||||||
|
type == CV_16UC4 ? (ippiRemap)ippiRemap_16u_C4R :
|
||||||
|
type == CV_32FC1 ? (ippiRemap)ippiRemap_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiRemap)ippiRemap_32f_C3R :
|
||||||
|
type == CV_32FC4 ? (ippiRemap)ippiRemap_32f_C4R : 0;
|
||||||
|
|
||||||
|
if (ippFunc)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
IPPRemapInvoker invoker(src, dst, map1, map2, ippFunc, ippInterpolation,
|
||||||
|
borderType, borderValue, &ok);
|
||||||
|
Range range(0, dst.rows);
|
||||||
|
parallel_for_(range, invoker, dst.total() / (double)(1 << 16));
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4482,6 +4502,10 @@ public:
|
|||||||
(int)dst.step[0], dstroi, coeffs, mode );
|
(int)dst.step[0], dstroi, coeffs, mode );
|
||||||
if( status < 0)
|
if( status < 0)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Mat &src;
|
Mat &src;
|
||||||
@ -4649,60 +4673,66 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
|||||||
const int AB_SCALE = 1 << AB_BITS;
|
const int AB_SCALE = 1 << AB_BITS;
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR >= 801 && 0
|
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR >= 801 && 0
|
||||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
CV_IPP_CHECK()
|
||||||
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
|
|
||||||
( cn == 1 || cn == 3 || cn == 4 ) &&
|
|
||||||
( interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC) &&
|
|
||||||
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT) )
|
|
||||||
{
|
{
|
||||||
ippiWarpAffineBackFunc ippFunc = 0;
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
if ((flags & WARP_INVERSE_MAP) != 0)
|
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
|
||||||
|
( cn == 1 || cn == 3 || cn == 4 ) &&
|
||||||
|
( interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC) &&
|
||||||
|
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT) )
|
||||||
{
|
{
|
||||||
ippFunc =
|
ippiWarpAffineBackFunc ippFunc = 0;
|
||||||
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R :
|
if ((flags & WARP_INVERSE_MAP) != 0)
|
||||||
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R :
|
{
|
||||||
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R :
|
ippFunc =
|
||||||
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C1R :
|
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R :
|
||||||
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C3R :
|
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R :
|
||||||
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C4R :
|
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R :
|
||||||
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C1R :
|
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C1R :
|
||||||
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R :
|
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C3R :
|
||||||
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R :
|
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C4R :
|
||||||
|
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R :
|
||||||
|
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R :
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ippFunc =
|
||||||
|
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C1R :
|
||||||
|
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C3R :
|
||||||
|
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C4R :
|
||||||
|
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C1R :
|
||||||
|
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C3R :
|
||||||
|
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C4R :
|
||||||
|
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C3R :
|
||||||
|
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C4R :
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
int mode =
|
||||||
|
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
||||||
|
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
||||||
|
interpolation == INTER_CUBIC ? IPPI_INTER_CUBIC :
|
||||||
0;
|
0;
|
||||||
}
|
CV_Assert(mode && ippFunc);
|
||||||
else
|
|
||||||
{
|
|
||||||
ippFunc =
|
|
||||||
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C1R :
|
|
||||||
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C3R :
|
|
||||||
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C4R :
|
|
||||||
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C1R :
|
|
||||||
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C3R :
|
|
||||||
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C4R :
|
|
||||||
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C1R :
|
|
||||||
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C3R :
|
|
||||||
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C4R :
|
|
||||||
0;
|
|
||||||
}
|
|
||||||
int mode =
|
|
||||||
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
|
||||||
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
|
||||||
interpolation == INTER_CUBIC ? IPPI_INTER_CUBIC :
|
|
||||||
0;
|
|
||||||
CV_Assert(mode && ippFunc);
|
|
||||||
|
|
||||||
double coeffs[2][3];
|
double coeffs[2][3];
|
||||||
for( int i = 0; i < 2; i++ )
|
for( int i = 0; i < 2; i++ )
|
||||||
for( int j = 0; j < 3; j++ )
|
for( int j = 0; j < 3; j++ )
|
||||||
coeffs[i][j] = matM.at<double>(i, j);
|
coeffs[i][j] = matM.at<double>(i, j);
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
Range range(0, dst.rows);
|
Range range(0, dst.rows);
|
||||||
IPPWarpAffineInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
IPPWarpAffineInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
if( ok )
|
if( ok )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4847,6 +4877,10 @@ public:
|
|||||||
IppStatus status = func(src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), (int)dst.step[0], dstroi, coeffs, mode);
|
IppStatus status = func(src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), (int)dst.step[0], dstroi, coeffs, mode);
|
||||||
if (status != ippStsNoErr)
|
if (status != ippStsNoErr)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Mat &src;
|
Mat &src;
|
||||||
@ -4895,55 +4929,61 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
|
|||||||
|
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR >= 801 && 0
|
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR >= 801 && 0
|
||||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
CV_IPP_CHECK()
|
||||||
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
|
|
||||||
(cn == 1 || cn == 3 || cn == 4) &&
|
|
||||||
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) &&
|
|
||||||
(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC))
|
|
||||||
{
|
{
|
||||||
ippiWarpPerspectiveFunc ippFunc = 0;
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
if ((flags & WARP_INVERSE_MAP) != 0)
|
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
|
||||||
|
(cn == 1 || cn == 3 || cn == 4) &&
|
||||||
|
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) &&
|
||||||
|
(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC))
|
||||||
{
|
{
|
||||||
ippFunc = type == CV_8UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C1R :
|
ippiWarpPerspectiveFunc ippFunc = 0;
|
||||||
type == CV_8UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C3R :
|
if ((flags & WARP_INVERSE_MAP) != 0)
|
||||||
type == CV_8UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C4R :
|
{
|
||||||
type == CV_16UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C1R :
|
ippFunc = type == CV_8UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C1R :
|
||||||
type == CV_16UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C3R :
|
type == CV_8UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C3R :
|
||||||
type == CV_16UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C4R :
|
type == CV_8UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C4R :
|
||||||
type == CV_32FC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C1R :
|
type == CV_16UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C1R :
|
||||||
type == CV_32FC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C3R :
|
type == CV_16UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C3R :
|
||||||
type == CV_32FC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C4R : 0;
|
type == CV_16UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C4R :
|
||||||
}
|
type == CV_32FC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C1R :
|
||||||
else
|
type == CV_32FC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C3R :
|
||||||
{
|
type == CV_32FC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C4R : 0;
|
||||||
ippFunc = type == CV_8UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C1R :
|
}
|
||||||
type == CV_8UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C3R :
|
else
|
||||||
type == CV_8UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C4R :
|
{
|
||||||
type == CV_16UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C1R :
|
ippFunc = type == CV_8UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C1R :
|
||||||
type == CV_16UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C3R :
|
type == CV_8UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C3R :
|
||||||
type == CV_16UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C4R :
|
type == CV_8UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C4R :
|
||||||
type == CV_32FC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C1R :
|
type == CV_16UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C1R :
|
||||||
type == CV_32FC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C3R :
|
type == CV_16UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C3R :
|
||||||
type == CV_32FC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C4R : 0;
|
type == CV_16UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C4R :
|
||||||
}
|
type == CV_32FC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C1R :
|
||||||
int mode =
|
type == CV_32FC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C3R :
|
||||||
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
type == CV_32FC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C4R : 0;
|
||||||
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
}
|
||||||
interpolation == INTER_CUBIC ? IPPI_INTER_CUBIC : 0;
|
int mode =
|
||||||
CV_Assert(mode && ippFunc);
|
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
||||||
|
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
||||||
|
interpolation == INTER_CUBIC ? IPPI_INTER_CUBIC : 0;
|
||||||
|
CV_Assert(mode && ippFunc);
|
||||||
|
|
||||||
double coeffs[3][3];
|
double coeffs[3][3];
|
||||||
for( int i = 0; i < 3; i++ )
|
for( int i = 0; i < 3; i++ )
|
||||||
for( int j = 0; j < 3; j++ )
|
for( int j = 0; j < 3; j++ )
|
||||||
coeffs[i][j] = matM.at<double>(i, j);
|
coeffs[i][j] = matM.at<double>(i, j);
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
Range range(0, dst.rows);
|
Range range(0, dst.rows);
|
||||||
IPPWarpPerspectiveInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
IPPWarpPerspectiveInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
if( ok )
|
if( ok )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -578,64 +578,68 @@ cv::Moments cv::moments( InputArray _src, bool binary )
|
|||||||
CV_Error( CV_StsBadArg, "Invalid image type (must be single-channel)" );
|
CV_Error( CV_StsBadArg, "Invalid image type (must be single-channel)" );
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && 0
|
#if IPP_VERSION_X100 >= 801 && 0
|
||||||
if (!binary)
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
IppiSize roi = { mat.cols, mat.rows };
|
if (!binary)
|
||||||
IppiMomentState_64f * moment = NULL;
|
|
||||||
// ippiMomentInitAlloc_64f, ippiMomentFree_64f are deprecated in 8.1, but there are not another way
|
|
||||||
// to initialize IppiMomentState_64f. When GetStateSize and Init functions will appear we have to
|
|
||||||
// change our code.
|
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
|
||||||
if (ippiMomentInitAlloc_64f(&moment, ippAlgHintAccurate) >= 0)
|
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiMoments)(const void * pSrc, int srcStep, IppiSize roiSize, IppiMomentState_64f* pCtx);
|
IppiSize roi = { mat.cols, mat.rows };
|
||||||
ippiMoments ippFunc =
|
IppiMomentState_64f * moment = NULL;
|
||||||
type == CV_8UC1 ? (ippiMoments)ippiMoments64f_8u_C1R :
|
// ippiMomentInitAlloc_64f, ippiMomentFree_64f are deprecated in 8.1, but there are not another way
|
||||||
type == CV_16UC1 ? (ippiMoments)ippiMoments64f_16u_C1R :
|
// to initialize IppiMomentState_64f. When GetStateSize and Init functions will appear we have to
|
||||||
type == CV_32FC1? (ippiMoments)ippiMoments64f_32f_C1R : 0;
|
// change our code.
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
if (ippFunc)
|
if (ippiMomentInitAlloc_64f(&moment, ippAlgHintAccurate) >= 0)
|
||||||
{
|
{
|
||||||
if (ippFunc(mat.data, (int)mat.step, roi, moment) >= 0)
|
typedef IppStatus (CV_STDCALL * ippiMoments)(const void * pSrc, int srcStep, IppiSize roiSize, IppiMomentState_64f* pCtx);
|
||||||
|
ippiMoments ippFunc =
|
||||||
|
type == CV_8UC1 ? (ippiMoments)ippiMoments64f_8u_C1R :
|
||||||
|
type == CV_16UC1 ? (ippiMoments)ippiMoments64f_16u_C1R :
|
||||||
|
type == CV_32FC1? (ippiMoments)ippiMoments64f_32f_C1R : 0;
|
||||||
|
|
||||||
|
if (ippFunc)
|
||||||
{
|
{
|
||||||
IppiPoint point = { 0, 0 };
|
if (ippFunc(mat.data, (int)mat.step, roi, moment) >= 0)
|
||||||
ippiGetSpatialMoment_64f(moment, 0, 0, 0, point, &m.m00);
|
{
|
||||||
ippiGetSpatialMoment_64f(moment, 1, 0, 0, point, &m.m10);
|
IppiPoint point = { 0, 0 };
|
||||||
ippiGetSpatialMoment_64f(moment, 0, 1, 0, point, &m.m01);
|
ippiGetSpatialMoment_64f(moment, 0, 0, 0, point, &m.m00);
|
||||||
|
ippiGetSpatialMoment_64f(moment, 1, 0, 0, point, &m.m10);
|
||||||
|
ippiGetSpatialMoment_64f(moment, 0, 1, 0, point, &m.m01);
|
||||||
|
|
||||||
ippiGetSpatialMoment_64f(moment, 2, 0, 0, point, &m.m20);
|
ippiGetSpatialMoment_64f(moment, 2, 0, 0, point, &m.m20);
|
||||||
ippiGetSpatialMoment_64f(moment, 1, 1, 0, point, &m.m11);
|
ippiGetSpatialMoment_64f(moment, 1, 1, 0, point, &m.m11);
|
||||||
ippiGetSpatialMoment_64f(moment, 0, 2, 0, point, &m.m02);
|
ippiGetSpatialMoment_64f(moment, 0, 2, 0, point, &m.m02);
|
||||||
|
|
||||||
ippiGetSpatialMoment_64f(moment, 3, 0, 0, point, &m.m30);
|
ippiGetSpatialMoment_64f(moment, 3, 0, 0, point, &m.m30);
|
||||||
ippiGetSpatialMoment_64f(moment, 2, 1, 0, point, &m.m21);
|
ippiGetSpatialMoment_64f(moment, 2, 1, 0, point, &m.m21);
|
||||||
ippiGetSpatialMoment_64f(moment, 1, 2, 0, point, &m.m12);
|
ippiGetSpatialMoment_64f(moment, 1, 2, 0, point, &m.m12);
|
||||||
ippiGetSpatialMoment_64f(moment, 0, 3, 0, point, &m.m03);
|
ippiGetSpatialMoment_64f(moment, 0, 3, 0, point, &m.m03);
|
||||||
ippiGetCentralMoment_64f(moment, 2, 0, 0, &m.mu20);
|
ippiGetCentralMoment_64f(moment, 2, 0, 0, &m.mu20);
|
||||||
ippiGetCentralMoment_64f(moment, 1, 1, 0, &m.mu11);
|
ippiGetCentralMoment_64f(moment, 1, 1, 0, &m.mu11);
|
||||||
ippiGetCentralMoment_64f(moment, 0, 2, 0, &m.mu02);
|
ippiGetCentralMoment_64f(moment, 0, 2, 0, &m.mu02);
|
||||||
ippiGetCentralMoment_64f(moment, 3, 0, 0, &m.mu30);
|
ippiGetCentralMoment_64f(moment, 3, 0, 0, &m.mu30);
|
||||||
ippiGetCentralMoment_64f(moment, 2, 1, 0, &m.mu21);
|
ippiGetCentralMoment_64f(moment, 2, 1, 0, &m.mu21);
|
||||||
ippiGetCentralMoment_64f(moment, 1, 2, 0, &m.mu12);
|
ippiGetCentralMoment_64f(moment, 1, 2, 0, &m.mu12);
|
||||||
ippiGetCentralMoment_64f(moment, 0, 3, 0, &m.mu03);
|
ippiGetCentralMoment_64f(moment, 0, 3, 0, &m.mu03);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 2, 0, 0, &m.nu20);
|
ippiGetNormalizedCentralMoment_64f(moment, 2, 0, 0, &m.nu20);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 1, 1, 0, &m.nu11);
|
ippiGetNormalizedCentralMoment_64f(moment, 1, 1, 0, &m.nu11);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 0, 2, 0, &m.nu02);
|
ippiGetNormalizedCentralMoment_64f(moment, 0, 2, 0, &m.nu02);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 3, 0, 0, &m.nu30);
|
ippiGetNormalizedCentralMoment_64f(moment, 3, 0, 0, &m.nu30);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 2, 1, 0, &m.nu21);
|
ippiGetNormalizedCentralMoment_64f(moment, 2, 1, 0, &m.nu21);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 1, 2, 0, &m.nu12);
|
ippiGetNormalizedCentralMoment_64f(moment, 1, 2, 0, &m.nu12);
|
||||||
ippiGetNormalizedCentralMoment_64f(moment, 0, 3, 0, &m.nu03);
|
ippiGetNormalizedCentralMoment_64f(moment, 0, 3, 0, &m.nu03);
|
||||||
|
|
||||||
ippiMomentFree_64f(moment);
|
ippiMomentFree_64f(moment);
|
||||||
return m;
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
ippiMomentFree_64f(moment);
|
||||||
}
|
}
|
||||||
ippiMomentFree_64f(moment);
|
else
|
||||||
|
setIppErrorStatus();
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
else
|
|
||||||
setIppErrorStatus();
|
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1707,8 +1707,14 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801
|
#if IPP_VERSION_X100 >= 801
|
||||||
if( IPPMorphOp(op, _src, _dst, kernel, anchor, iterations, borderType, borderValue) )
|
CV_IPP_CHECK()
|
||||||
return;
|
{
|
||||||
|
if( IPPMorphOp(op, _src, _dst, kernel, anchor, iterations, borderType, borderValue) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Mat src = _src.getMat();
|
Mat src = _src.getMat();
|
||||||
|
@ -703,36 +703,42 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && 0
|
#if IPP_VERSION_X100 >= 801 && 0
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
CV_IPP_CHECK()
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size((src.cols + 1)/2, (src.rows + 1)/2))
|
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiPyrDown)(const void* pSrc, int srcStep, void* pDst, int dstStep, IppiSize srcRoi, Ipp8u* buffer);
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
int type = src.type();
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size((src.cols + 1)/2, (src.rows + 1)/2))
|
||||||
ippiPyrDown pyrDownFunc = type == CV_8UC1 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_8u_C1R :
|
|
||||||
type == CV_8UC3 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_8u_C3R :
|
|
||||||
type == CV_32FC1 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_32f_C1R :
|
|
||||||
type == CV_32FC3 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_32f_C3R : 0;
|
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
|
|
||||||
if (pyrDownFunc)
|
|
||||||
{
|
{
|
||||||
int bufferSize;
|
typedef IppStatus (CV_STDCALL * ippiPyrDown)(const void* pSrc, int srcStep, void* pDst, int dstStep, IppiSize srcRoi, Ipp8u* buffer);
|
||||||
IppiSize srcRoi = { src.cols, src.rows };
|
int type = src.type();
|
||||||
IppDataType dataType = depth == CV_8U ? ipp8u : ipp32f;
|
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
IppStatus ok = ippiPyrDownGetBufSize_Gauss5x5(srcRoi.width, dataType, src.channels(), &bufferSize);
|
ippiPyrDown pyrDownFunc = type == CV_8UC1 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_8u_C1R :
|
||||||
|
type == CV_8UC3 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_8u_C3R :
|
||||||
|
type == CV_32FC1 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiPyrDown) ippiPyrDown_Gauss5x5_32f_C3R : 0;
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
if (ok >= 0)
|
|
||||||
{
|
|
||||||
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
|
||||||
ok = pyrDownFunc(src.data, (int) src.step, dst.data, (int) dst.step, srcRoi, buffer);
|
|
||||||
ippsFree(buffer);
|
|
||||||
|
|
||||||
|
if (pyrDownFunc)
|
||||||
|
{
|
||||||
|
int bufferSize;
|
||||||
|
IppiSize srcRoi = { src.cols, src.rows };
|
||||||
|
IppDataType dataType = depth == CV_8U ? ipp8u : ipp32f;
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
IppStatus ok = ippiPyrDownGetBufSize_Gauss5x5(srcRoi.width, dataType, src.channels(), &bufferSize);
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
||||||
|
ok = pyrDownFunc(src.data, (int) src.step, dst.data, (int) dst.step, srcRoi, buffer);
|
||||||
|
ippsFree(buffer);
|
||||||
|
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -774,36 +780,42 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && 0
|
#if IPP_VERSION_X100 >= 801 && 0
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
CV_IPP_CHECK()
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size(src.cols*2, src.rows*2))
|
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiPyrUp)(const void* pSrc, int srcStep, void* pDst, int dstStep, IppiSize srcRoi, Ipp8u* buffer);
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
int type = src.type();
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size(src.cols*2, src.rows*2))
|
||||||
ippiPyrUp pyrUpFunc = type == CV_8UC1 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_8u_C1R :
|
|
||||||
type == CV_8UC3 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_8u_C3R :
|
|
||||||
type == CV_32FC1 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_32f_C1R :
|
|
||||||
type == CV_32FC3 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_32f_C3R : 0;
|
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
|
|
||||||
if (pyrUpFunc)
|
|
||||||
{
|
{
|
||||||
int bufferSize;
|
typedef IppStatus (CV_STDCALL * ippiPyrUp)(const void* pSrc, int srcStep, void* pDst, int dstStep, IppiSize srcRoi, Ipp8u* buffer);
|
||||||
IppiSize srcRoi = { src.cols, src.rows };
|
int type = src.type();
|
||||||
IppDataType dataType = depth == CV_8U ? ipp8u : ipp32f;
|
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
IppStatus ok = ippiPyrUpGetBufSize_Gauss5x5(srcRoi.width, dataType, src.channels(), &bufferSize);
|
ippiPyrUp pyrUpFunc = type == CV_8UC1 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_8u_C1R :
|
||||||
|
type == CV_8UC3 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_8u_C3R :
|
||||||
|
type == CV_32FC1 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiPyrUp) ippiPyrUp_Gauss5x5_32f_C3R : 0;
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
if (ok >= 0)
|
|
||||||
{
|
|
||||||
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
|
||||||
ok = pyrUpFunc(src.data, (int) src.step, dst.data, (int) dst.step, srcRoi, buffer);
|
|
||||||
ippsFree(buffer);
|
|
||||||
|
|
||||||
|
if (pyrUpFunc)
|
||||||
|
{
|
||||||
|
int bufferSize;
|
||||||
|
IppiSize srcRoi = { src.cols, src.rows };
|
||||||
|
IppDataType dataType = depth == CV_8U ? ipp8u : ipp32f;
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
IppStatus ok = ippiPyrUpGetBufSize_Gauss5x5(srcRoi.width, dataType, src.channels(), &bufferSize);
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
|
||||||
|
ok = pyrUpFunc(src.data, (int) src.step, dst.data, (int) dst.step, srcRoi, buffer);
|
||||||
|
ippsFree(buffer);
|
||||||
|
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -847,87 +859,94 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
|
|||||||
int i=1;
|
int i=1;
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && 0
|
#if IPP_VERSION_X100 >= 801 && 0
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
CV_IPP_CHECK()
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
|
||||||
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated))
|
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiPyramidLayerDownInitAlloc)(void** ppState, IppiSize srcRoi, Ipp32f rate, void* pKernel, int kerSize, int mode);
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
typedef IppStatus (CV_STDCALL * ippiPyramidLayerDown)(void* pSrc, int srcStep, IppiSize srcRoiSize, void* pDst, int dstStep, IppiSize dstRoiSize, void* pState);
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
typedef IppStatus (CV_STDCALL * ippiPyramidLayerDownFree)(void* pState);
|
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated))
|
||||||
|
|
||||||
int type = src.type();
|
|
||||||
int depth = src.depth();
|
|
||||||
ippiPyramidLayerDownInitAlloc pyrInitAllocFunc = 0;
|
|
||||||
ippiPyramidLayerDown pyrDownFunc = 0;
|
|
||||||
ippiPyramidLayerDownFree pyrFreeFunc = 0;
|
|
||||||
|
|
||||||
if (type == CV_8UC1)
|
|
||||||
{
|
{
|
||||||
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_8u_C1R;
|
typedef IppStatus (CV_STDCALL * ippiPyramidLayerDownInitAlloc)(void** ppState, IppiSize srcRoi, Ipp32f rate, void* pKernel, int kerSize, int mode);
|
||||||
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_8u_C1R;
|
typedef IppStatus (CV_STDCALL * ippiPyramidLayerDown)(void* pSrc, int srcStep, IppiSize srcRoiSize, void* pDst, int dstStep, IppiSize dstRoiSize, void* pState);
|
||||||
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_8u_C1R;
|
typedef IppStatus (CV_STDCALL * ippiPyramidLayerDownFree)(void* pState);
|
||||||
}
|
|
||||||
else if (type == CV_8UC3)
|
|
||||||
{
|
|
||||||
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_8u_C3R;
|
|
||||||
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_8u_C3R;
|
|
||||||
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_8u_C3R;
|
|
||||||
}
|
|
||||||
else if (type == CV_32FC1)
|
|
||||||
{
|
|
||||||
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_32f_C1R;
|
|
||||||
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_32f_C1R;
|
|
||||||
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_32f_C1R;
|
|
||||||
}
|
|
||||||
else if (type == CV_32FC3)
|
|
||||||
{
|
|
||||||
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_32f_C3R;
|
|
||||||
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_32f_C3R;
|
|
||||||
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_32f_C3R;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pyrInitAllocFunc && pyrDownFunc && pyrFreeFunc)
|
int type = src.type();
|
||||||
{
|
int depth = src.depth();
|
||||||
float rate = 2.f;
|
ippiPyramidLayerDownInitAlloc pyrInitAllocFunc = 0;
|
||||||
IppiSize srcRoi = { src.cols, src.rows };
|
ippiPyramidLayerDown pyrDownFunc = 0;
|
||||||
IppiPyramid *gPyr;
|
ippiPyramidLayerDownFree pyrFreeFunc = 0;
|
||||||
IppStatus ok = ippiPyramidInitAlloc(&gPyr, maxlevel + 1, srcRoi, rate);
|
|
||||||
|
|
||||||
Ipp16s iKernel[5] = { 1, 4, 6, 4, 1 };
|
if (type == CV_8UC1)
|
||||||
Ipp32f fKernel[5] = { 1.f, 4.f, 6.f, 4.f, 1.f };
|
|
||||||
void* kernel = depth >= CV_32F ? (void*) fKernel : (void*) iKernel;
|
|
||||||
|
|
||||||
if (ok >= 0) ok = pyrInitAllocFunc((void**) &(gPyr->pState), srcRoi, rate, kernel, 5, IPPI_INTER_LINEAR);
|
|
||||||
if (ok >= 0)
|
|
||||||
{
|
{
|
||||||
gPyr->pImage[0] = src.data;
|
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_8u_C1R;
|
||||||
gPyr->pStep[0] = (int) src.step;
|
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_8u_C1R;
|
||||||
gPyr->pRoi[0] = srcRoi;
|
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_8u_C1R;
|
||||||
for( ; i <= maxlevel; i++ )
|
}
|
||||||
{
|
else if (type == CV_8UC3)
|
||||||
IppiSize dstRoi;
|
{
|
||||||
ok = ippiGetPyramidDownROI(gPyr->pRoi[i-1], &dstRoi, rate);
|
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_8u_C3R;
|
||||||
Mat& dst = _dst.getMatRef(i);
|
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_8u_C3R;
|
||||||
dst.create(Size(dstRoi.width, dstRoi.height), type);
|
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_8u_C3R;
|
||||||
gPyr->pImage[i] = dst.data;
|
}
|
||||||
gPyr->pStep[i] = (int) dst.step;
|
else if (type == CV_32FC1)
|
||||||
gPyr->pRoi[i] = dstRoi;
|
{
|
||||||
|
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_32f_C1R;
|
||||||
if (ok >= 0) ok = pyrDownFunc(gPyr->pImage[i-1], gPyr->pStep[i-1], gPyr->pRoi[i-1],
|
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_32f_C1R;
|
||||||
gPyr->pImage[i], gPyr->pStep[i], gPyr->pRoi[i], gPyr->pState);
|
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_32f_C1R;
|
||||||
|
}
|
||||||
if (ok < 0)
|
else if (type == CV_32FC3)
|
||||||
{
|
{
|
||||||
setIppErrorStatus();
|
pyrInitAllocFunc = (ippiPyramidLayerDownInitAlloc) ippiPyramidLayerDownInitAlloc_32f_C3R;
|
||||||
break;
|
pyrDownFunc = (ippiPyramidLayerDown) ippiPyramidLayerDown_32f_C3R;
|
||||||
}
|
pyrFreeFunc = (ippiPyramidLayerDownFree) ippiPyramidLayerDownFree_32f_C3R;
|
||||||
}
|
|
||||||
pyrFreeFunc(gPyr->pState);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
setIppErrorStatus();
|
|
||||||
|
|
||||||
ippiPyramidFree(gPyr);
|
if (pyrInitAllocFunc && pyrDownFunc && pyrFreeFunc)
|
||||||
|
{
|
||||||
|
float rate = 2.f;
|
||||||
|
IppiSize srcRoi = { src.cols, src.rows };
|
||||||
|
IppiPyramid *gPyr;
|
||||||
|
IppStatus ok = ippiPyramidInitAlloc(&gPyr, maxlevel + 1, srcRoi, rate);
|
||||||
|
|
||||||
|
Ipp16s iKernel[5] = { 1, 4, 6, 4, 1 };
|
||||||
|
Ipp32f fKernel[5] = { 1.f, 4.f, 6.f, 4.f, 1.f };
|
||||||
|
void* kernel = depth >= CV_32F ? (void*) fKernel : (void*) iKernel;
|
||||||
|
|
||||||
|
if (ok >= 0) ok = pyrInitAllocFunc((void**) &(gPyr->pState), srcRoi, rate, kernel, 5, IPPI_INTER_LINEAR);
|
||||||
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
gPyr->pImage[0] = src.data;
|
||||||
|
gPyr->pStep[0] = (int) src.step;
|
||||||
|
gPyr->pRoi[0] = srcRoi;
|
||||||
|
for( ; i <= maxlevel; i++ )
|
||||||
|
{
|
||||||
|
IppiSize dstRoi;
|
||||||
|
ok = ippiGetPyramidDownROI(gPyr->pRoi[i-1], &dstRoi, rate);
|
||||||
|
Mat& dst = _dst.getMatRef(i);
|
||||||
|
dst.create(Size(dstRoi.width, dstRoi.height), type);
|
||||||
|
gPyr->pImage[i] = dst.data;
|
||||||
|
gPyr->pStep[i] = (int) dst.step;
|
||||||
|
gPyr->pRoi[i] = dstRoi;
|
||||||
|
|
||||||
|
if (ok >= 0) ok = pyrDownFunc(gPyr->pImage[i-1], gPyr->pStep[i-1], gPyr->pRoi[i-1],
|
||||||
|
gPyr->pImage[i], gPyr->pStep[i], gPyr->pRoi[i], gPyr->pState);
|
||||||
|
|
||||||
|
if (ok < 0)
|
||||||
|
{
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pyrFreeFunc(gPyr->pState);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setIppErrorStatus();
|
||||||
|
|
||||||
|
ippiPyramidFree(gPyr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -375,27 +375,33 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
|||||||
Mat patch = _patch.getMat();
|
Mat patch = _patch.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step,
|
CV_IPP_CHECK()
|
||||||
IppiSize src_size, void* dst,
|
|
||||||
int dst_step, IppiSize win_size,
|
|
||||||
IppiPoint_32f center,
|
|
||||||
IppiPoint* minpt, IppiPoint* maxpt );
|
|
||||||
|
|
||||||
IppiPoint minpt={0,0}, maxpt={0,0};
|
|
||||||
IppiPoint_32f icenter = {center.x, center.y};
|
|
||||||
IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows};
|
|
||||||
int srctype = image.type();
|
|
||||||
ippiGetRectSubPixFunc ippfunc =
|
|
||||||
srctype == CV_8UC1 && ddepth == CV_8U ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R :
|
|
||||||
srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R :
|
|
||||||
srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0;
|
|
||||||
|
|
||||||
if( ippfunc)
|
|
||||||
{
|
{
|
||||||
if (ippfunc(image.ptr(), (int)image.step, src_size, patch.ptr(),
|
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step,
|
||||||
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
IppiSize src_size, void* dst,
|
||||||
return;
|
int dst_step, IppiSize win_size,
|
||||||
setIppErrorStatus();
|
IppiPoint_32f center,
|
||||||
|
IppiPoint* minpt, IppiPoint* maxpt );
|
||||||
|
|
||||||
|
IppiPoint minpt={0,0}, maxpt={0,0};
|
||||||
|
IppiPoint_32f icenter = {center.x, center.y};
|
||||||
|
IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows};
|
||||||
|
int srctype = image.type();
|
||||||
|
ippiGetRectSubPixFunc ippfunc =
|
||||||
|
srctype == CV_8UC1 && ddepth == CV_8U ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R :
|
||||||
|
srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R :
|
||||||
|
srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0;
|
||||||
|
|
||||||
|
if( ippfunc)
|
||||||
|
{
|
||||||
|
if (ippfunc(image.ptr(), (int)image.step, src_size, patch.ptr(),
|
||||||
|
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1178,68 +1178,74 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
int ippBorderType = borderType & ~BORDER_ISOLATED;
|
CV_IPP_CHECK()
|
||||||
Point ocvAnchor, ippAnchor;
|
|
||||||
ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x;
|
|
||||||
ocvAnchor.y = anchor.y < 0 ? ksize.height / 2 : anchor.y;
|
|
||||||
ippAnchor.x = ksize.width / 2 - (ksize.width % 2 == 0 ? 1 : 0);
|
|
||||||
ippAnchor.y = ksize.height / 2 - (ksize.height % 2 == 0 ? 1 : 0);
|
|
||||||
|
|
||||||
if (normalize && !src.isSubmatrix() && ddepth == sdepth &&
|
|
||||||
(/*ippBorderType == BORDER_REPLICATE ||*/ /* returns ippStsStepErr: Step value is not valid */
|
|
||||||
ippBorderType == BORDER_CONSTANT) && ocvAnchor == ippAnchor &&
|
|
||||||
dst.cols != ksize.width && dst.rows != ksize.height) // returns ippStsMaskSizeErr: mask has an illegal value
|
|
||||||
{
|
{
|
||||||
Ipp32s bufSize = 0;
|
int ippBorderType = borderType & ~BORDER_ISOLATED;
|
||||||
IppiSize roiSize = { dst.cols, dst.rows }, maskSize = { ksize.width, ksize.height };
|
Point ocvAnchor, ippAnchor;
|
||||||
|
ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x;
|
||||||
|
ocvAnchor.y = anchor.y < 0 ? ksize.height / 2 : anchor.y;
|
||||||
|
ippAnchor.x = ksize.width / 2 - (ksize.width % 2 == 0 ? 1 : 0);
|
||||||
|
ippAnchor.y = ksize.height / 2 - (ksize.height % 2 == 0 ? 1 : 0);
|
||||||
|
|
||||||
|
if (normalize && !src.isSubmatrix() && ddepth == sdepth &&
|
||||||
|
(/*ippBorderType == BORDER_REPLICATE ||*/ /* returns ippStsStepErr: Step value is not valid */
|
||||||
|
ippBorderType == BORDER_CONSTANT) && ocvAnchor == ippAnchor &&
|
||||||
|
dst.cols != ksize.width && dst.rows != ksize.height) // returns ippStsMaskSizeErr: mask has an illegal value
|
||||||
|
{
|
||||||
|
Ipp32s bufSize = 0;
|
||||||
|
IppiSize roiSize = { dst.cols, dst.rows }, maskSize = { ksize.width, ksize.height };
|
||||||
|
|
||||||
#define IPP_FILTER_BOX_BORDER(ippType, ippDataType, flavor) \
|
#define IPP_FILTER_BOX_BORDER(ippType, ippDataType, flavor) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if (ippiFilterBoxBorderGetBufferSize(roiSize, maskSize, ippDataType, cn, &bufSize) >= 0) \
|
|
||||||
{ \
|
{ \
|
||||||
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
|
if (ippiFilterBoxBorderGetBufferSize(roiSize, maskSize, ippDataType, cn, &bufSize) >= 0) \
|
||||||
ippType borderValue[4] = { 0, 0, 0, 0 }; \
|
{ \
|
||||||
ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorderRepl; \
|
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
|
||||||
IppStatus status = ippiFilterBoxBorder_##flavor(src.ptr<ippType>(), (int)src.step, dst.ptr<ippType>(), \
|
ippType borderValue[4] = { 0, 0, 0, 0 }; \
|
||||||
(int)dst.step, roiSize, maskSize, \
|
ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorderRepl; \
|
||||||
(IppiBorderType)ippBorderType, borderValue, buffer); \
|
IppStatus status = ippiFilterBoxBorder_##flavor(src.ptr<ippType>(), (int)src.step, dst.ptr<ippType>(), \
|
||||||
ippsFree(buffer); \
|
(int)dst.step, roiSize, maskSize, \
|
||||||
if (status >= 0) \
|
(IppiBorderType)ippBorderType, borderValue, buffer); \
|
||||||
return; \
|
ippsFree(buffer); \
|
||||||
} \
|
if (status >= 0) \
|
||||||
setIppErrorStatus(); \
|
{ \
|
||||||
} while ((void)0, 0)
|
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
setIppErrorStatus(); \
|
||||||
|
} while ((void)0, 0)
|
||||||
|
|
||||||
if (stype == CV_8UC1)
|
if (stype == CV_8UC1)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp8u, ipp8u, 8u_C1R);
|
IPP_FILTER_BOX_BORDER(Ipp8u, ipp8u, 8u_C1R);
|
||||||
else if (stype == CV_8UC3)
|
else if (stype == CV_8UC3)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp8u, ipp8u, 8u_C3R);
|
IPP_FILTER_BOX_BORDER(Ipp8u, ipp8u, 8u_C3R);
|
||||||
else if (stype == CV_8UC4)
|
else if (stype == CV_8UC4)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp8u, ipp8u, 8u_C4R);
|
IPP_FILTER_BOX_BORDER(Ipp8u, ipp8u, 8u_C4R);
|
||||||
|
|
||||||
else if (stype == CV_16UC1)
|
else if (stype == CV_16UC1)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp16u, ipp16u, 16u_C1R);
|
IPP_FILTER_BOX_BORDER(Ipp16u, ipp16u, 16u_C1R);
|
||||||
else if (stype == CV_16UC3)
|
else if (stype == CV_16UC3)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp16u, ipp16u, 16u_C3R);
|
IPP_FILTER_BOX_BORDER(Ipp16u, ipp16u, 16u_C3R);
|
||||||
else if (stype == CV_16UC4)
|
else if (stype == CV_16UC4)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp16u, ipp16u, 16u_C4R);
|
IPP_FILTER_BOX_BORDER(Ipp16u, ipp16u, 16u_C4R);
|
||||||
|
|
||||||
else if (stype == CV_16SC1)
|
else if (stype == CV_16SC1)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp16s, ipp16s, 16s_C1R);
|
IPP_FILTER_BOX_BORDER(Ipp16s, ipp16s, 16s_C1R);
|
||||||
else if (stype == CV_16SC3)
|
else if (stype == CV_16SC3)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp16s, ipp16s, 16s_C3R);
|
IPP_FILTER_BOX_BORDER(Ipp16s, ipp16s, 16s_C3R);
|
||||||
else if (stype == CV_16SC4)
|
else if (stype == CV_16SC4)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp16s, ipp16s, 16s_C4R);
|
IPP_FILTER_BOX_BORDER(Ipp16s, ipp16s, 16s_C4R);
|
||||||
|
|
||||||
else if (stype == CV_32FC1)
|
else if (stype == CV_32FC1)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp32f, ipp32f, 32f_C1R);
|
IPP_FILTER_BOX_BORDER(Ipp32f, ipp32f, 32f_C1R);
|
||||||
else if (stype == CV_32FC3)
|
else if (stype == CV_32FC3)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp32f, ipp32f, 32f_C3R);
|
IPP_FILTER_BOX_BORDER(Ipp32f, ipp32f, 32f_C3R);
|
||||||
else if (stype == CV_32FC4)
|
else if (stype == CV_32FC4)
|
||||||
IPP_FILTER_BOX_BORDER(Ipp32f, ipp32f, 32f_C4R);
|
IPP_FILTER_BOX_BORDER(Ipp32f, ipp32f, 32f_C4R);
|
||||||
}
|
}
|
||||||
#undef IPP_FILTER_BOX_BORDER
|
#undef IPP_FILTER_BOX_BORDER
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ptr<FilterEngine> f = createBoxFilter( src.type(), dst.type(),
|
Ptr<FilterEngine> f = createBoxFilter( src.type(), dst.type(),
|
||||||
@ -1494,62 +1500,68 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && 0 // these functions are slower in IPP 8.1
|
#if IPP_VERSION_X100 >= 801 && 0 // these functions are slower in IPP 8.1
|
||||||
int depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
CV_IPP_CHECK()
|
||||||
|
|
||||||
if ((depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F) && (cn == 1 || cn == 3) &&
|
|
||||||
sigma1 == sigma2 && ksize.width == ksize.height && sigma1 != 0.0 )
|
|
||||||
{
|
{
|
||||||
IppiBorderType ippBorder = ippiGetBorderType(borderType);
|
int depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
if (ippBorderConst == ippBorder || ippBorderRepl == ippBorder)
|
|
||||||
|
if ((depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F) && (cn == 1 || cn == 3) &&
|
||||||
|
sigma1 == sigma2 && ksize.width == ksize.height && sigma1 != 0.0 )
|
||||||
{
|
{
|
||||||
Mat src = _src.getMat(), dst = _dst.getMat();
|
IppiBorderType ippBorder = ippiGetBorderType(borderType);
|
||||||
IppiSize roiSize = { src.cols, src.rows };
|
if (ippBorderConst == ippBorder || ippBorderRepl == ippBorder)
|
||||||
IppDataType dataType = ippiGetDataType(depth);
|
|
||||||
Ipp32s specSize = 0, bufferSize = 0;
|
|
||||||
|
|
||||||
if (ippiFilterGaussianGetBufferSize(roiSize, (Ipp32u)ksize.width, dataType, cn, &specSize, &bufferSize) >= 0)
|
|
||||||
{
|
{
|
||||||
IppFilterGaussianSpec * pSpec = (IppFilterGaussianSpec *)ippMalloc(specSize);
|
Mat src = _src.getMat(), dst = _dst.getMat();
|
||||||
Ipp8u * pBuffer = (Ipp8u*)ippMalloc(bufferSize);
|
IppiSize roiSize = { src.cols, src.rows };
|
||||||
|
IppDataType dataType = ippiGetDataType(depth);
|
||||||
|
Ipp32s specSize = 0, bufferSize = 0;
|
||||||
|
|
||||||
if (ippiFilterGaussianInit(roiSize, (Ipp32u)ksize.width, (Ipp32f)sigma1, ippBorder, dataType, 1, pSpec, pBuffer) >= 0)
|
if (ippiFilterGaussianGetBufferSize(roiSize, (Ipp32u)ksize.width, dataType, cn, &specSize, &bufferSize) >= 0)
|
||||||
{
|
{
|
||||||
#define IPP_FILTER_GAUSS(ippfavor, ippcn) \
|
IppFilterGaussianSpec * pSpec = (IppFilterGaussianSpec *)ippMalloc(specSize);
|
||||||
do \
|
Ipp8u * pBuffer = (Ipp8u*)ippMalloc(bufferSize);
|
||||||
{ \
|
|
||||||
typedef Ipp##ippfavor ippType; \
|
|
||||||
ippType borderValues[] = { 0, 0, 0 }; \
|
|
||||||
IppStatus status = ippcn == 1 ? \
|
|
||||||
ippiFilterGaussianBorder_##ippfavor##_C1R(src.ptr<ippType>(), (int)src.step, \
|
|
||||||
dst.ptr<ippType>(), (int)dst.step, roiSize, borderValues[0], pSpec, pBuffer) : \
|
|
||||||
ippiFilterGaussianBorder_##ippfavor##_C3R(src.ptr<ippType>(), (int)src.step, \
|
|
||||||
dst.ptr<ippType>(), (int)dst.step, roiSize, borderValues, pSpec, pBuffer); \
|
|
||||||
ippFree(pBuffer); \
|
|
||||||
ippFree(pSpec); \
|
|
||||||
if (status >= 0) \
|
|
||||||
return; \
|
|
||||||
} while ((void)0, 0)
|
|
||||||
|
|
||||||
if (type == CV_8UC1)
|
if (ippiFilterGaussianInit(roiSize, (Ipp32u)ksize.width, (Ipp32f)sigma1, ippBorder, dataType, 1, pSpec, pBuffer) >= 0)
|
||||||
IPP_FILTER_GAUSS(8u, 1);
|
{
|
||||||
else if (type == CV_8UC3)
|
#define IPP_FILTER_GAUSS(ippfavor, ippcn) \
|
||||||
IPP_FILTER_GAUSS(8u, 3);
|
do \
|
||||||
else if (type == CV_16UC1)
|
{ \
|
||||||
IPP_FILTER_GAUSS(16u, 1);
|
typedef Ipp##ippfavor ippType; \
|
||||||
else if (type == CV_16UC3)
|
ippType borderValues[] = { 0, 0, 0 }; \
|
||||||
IPP_FILTER_GAUSS(16u, 3);
|
IppStatus status = ippcn == 1 ? \
|
||||||
else if (type == CV_16SC1)
|
ippiFilterGaussianBorder_##ippfavor##_C1R(src.ptr<ippType>(), (int)src.step, \
|
||||||
IPP_FILTER_GAUSS(16s, 1);
|
dst.ptr<ippType>(), (int)dst.step, roiSize, borderValues[0], pSpec, pBuffer) : \
|
||||||
else if (type == CV_16SC3)
|
ippiFilterGaussianBorder_##ippfavor##_C3R(src.ptr<ippType>(), (int)src.step, \
|
||||||
IPP_FILTER_GAUSS(16s, 3);
|
dst.ptr<ippType>(), (int)dst.step, roiSize, borderValues, pSpec, pBuffer); \
|
||||||
else if (type == CV_32FC1)
|
ippFree(pBuffer); \
|
||||||
IPP_FILTER_GAUSS(32f, 1);
|
ippFree(pSpec); \
|
||||||
else if (type == CV_32FC3)
|
if (status >= 0) \
|
||||||
IPP_FILTER_GAUSS(32f, 3);
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while ((void)0, 0)
|
||||||
|
|
||||||
|
if (type == CV_8UC1)
|
||||||
|
IPP_FILTER_GAUSS(8u, 1);
|
||||||
|
else if (type == CV_8UC3)
|
||||||
|
IPP_FILTER_GAUSS(8u, 3);
|
||||||
|
else if (type == CV_16UC1)
|
||||||
|
IPP_FILTER_GAUSS(16u, 1);
|
||||||
|
else if (type == CV_16UC3)
|
||||||
|
IPP_FILTER_GAUSS(16u, 3);
|
||||||
|
else if (type == CV_16SC1)
|
||||||
|
IPP_FILTER_GAUSS(16s, 1);
|
||||||
|
else if (type == CV_16SC3)
|
||||||
|
IPP_FILTER_GAUSS(16s, 3);
|
||||||
|
else if (type == CV_32FC1)
|
||||||
|
IPP_FILTER_GAUSS(32f, 1);
|
||||||
|
else if (type == CV_32FC3)
|
||||||
|
IPP_FILTER_GAUSS(32f, 3);
|
||||||
#undef IPP_FILTER_GAUSS
|
#undef IPP_FILTER_GAUSS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2483,45 +2495,51 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
|
|||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801
|
#if IPP_VERSION_X100 >= 801
|
||||||
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
|
CV_IPP_CHECK()
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
if (ippiFilterMedianBorderGetBufferSize(dstRoiSize, maskSize, \
|
|
||||||
ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \
|
|
||||||
{ \
|
|
||||||
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
|
|
||||||
IppStatus status = ippiFilterMedianBorder_##flavor(src.ptr<ippType>(), (int)src.step, \
|
|
||||||
dst.ptr<ippType>(), (int)dst.step, dstRoiSize, maskSize, \
|
|
||||||
ippBorderRepl, (ippType)0, buffer); \
|
|
||||||
ippsFree(buffer); \
|
|
||||||
if (status >= 0) \
|
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
setIppErrorStatus(); \
|
|
||||||
} \
|
|
||||||
while ((void)0, 0)
|
|
||||||
|
|
||||||
if( ksize <= 5 )
|
|
||||||
{
|
{
|
||||||
Ipp32s bufSize;
|
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
|
||||||
IppiSize dstRoiSize = ippiSize(dst.cols, dst.rows), maskSize = ippiSize(ksize, ksize);
|
do \
|
||||||
Mat src;
|
{ \
|
||||||
if( dst.data != src0.data )
|
if (ippiFilterMedianBorderGetBufferSize(dstRoiSize, maskSize, \
|
||||||
src = src0;
|
ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \
|
||||||
else
|
{ \
|
||||||
src0.copyTo(src);
|
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
|
||||||
|
IppStatus status = ippiFilterMedianBorder_##flavor(src.ptr<ippType>(), (int)src.step, \
|
||||||
|
dst.ptr<ippType>(), (int)dst.step, dstRoiSize, maskSize, \
|
||||||
|
ippBorderRepl, (ippType)0, buffer); \
|
||||||
|
ippsFree(buffer); \
|
||||||
|
if (status >= 0) \
|
||||||
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
setIppErrorStatus(); \
|
||||||
|
} \
|
||||||
|
while ((void)0, 0)
|
||||||
|
|
||||||
int type = src0.type();
|
if( ksize <= 5 )
|
||||||
if (type == CV_8UC1)
|
{
|
||||||
IPP_FILTER_MEDIAN_BORDER(Ipp8u, ipp8u, 8u_C1R);
|
Ipp32s bufSize;
|
||||||
else if (type == CV_16UC1)
|
IppiSize dstRoiSize = ippiSize(dst.cols, dst.rows), maskSize = ippiSize(ksize, ksize);
|
||||||
IPP_FILTER_MEDIAN_BORDER(Ipp16u, ipp16u, 16u_C1R);
|
Mat src;
|
||||||
else if (type == CV_16SC1)
|
if( dst.data != src0.data )
|
||||||
IPP_FILTER_MEDIAN_BORDER(Ipp16s, ipp16s, 16s_C1R);
|
src = src0;
|
||||||
else if (type == CV_32FC1)
|
else
|
||||||
IPP_FILTER_MEDIAN_BORDER(Ipp32f, ipp32f, 32f_C1R);
|
src0.copyTo(src);
|
||||||
}
|
|
||||||
|
int type = src0.type();
|
||||||
|
if (type == CV_8UC1)
|
||||||
|
IPP_FILTER_MEDIAN_BORDER(Ipp8u, ipp8u, 8u_C1R);
|
||||||
|
else if (type == CV_16UC1)
|
||||||
|
IPP_FILTER_MEDIAN_BORDER(Ipp16u, ipp16u, 16u_C1R);
|
||||||
|
else if (type == CV_16SC1)
|
||||||
|
IPP_FILTER_MEDIAN_BORDER(Ipp16s, ipp16s, 16s_C1R);
|
||||||
|
else if (type == CV_32FC1)
|
||||||
|
IPP_FILTER_MEDIAN_BORDER(Ipp32f, ipp32f, 32f_C1R);
|
||||||
|
}
|
||||||
#undef IPP_FILTER_MEDIAN_BORDER
|
#undef IPP_FILTER_MEDIAN_BORDER
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
@ -2771,6 +2789,10 @@ public:
|
|||||||
}
|
}
|
||||||
if (0 > ippiFilterBilateral_8u_C1R( src.ptr<uchar>(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr<uchar>(range.start), (int)dst.step[0], roi, kernel, pSpec ))
|
if (0 > ippiFilterBilateral_8u_C1R( src.ptr<uchar>(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr<uchar>(range.start), (int)dst.step[0], roi, kernel, pSpec ))
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Mat &src;
|
Mat &src;
|
||||||
@ -2902,14 +2924,20 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
|
|||||||
copyMakeBorder( src, temp, radius, radius, radius, radius, borderType );
|
copyMakeBorder( src, temp, radius, radius, radius, radius, borderType );
|
||||||
|
|
||||||
#if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7) && 0
|
#if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7) && 0
|
||||||
if( cn == 1 )
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
bool ok;
|
if( cn == 1 )
|
||||||
IPPBilateralFilter_8u_Invoker body(temp, dst, sigma_color * sigma_color, sigma_space * sigma_space, radius, &ok );
|
{
|
||||||
parallel_for_(Range(0, dst.rows), body, dst.total()/(double)(1<<16));
|
bool ok;
|
||||||
if( ok )
|
IPPBilateralFilter_8u_Invoker body(temp, dst, sigma_color * sigma_color, sigma_space * sigma_space, radius, &ok );
|
||||||
return;
|
parallel_for_(Range(0, dst.rows), body, dst.total()/(double)(1<<16));
|
||||||
setIppErrorStatus();
|
if( ok )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -355,35 +355,41 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) // Disabled on ICV due invalid results
|
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) // Disabled on ICV due invalid results
|
||||||
if( ( depth == CV_8U ) && ( sdepth == CV_32F || sdepth == CV_32S ) && ( !_tilted.needed() ) && ( !_sqsum.needed() || sqdepth == CV_64F ) && ( cn == 1 ) )
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
IppStatus status = ippStsErr;
|
if( ( depth == CV_8U ) && ( sdepth == CV_32F || sdepth == CV_32S ) && ( !_tilted.needed() ) && ( !_sqsum.needed() || sqdepth == CV_64F ) && ( cn == 1 ) )
|
||||||
IppiSize srcRoiSize = ippiSize( src.cols, src.rows );
|
|
||||||
if( sdepth == CV_32F )
|
|
||||||
{
|
{
|
||||||
if( _sqsum.needed() )
|
IppStatus status = ippStsErr;
|
||||||
|
IppiSize srcRoiSize = ippiSize( src.cols, src.rows );
|
||||||
|
if( sdepth == CV_32F )
|
||||||
{
|
{
|
||||||
status = ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 );
|
if( _sqsum.needed() )
|
||||||
|
{
|
||||||
|
status = ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else if( sdepth == CV_32S )
|
||||||
{
|
{
|
||||||
status = ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 );
|
if( _sqsum.needed() )
|
||||||
|
{
|
||||||
|
status = ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (0 <= status)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( sdepth == CV_32S )
|
|
||||||
{
|
|
||||||
if( _sqsum.needed() )
|
|
||||||
{
|
|
||||||
status = ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
status = ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (0 <= status)
|
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -853,13 +853,20 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
bool useIppMT = (templ.rows < img.rows/2 && templ.cols < img.cols/2);
|
bool useIppMT = false;
|
||||||
|
CV_IPP_CHECK()
|
||||||
if (method == CV_TM_SQDIFF && cn == 1 && useIppMT)
|
|
||||||
{
|
{
|
||||||
if (ipp_sqrDistance(img, templ, result))
|
useIppMT = (templ.rows < img.rows/2 && templ.cols < img.cols/2);
|
||||||
return;
|
|
||||||
setIppErrorStatus();
|
if (method == CV_TM_SQDIFF && cn == 1 && useIppMT)
|
||||||
|
{
|
||||||
|
if (ipp_sqrDistance(img, templ, result))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -871,6 +878,10 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
crossCorr( img, templ, result, result.size(), result.type(), Point(0,0), 0, 0);
|
crossCorr( img, templ, result, result.size(), result.type(), Point(0,0), 0, 0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,39 +69,60 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
IppiSize sz = { roi.width, roi.height };
|
CV_IPP_CHECK()
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
|
||||||
switch( type )
|
|
||||||
{
|
{
|
||||||
case THRESH_TRUNC:
|
IppiSize sz = { roi.width, roi.height };
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case THRESH_TRUNC:
|
||||||
#ifndef HAVE_IPP_ICV_ONLY
|
#ifndef HAVE_IPP_ICV_ONLY
|
||||||
if (_src.data == _dst.data && ippiThreshold_GT_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh) >= 0)
|
if (_src.data == _dst.data && ippiThreshold_GT_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh) >= 0)
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ippiThreshold_GT_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh) >= 0)
|
if (ippiThreshold_GT_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
break;
|
return;
|
||||||
case THRESH_TOZERO:
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
case THRESH_TOZERO:
|
||||||
#ifndef HAVE_IPP_ICV_ONLY
|
#ifndef HAVE_IPP_ICV_ONLY
|
||||||
if (_src.data == _dst.data && ippiThreshold_LTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0)
|
if (_src.data == _dst.data && ippiThreshold_LTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0)
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ippiThreshold_LTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0)
|
if (ippiThreshold_LTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
break;
|
return;
|
||||||
case THRESH_TOZERO_INV:
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
case THRESH_TOZERO_INV:
|
||||||
#ifndef HAVE_IPP_ICV_ONLY
|
#ifndef HAVE_IPP_ICV_ONLY
|
||||||
if (_src.data == _dst.data && ippiThreshold_GTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0)
|
if (_src.data == _dst.data && ippiThreshold_GTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0)
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ippiThreshold_GTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0)
|
if (ippiThreshold_GTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
break;
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -392,39 +413,60 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
IppiSize sz = { roi.width, roi.height };
|
CV_IPP_CHECK()
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
|
||||||
switch( type )
|
|
||||||
{
|
{
|
||||||
case THRESH_TRUNC:
|
IppiSize sz = { roi.width, roi.height };
|
||||||
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case THRESH_TRUNC:
|
||||||
#ifndef HAVE_IPP_ICV_ONLY
|
#ifndef HAVE_IPP_ICV_ONLY
|
||||||
if (_src.data == _dst.data && ippiThreshold_GT_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0)
|
if (_src.data == _dst.data && ippiThreshold_GT_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0)
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ippiThreshold_GT_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0)
|
if (ippiThreshold_GT_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
break;
|
return;
|
||||||
case THRESH_TOZERO:
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
case THRESH_TOZERO:
|
||||||
#ifndef HAVE_IPP_ICV_ONLY
|
#ifndef HAVE_IPP_ICV_ONLY
|
||||||
if (_src.data == _dst.data && ippiThreshold_LTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh + 1, 0) >= 0)
|
if (_src.data == _dst.data && ippiThreshold_LTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh + 1, 0) >= 0)
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ippiThreshold_LTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+1, 0) >= 0)
|
if (ippiThreshold_LTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+1, 0) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
break;
|
return;
|
||||||
case THRESH_TOZERO_INV:
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
case THRESH_TOZERO_INV:
|
||||||
#ifndef HAVE_IPP_ICV_ONLY
|
#ifndef HAVE_IPP_ICV_ONLY
|
||||||
if (_src.data == _dst.data && ippiThreshold_GTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0)
|
if (_src.data == _dst.data && ippiThreshold_GTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0)
|
||||||
return;
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ippiThreshold_GTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0)
|
if (ippiThreshold_GTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0)
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
break;
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -639,24 +681,36 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
IppiSize sz = { roi.width, roi.height };
|
CV_IPP_CHECK()
|
||||||
switch( type )
|
|
||||||
{
|
{
|
||||||
case THRESH_TRUNC:
|
IppiSize sz = { roi.width, roi.height };
|
||||||
if (0 <= ippiThreshold_GT_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh))
|
switch( type )
|
||||||
return;
|
{
|
||||||
setIppErrorStatus();
|
case THRESH_TRUNC:
|
||||||
break;
|
if (0 <= ippiThreshold_GT_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh))
|
||||||
case THRESH_TOZERO:
|
{
|
||||||
if (0 <= ippiThreshold_LTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+FLT_EPSILON, 0))
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
setIppErrorStatus();
|
}
|
||||||
break;
|
setIppErrorStatus();
|
||||||
case THRESH_TOZERO_INV:
|
break;
|
||||||
if (0 <= ippiThreshold_GTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0))
|
case THRESH_TOZERO:
|
||||||
return;
|
if (0 <= ippiThreshold_LTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+FLT_EPSILON, 0))
|
||||||
setIppErrorStatus();
|
{
|
||||||
break;
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
case THRESH_TOZERO_INV:
|
||||||
|
if (0 <= ippiThreshold_GTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -864,14 +918,20 @@ getThreshVal_Otsu_8u( const Mat& _src )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801 && !defined(HAVE_IPP_ICV_ONLY)
|
#if IPP_VERSION_X100 >= 801 && !defined(HAVE_IPP_ICV_ONLY)
|
||||||
IppiSize srcSize = { size.width, size.height };
|
CV_IPP_CHECK()
|
||||||
Ipp8u thresh;
|
{
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
IppiSize srcSize = { size.width, size.height };
|
||||||
IppStatus ok = ippiComputeThreshold_Otsu_8u_C1R(_src.ptr(), step, srcSize, &thresh);
|
Ipp8u thresh;
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
if (ok >= 0)
|
IppStatus ok = ippiComputeThreshold_Otsu_8u_C1R(_src.ptr(), step, srcSize, &thresh);
|
||||||
return thresh;
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
setIppErrorStatus();
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
return thresh;
|
||||||
|
}
|
||||||
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int N = 256;
|
const int N = 256;
|
||||||
|
@ -1213,6 +1213,7 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
|||||||
if( maxObjectSize.height == 0 || maxObjectSize.width == 0 )
|
if( maxObjectSize.height == 0 || maxObjectSize.width == 0 )
|
||||||
maxObjectSize = imgsz;
|
maxObjectSize = imgsz;
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENCL
|
||||||
bool use_ocl = tryOpenCL && ocl::useOpenCL() &&
|
bool use_ocl = tryOpenCL && ocl::useOpenCL() &&
|
||||||
featureEvaluator->getLocalSize().area() > 0 &&
|
featureEvaluator->getLocalSize().area() > 0 &&
|
||||||
ocl::Device::getDefault().type() != ocl::Device::TYPE_CPU &&
|
ocl::Device::getDefault().type() != ocl::Device::TYPE_CPU &&
|
||||||
@ -1220,6 +1221,7 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
|||||||
!isOldFormatCascade() &&
|
!isOldFormatCascade() &&
|
||||||
maskGenerator.empty() &&
|
maskGenerator.empty() &&
|
||||||
!outputRejectLevels;
|
!outputRejectLevels;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*if( use_ocl )
|
/*if( use_ocl )
|
||||||
{
|
{
|
||||||
@ -1262,8 +1264,8 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// OpenCL code
|
// OpenCL code
|
||||||
if( use_ocl && ocl_detectMultiScaleNoGrouping( scales, candidates ))
|
CV_OCL_RUN(use_ocl, ocl_detectMultiScaleNoGrouping( scales, candidates ))
|
||||||
return;
|
|
||||||
tryOpenCL = false;
|
tryOpenCL = false;
|
||||||
|
|
||||||
// CPU code
|
// CPU code
|
||||||
|
@ -159,7 +159,7 @@ icvReleaseHidHaarClassifierCascade( CvHidHaarClassifierCascade** _cascade )
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
CvHidHaarClassifierCascade* cascade = *_cascade;
|
CvHidHaarClassifierCascade* cascade = *_cascade;
|
||||||
if( cascade->ipp_stages )
|
if( CV_IPP_CHECK_COND && cascade->ipp_stages )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i < cascade->count; i++ )
|
for( i = 0; i < cascade->count; i++ )
|
||||||
@ -338,7 +338,7 @@ icvCreateHidHaarClassifierCascade( CvHaarClassifierCascade* cascade )
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
int can_use_ipp = !out->has_tilted_features && !out->is_tree && out->isStumpBased;
|
int can_use_ipp = CV_IPP_CHECK_COND && (!out->has_tilted_features && !out->is_tree && out->isStumpBased);
|
||||||
|
|
||||||
if( can_use_ipp )
|
if( can_use_ipp )
|
||||||
{
|
{
|
||||||
@ -1315,7 +1315,7 @@ public:
|
|||||||
int x, y, ystep = factor > 2 ? 1 : 2;
|
int x, y, ystep = factor > 2 ? 1 : 2;
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
if( cascade->hid_cascade->ipp_stages )
|
if(CV_IPP_CHECK_COND && cascade->hid_cascade->ipp_stages )
|
||||||
{
|
{
|
||||||
IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height};
|
IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height};
|
||||||
ippiRectStdDev_32f_C1R(sum1.ptr<float>(y1), (int)sum1.step,
|
ippiRectStdDev_32f_C1R(sum1.ptr<float>(y1), (int)sum1.step,
|
||||||
@ -1351,6 +1351,7 @@ public:
|
|||||||
if( positive <= 0 )
|
if( positive <= 0 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
|
||||||
if( positive > 0 )
|
if( positive > 0 )
|
||||||
for( y = y1; y < y2; y += ystep )
|
for( y = y1; y < y2; y += ystep )
|
||||||
@ -1561,7 +1562,7 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
|
|||||||
{
|
{
|
||||||
CvSize winSize0 = cascade->orig_window_size;
|
CvSize winSize0 = cascade->orig_window_size;
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
int use_ipp = cascade->hid_cascade->ipp_stages != 0;
|
int use_ipp = CV_IPP_CHECK_COND && (cascade->hid_cascade->ipp_stages != 0);
|
||||||
|
|
||||||
if( use_ipp )
|
if( use_ipp )
|
||||||
normImg.reset(cvCreateMat( img->rows, img->cols, CV_32FC1));
|
normImg.reset(cvCreateMat( img->rows, img->cols, CV_32FC1));
|
||||||
|
@ -414,6 +414,12 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_OPENCL
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
x_tl /= 2; y_tl /= 2;
|
x_tl /= 2; y_tl /= 2;
|
||||||
x_br /= 2; y_br /= 2;
|
x_br /= 2; y_br /= 2;
|
||||||
@ -476,8 +482,8 @@ void normalizeUsingWeightMap(InputArray _weight, InputOutputArray _src)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
if ( !cv::ocl::useOpenCL() ||
|
if ( !cv::ocl::useOpenCL() ||
|
||||||
!ocl_normalizeUsingWeightMap(_weight, _src) )
|
!ocl_normalizeUsingWeightMap(_weight, _src) )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Mat weight = _weight.getMat();
|
Mat weight = _weight.getMat();
|
||||||
@ -519,6 +525,12 @@ void normalizeUsingWeightMap(InputArray _weight, InputOutputArray _src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_OPENCL
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,10 @@ Rect PlaneWarper::buildMaps(Size src_size, InputArray K, InputArray R, InputArra
|
|||||||
|
|
||||||
size_t globalsize[2] = { dsize.width, (dsize.height + rowsPerWI - 1) / rowsPerWI };
|
size_t globalsize[2] = { dsize.width, (dsize.height + rowsPerWI - 1) / rowsPerWI };
|
||||||
if (k.run(2, globalsize, NULL, true))
|
if (k.run(2, globalsize, NULL, true))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return Rect(dst_tl, dst_br);
|
return Rect(dst_tl, dst_br);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +392,10 @@ Rect SphericalWarper::buildMaps(Size src_size, InputArray K, InputArray R, Outpu
|
|||||||
|
|
||||||
size_t globalsize[2] = { dsize.width, (dsize.height + rowsPerWI - 1) / rowsPerWI };
|
size_t globalsize[2] = { dsize.width, (dsize.height + rowsPerWI - 1) / rowsPerWI };
|
||||||
if (k.run(2, globalsize, NULL, true))
|
if (k.run(2, globalsize, NULL, true))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return Rect(dst_tl, dst_br);
|
return Rect(dst_tl, dst_br);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +441,10 @@ Rect CylindricalWarper::buildMaps(Size src_size, InputArray K, InputArray R, Out
|
|||||||
|
|
||||||
size_t globalsize[2] = { dsize.width, (dsize.height + rowsPerWI - 1) / rowsPerWI };
|
size_t globalsize[2] = { dsize.width, (dsize.height + rowsPerWI - 1) / rowsPerWI };
|
||||||
if (k.run(2, globalsize, NULL, true))
|
if (k.run(2, globalsize, NULL, true))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return Rect(dst_tl, dst_br);
|
return Rect(dst_tl, dst_br);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +265,95 @@ enum PERF_STRATEGY
|
|||||||
/*****************************************************************************************\
|
/*****************************************************************************************\
|
||||||
* Base fixture for performance tests *
|
* Base fixture for performance tests *
|
||||||
\*****************************************************************************************/
|
\*****************************************************************************************/
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
// Implementation collection processing class.
|
||||||
|
// Accumulates and shapes implementation data.
|
||||||
|
typedef struct ImplData
|
||||||
|
{
|
||||||
|
bool ipp;
|
||||||
|
bool icv;
|
||||||
|
bool ipp_mt;
|
||||||
|
bool ocl;
|
||||||
|
bool plain;
|
||||||
|
std::vector<int> implCode;
|
||||||
|
std::vector<cv::String> funName;
|
||||||
|
|
||||||
|
ImplData()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
cv::setImpl(0);
|
||||||
|
ipp = icv = ocl = ipp_mt = false;
|
||||||
|
implCode.clear();
|
||||||
|
funName.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetImpl()
|
||||||
|
{
|
||||||
|
flagsToVars(cv::getImpl(implCode, funName));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<cv::String> GetCallsForImpl(int impl)
|
||||||
|
{
|
||||||
|
std::vector<cv::String> out;
|
||||||
|
|
||||||
|
for(int i = 0; i < implCode.size(); i++)
|
||||||
|
{
|
||||||
|
if(impl == implCode[i])
|
||||||
|
out.push_back(funName[i]);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate entries
|
||||||
|
void ShapeUp()
|
||||||
|
{
|
||||||
|
std::vector<int> savedCode;
|
||||||
|
std::vector<cv::String> savedName;
|
||||||
|
|
||||||
|
for(int i = 0; i < implCode.size(); i++)
|
||||||
|
{
|
||||||
|
bool match = false;
|
||||||
|
for(int j = 0; j < savedCode.size(); j++)
|
||||||
|
{
|
||||||
|
if(implCode[i] == savedCode[j] && !funName[i].compare(savedName[j]))
|
||||||
|
{
|
||||||
|
match = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!match)
|
||||||
|
{
|
||||||
|
savedCode.push_back(implCode[i]);
|
||||||
|
savedName.push_back(funName[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implCode = savedCode;
|
||||||
|
funName = savedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert flags register to more handy variables
|
||||||
|
void flagsToVars(int flags)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_IPP_ICV_ONLY)
|
||||||
|
ipp = 0;
|
||||||
|
icv = ((flags&CV_IMPL_IPP) > 0);
|
||||||
|
#else
|
||||||
|
ipp = ((flags&CV_IMPL_IPP) > 0);
|
||||||
|
icv = 0;
|
||||||
|
#endif
|
||||||
|
ipp_mt = ((flags&CV_IMPL_MT) > 0);
|
||||||
|
ocl = ((flags&CV_IMPL_OCL) > 0);
|
||||||
|
plain = (flags == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
} ImplData;
|
||||||
|
#endif
|
||||||
|
|
||||||
class CV_EXPORTS TestBase: public ::testing::Test
|
class CV_EXPORTS TestBase: public ::testing::Test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -308,6 +397,10 @@ protected:
|
|||||||
performance_metrics& calcMetrics();
|
performance_metrics& calcMetrics();
|
||||||
|
|
||||||
void RunPerfTestBody();
|
void RunPerfTestBody();
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
ImplData implConf;
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
typedef std::vector<std::pair<int, cv::Size> > SizeVector;
|
typedef std::vector<std::pair<int, cv::Size> > SizeVector;
|
||||||
typedef std::vector<int64> TimeVector;
|
typedef std::vector<int64> TimeVector;
|
||||||
|
@ -31,6 +31,9 @@ static double param_time_limit;
|
|||||||
static int param_threads;
|
static int param_threads;
|
||||||
static bool param_write_sanity;
|
static bool param_write_sanity;
|
||||||
static bool param_verify_sanity;
|
static bool param_verify_sanity;
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
static bool param_collect_impl;
|
||||||
|
#endif
|
||||||
extern bool test_ipp_check;
|
extern bool test_ipp_check;
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
static int param_cuda_device;
|
static int param_cuda_device;
|
||||||
@ -673,6 +676,9 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
|||||||
"{ perf_max_deviation |1.0 |}"
|
"{ perf_max_deviation |1.0 |}"
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
"{ perf_ipp_check |false |check whether IPP works without failures}"
|
"{ perf_ipp_check |false |check whether IPP works without failures}"
|
||||||
|
#endif
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
"{ perf_collect_impl |false |collect info about executed implementations}"
|
||||||
#endif
|
#endif
|
||||||
"{ help h |false |print help info}"
|
"{ help h |false |print help info}"
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
@ -719,6 +725,9 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
|||||||
param_verify_sanity = args.has("perf_verify_sanity");
|
param_verify_sanity = args.has("perf_verify_sanity");
|
||||||
test_ipp_check = !args.has("perf_ipp_check") ? getenv("OPENCV_IPP_CHECK") != NULL : true;
|
test_ipp_check = !args.has("perf_ipp_check") ? getenv("OPENCV_IPP_CHECK") != NULL : true;
|
||||||
param_threads = args.get<int>("perf_threads");
|
param_threads = args.get<int>("perf_threads");
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
param_collect_impl = args.has("perf_collect_impl");
|
||||||
|
#endif
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
param_affinity_mask = args.get<int>("perf_affinity_mask");
|
param_affinity_mask = args.get<int>("perf_affinity_mask");
|
||||||
log_power_checkpoints = args.has("perf_log_power_checkpoints");
|
log_power_checkpoints = args.has("perf_log_power_checkpoints");
|
||||||
@ -743,6 +752,13 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
if(param_collect_impl)
|
||||||
|
cv::setUseCollection(1);
|
||||||
|
else
|
||||||
|
cv::setUseCollection(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
|
|
||||||
bool printOnly = args.has("perf_cuda_info_only");
|
bool printOnly = args.has("perf_cuda_info_only");
|
||||||
@ -1242,6 +1258,28 @@ void TestBase::reportMetrics(bool toJUnitXML)
|
|||||||
RecordProperty("gstddev", cv::format("%.6f", m.gstddev).c_str());
|
RecordProperty("gstddev", cv::format("%.6f", m.gstddev).c_str());
|
||||||
RecordProperty("mean", cv::format("%.0f", m.mean).c_str());
|
RecordProperty("mean", cv::format("%.0f", m.mean).c_str());
|
||||||
RecordProperty("stddev", cv::format("%.0f", m.stddev).c_str());
|
RecordProperty("stddev", cv::format("%.0f", m.stddev).c_str());
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
if(param_collect_impl)
|
||||||
|
{
|
||||||
|
RecordProperty("impl_ipp", (int)(implConf.ipp || implConf.icv));
|
||||||
|
RecordProperty("impl_ocl", (int)implConf.ocl);
|
||||||
|
RecordProperty("impl_plain", (int)implConf.plain);
|
||||||
|
|
||||||
|
std::string rec_line;
|
||||||
|
std::vector<cv::String> rec;
|
||||||
|
rec_line.clear();
|
||||||
|
rec = implConf.GetCallsForImpl(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
for(int i=0; i<rec.size();i++ ){rec_line += rec[i].c_str(); rec_line += " ";}
|
||||||
|
rec = implConf.GetCallsForImpl(CV_IMPL_IPP);
|
||||||
|
for(int i=0; i<rec.size();i++ ){rec_line += rec[i].c_str(); rec_line += " ";}
|
||||||
|
RecordProperty("impl_rec_ipp", rec_line.c_str());
|
||||||
|
|
||||||
|
rec_line.clear();
|
||||||
|
rec = implConf.GetCallsForImpl(CV_IMPL_OCL);
|
||||||
|
for(int i=0; i<rec.size();i++ ){rec_line += rec[i].c_str(); rec_line += " ";}
|
||||||
|
RecordProperty("impl_rec_ocl", rec_line.c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1276,6 +1314,29 @@ void TestBase::reportMetrics(bool toJUnitXML)
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
if(param_collect_impl)
|
||||||
|
{
|
||||||
|
LOGD("impl_ipp =%11d", (int)(implConf.ipp || implConf.icv));
|
||||||
|
LOGD("impl_ocl =%11d", (int)implConf.ocl);
|
||||||
|
LOGD("impl_plain =%11d", (int)implConf.plain);
|
||||||
|
|
||||||
|
std::string rec_line;
|
||||||
|
std::vector<cv::String> rec;
|
||||||
|
rec_line.clear();
|
||||||
|
rec = implConf.GetCallsForImpl(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
for(int i=0; i<rec.size();i++ ){rec_line += rec[i].c_str(); rec_line += " ";}
|
||||||
|
rec = implConf.GetCallsForImpl(CV_IMPL_IPP);
|
||||||
|
for(int i=0; i<rec.size();i++ ){rec_line += rec[i].c_str(); rec_line += " ";}
|
||||||
|
LOGD("impl_rec_ipp =%s", rec_line.c_str());
|
||||||
|
|
||||||
|
rec_line.clear();
|
||||||
|
rec = implConf.GetCallsForImpl(CV_IMPL_OCL);
|
||||||
|
for(int i=0; i<rec.size();i++ ){rec_line += rec[i].c_str(); rec_line += " ";}
|
||||||
|
LOGD("impl_rec_ocl =%s", rec_line.c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
LOGD("bytesIn =%11lu", (unsigned long)m.bytesIn);
|
LOGD("bytesIn =%11lu", (unsigned long)m.bytesIn);
|
||||||
LOGD("bytesOut =%11lu", (unsigned long)m.bytesOut);
|
LOGD("bytesOut =%11lu", (unsigned long)m.bytesOut);
|
||||||
if (nIters == (unsigned int)-1 || m.terminationReason == performance_metrics::TERM_ITERATIONS)
|
if (nIters == (unsigned int)-1 || m.terminationReason == performance_metrics::TERM_ITERATIONS)
|
||||||
@ -1343,6 +1404,30 @@ void TestBase::TearDown()
|
|||||||
const char* value_param = test_info->value_param();
|
const char* value_param = test_info->value_param();
|
||||||
if (value_param) printf("[ VALUE ] \t%s\n", value_param), fflush(stdout);
|
if (value_param) printf("[ VALUE ] \t%s\n", value_param), fflush(stdout);
|
||||||
if (type_param) printf("[ TYPE ] \t%s\n", type_param), fflush(stdout);
|
if (type_param) printf("[ TYPE ] \t%s\n", type_param), fflush(stdout);
|
||||||
|
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
if(param_collect_impl)
|
||||||
|
{
|
||||||
|
implConf.ShapeUp();
|
||||||
|
printf("[ I. FLAGS ] \t");
|
||||||
|
if(implConf.ipp_mt)
|
||||||
|
{
|
||||||
|
if(implConf.icv) {printf("ICV_MT "); std::vector<cv::String> fun = implConf.GetCallsForImpl(CV_IMPL_IPP|CV_IMPL_MT); printf("("); for(int i=0; i<fun.size();i++ ){printf("%s ", fun[i].c_str());} printf(") "); }
|
||||||
|
if(implConf.ipp) {printf("IPP_MT "); std::vector<cv::String> fun = implConf.GetCallsForImpl(CV_IMPL_IPP|CV_IMPL_MT); printf("("); for(int i=0; i<fun.size();i++ ){printf("%s ", fun[i].c_str());} printf(") "); }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(implConf.icv) {printf("ICV "); std::vector<cv::String> fun = implConf.GetCallsForImpl(CV_IMPL_IPP); printf("("); for(int i=0; i<fun.size();i++ ){printf("%s ", fun[i].c_str());} printf(") "); }
|
||||||
|
if(implConf.ipp) {printf("IPP "); std::vector<cv::String> fun = implConf.GetCallsForImpl(CV_IMPL_IPP); printf("("); for(int i=0; i<fun.size();i++ ){printf("%s ", fun[i].c_str());} printf(") "); }
|
||||||
|
}
|
||||||
|
if(implConf.ocl) {printf("OCL "); std::vector<cv::String> fun = implConf.GetCallsForImpl(CV_IMPL_OCL); printf("("); for(int i=0; i<fun.size();i++ ){printf("%s ", fun[i].c_str());} printf(") "); }
|
||||||
|
if(implConf.plain) printf("PLAIN ");
|
||||||
|
if(!(implConf.ipp_mt || implConf.icv || implConf.ipp || implConf.ocl || implConf.plain))
|
||||||
|
printf("ERROR ");
|
||||||
|
printf("\n");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
reportMetrics(true);
|
reportMetrics(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1391,7 +1476,15 @@ void TestBase::RunPerfTestBody()
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
if(param_collect_impl)
|
||||||
|
implConf.Reset();
|
||||||
|
#endif
|
||||||
this->PerfTestBody();
|
this->PerfTestBody();
|
||||||
|
#ifdef CV_COLLECT_IMPL_DATA
|
||||||
|
if(param_collect_impl)
|
||||||
|
implConf.GetImpl();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
catch(PerfSkipTestException&)
|
catch(PerfSkipTestException&)
|
||||||
{
|
{
|
||||||
|
@ -1096,7 +1096,10 @@ void cv::calcOpticalFlowPyrLK( InputArray _prevImg, InputArray _nextImg,
|
|||||||
(_prevImg.isUMat() || _nextImg.isUMat()) &&
|
(_prevImg.isUMat() || _nextImg.isUMat()) &&
|
||||||
ocl::Image2D::isFormatSupported(CV_32F, 1, false);
|
ocl::Image2D::isFormatSupported(CV_32F, 1, false);
|
||||||
if ( use_opencl && ocl_calcOpticalFlowPyrLK(_prevImg, _nextImg, _prevPts, _nextPts, _status, _err, winSize, maxLevel, criteria, flags/*, minEigThreshold*/))
|
if ( use_opencl && ocl_calcOpticalFlowPyrLK(_prevImg, _nextImg, _prevPts, _nextPts, _status, _err, winSize, maxLevel, criteria, flags/*, minEigThreshold*/))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Mat prevPtsMat = _prevPts.getMat();
|
Mat prevPtsMat = _prevPts.getMat();
|
||||||
const int derivDepth = DataType<cv::detail::deriv_type>::depth;
|
const int derivDepth = DataType<cv::detail::deriv_type>::depth;
|
||||||
|
@ -1081,7 +1081,10 @@ void cv::calcOpticalFlowFarneback( InputArray _prev0, InputArray _next0,
|
|||||||
{
|
{
|
||||||
bool use_opencl = ocl::useOpenCL() && _flow0.isUMat();
|
bool use_opencl = ocl::useOpenCL() && _flow0.isUMat();
|
||||||
if( use_opencl && ocl_calcOpticalFlowFarneback(_prev0, _next0, _flow0, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags))
|
if( use_opencl && ocl_calcOpticalFlowFarneback(_prev0, _next0, _flow0, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Mat prev0 = _prev0.getMat(), next0 = _next0.getMat();
|
Mat prev0 = _prev0.getMat(), next0 = _next0.getMat();
|
||||||
const int min_size = 32;
|
const int min_size = 32;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user