Merge pull request #3332 from lupustr3:pvlasov/implementation_detector
This commit is contained in:
commit
af1d29db83
CMakeLists.txt
modules
calib3d/src
core
include/opencv2/core
src
features2d/src
imgproc/src
accum.cppcanny.cppclahe.cppcolor.cppcorner.cppderiv.cppdistransform.cppfilter.cpphistogram.cpphough.cppimgwarp.cppmoments.cppmorph.cpppyramids.cppsamplers.cppsmooth.cppsumpixels.cpptemplmatch.cppthresh.cpp
objdetect/src
stitching/src
ts
video/src
@ -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,6 +1085,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
Ipp32s bufsize = 0;
|
Ipp32s bufsize = 0;
|
||||||
IppiSize roisize = { img.cols, img.rows };
|
IppiSize roisize = { img.cols, img.rows };
|
||||||
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s;
|
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s;
|
||||||
@ -1105,9 +1107,13 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (type == CV_8UC1)
|
if (type == CV_8UC1)
|
||||||
|
@ -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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
if (0 <= ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
if (0 <= ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
if (0 <= ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
if (0 <= ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
if (0 <= ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
if (0 <= ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +759,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
uchar* s1 = (uchar*)src1;
|
uchar* s1 = (uchar*)src1;
|
||||||
uchar* s2 = (uchar*)src2;
|
uchar* s2 = (uchar*)src2;
|
||||||
uchar* d = dst;
|
uchar* d = dst;
|
||||||
@ -725,8 +775,12 @@ static void max8u( const uchar* src1, size_t step1,
|
|||||||
d += step;
|
d += step;
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +797,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
ushort* s1 = (ushort*)src1;
|
ushort* s1 = (ushort*)src1;
|
||||||
ushort* s2 = (ushort*)src2;
|
ushort* s2 = (ushort*)src2;
|
||||||
ushort* d = dst;
|
ushort* d = dst;
|
||||||
@ -757,8 +813,12 @@ static void max16u( const ushort* src1, size_t step1,
|
|||||||
d = (ushort*)((uchar*)d + step);
|
d = (ushort*)((uchar*)d + step);
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +842,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
float* s1 = (float*)src1;
|
float* s1 = (float*)src1;
|
||||||
float* s2 = (float*)src2;
|
float* s2 = (float*)src2;
|
||||||
float* d = dst;
|
float* d = dst;
|
||||||
@ -796,8 +858,12 @@ static void max32f( const float* src1, size_t step1,
|
|||||||
d = (float*)((uchar*)d + step);
|
d = (float*)((uchar*)d + step);
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +873,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
double* s1 = (double*)src1;
|
double* s1 = (double*)src1;
|
||||||
double* s2 = (double*)src2;
|
double* s2 = (double*)src2;
|
||||||
double* d = dst;
|
double* d = dst;
|
||||||
@ -821,8 +889,12 @@ static void max64f( const double* src1, size_t step1,
|
|||||||
d = (double*)((uchar*)d + step);
|
d = (double*)((uchar*)d + step);
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +904,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
uchar* s1 = (uchar*)src1;
|
uchar* s1 = (uchar*)src1;
|
||||||
uchar* s2 = (uchar*)src2;
|
uchar* s2 = (uchar*)src2;
|
||||||
uchar* d = dst;
|
uchar* d = dst;
|
||||||
@ -846,8 +920,12 @@ static void min8u( const uchar* src1, size_t step1,
|
|||||||
d += step;
|
d += step;
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +942,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
ushort* s1 = (ushort*)src1;
|
ushort* s1 = (ushort*)src1;
|
||||||
ushort* s2 = (ushort*)src2;
|
ushort* s2 = (ushort*)src2;
|
||||||
ushort* d = dst;
|
ushort* d = dst;
|
||||||
@ -878,8 +958,12 @@ static void min16u( const ushort* src1, size_t step1,
|
|||||||
d = (ushort*)((uchar*)d + step);
|
d = (ushort*)((uchar*)d + step);
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +987,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
float* s1 = (float*)src1;
|
float* s1 = (float*)src1;
|
||||||
float* s2 = (float*)src2;
|
float* s2 = (float*)src2;
|
||||||
float* d = dst;
|
float* d = dst;
|
||||||
@ -917,8 +1003,12 @@ static void min32f( const float* src1, size_t step1,
|
|||||||
d = (float*)((uchar*)d + step);
|
d = (float*)((uchar*)d + step);
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +1018,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
double* s1 = (double*)src1;
|
double* s1 = (double*)src1;
|
||||||
double* s2 = (double*)src2;
|
double* s2 = (double*)src2;
|
||||||
double* d = dst;
|
double* d = dst;
|
||||||
@ -942,8 +1034,12 @@ static void min64f( const double* src1, size_t step1,
|
|||||||
d = (double*)((uchar*)d + step);
|
d = (double*)((uchar*)d + step);
|
||||||
}
|
}
|
||||||
if (i == sz.height)
|
if (i == sz.height)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step);
|
||||||
if (0 <= ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void)src2;
|
fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void)src2;
|
||||||
if (0 <= ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
if (0 <= ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, ippiSize(sz)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,12 +2514,18 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
{
|
{
|
||||||
if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
}
|
}
|
||||||
@ -2397,12 +2541,18 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
{
|
{
|
||||||
if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
}
|
}
|
||||||
@ -2412,12 +2562,18 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
{
|
{
|
||||||
if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
}
|
}
|
||||||
@ -2433,12 +2589,18 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||||
{
|
{
|
||||||
if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)
|
if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||||
}
|
}
|
||||||
@ -3185,14 +3347,20 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if( op >= 0 )
|
if( op >= 0 )
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
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))
|
if (0 <= ippiCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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);
|
||||||
int code = *(int*)_cmpop;
|
int code = *(int*)_cmpop;
|
||||||
@ -3284,14 +3452,20 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if( op >= 0 )
|
if( op >= 0 )
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
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))
|
if (0 <= ippiCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||||
}
|
}
|
||||||
@ -3300,14 +3474,20 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if( op > 0 )
|
if( op > 0 )
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
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))
|
if (0 <= ippiCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,14 +3618,20 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
IppCmpOp op = convert_cmp(*(int *)_cmpop);
|
||||||
if( op >= 0 )
|
if( op >= 0 )
|
||||||
{
|
{
|
||||||
fixSteps(size, sizeof(dst[0]), step1, step2, step);
|
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))
|
if (0 <= ippiCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||||
}
|
}
|
||||||
|
@ -2988,26 +2988,38 @@ dtype* dst, size_t dstep, Size size, double* scale) \
|
|||||||
#define DEF_CVT_FUNC_F(suffix, stype, dtype, ippFavor) \
|
#define DEF_CVT_FUNC_F(suffix, stype, dtype, ippFavor) \
|
||||||
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*) \
|
||||||
|
{ \
|
||||||
|
CV_IPP_CHECK()\
|
||||||
{\
|
{\
|
||||||
if (src && dst)\
|
if (src && dst)\
|
||||||
{\
|
{\
|
||||||
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \
|
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \
|
||||||
|
{\
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)\
|
||||||
return; \
|
return; \
|
||||||
|
}\
|
||||||
setIppErrorStatus(); \
|
setIppErrorStatus(); \
|
||||||
}\
|
}\
|
||||||
|
}\
|
||||||
cvt_(src, sstep, dst, dstep, size); \
|
cvt_(src, sstep, dst, dstep, size); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_CVT_FUNC_F2(suffix, stype, dtype, ippFavor) \
|
#define DEF_CVT_FUNC_F2(suffix, stype, dtype, ippFavor) \
|
||||||
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*) \
|
||||||
|
{ \
|
||||||
|
CV_IPP_CHECK()\
|
||||||
{\
|
{\
|
||||||
if (src && dst)\
|
if (src && dst)\
|
||||||
{\
|
{\
|
||||||
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \
|
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \
|
||||||
|
{\
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)\
|
||||||
return; \
|
return; \
|
||||||
|
}\
|
||||||
setIppErrorStatus(); \
|
setIppErrorStatus(); \
|
||||||
}\
|
}\
|
||||||
|
}\
|
||||||
cvt_(src, sstep, dst, dstep, size); \
|
cvt_(src, sstep, dst, dstep, size); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -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,15 +3620,21 @@ 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,6 +3711,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
|
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)
|
||||||
@ -3704,6 +3727,7 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
|||||||
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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
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;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||||
@ -200,10 +212,16 @@ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask,
|
|||||||
#define DEF_COPY_MASK_F(suffix, type, ippfavor, ipptype) \
|
#define DEF_COPY_MASK_F(suffix, type, ippfavor, ipptype) \
|
||||||
static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \
|
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*) \
|
||||||
|
{ \
|
||||||
|
CV_IPP_CHECK()\
|
||||||
{\
|
{\
|
||||||
if (ippiCopy_##ippfavor((const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0) \
|
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;\
|
return;\
|
||||||
|
}\
|
||||||
setIppErrorStatus(); \
|
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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0)
|
if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( ; sz.height--; sptr += step, dptr += dst.step )
|
for( ; sz.height--; sptr += step, dptr += dst.step )
|
||||||
@ -380,6 +404,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (dims <= 2 || isContinuous())
|
if (dims <= 2 || isContinuous())
|
||||||
{
|
{
|
||||||
IppiSize roisize = { cols, rows };
|
IppiSize roisize = { cols, rows };
|
||||||
@ -389,15 +415,22 @@ Mat& Mat::operator = (const Scalar& s)
|
|||||||
roisize.height = 1;
|
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;
|
return *this;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
roisize.width *= (int)elemSize();
|
roisize.width *= (int)elemSize();
|
||||||
|
|
||||||
if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
|
if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP)
|
||||||
return *this;
|
return *this;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( size_t i = 0; i < it.nplanes; i++, ++it )
|
for( size_t i = 0; i < it.nplanes; i++, ++it )
|
||||||
@ -439,6 +472,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int cn = channels(), depth0 = depth();
|
int cn = channels(), depth0 = depth();
|
||||||
|
|
||||||
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) &&
|
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) &&
|
||||||
@ -508,9 +543,13 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return *this;
|
return *this;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t esz = elemSize();
|
size_t esz = elemSize();
|
||||||
@ -714,6 +753,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip);
|
typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip);
|
||||||
typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip);
|
typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip);
|
||||||
ippiMirror ippFunc = 0;
|
ippiMirror ippFunc = 0;
|
||||||
@ -766,15 +807,22 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
|||||||
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (ippFuncI != 0)
|
else if (ippFuncI != 0)
|
||||||
{
|
{
|
||||||
if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0)
|
if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( flip_mode <= 0 )
|
if( flip_mode <= 0 )
|
||||||
@ -1135,6 +1183,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst,
|
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorder)(const void * pSrc, int srcStep, IppiSize srcRoiSize, void * pDst,
|
||||||
int dstStep, IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth);
|
int dstStep, IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth);
|
||||||
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorderI)(const void * pSrc, int srcDstStep, IppiSize srcRoiSize, IppiSize dstRoiSize,
|
typedef IppStatus (CV_STDCALL * ippiCopyMakeBorderI)(const void * pSrc, int srcDstStep, IppiSize srcRoiSize, IppiSize dstRoiSize,
|
||||||
@ -1237,10 +1287,14 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
|
|||||||
(ippFuncI && ippFuncI(src.data, (int)src.step, srcRoiSize, 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,
|
(ippFuncConst && ippFuncConst(src.data, (int)src.step, srcRoiSize, dst.data, (int)dst.step,
|
||||||
dstRoiSize, top, left, scbuf) >= 0))
|
dstRoiSize, top, left, scbuf) >= 0))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( borderType != BORDER_CONSTANT )
|
if( borderType != BORDER_CONSTANT )
|
||||||
|
@ -554,13 +554,19 @@ 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();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -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,7 +1737,12 @@ 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,7 +2475,8 @@ 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 ((src.depth() == CV_32F) && (src.total()>(int)(1<<6)) && nonzero_rows == 0)
|
||||||
{
|
{
|
||||||
if ((flags & DFT_ROWS) == 0)
|
if ((flags & DFT_ROWS) == 0)
|
||||||
@ -2463,13 +2484,19 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
if (src.channels() == 2 && !(inv && (flags & DFT_REAL_OUTPUT)))
|
if (src.channels() == 2 && !(inv && (flags & DFT_REAL_OUTPUT)))
|
||||||
{
|
{
|
||||||
if (ippi_DFT_C_32F(src, dst, inv, ipp_norm_flag))
|
if (ippi_DFT_C_32F(src, dst, inv, ipp_norm_flag))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
||||||
{
|
{
|
||||||
if (ippi_DFT_R_32F(src, dst, inv, ipp_norm_flag))
|
if (ippi_DFT_R_32F(src, dst, inv, ipp_norm_flag))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2479,18 +2506,25 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
{
|
{
|
||||||
ippiDFT_C_Func ippiFunc = inv ? (ippiDFT_C_Func)ippiDFTInv_CToC_32fc_C1R : (ippiDFT_C_Func)ippiDFTFwd_CToC_32fc_C1R;
|
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 (Dft_C_IPPLoop(src, dst, IPPDFT_C_Functor(ippiFunc),ipp_norm_flag))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
if (src.channels() == 1 && (inv || !(flags & DFT_COMPLEX_OUTPUT)))
|
||||||
{
|
{
|
||||||
ippiDFT_R_Func ippiFunc = inv ? (ippiDFT_R_Func)ippiDFTInv_PackToR_32f_C1R : (ippiDFT_R_Func)ippiDFTFwd_RToPack_32f_C1R;
|
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 (Dft_R_IPPLoop(src, dst, IPPDFT_R_Functor(ippiFunc),ipp_norm_flag))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !real_transform )
|
if( !real_transform )
|
||||||
@ -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,13 +3466,19 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
bool row = (flags & DCT_ROWS) != 0;
|
bool row = (flags & DCT_ROWS) != 0;
|
||||||
if (src.type() == CV_32F)
|
if (src.type() == CV_32F)
|
||||||
{
|
{
|
||||||
if(ippi_DCT_32f(src,dst,inv, row))
|
if(ippi_DCT_32f(src,dst,inv, row))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DCTFunc dct_func = dct_tbl[(int)inv + (depth == CV_64F)*2];
|
DCTFunc dct_func = dct_tbl[(int)inv + (depth == CV_64F)*2];
|
||||||
|
@ -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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppStatus status = ippsMagnitude_32f(x, y, mag, len);
|
IppStatus status = ippsMagnitude_32f(x, y, mag, len);
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppStatus status = ippsMagnitude_64f(x, y, mag, len);
|
IppStatus status = ippsMagnitude_64f(x, y, mag, len);
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippsInvSqrt_32f_A21(src, dst, len) >= 0)
|
if (ippsInvSqrt_32f_A21(src, dst, len) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippsSqrt_32f_A21(src, dst, len) >= 0)
|
if (ippsSqrt_32f_A21(src, dst, len) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippsSqrt_64f_A50(src, dst, len) >= 0)
|
if (ippsSqrt_64f_A50(src, dst, len) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -790,6 +820,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees)
|
if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees)
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
|
typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase,
|
||||||
@ -801,9 +833,13 @@ void polarToCart( InputArray src1, InputArray src2,
|
|||||||
|
|
||||||
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const Mat* arrays[] = {&Mag, &Angle, &X, &Y, 0};
|
const Mat* arrays[] = {&Mag, &Angle, &X, &Y, 0};
|
||||||
@ -1352,18 +1388,30 @@ 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)
|
||||||
|
{
|
||||||
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (0 <= ippsExp_32f_A21(x, y, n))
|
if (0 <= ippsExp_32f_A21(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
{
|
||||||
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (0 <= ippsExp_64f_A50(x, y, n))
|
if (0 <= ippsExp_64f_A50(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
Exp_64f(x, y, n);
|
Exp_64f(x, y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2012,18 +2060,30 @@ 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)
|
||||||
|
{
|
||||||
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (0 <= ippsLn_32f_A21(x, y, n))
|
if (0 <= ippsLn_32f_A21(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
{
|
||||||
|
CV_IPP_CHECK()
|
||||||
{
|
{
|
||||||
if (0 <= ippsLn_64f_A50(x, y, n))
|
if (0 <= ippsLn_64f_A50(x, y, n))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
Log_64f(x, y, n);
|
Log_64f(x, y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2216,6 +2276,8 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
|||||||
return;
|
return;
|
||||||
case 2:
|
case 2:
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) ||
|
if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) ||
|
||||||
(_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) ))
|
(_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) ))
|
||||||
{
|
{
|
||||||
@ -2236,9 +2298,13 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
|||||||
IppStatus status = ippiSqr_32f_C1R(src.ptr<Ipp32f>(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
IppStatus status = ippiSqr_32f_C1R(src.ptr<Ipp32f>(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (same)
|
if (same)
|
||||||
multiply(_dst, _dst, _dst);
|
multiply(_dst, _dst, _dst);
|
||||||
@ -2288,6 +2354,8 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (src.isContinuous() && dst.isContinuous())
|
if (src.isContinuous() && dst.isContinuous())
|
||||||
{
|
{
|
||||||
IppStatus status = depth == CV_32F ?
|
IppStatus status = depth == CV_32F ?
|
||||||
@ -2295,9 +2363,13 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
|||||||
ippsPowx_64f_A50(src.ptr<Ipp64f>(), power, dst.ptr<Ipp64f>(), (Ipp32s)(src.total() * cn));
|
ippsPowx_64f_A50(src.ptr<Ipp64f>(), power, dst.ptr<Ipp64f>(), (Ipp32s)(src.total() * cn));
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int j, k, blockSize = std::min(len, ((BLOCK_SIZE + cn-1)/cn)*cn);
|
int j, k, blockSize = std::min(len, ((BLOCK_SIZE + cn-1)/cn)*cn);
|
||||||
|
@ -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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])),
|
if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])),
|
||||||
src2, (int)(len*sizeof(src2[0])),
|
src2, (int)(len*sizeof(src2[0])),
|
||||||
ippiSize(len, 1), &r))
|
ippiSize(len, 1), &r))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
double r = 0;
|
double r = 0;
|
||||||
if (0 <= ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
if (0 <= 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;
|
return r;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
double r = 0;
|
double r = 0;
|
||||||
if (0 <= ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
if (0 <= 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;
|
return r;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
double r = 0;
|
double r = 0;
|
||||||
if (0 <= ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
|
if (0 <= 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;
|
return r;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (0 <= ippsDotProd_32f64f(src1, src2, len, &r))
|
if (0 <= ippsDotProd_32f64f(src1, src2, len, &r))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
double r = 0;
|
double r = 0;
|
||||||
if (0 <= ippsDotProd_64f(src1, src2, len, &r))
|
if (0 <= ippsDotProd_64f(src1, src2, len, &r))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return dotProd_(src1, src2, len);
|
return dotProd_(src1, src2, len);
|
||||||
}
|
}
|
||||||
|
@ -3066,6 +3066,8 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize);
|
typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize);
|
||||||
typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize);
|
typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize);
|
||||||
ippiTranspose ippFunc = 0;
|
ippiTranspose ippFunc = 0;
|
||||||
@ -3116,15 +3118,22 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
|||||||
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (ippFuncI != 0)
|
else if (ippFuncI != 0)
|
||||||
{
|
{
|
||||||
if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0)
|
if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( dst.data == src.data )
|
if( dst.data == src.data )
|
||||||
@ -3353,6 +3362,8 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
|
|||||||
}
|
}
|
||||||
CV_Assert(!(ippFunc && ippFuncHint) && func);
|
CV_Assert(!(ippFunc && ippFuncHint) && func);
|
||||||
|
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippFunc)
|
if (ippFunc)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < size.height; ++y)
|
for (int y = 0; y < size.height; ++y)
|
||||||
@ -3362,6 +3373,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
|
|||||||
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
||||||
func(srcmat.rowRange(y, y + 1), dstroi);
|
func(srcmat.rowRange(y, y + 1), dstroi);
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ippFuncHint)
|
else if (ippFuncHint)
|
||||||
@ -3373,8 +3385,10 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
|
|||||||
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
|
||||||
func(srcmat.rowRange(y, y + 1), dstroi);
|
func(srcmat.rowRange(y, y + 1), dstroi);
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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;
|
||||||
|
@ -879,6 +879,8 @@ cv::Scalar cv::sum( InputArray _src )
|
|||||||
int k, cn = src.channels(), depth = src.depth();
|
int k, cn = src.channels(), depth = src.depth();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t total_size = src.total();
|
size_t total_size = src.total();
|
||||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||||
if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
||||||
@ -914,11 +916,13 @@ cv::Scalar cv::sum( InputArray _src )
|
|||||||
Scalar sc;
|
Scalar sc;
|
||||||
for( int i = 0; i < cn; i++ )
|
for( int i = 0; i < cn; i++ )
|
||||||
sc[i] = res[i];
|
sc[i] = res[i];
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SumFunc func = getSumFunc(depth);
|
SumFunc func = getSumFunc(depth);
|
||||||
@ -1029,6 +1033,8 @@ int cv::countNonZero( InputArray _src )
|
|||||||
Mat src = _src.getMat();
|
Mat src = _src.getMat();
|
||||||
|
|
||||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && 0
|
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && 0
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (src.dims <= 2 || src.isContinuous())
|
if (src.dims <= 2 || src.isContinuous())
|
||||||
{
|
{
|
||||||
IppiSize roiSize = { src.cols, src.rows };
|
IppiSize roiSize = { src.cols, src.rows };
|
||||||
@ -1049,9 +1055,13 @@ int cv::countNonZero( InputArray _src )
|
|||||||
status = ippiCountInRange_32f_C1R((const Ipp32f *)src.data, srcstep, roiSize, &count, 0, 0);
|
status = ippiCountInRange_32f_C1R((const Ipp32f *)src.data, srcstep, roiSize, &count, 0, 0);
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return (Ipp32s)src.total() - count;
|
return (Ipp32s)src.total() - count;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CountNonZeroFunc func = getCountNonZeroTab(src.depth());
|
CountNonZeroFunc func = getCountNonZeroTab(src.depth());
|
||||||
@ -1076,6 +1086,8 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
|||||||
int k, cn = src.channels(), depth = src.depth();
|
int k, cn = src.channels(), depth = src.depth();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t total_size = src.total();
|
size_t total_size = src.total();
|
||||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||||
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
||||||
@ -1094,7 +1106,10 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
|||||||
{
|
{
|
||||||
Ipp64f res;
|
Ipp64f res;
|
||||||
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 )
|
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return Scalar(res);
|
return Scalar(res);
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||||
@ -1110,6 +1125,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
|||||||
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 &&
|
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 &&
|
||||||
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 )
|
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 )
|
||||||
{
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return Scalar(res1, res2, res3);
|
return Scalar(res1, res2, res3);
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
@ -1147,12 +1163,14 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
|||||||
Scalar sc;
|
Scalar sc;
|
||||||
for( int i = 0; i < cn; i++ )
|
for( int i = 0; i < cn; i++ )
|
||||||
sc[i] = res[i];
|
sc[i] = res[i];
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SumFunc func = getSumFunc(depth);
|
SumFunc func = getSumFunc(depth);
|
||||||
@ -1338,6 +1356,8 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
int k, cn = src.channels(), depth = src.depth();
|
int k, cn = src.channels(), depth = src.depth();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t total_size = src.total();
|
size_t total_size = src.total();
|
||||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||||
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
||||||
@ -1382,7 +1402,10 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
if( ippFuncC1 )
|
if( ippFuncC1 )
|
||||||
{
|
{
|
||||||
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, pmean, pstddev) >= 0 )
|
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, pmean, pstddev) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
|
||||||
@ -1396,7 +1419,10 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
if( ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
|
if( ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
|
||||||
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
|
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
|
||||||
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
|
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1413,7 +1439,10 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
if( ippFuncC1 )
|
if( ippFuncC1 )
|
||||||
{
|
{
|
||||||
if( ippFuncC1(src.ptr(), (int)src.step[0], sz, pmean, pstddev) >= 0 )
|
if( ippFuncC1(src.ptr(), (int)src.step[0], sz, pmean, pstddev) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
|
||||||
@ -1427,11 +1456,15 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
if( ippFuncC3(src.ptr(), (int)src.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
|
if( ippFuncC3(src.ptr(), (int)src.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
|
||||||
ippFuncC3(src.ptr(), (int)src.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
|
ippFuncC3(src.ptr(), (int)src.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
|
||||||
ippFuncC3(src.ptr(), (int)src.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
|
ippFuncC3(src.ptr(), (int)src.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -1885,6 +1918,8 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
|||||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t total_size = src.total();
|
size_t total_size = src.total();
|
||||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||||
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
||||||
@ -1926,6 +1961,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
|||||||
size_t maxidx = maxp.y * cols + maxp.x + 1;
|
size_t maxidx = maxp.y * cols + maxp.x + 1;
|
||||||
ofs2idx(src, maxidx, maxIdx);
|
ofs2idx(src, maxidx, maxIdx);
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
@ -1963,12 +1999,14 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
|||||||
size_t maxidx = maxp.y * cols + maxp.x + 1;
|
size_t maxidx = maxp.y * cols + maxp.x + 1;
|
||||||
ofs2idx(src, maxidx, maxIdx);
|
ofs2idx(src, maxidx, maxIdx);
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MinMaxIdxFunc func = getMinmaxTab(depth);
|
MinMaxIdxFunc func = getMinmaxTab(depth);
|
||||||
@ -2569,6 +2607,8 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
|||||||
int depth = src.depth(), cn = src.channels();
|
int depth = src.depth(), cn = src.channels();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t total_size = src.total();
|
size_t total_size = src.total();
|
||||||
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||||
|
|
||||||
@ -2605,7 +2645,10 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
|||||||
{
|
{
|
||||||
Ipp64f norm;
|
Ipp64f norm;
|
||||||
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
||||||
|
}
|
||||||
|
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
@ -2641,6 +2684,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
|||||||
normType == NORM_L1 ? norm1 + norm2 + norm3 :
|
normType == NORM_L1 ? norm1 + norm2 + norm3 :
|
||||||
normType == NORM_L2 || normType == NORM_L2SQR ? std::sqrt(norm1 * norm1 + norm2 * norm2 + norm3 * norm3) :
|
normType == NORM_L2 || normType == NORM_L2SQR ? std::sqrt(norm1 * norm1 + norm2 * norm2 + norm3 * norm3) :
|
||||||
0;
|
0;
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
@ -2718,12 +2762,14 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
|||||||
normType == NORM_L2 || normType == NORM_L2SQR ? norm + norm_array[i] * norm_array[i] :
|
normType == NORM_L2 || normType == NORM_L2SQR ? norm + norm_array[i] * norm_array[i] :
|
||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2 ? (double)std::sqrt(norm) : (double)norm;
|
return normType == NORM_L2 ? (double)std::sqrt(norm) : (double)norm;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( src.isContinuous() && mask.empty() )
|
if( src.isContinuous() && mask.empty() )
|
||||||
@ -2925,6 +2971,8 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
if( normType & CV_RELATIVE )
|
if( normType & CV_RELATIVE )
|
||||||
{
|
{
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
||||||
|
|
||||||
normType &= NORM_TYPE_MASK;
|
normType &= NORM_TYPE_MASK;
|
||||||
@ -2969,7 +3017,10 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
{
|
{
|
||||||
Ipp64f norm;
|
Ipp64f norm;
|
||||||
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3005,18 +3056,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
{
|
{
|
||||||
Ipp64f norm;
|
Ipp64f norm;
|
||||||
if( ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 )
|
if( ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return (double)norm;
|
return (double)norm;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if (ippFuncHint)
|
if (ippFuncHint)
|
||||||
{
|
{
|
||||||
Ipp64f norm;
|
Ipp64f norm;
|
||||||
if( ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 )
|
if( ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return (double)norm;
|
return (double)norm;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return norm(_src1, _src2, normType & ~CV_RELATIVE, _mask)/(norm(_src2, normType, _mask) + DBL_EPSILON);
|
return norm(_src1, _src2, normType & ~CV_RELATIVE, _mask)/(norm(_src2, normType, _mask) + DBL_EPSILON);
|
||||||
}
|
}
|
||||||
@ -3030,6 +3088,8 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
((normType == NORM_HAMMING || normType == NORM_HAMMING2) && src1.type() == CV_8U) );
|
((normType == NORM_HAMMING || normType == NORM_HAMMING2) && src1.type() == CV_8U) );
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
size_t total_size = src1.total();
|
size_t total_size = src1.total();
|
||||||
int rows = src1.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
int rows = src1.size[0], cols = rows ? (int)(total_size/rows) : 0;
|
||||||
if( (src1.dims == 2 || (src1.isContinuous() && src2.isContinuous() && mask.isContinuous()))
|
if( (src1.dims == 2 || (src1.isContinuous() && src2.isContinuous() && mask.isContinuous()))
|
||||||
@ -3067,7 +3127,10 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
{
|
{
|
||||||
Ipp64f norm;
|
Ipp64f norm;
|
||||||
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
@ -3103,6 +3166,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
normType == NORM_L1 ? norm1 + norm2 + norm3 :
|
normType == NORM_L1 ? norm1 + norm2 + norm3 :
|
||||||
normType == NORM_L2 || normType == NORM_L2SQR ? std::sqrt(norm1 * norm1 + norm2 * norm2 + norm3 * norm3) :
|
normType == NORM_L2 || normType == NORM_L2SQR ? std::sqrt(norm1 * norm1 + norm2 * norm2 + norm3 * norm3) :
|
||||||
0;
|
0;
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
@ -3181,12 +3245,14 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
|||||||
normType == NORM_L2 || normType == NORM_L2SQR ? norm + norm_array[i] * norm_array[i] :
|
normType == NORM_L2 || normType == NORM_L2SQR ? norm + norm_array[i] * norm_array[i] :
|
||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return normType == NORM_L2 ? (double)std::sqrt(norm) : (double)norm;
|
return normType == NORM_L2 ? (double)std::sqrt(norm) : (double)norm;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( src1.isContinuous() && src2.isContinuous() && mask.empty() )
|
if( src1.isContinuous() && src2.isContinuous() && mask.empty() )
|
||||||
|
@ -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,9 +697,12 @@ 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
|
||||||
Mat src = getMat(ACCESS_READ);
|
Mat src = getMat(ACCESS_READ);
|
||||||
src.copyTo(_dst, _mask);
|
src.copyTo(_dst, _mask);
|
||||||
@ -753,9 +756,12 @@ 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
|
||||||
Mat m = getMat(ACCESS_READ);
|
Mat m = getMat(ACCESS_READ);
|
||||||
m.convertTo(_dst, _type, alpha, beta);
|
m.convertTo(_dst, _type, alpha, beta);
|
||||||
@ -802,9 +808,12 @@ 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
|
||||||
Mat m = getMat(haveMask ? ACCESS_RW : ACCESS_WRITE);
|
Mat m = getMat(haveMask ? ACCESS_RW : ACCESS_WRITE);
|
||||||
m.setTo(_value, _mask);
|
m.setTo(_value, _mask);
|
||||||
|
@ -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))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case FastFeatureDetector::TYPE_5_8:
|
case FastFeatureDetector::TYPE_5_8:
|
||||||
|
@ -943,28 +943,40 @@ 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
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Mat queryDescriptors = _queryDescriptors.getMat();
|
Mat queryDescriptors = _queryDescriptors.getMat();
|
||||||
if(trainDescCollection.empty() && !utrainDescCollection.empty())
|
if(trainDescCollection.empty() && !utrainDescCollection.empty())
|
||||||
@ -1073,14 +1085,20 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Mat queryDescriptors = _queryDescriptors.getMat();
|
Mat queryDescriptors = _queryDescriptors.getMat();
|
||||||
if(trainDescCollection.empty() && !utrainDescCollection.empty())
|
if(trainDescCollection.empty() && !utrainDescCollection.empty())
|
||||||
|
@ -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,6 +856,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
||||||
@ -902,10 +904,14 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask )
|
|||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fidx = getAccTabIdx(sdepth, ddepth);
|
int fidx = getAccTabIdx(sdepth, ddepth);
|
||||||
@ -935,6 +941,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous())))
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize);
|
||||||
@ -979,10 +987,14 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m
|
|||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fidx = getAccTabIdx(sdepth, ddepth);
|
int fidx = getAccTabIdx(sdepth, ddepth);
|
||||||
@ -1014,6 +1026,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous()))
|
if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous()))
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2,
|
typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2,
|
||||||
@ -1061,10 +1075,14 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2,
|
|||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fidx = getAccTabIdx(sdepth, ddepth);
|
int fidx = getAccTabIdx(sdepth, ddepth);
|
||||||
@ -1095,6 +1113,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && mask.isContinuous()))
|
if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && mask.isContinuous()))
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiAddWeighted)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep,
|
typedef IppStatus (CV_STDCALL * ippiAddWeighted)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep,
|
||||||
@ -1141,10 +1161,14 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst,
|
|||||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fidx = getAccTabIdx(sdepth, ddepth);
|
int fidx = getAccTabIdx(sdepth, ddepth);
|
||||||
|
@ -265,12 +265,18 @@ void cv::Canny( InputArray _src, OutputArray _dst,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_IPP_CANNY
|
#ifdef USE_IPP_CANNY
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( aperture_size == 3 && !L2gradient && 1 == cn )
|
if( aperture_size == 3 && !L2gradient && 1 == cn )
|
||||||
{
|
{
|
||||||
if (ippCanny(src, dst, (float)low_thresh, (float)high_thresh))
|
if (ippCanny(src, dst, (float)low_thresh, (float)high_thresh))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Mat dx(src.rows, src.cols, CV_16SC(cn));
|
Mat dx(src.rows, src.cols, CV_16SC(cn));
|
||||||
|
@ -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();
|
||||||
|
@ -223,6 +223,10 @@ public:
|
|||||||
void *yD = dst.ptr<uchar>(range.start);
|
void *yD = dst.ptr<uchar>(range.start);
|
||||||
if( !cvt(yS, (int)src.step[0], yD, (int)dst.step[0], src.cols, range.end - range.start) )
|
if( !cvt(yS, (int)src.step[0], yD, (int)dst.step[0], src.cols, range.end - range.start) )
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -5427,44 +5431,65 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( code == CV_BGR2BGRA)
|
if( code == CV_BGR2BGRA)
|
||||||
{
|
{
|
||||||
if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 0, 1, 2)) )
|
if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 0, 1, 2)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGRA2BGR )
|
else if( code == CV_BGRA2BGR )
|
||||||
{
|
{
|
||||||
if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiCopyAC4C3RTab[depth])) )
|
if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiCopyAC4C3RTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGR2RGBA )
|
else if( code == CV_BGR2RGBA )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 2, 1, 0)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 2, 1, 0)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGBA2BGR )
|
else if( code == CV_RGBA2BGR )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC4C3RTab[depth], 2, 1, 0)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC4C3RTab[depth], 2, 1, 0)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2BGR )
|
else if( code == CV_RGB2BGR )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
#if IPP_VERSION_X100 >= 801
|
#if IPP_VERSION_X100 >= 801
|
||||||
else if( code == CV_RGBA2BGRA )
|
else if( code == CV_RGBA2BGRA )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( depth == CV_8U )
|
if( depth == CV_8U )
|
||||||
@ -5487,12 +5512,17 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined(HAVE_IPP) && 0 // breaks OCL accuracy tests
|
#if defined(HAVE_IPP) && 0 // breaks OCL accuracy tests
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
|
|
||||||
if (code == CV_BGR2BGR565 && scn == 3)
|
if (code == CV_BGR2BGR565 && scn == 3)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R)))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_BGRA2BGR565 && scn == 4)
|
else if (code == CV_BGRA2BGR565 && scn == 4)
|
||||||
@ -5500,24 +5530,34 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
if (CvtColorIPPLoopCopy(src, dst,
|
if (CvtColorIPPLoopCopy(src, dst,
|
||||||
IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 0, 1, 2, depth)))
|
(ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 0, 1, 2, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_RGB2BGR565 && scn == 3)
|
else if (code == CV_RGB2BGR565 && scn == 3)
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 2, 1, 0, depth)) )
|
(ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_RGBA2BGR565 && scn == 4)
|
else if (code == CV_RGBA2BGR565 && scn == 4)
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 2, 1, 0, depth)) )
|
(ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
@ -5542,35 +5582,50 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
if (code == CV_BGR5652BGR && dcn == 3)
|
if (code == CV_BGR5652BGR && dcn == 3)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R)))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_BGR5652RGB && dcn == 3)
|
else if (code == CV_BGR5652RGB && dcn == 3)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R,
|
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R,
|
||||||
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)))
|
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_BGR5652BGRA && dcn == 4)
|
else if (code == CV_BGR5652BGRA && dcn == 4)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R,
|
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R,
|
||||||
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)))
|
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_BGR5652RGBA && dcn == 4)
|
else if (code == CV_BGR5652RGBA && dcn == 4)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R,
|
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R,
|
||||||
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)))
|
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CvtColorLoop(src, dst, RGB5x52RGB(dcn,
|
CvtColorLoop(src, dst, RGB5x52RGB(dcn,
|
||||||
@ -5587,30 +5642,45 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( code == CV_BGR2GRAY && depth == CV_32F )
|
if( code == CV_BGR2GRAY && depth == CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC3Tab[depth])) )
|
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC3Tab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2GRAY && depth == CV_32F )
|
else if( code == CV_RGB2GRAY && depth == CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC3Tab[depth])) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC3Tab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGRA2GRAY && depth == CV_32F )
|
else if( code == CV_BGRA2GRAY && depth == CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC4Tab[depth])) )
|
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC4Tab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGBA2GRAY && depth == CV_32F )
|
else if( code == CV_RGBA2GRAY && depth == CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC4Tab[depth])) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC4Tab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bidx = code == CV_BGR2GRAY || code == CV_BGRA2GRAY ? 0 : 2;
|
bidx = code == CV_BGR2GRAY || code == CV_BGRA2GRAY ? 0 : 2;
|
||||||
@ -5643,18 +5713,27 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( code == CV_GRAY2BGR )
|
if( code == CV_GRAY2BGR )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippiCopyP3C3RTab[depth])) )
|
if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippiCopyP3C3RTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_GRAY2BGRA )
|
else if( code == CV_GRAY2BGRA )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippiCopyP3C3RTab[depth], ippiSwapChannelsC3C4RTab[depth], depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippiCopyP3C3RTab[depth], ippiSwapChannelsC3C4RTab[depth], depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -5693,33 +5772,48 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined HAVE_IPP && 0
|
#if defined HAVE_IPP && 0
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (code == CV_RGB2YUV && scn == 3 && depth == CV_8U)
|
if (code == CV_RGB2YUV && scn == 3 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiRGBToYUV_8u_C3R)))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiRGBToYUV_8u_C3R)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_BGR2YUV && scn == 3 && depth == CV_8U)
|
else if (code == CV_BGR2YUV && scn == 3 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 2, 1, 0, depth)))
|
(ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_RGB2YUV && scn == 4 && depth == CV_8U)
|
else if (code == CV_RGB2YUV && scn == 4 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 0, 1, 2, depth)))
|
(ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 0, 1, 2, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_BGR2YUV && scn == 4 && depth == CV_8U)
|
else if (code == CV_BGR2YUV && scn == 4 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 2, 1, 0, depth)))
|
(ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( depth == CV_8U )
|
if( depth == CV_8U )
|
||||||
@ -5752,33 +5846,48 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined HAVE_IPP && 0
|
#if defined HAVE_IPP && 0
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (code == CV_YUV2RGB && dcn == 3 && depth == CV_8U)
|
if (code == CV_YUV2RGB && dcn == 3 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R)))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_YUV2BGR && dcn == 3 && depth == CV_8U)
|
else if (code == CV_YUV2BGR && dcn == 3 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R,
|
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R,
|
||||||
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)))
|
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_YUV2RGB && dcn == 4 && depth == CV_8U)
|
else if (code == CV_YUV2RGB && dcn == 4 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R,
|
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R,
|
||||||
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)))
|
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_YUV2BGR && dcn == 4 && depth == CV_8U)
|
else if (code == CV_YUV2BGR && dcn == 4 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R,
|
if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R,
|
||||||
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)))
|
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( depth == CV_8U )
|
if( depth == CV_8U )
|
||||||
@ -5798,30 +5907,45 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( code == CV_BGR2XYZ && scn == 3 && depth != CV_32F )
|
if( code == CV_BGR2XYZ && scn == 3 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGR2XYZ && scn == 4 && depth != CV_32F )
|
else if( code == CV_BGR2XYZ && scn == 4 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2XYZ && scn == 3 && depth != CV_32F )
|
else if( code == CV_RGB2XYZ && scn == 3 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2XYZTab[depth])) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2XYZTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2XYZ && scn == 4 && depth != CV_32F )
|
else if( code == CV_RGB2XYZ && scn == 4 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 0, 1, 2, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( depth == CV_8U )
|
if( depth == CV_8U )
|
||||||
@ -5841,30 +5965,45 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( code == CV_XYZ2BGR && dcn == 3 && depth != CV_32F )
|
if( code == CV_XYZ2BGR && dcn == 3 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_XYZ2BGR && dcn == 4 && depth != CV_32F )
|
else if( code == CV_XYZ2BGR && dcn == 4 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if( code == CV_XYZ2RGB && dcn == 3 && depth != CV_32F )
|
if( code == CV_XYZ2RGB && dcn == 3 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiXYZ2RGBTab[depth])) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiXYZ2RGBTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_XYZ2RGB && dcn == 4 && depth != CV_32F )
|
else if( code == CV_XYZ2RGB && dcn == 4 && depth != CV_32F )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( depth == CV_8U )
|
if( depth == CV_8U )
|
||||||
@ -5888,59 +6027,86 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( depth == CV_8U || depth == CV_16U )
|
if( depth == CV_8U || depth == CV_16U )
|
||||||
{
|
{
|
||||||
#if 0 // breaks OCL accuracy tests
|
#if 0 // breaks OCL accuracy tests
|
||||||
if( code == CV_BGR2HSV_FULL && scn == 3 )
|
if( code == CV_BGR2HSV_FULL && scn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGR2HSV_FULL && scn == 4 )
|
else if( code == CV_BGR2HSV_FULL && scn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2HSV_FULL && scn == 4 )
|
else if( code == CV_RGB2HSV_FULL && scn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 0, 1, 2, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if( code == CV_RGB2HSV_FULL && scn == 3 && depth == CV_16U )
|
if( code == CV_RGB2HSV_FULL && scn == 3 && depth == CV_16U )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HSVTab[depth])) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HSVTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGR2HLS_FULL && scn == 3 )
|
else if( code == CV_BGR2HLS_FULL && scn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_BGR2HLS_FULL && scn == 4 )
|
else if( code == CV_BGR2HLS_FULL && scn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2HLS_FULL && scn == 3 )
|
else if( code == CV_RGB2HLS_FULL && scn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HLSTab[depth])) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HLSTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_RGB2HLS_FULL && scn == 4 )
|
else if( code == CV_RGB2HLS_FULL && scn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 0, 1, 2, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( code == CV_BGR2HSV || code == CV_RGB2HSV ||
|
if( code == CV_BGR2HSV || code == CV_RGB2HSV ||
|
||||||
@ -5979,57 +6145,84 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( depth == CV_8U || depth == CV_16U )
|
if( depth == CV_8U || depth == CV_16U )
|
||||||
{
|
{
|
||||||
if( code == CV_HSV2BGR_FULL && dcn == 3 )
|
if( code == CV_HSV2BGR_FULL && dcn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HSV2BGR_FULL && dcn == 4 )
|
else if( code == CV_HSV2BGR_FULL && dcn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HSV2RGB_FULL && dcn == 3 )
|
else if( code == CV_HSV2RGB_FULL && dcn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHSV2RGBTab[depth])) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHSV2RGBTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HSV2RGB_FULL && dcn == 4 )
|
else if( code == CV_HSV2RGB_FULL && dcn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HLS2BGR_FULL && dcn == 3 )
|
else if( code == CV_HLS2BGR_FULL && dcn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HLS2BGR_FULL && dcn == 4 )
|
else if( code == CV_HLS2BGR_FULL && dcn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HLS2RGB_FULL && dcn == 3 )
|
else if( code == CV_HLS2RGB_FULL && dcn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHLS2RGBTab[depth])) )
|
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHLS2RGBTab[depth])) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_HLS2RGB_FULL && dcn == 4 )
|
else if( code == CV_HLS2RGB_FULL && dcn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( code == CV_HSV2BGR || code == CV_HSV2RGB ||
|
if( code == CV_HSV2BGR || code == CV_HSV2RGB ||
|
||||||
@ -6062,19 +6255,26 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
_dst.create(sz, CV_MAKETYPE(depth, 3));
|
_dst.create(sz, CV_MAKETYPE(depth, 3));
|
||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#if defined HAVE_IPP && 0
|
||||||
#if 0
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (code == CV_LBGR2Lab && scn == 3 && depth == CV_8U)
|
if (code == CV_LBGR2Lab && scn == 3 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToLab_8u_C3R)))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToLab_8u_C3R)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_LBGR2Lab && scn == 4 && depth == CV_8U)
|
else if (code == CV_LBGR2Lab && scn == 4 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 0, 1, 2, depth)))
|
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 0, 1, 2, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6082,44 +6282,62 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth)))
|
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_LRGB2Lab && scn == 4 && depth == CV_8U) // slower than OpenCV
|
else if (code == CV_LRGB2Lab && scn == 4 && depth == CV_8U) // slower than OpenCV
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth)))
|
(ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_LRGB2Luv && scn == 3)
|
else if (code == CV_LRGB2Luv && scn == 3)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGBToLUVTab[depth])))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGBToLUVTab[depth])))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_LRGB2Luv && scn == 4)
|
else if (code == CV_LRGB2Luv && scn == 4)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
ippiRGBToLUVTab[depth], 0, 1, 2, depth)))
|
ippiRGBToLUVTab[depth], 0, 1, 2, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_LBGR2Luv && scn == 3)
|
else if (code == CV_LBGR2Luv && scn == 3)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth],
|
||||||
ippiRGBToLUVTab[depth], 2, 1, 0, depth)))
|
ippiRGBToLUVTab[depth], 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if (code == CV_LBGR2Luv && scn == 4)
|
else if (code == CV_LBGR2Luv && scn == 4)
|
||||||
{
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth],
|
||||||
ippiRGBToLUVTab[depth], 2, 1, 0, depth)))
|
ippiRGBToLUVTab[depth], 2, 1, 0, depth)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( code == CV_BGR2Lab || code == CV_RGB2Lab ||
|
if( code == CV_BGR2Lab || code == CV_RGB2Lab ||
|
||||||
@ -6154,31 +6372,45 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
|
|
||||||
#if defined HAVE_IPP && 0
|
#if defined HAVE_IPP && 0
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( code == CV_Lab2LBGR && dcn == 3 && depth == CV_8U)
|
if( code == CV_Lab2LBGR && dcn == 3 && depth == CV_8U)
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R)) )
|
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_Lab2LBGR && dcn == 4 && depth == CV_8U )
|
else if( code == CV_Lab2LBGR && dcn == 4 && depth == CV_8U )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R,
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R,
|
||||||
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if( code == CV_Lab2LRGB && dcn == 3 && depth == CV_8U )
|
if( code == CV_Lab2LRGB && dcn == 3 && depth == CV_8U )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R,
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R,
|
||||||
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
else if( code == CV_Lab2LRGB && dcn == 4 && depth == CV_8U )
|
else if( code == CV_Lab2LRGB && dcn == 4 && depth == CV_8U )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R,
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R,
|
||||||
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
if( code == CV_Luv2LRGB && dcn == 3 )
|
if( code == CV_Luv2LRGB && dcn == 3 )
|
||||||
@ -6190,20 +6422,30 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiLUVToRGBTab[depth],
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiLUVToRGBTab[depth],
|
||||||
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if( code == CV_Luv2LBGR && dcn == 3 )
|
if( code == CV_Luv2LBGR && dcn == 3 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiLUVToRGBTab[depth],
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiLUVToRGBTab[depth],
|
||||||
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if( code == CV_Luv2LBGR && dcn == 4 )
|
else if( code == CV_Luv2LBGR && dcn == 4 )
|
||||||
{
|
{
|
||||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiLUVToRGBTab[depth],
|
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiLUVToRGBTab[depth],
|
||||||
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( code == CV_Lab2BGR || code == CV_Lab2RGB ||
|
if( code == CV_Lab2BGR || code == CV_Lab2RGB ||
|
||||||
@ -6314,10 +6556,16 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
_dst.create(dstSz, CV_MAKETYPE(depth, dcn));
|
_dst.create(dstSz, CV_MAKETYPE(depth, dcn));
|
||||||
dst = _dst.getMat();
|
dst = _dst.getMat();
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ippStsNoErr == ippiCopy_8u_C1R(src.data, (int)src.step, dst.data, (int)dst.step,
|
if (ippStsNoErr == ippiCopy_8u_C1R(src.data, (int)src.step, dst.data, (int)dst.step,
|
||||||
ippiSize(dstSz.width, dstSz.height)))
|
ippiSize(dstSz.width, dstSz.height)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
src(Range(0, dstSz.height), Range::all()).copyTo(dst);
|
src(Range(0, dstSz.height), Range::all()).copyTo(dst);
|
||||||
}
|
}
|
||||||
@ -6409,9 +6657,15 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
if( depth == CV_8U )
|
if( depth == CV_8U )
|
||||||
{
|
{
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiAlphaPremul_8u_AC4R)))
|
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiAlphaPremul_8u_AC4R)))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
CvtColorLoop(src, dst, RGBA2mRGBA<uchar>());
|
CvtColorLoop(src, dst, RGBA2mRGBA<uchar>());
|
||||||
}
|
}
|
||||||
|
@ -472,6 +472,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
|
typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
|
||||||
typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
|
typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
|
||||||
IppiKernelType kerType;
|
IppiKernelType kerType;
|
||||||
@ -519,11 +521,15 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
|
|||||||
if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi);
|
if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi);
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
cornerEigenValsVecs( src, dst, blockSize, ksize, MINEIGENVAL, 0, borderType );
|
cornerEigenValsVecs( src, dst, blockSize, ksize, MINEIGENVAL, 0, borderType );
|
||||||
}
|
}
|
||||||
@ -538,6 +544,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
@ -573,10 +581,14 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi
|
|||||||
ippsFree(buffer);
|
ippsFree(buffer);
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cornerEigenValsVecs( src, dst, blockSize, ksize, HARRIS, k, borderType );
|
cornerEigenValsVecs( src, dst, blockSize, ksize, HARRIS, k, borderType );
|
||||||
|
@ -573,16 +573,25 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (ksize < 0)
|
if (ksize < 0)
|
||||||
{
|
{
|
||||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (0 < ksize)
|
else if (0 < ksize)
|
||||||
{
|
{
|
||||||
if (IPPDerivSobel(_src, _dst, ddepth, dx, dy, ksize, scale, delta, borderType))
|
if (IPPDerivSobel(_src, _dst, ddepth, dx, dy, ksize, scale, delta, borderType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
int ktype = std::max(CV_32F, std::max(ddepth, sdepth));
|
||||||
|
|
||||||
@ -793,6 +808,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
|
if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
|
||||||
((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)) && !ocl::useOpenCL())
|
((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)) && !ocl::useOpenCL())
|
||||||
{
|
{
|
||||||
@ -844,11 +861,15 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
|||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef IPP_FILTER_LAPLACIAN
|
#undef IPP_FILTER_LAPLACIAN
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
|
@ -689,11 +689,17 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst)
|
|||||||
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,6 +741,8 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef HAVE_IPP
|
#ifdef HAVE_IPP
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
|
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
|
||||||
{
|
{
|
||||||
IppStatus status;
|
IppStatus status;
|
||||||
@ -749,10 +757,14 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
|||||||
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
|
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
|
||||||
ippFree( pBuffer );
|
ippFree( pBuffer );
|
||||||
if (status>=0)
|
if (status>=0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
trueDistTrans( src, dst );
|
trueDistTrans( src, dst );
|
||||||
@ -774,10 +786,16 @@ 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);
|
||||||
@ -785,10 +803,16 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#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_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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int ret = ippiOperator(_src, _dst, width, cn);
|
int ret = ippiOperator(_src, _dst, width, cn);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
return ret;
|
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,6 +3747,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
typedef IppStatus (CV_STDCALL * ippiFilterBorder)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize dstRoiSize,
|
typedef IppStatus (CV_STDCALL * ippiFilterBorder)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize dstRoiSize,
|
||||||
IppiBorderType border, const void * borderValue,
|
IppiBorderType border, const void * borderValue,
|
||||||
const IppiFilterBorderSpec* pSpec, Ipp8u* pBuffer);
|
const IppiFilterBorderSpec* pSpec, Ipp8u* pBuffer);
|
||||||
@ -3802,10 +3808,14 @@ void cv::filter2D( InputArray _src, OutputArray _dst, int ddepth,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
|
@ -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,6 +1234,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels &&
|
if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels &&
|
||||||
channels[0] == 0 && mask.empty() && images[0].dims <= 2 &&
|
channels[0] == 0 && mask.empty() && images[0].dims <= 2 &&
|
||||||
!accumulate && uniform)
|
!accumulate && uniform)
|
||||||
@ -1253,10 +1256,12 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
|
|||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
ihist.convertTo(hist, CV_32F);
|
ihist.convertTo(hist, CV_32F);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !accumulate || histdata != hist.data )
|
if( !accumulate || histdata != hist.data )
|
||||||
|
@ -100,6 +100,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize srcSize = { width, height };
|
IppiSize srcSize = { width, height };
|
||||||
IppPointPolar delta = { rho, theta };
|
IppPointPolar delta = { rho, theta };
|
||||||
IppPointPolar dstRoi[2] = {{(Ipp32f) -(width + height), (Ipp32f) min_theta},{(Ipp32f) (width + height), (Ipp32f) max_theta}};
|
IppPointPolar dstRoi[2] = {{(Ipp32f) -(width + height), (Ipp32f) min_theta},{(Ipp32f) (width + height), (Ipp32f) max_theta}};
|
||||||
@ -115,10 +117,12 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
|
|||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
{
|
{
|
||||||
lines.resize(linesCount);
|
lines.resize(linesCount);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lines.clear();
|
lines.clear();
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AutoBuffer<int> _accum((numangle+2) * (numrho+2));
|
AutoBuffer<int> _accum((numangle+2) * (numrho+2));
|
||||||
@ -429,6 +433,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize srcSize = { width, height };
|
IppiSize srcSize = { width, height };
|
||||||
IppPointPolar delta = { rho, theta };
|
IppPointPolar delta = { rho, theta };
|
||||||
IppiHoughProbSpec* pSpec;
|
IppiHoughProbSpec* pSpec;
|
||||||
@ -447,10 +453,12 @@ HoughLinesProbabilistic( Mat& image,
|
|||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
{
|
{
|
||||||
lines.resize(linesCount);
|
lines.resize(linesCount);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lines.clear();
|
lines.clear();
|
||||||
setIppErrorStatus();
|
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,6 +2698,8 @@ 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;
|
||||||
@ -2718,11 +2724,15 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
|
|||||||
IPPresizeInvoker invoker(src, dst, inv_scale_x, inv_scale_y, mode, &ok);
|
IPPresizeInvoker invoker(src, dst, inv_scale_x, inv_scale_y, mode, &ok);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
if( ok )
|
if( ok )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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,6 +4116,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if ((interpolation == INTER_LINEAR || interpolation == INTER_CUBIC || interpolation == INTER_NEAREST) &&
|
if ((interpolation == INTER_LINEAR || interpolation == INTER_CUBIC || interpolation == INTER_NEAREST) &&
|
||||||
map1.type() == CV_32FC1 && map2.type() == CV_32FC1 &&
|
map1.type() == CV_32FC1 && map2.type() == CV_32FC1 &&
|
||||||
(borderType == BORDER_CONSTANT || borderType == BORDER_TRANSPARENT))
|
(borderType == BORDER_CONSTANT || borderType == BORDER_TRANSPARENT))
|
||||||
@ -4130,10 +4146,14 @@ void cv::remap( InputArray _src, OutputArray _dst,
|
|||||||
parallel_for_(range, invoker, dst.total() / (double)(1 << 16));
|
parallel_for_(range, invoker, dst.total() / (double)(1 << 16));
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RemapNNFunc nnfunc = 0;
|
RemapNNFunc nnfunc = 0;
|
||||||
@ -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,6 +4673,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
|
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
|
||||||
( cn == 1 || cn == 3 || cn == 4 ) &&
|
( cn == 1 || cn == 3 || cn == 4 ) &&
|
||||||
@ -4701,9 +4727,13 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
|||||||
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 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( x = 0; x < dst.cols; x++ )
|
for( x = 0; x < dst.cols; x++ )
|
||||||
@ -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,6 +4929,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
|
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
|
||||||
(cn == 1 || cn == 3 || cn == 4) &&
|
(cn == 1 || cn == 3 || cn == 4) &&
|
||||||
@ -4942,9 +4978,13 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
|
|||||||
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 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !(flags & WARP_INVERSE_MAP) )
|
if( !(flags & WARP_INVERSE_MAP) )
|
||||||
|
@ -578,6 +578,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if (!binary)
|
if (!binary)
|
||||||
{
|
{
|
||||||
IppiSize roi = { mat.cols, mat.rows };
|
IppiSize roi = { mat.cols, mat.rows };
|
||||||
@ -627,6 +629,7 @@ cv::Moments cv::moments( InputArray _src, bool binary )
|
|||||||
ippiGetNormalizedCentralMoment_64f(moment, 0, 3, 0, &m.nu03);
|
ippiGetNormalizedCentralMoment_64f(moment, 0, 3, 0, &m.nu03);
|
||||||
|
|
||||||
ippiMomentFree_64f(moment);
|
ippiMomentFree_64f(moment);
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
@ -637,6 +640,7 @@ cv::Moments cv::moments( InputArray _src, bool binary )
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( binary || depth == CV_8U )
|
if( binary || depth == CV_8U )
|
||||||
|
@ -1707,8 +1707,14 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if IPP_VERSION_X100 >= 801
|
#if IPP_VERSION_X100 >= 801
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( IPPMorphOp(op, _src, _dst, kernel, anchor, iterations, borderType, borderValue) )
|
if( IPPMorphOp(op, _src, _dst, kernel, anchor, iterations, borderType, borderValue) )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Mat src = _src.getMat();
|
Mat src = _src.getMat();
|
||||||
|
@ -703,6 +703,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size((src.cols + 1)/2, (src.rows + 1)/2))
|
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size((src.cols + 1)/2, (src.rows + 1)/2))
|
||||||
@ -731,11 +733,15 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
|
|||||||
ippsFree(buffer);
|
ippsFree(buffer);
|
||||||
|
|
||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyrFunc func = 0;
|
PyrFunc func = 0;
|
||||||
@ -774,6 +780,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size(src.cols*2, src.rows*2))
|
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size(src.cols*2, src.rows*2))
|
||||||
@ -802,11 +810,15 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
|
|||||||
ippsFree(buffer);
|
ippsFree(buffer);
|
||||||
|
|
||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyrFunc func = 0;
|
PyrFunc func = 0;
|
||||||
@ -847,6 +859,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
bool isolated = (borderType & BORDER_ISOLATED) != 0;
|
||||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||||
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated))
|
if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated))
|
||||||
@ -921,6 +935,10 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pyrFreeFunc(gPyr->pState);
|
pyrFreeFunc(gPyr->pState);
|
||||||
}
|
}
|
||||||
@ -930,6 +948,7 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel,
|
|||||||
ippiPyramidFree(gPyr);
|
ippiPyramidFree(gPyr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
for( ; i <= maxlevel; i++ )
|
for( ; i <= maxlevel; i++ )
|
||||||
pyrDown( _dst.getMatRef(i-1), _dst.getMatRef(i), Size(), borderType );
|
pyrDown( _dst.getMatRef(i-1), _dst.getMatRef(i), Size(), borderType );
|
||||||
|
@ -375,6 +375,8 @@ 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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step,
|
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step,
|
||||||
IppiSize src_size, void* dst,
|
IppiSize src_size, void* dst,
|
||||||
int dst_step, IppiSize win_size,
|
int dst_step, IppiSize win_size,
|
||||||
@ -394,9 +396,13 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
|||||||
{
|
{
|
||||||
if (ippfunc(image.ptr(), (int)image.step, src_size, patch.ptr(),
|
if (ippfunc(image.ptr(), (int)image.step, src_size, patch.ptr(),
|
||||||
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( depth == CV_8U && ddepth == CV_8U )
|
if( depth == CV_8U && ddepth == CV_8U )
|
||||||
|
@ -1178,6 +1178,8 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int ippBorderType = borderType & ~BORDER_ISOLATED;
|
int ippBorderType = borderType & ~BORDER_ISOLATED;
|
||||||
Point ocvAnchor, ippAnchor;
|
Point ocvAnchor, ippAnchor;
|
||||||
ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x;
|
ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x;
|
||||||
@ -1206,8 +1208,11 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
|
|||||||
(IppiBorderType)ippBorderType, borderValue, buffer); \
|
(IppiBorderType)ippBorderType, borderValue, buffer); \
|
||||||
ippsFree(buffer); \
|
ippsFree(buffer); \
|
||||||
if (status >= 0) \
|
if (status >= 0) \
|
||||||
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
setIppErrorStatus(); \
|
setIppErrorStatus(); \
|
||||||
} while ((void)0, 0)
|
} while ((void)0, 0)
|
||||||
|
|
||||||
@ -1240,6 +1245,7 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
|
|||||||
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,6 +1500,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
int depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
int depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
|
|
||||||
if ((depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F) && (cn == 1 || cn == 3) &&
|
if ((depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F) && (cn == 1 || cn == 3) &&
|
||||||
@ -1527,7 +1535,10 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
|||||||
ippFree(pBuffer); \
|
ippFree(pBuffer); \
|
||||||
ippFree(pSpec); \
|
ippFree(pSpec); \
|
||||||
if (status >= 0) \
|
if (status >= 0) \
|
||||||
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||||
return; \
|
return; \
|
||||||
|
} \
|
||||||
} while ((void)0, 0)
|
} while ((void)0, 0)
|
||||||
|
|
||||||
if (type == CV_8UC1)
|
if (type == CV_8UC1)
|
||||||
@ -1552,6 +1563,7 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
|||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Mat kx, ky;
|
Mat kx, ky;
|
||||||
@ -2483,6 +2495,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
|
#define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -2495,8 +2509,11 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
|
|||||||
ippBorderRepl, (ippType)0, buffer); \
|
ippBorderRepl, (ippType)0, buffer); \
|
||||||
ippsFree(buffer); \
|
ippsFree(buffer); \
|
||||||
if (status >= 0) \
|
if (status >= 0) \
|
||||||
|
{ \
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
setIppErrorStatus(); \
|
setIppErrorStatus(); \
|
||||||
} \
|
} \
|
||||||
while ((void)0, 0)
|
while ((void)0, 0)
|
||||||
@ -2522,6 +2539,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
|
|||||||
IPP_FILTER_MEDIAN_BORDER(Ipp32f, ipp32f, 32f_C1R);
|
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,15 +2924,21 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( cn == 1 )
|
if( cn == 1 )
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
IPPBilateralFilter_8u_Invoker body(temp, dst, sigma_color * sigma_color, sigma_space * sigma_space, radius, &ok );
|
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));
|
parallel_for_(Range(0, dst.rows), body, dst.total()/(double)(1<<16));
|
||||||
if( ok )
|
if( ok )
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<float> _color_weight(cn*256);
|
std::vector<float> _color_weight(cn*256);
|
||||||
|
@ -355,6 +355,8 @@ 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
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
if( ( depth == CV_8U ) && ( sdepth == CV_32F || sdepth == CV_32S ) && ( !_tilted.needed() ) && ( !_sqsum.needed() || sqdepth == CV_64F ) && ( cn == 1 ) )
|
if( ( depth == CV_8U ) && ( sdepth == CV_32F || sdepth == CV_32S ) && ( !_tilted.needed() ) && ( !_sqsum.needed() || sqdepth == CV_64F ) && ( cn == 1 ) )
|
||||||
{
|
{
|
||||||
IppStatus status = ippStsErr;
|
IppStatus status = ippStsErr;
|
||||||
@ -382,9 +384,13 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 <= status)
|
if (0 <= status)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( _tilted.needed() )
|
if( _tilted.needed() )
|
||||||
|
@ -853,14 +853,21 @@ 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()
|
||||||
|
{
|
||||||
|
useIppMT = (templ.rows < img.rows/2 && templ.cols < img.cols/2);
|
||||||
|
|
||||||
if (method == CV_TM_SQDIFF && cn == 1 && useIppMT)
|
if (method == CV_TM_SQDIFF && cn == 1 && useIppMT)
|
||||||
{
|
{
|
||||||
if (ipp_sqrDistance(img, templ, result))
|
if (ipp_sqrDistance(img, templ, result))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_IPP
|
#if defined HAVE_IPP
|
||||||
@ -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,6 +69,8 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize sz = { roi.width, roi.height };
|
IppiSize sz = { roi.width, roi.height };
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -76,32 +78,51 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
|
|||||||
case THRESH_TRUNC:
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
case THRESH_TOZERO:
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
case THRESH_TOZERO_INV:
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -392,6 +413,8 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize sz = { roi.width, roi.height };
|
IppiSize sz = { roi.width, roi.height };
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -399,32 +422,51 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
|
|||||||
case THRESH_TRUNC:
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
case THRESH_TOZERO:
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
case THRESH_TOZERO_INV:
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -639,25 +681,37 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_IPP)
|
#if defined(HAVE_IPP)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize sz = { roi.width, roi.height };
|
IppiSize sz = { roi.width, roi.height };
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case THRESH_TRUNC:
|
case THRESH_TRUNC:
|
||||||
if (0 <= ippiThreshold_GT_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh))
|
if (0 <= ippiThreshold_GT_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh))
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
case THRESH_TOZERO:
|
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))
|
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();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
case THRESH_TOZERO_INV:
|
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))
|
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;
|
return;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
@ -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)
|
||||||
|
CV_IPP_CHECK()
|
||||||
|
{
|
||||||
IppiSize srcSize = { size.width, size.height };
|
IppiSize srcSize = { size.width, size.height };
|
||||||
Ipp8u thresh;
|
Ipp8u thresh;
|
||||||
CV_SUPPRESS_DEPRECATED_START
|
CV_SUPPRESS_DEPRECATED_START
|
||||||
IppStatus ok = ippiComputeThreshold_Otsu_8u_C1R(_src.ptr(), step, srcSize, &thresh);
|
IppStatus ok = ippiComputeThreshold_Otsu_8u_C1R(_src.ptr(), step, srcSize, &thresh);
|
||||||
CV_SUPPRESS_DEPRECATED_END
|
CV_SUPPRESS_DEPRECATED_END
|
||||||
if (ok >= 0)
|
if (ok >= 0)
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_IPP);
|
||||||
return thresh;
|
return thresh;
|
||||||
|
}
|
||||||
setIppErrorStatus();
|
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;
|
||||||
@ -519,6 +525,12 @@ void normalizeUsingWeightMap(InputArray _weight, InputOutputArray _src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_OPENCL
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CV_IMPL_ADD(CV_IMPL_OCL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,9 +114,12 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Mat xmap = _xmap.getMat(), ymap = _ymap.getMat();
|
Mat xmap = _xmap.getMat(), ymap = _ymap.getMat();
|
||||||
|
|
||||||
@ -389,9 +392,12 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return RotationWarperBase<SphericalProjector>::buildMaps(src_size, K, R, xmap, ymap);
|
return RotationWarperBase<SphericalProjector>::buildMaps(src_size, K, R, xmap, ymap);
|
||||||
}
|
}
|
||||||
@ -435,9 +441,12 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return RotationWarperBase<CylindricalProjector>::buildMaps(src_size, K, R, xmap, ymap);
|
return RotationWarperBase<CylindricalProjector>::buildMaps(src_size, K, R, xmap, ymap);
|
||||||
}
|
}
|
||||||
|
@ -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