diff --git a/CMakeLists.txt b/CMakeLists.txt index 20522e0496..e7ceb6281e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -917,9 +917,14 @@ endif(DEFINED WITH_INTELPERC) status("") status(" Other third-party libraries:") +<<<<<<< HEAD if((WITH_IPP OR WITH_ICV) AND HAVE_IPP) status(" Use IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]") status(" at:" "${IPP_ROOT_DIR}") +======= +if(WITH_IPP AND IPP_FOUND) + status(" Use IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]") +>>>>>>> Prepare codes for ippicv library else() status(" Use IPP:" (WITH_IPP OR WITH_ICV) AND NOT HAVE_IPP THEN "IPP not found" ELSE NO) endif() diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index 780ee51b87..ab4d7c7b9b 100644 --- a/cmake/OpenCVFindIPP.cmake +++ b/cmake/OpenCVFindIPP.cmake @@ -1,5 +1,5 @@ # -# The script to detect Intel(R) Integrated Performance Primitives (IPP) +# The script to setting up Intel(R) Integrated Performance Primitives (IPP) # installation/package # # Windows host: @@ -19,10 +19,10 @@ # IPP_ROOT_DIR - root of IPP installation # IPP_INCLUDE_DIRS - IPP include folder # IPP_LIBRARIES - IPP libraries that are used by OpenCV -# IPP_VERSION_STR - string with the newest detected IPP version -# IPP_VERSION_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD) -# IPP_VERSION_MINOR -# IPP_VERSION_BUILD +# IPP_FOUND - True if Intel IPP found +# IPP_INCLUDE_DIR - IPP include folder +# IPP_LIBRARY_DIR - IPP libraries folder +# IPP_LIBRARIES - IPP libraries names that are used by OpenCV # # Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com) # @@ -222,9 +222,53 @@ if(IPP_H_PATH) ipp_get_version(${IPP_ROOT_DIR}) ipp_set_variables(${IPP_VERSION_STR}) +======= + +set(IPP_FOUND TRUE) +set(IPP_VERSION_STR "5.3.0.0") # will not detect earlier versions +set(IPP_VERSION_MAJOR 0) +set(IPP_VERSION_MINOR 0) +set(IPP_VERSION_BUILD 0) +set(IPP_INCLUDE_DIR ${OpenCV_SOURCE_DIR}/3rdparty/ippicv/include) +set(IPP_LIBRARY_DIRS) +set(IPP_LIBRARIES) +if(WIN32 AND NOT ARM) + if (X86_64) + set(IPP_LIBRARY_DIR ${OpenCV_SOURCE_DIR}/3rdparty/ippicv/libs/windows/intel64) + else() + set(IPP_LIBRARY_DIR ${OpenCV_SOURCE_DIR}/3rdparty/ippicv/libs/windows/ia32/) + endif() + set(IPP_LIBRARIES ippccmt.lib ippcoremt.lib ippcvmt.lib ippimt.lib ippsmt.lib ippvmmt.lib) +elseif(UNIX) + if (X86_64) + set(IPP_LIBRARY_DIR ${OpenCV_SOURCE_DIR}/3rdparty/ippicv/libs/linux/intel64) + else() + set(IPP_LIBRARY_DIR ${OpenCV_SOURCE_DIR}/3rdparty/ippicv/libs/linux/ia32/) + endif() + set(IPP_LIBRARIES libippcc.a libippcore.a libippcv.a libippi.a libipps.a libippvm.a) endif() +# read IPP version info from file +set(_VERSION_STR) +set(_MAJOR) +set(_MINOR) +set(_BUILD) +file(STRINGS ${IPP_INCLUDE_DIR}/ippversion.h STR1 REGEX "IPP_VERSION_MAJOR") +file(STRINGS ${IPP_INCLUDE_DIR}/ippversion.h STR2 REGEX "IPP_VERSION_MINOR") +file(STRINGS ${IPP_INCLUDE_DIR}/ippversion.h STR3 REGEX "IPP_VERSION_BUILD") +if("${STR3}" STREQUAL "") + file(STRINGS ${IPP_INCLUDE_DIR}/ippversion.h STR3 REGEX "IPP_VERSION_UPDATE") +>>>>>>> Prepare codes for ippicv library +endif() +file(STRINGS ${IPP_INCLUDE_DIR}/ippversion.h STR4 REGEX "IPP_VERSION_STR") +# extract info and assign to variables +string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1}) +string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2}) +string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3}) +string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4}) + +<<<<<<< HEAD if(WIN32 AND MINGW AND NOT IPP_VERSION_MAJOR LESS 7) # Since IPP built with Microsoft compiler and /GS option # ====================================================== @@ -242,3 +286,12 @@ if(WIN32 AND MINGW AND NOT IPP_VERSION_MAJOR LESS 7) set(MSV_NTDLL "ntdll") set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_NTDLL}${IPP_LIB_SUFFIX}) endif() +======= +# export info to parent scope +set(IPP_VERSION_STR ${_VERSION_STR}) +set(IPP_VERSION_MAJOR ${_MAJOR}) +set(IPP_VERSION_MINOR ${_MINOR}) +set(IPP_VERSION_BUILD ${_BUILD}) + +message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]") +>>>>>>> Prepare codes for ippicv library diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 17bd34cba1..3e343f6b6b 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -458,9 +458,12 @@ static void add8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), - (vBinOp, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0)) + return; +#endif + (vBinOp, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz)); } static void add8s( const schar* src1, size_t step1, @@ -474,18 +477,24 @@ static void add16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), - (vBinOp, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0)) + return; +#endif + (vBinOp, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz)); } static void add16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), - (vBinOp, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0)) + return; +#endif + (vBinOp, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz)); } static void add32s( const int* src1, size_t step1, @@ -499,9 +508,12 @@ static void add32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp32, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp32, IF_SIMD(VAdd)>(src1, step1, src2, step2, dst, step, sz)); } static void add64f( const double* src1, size_t step1, @@ -515,9 +527,12 @@ static void sub8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), - (vBinOp, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0)) + return; +#endif + (vBinOp, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz)); } static void sub8s( const schar* src1, size_t step1, @@ -531,18 +546,24 @@ static void sub16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), - (vBinOp, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0)) + return; +#endif + (vBinOp, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz)); } static void sub16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), - (vBinOp, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0)) + return; +#endif + (vBinOp, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz)); } static void sub32s( const int* src1, size_t step1, @@ -556,9 +577,12 @@ static void sub32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz), - (vBinOp32, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp32, IF_SIMD(VSub)>(src1, step1, src2, step2, dst, step, sz)); } static void sub64f( const double* src1, size_t step1, @@ -576,26 +600,23 @@ static void max8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { #if (ARITHM_USE_IPP == 1) - { uchar* s1 = (uchar*)src1; uchar* s2 = (uchar*)src2; uchar* d = dst; fixSteps(sz, sizeof(dst[0]), step1, step2, step); - for(int i = 0; i < sz.height; i++) + int i = 0; + for(; i < sz.height; i++) { - ippsMaxEvery_8u(s1, s2, d, sz.width); - s1 += step1; - s2 += step2; - d += step; + if (0 > ippicvsMaxEvery_8u(s1, s2, d, sz.width)) + break; + s1 += step1; + s2 += step2; + d += step; } - } -#else - vBinOp, IF_SIMD(VMax)>(src1, step1, src2, step2, dst, step, sz); + if (i == sz.height) + return; #endif - -// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMaxEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), -// (vBinOp8, IF_SIMD(_VMax8u)>(src1, step1, src2, step2, dst, step, sz))); + vBinOp, IF_SIMD(VMax)>(src1, step1, src2, step2, dst, step, sz); } static void max8s( const schar* src1, size_t step1, @@ -610,26 +631,23 @@ static void max16u( const ushort* src1, size_t step1, ushort* dst, size_t step, Size sz, void* ) { #if (ARITHM_USE_IPP == 1) - { ushort* s1 = (ushort*)src1; ushort* s2 = (ushort*)src2; ushort* d = dst; fixSteps(sz, sizeof(dst[0]), step1, step2, step); - for(int i = 0; i < sz.height; i++) + int i = 0; + for(; i < sz.height; i++) { - ippsMaxEvery_16u(s1, s2, d, sz.width); - s1 = (ushort*)((uchar*)s1 + step1); - s2 = (ushort*)((uchar*)s2 + step2); - d = (ushort*)((uchar*)d + step); + if (0 > ippicvsMaxEvery_16u(s1, s2, d, sz.width)) + break; + s1 = (ushort*)((uchar*)s1 + step1); + s2 = (ushort*)((uchar*)s2 + step2); + d = (ushort*)((uchar*)d + step); } - } -#else - vBinOp, IF_SIMD(VMax)>(src1, step1, src2, step2, dst, step, sz); + if (i == sz.height) + return; #endif - -// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMaxEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), -// (vBinOp16, IF_SIMD(_VMax16u)>(src1, step1, src2, step2, dst, step, sz))); + vBinOp, IF_SIMD(VMax)>(src1, step1, src2, step2, dst, step, sz); } static void max16s( const short* src1, size_t step1, @@ -651,25 +669,23 @@ static void max32f( const float* src1, size_t step1, float* dst, size_t step, Size sz, void* ) { #if (ARITHM_USE_IPP == 1) - { float* s1 = (float*)src1; float* s2 = (float*)src2; float* d = dst; fixSteps(sz, sizeof(dst[0]), step1, step2, step); - for(int i = 0; i < sz.height; i++) + int i = 0; + for(; i < sz.height; i++) { - ippsMaxEvery_32f(s1, s2, d, sz.width); - s1 = (float*)((uchar*)s1 + step1); - s2 = (float*)((uchar*)s2 + step2); - d = (float*)((uchar*)d + step); + if (0 > ippicvsMaxEvery_32f(s1, s2, d, sz.width)) + break; + s1 = (float*)((uchar*)s1 + step1); + s2 = (float*)((uchar*)s2 + step2); + d = (float*)((uchar*)d + step); } - } -#else - vBinOp32, IF_SIMD(VMax)>(src1, step1, src2, step2, dst, step, sz); + if (i == sz.height) + return; #endif -// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMaxEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), -// (vBinOp32f, IF_SIMD(_VMax32f)>(src1, step1, src2, step2, dst, step, sz))); + vBinOp32, IF_SIMD(VMax)>(src1, step1, src2, step2, dst, step, sz); } static void max64f( const double* src1, size_t step1, @@ -684,26 +700,23 @@ static void min8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { #if (ARITHM_USE_IPP == 1) - { uchar* s1 = (uchar*)src1; uchar* s2 = (uchar*)src2; uchar* d = dst; fixSteps(sz, sizeof(dst[0]), step1, step2, step); - for(int i = 0; i < sz.height; i++) + int i = 0; + for(; i < sz.height; i++) { - ippsMinEvery_8u(s1, s2, d, sz.width); - s1 += step1; - s2 += step2; - d += step; + if (0 > ippicvsMinEvery_8u(s1, s2, d, sz.width)) + break; + s1 += step1; + s2 += step2; + d += step; } - } -#else - vBinOp, IF_SIMD(VMin)>(src1, step1, src2, step2, dst, step, sz); + if (i == sz.height) + return; #endif - -// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMinEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), -// (vBinOp8, IF_SIMD(_VMin8u)>(src1, step1, src2, step2, dst, step, sz))); + vBinOp, IF_SIMD(VMin)>(src1, step1, src2, step2, dst, step, sz); } static void min8s( const schar* src1, size_t step1, @@ -718,26 +731,23 @@ static void min16u( const ushort* src1, size_t step1, ushort* dst, size_t step, Size sz, void* ) { #if (ARITHM_USE_IPP == 1) - { ushort* s1 = (ushort*)src1; ushort* s2 = (ushort*)src2; ushort* d = dst; fixSteps(sz, sizeof(dst[0]), step1, step2, step); - for(int i = 0; i < sz.height; i++) + int i = 0; + for(; i < sz.height; i++) { - ippsMinEvery_16u(s1, s2, d, sz.width); - s1 = (ushort*)((uchar*)s1 + step1); - s2 = (ushort*)((uchar*)s2 + step2); - d = (ushort*)((uchar*)d + step); + if (0 > ippicvsMinEvery_16u(s1, s2, d, sz.width)) + break; + s1 = (ushort*)((uchar*)s1 + step1); + s2 = (ushort*)((uchar*)s2 + step2); + d = (ushort*)((uchar*)d + step); } - } -#else - vBinOp, IF_SIMD(VMin)>(src1, step1, src2, step2, dst, step, sz); + if (i == sz.height) + return; #endif - -// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMinEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), -// (vBinOp16, IF_SIMD(_VMin16u)>(src1, step1, src2, step2, dst, step, sz))); + vBinOp, IF_SIMD(VMin)>(src1, step1, src2, step2, dst, step, sz); } static void min16s( const short* src1, size_t step1, @@ -759,25 +769,23 @@ static void min32f( const float* src1, size_t step1, float* dst, size_t step, Size sz, void* ) { #if (ARITHM_USE_IPP == 1) - { float* s1 = (float*)src1; float* s2 = (float*)src2; float* d = dst; fixSteps(sz, sizeof(dst[0]), step1, step2, step); - for(int i = 0; i < sz.height; i++) + int i = 0; + for(; i < sz.height; i++) { - ippsMinEvery_32f(s1, s2, d, sz.width); - s1 = (float*)((uchar*)s1 + step1); - s2 = (float*)((uchar*)s2 + step2); - d = (float*)((uchar*)d + step); + if (0 > ippicvsMinEvery_32f(s1, s2, d, sz.width)) + break; + s1 = (float*)((uchar*)s1 + step1); + s2 = (float*)((uchar*)s2 + step2); + d = (float*)((uchar*)d + step); } - } -#else - vBinOp32, IF_SIMD(VMin)>(src1, step1, src2, step2, dst, step, sz); + if (i == sz.height) + return; #endif -// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMinEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), -// (vBinOp32f, IF_SIMD(_VMin32f)>(src1, step1, src2, step2, dst, step, sz))); + vBinOp32, IF_SIMD(VMin)>(src1, step1, src2, step2, dst, step, sz); } static void min64f( const double* src1, size_t step1, @@ -791,9 +799,12 @@ static void absdiff8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp, IF_SIMD(VAbsDiff)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp, IF_SIMD(VAbsDiff)>(src1, step1, src2, step2, dst, step, sz)); } static void absdiff8s( const schar* src1, size_t step1, @@ -807,9 +818,12 @@ static void absdiff16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp, IF_SIMD(VAbsDiff)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp, IF_SIMD(VAbsDiff)>(src1, step1, src2, step2, dst, step, sz)); } static void absdiff16s( const short* src1, size_t step1, @@ -830,9 +844,12 @@ static void absdiff32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp32, IF_SIMD(VAbsDiff)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp32, IF_SIMD(VAbsDiff)>(src1, step1, src2, step2, dst, step, sz)); } static void absdiff64f( const double* src1, size_t step1, @@ -847,36 +864,48 @@ static void and8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp, IF_SIMD(VAnd)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp, IF_SIMD(VAnd)>(src1, step1, src2, step2, dst, step, sz)); } static void or8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp, IF_SIMD(VOr)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp, IF_SIMD(VOr)>(src1, step1, src2, step2, dst, step, sz)); } static void xor8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), - (vBinOp, IF_SIMD(VXor)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); + if (0 <= ippicviXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp, IF_SIMD(VXor)>(src1, step1, src2, step2, dst, step, sz)); } static void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void *)src2; - ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, (IppiSize&)sz), - (vBinOp, IF_SIMD(VNot)>(src1, step1, src2, step2, dst, step, sz))); +#if (ARITHM_USE_IPP == 1) + fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void *)src2; + if (0 <= ippicviNot_8u_C1R(src1, (int)step1, dst, (int)step, (IppiSize&)sz)) + return; +#endif + (vBinOp, IF_SIMD(VNot)>(src1, step1, src2, step2, dst, step, sz)); } /****************************************************************************************\ @@ -2357,7 +2386,7 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste if( op >= 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if (0 <= ippicviCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op)) return; } #endif @@ -2440,7 +2469,7 @@ static void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t if( op >= 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if (0 <= ippicviCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op)) return; } #endif @@ -2455,7 +2484,7 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st if( op > 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if (0 <= ippicviCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op)) return; } #endif @@ -2561,7 +2590,7 @@ static void cmp32f(const float* src1, size_t step1, const float* src2, size_t st if( op >= 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if (0 <= ippicviCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op)) return; } #endif diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index 4cdb6a16d2..73335e3589 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -466,56 +466,56 @@ template<> struct DFT_VecR4 #endif #ifdef USE_IPP_DFT -static void ippsDFTFwd_CToC( const Complex* src, Complex* dst, +static void ippicvsDFTFwd_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, + ippicvsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, (const IppsDFTSpec_C_32fc*)spec, buf); } -static void ippsDFTFwd_CToC( const Complex* src, Complex* dst, +static void ippicvsDFTFwd_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, + ippicvsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, (const IppsDFTSpec_C_64fc*)spec, buf); } -static void ippsDFTInv_CToC( const Complex* src, Complex* dst, +static void ippicvsDFTInv_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, + ippicvsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, (const IppsDFTSpec_C_32fc*)spec, buf); } -static void ippsDFTInv_CToC( const Complex* src, Complex* dst, +static void ippicvsDFTInv_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, + ippicvsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, (const IppsDFTSpec_C_64fc*)spec, buf); } -static void ippsDFTFwd_RToPack( const float* src, float* dst, +static void ippicvsDFTFwd_RToPack( const float* src, float* dst, const void* spec, uchar* buf) { - ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); + ippicvsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); } -static void ippsDFTFwd_RToPack( const double* src, double* dst, +static void ippicvsDFTFwd_RToPack( const double* src, double* dst, const void* spec, uchar* buf) { - ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); + ippicvsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); } -static void ippsDFTInv_PackToR( const float* src, float* dst, +static void ippicvsDFTInv_PackToR( const float* src, float* dst, const void* spec, uchar* buf) { - ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); + ippicvsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); } -static void ippsDFTInv_PackToR( const double* src, double* dst, +static void ippicvsDFTInv_PackToR( const double* src, double* dst, const void* spec, uchar* buf) { - ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); + ippicvsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); } #endif @@ -551,9 +551,9 @@ DFT( const Complex* src, Complex* dst, int n, if( spec ) { if( !inv ) - ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf ); + ippicvsDFTFwd_CToC( src, dst, spec, (uchar*)buf ); else - ippsDFTInv_CToC( src, dst, spec, (uchar*)buf ); + ippicvsDFTInv_CToC( src, dst, spec, (uchar*)buf ); return; } #endif @@ -981,7 +981,7 @@ RealDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab, #ifdef USE_IPP_DFT if( spec ) { - ippsDFTFwd_RToPack( src, dst, spec, (uchar*)buf ); + ippicvsDFTFwd_RToPack( src, dst, spec, (uchar*)buf ); if( complex_output ) { dst[-1] = dst[0]; @@ -1113,7 +1113,7 @@ CCSIDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab, #ifdef USE_IPP_DFT if( spec ) { - ippsDFTInv_PackToR( src, dst, spec, (uchar*)buf ); + ippicvsDFTInv_PackToR( src, dst, spec, (uchar*)buf ); goto finalize; } #endif @@ -1824,26 +1824,26 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) { if( depth == CV_32F ) { - getSizeFunc = ippsDFTGetSize_R_32f; - initFunc = (IppDFTInitFunc)ippsDFTInit_R_32f; + getSizeFunc = ippicvsDFTGetSize_R_32f; + initFunc = (IppDFTInitFunc)ippicvsDFTInit_R_32f; } else { - getSizeFunc = ippsDFTGetSize_R_64f; - initFunc = (IppDFTInitFunc)ippsDFTInit_R_64f; + getSizeFunc = ippicvsDFTGetSize_R_64f; + initFunc = (IppDFTInitFunc)ippicvsDFTInit_R_64f; } } else { if( depth == CV_32F ) { - getSizeFunc = ippsDFTGetSize_C_32fc; - initFunc = (IppDFTInitFunc)ippsDFTInit_C_32fc; + getSizeFunc = ippicvsDFTGetSize_C_32fc; + initFunc = (IppDFTInitFunc)ippicvsDFTInit_C_32fc; } else { - getSizeFunc = ippsDFTGetSize_C_64fc; - initFunc = (IppDFTInitFunc)ippsDFTInit_C_64fc; + getSizeFunc = ippicvsDFTGetSize_C_64fc; + initFunc = (IppDFTInitFunc)ippicvsDFTInit_C_64fc; } } if( getSizeFunc(len, ipp_norm_flag, ippAlgHintNone, &specsize, &initsize, &worksize) >= 0 ) diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index 16df02cafa..95a5f0a461 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -812,8 +812,6 @@ typedef union } DBLINT; -#ifndef HAVE_IPP - #define EXPTAB_SCALE 6 #define EXPTAB_MASK ((1 << EXPTAB_SCALE) - 1) @@ -898,7 +896,7 @@ static const double exp_prescale = 1.4426950408889634073599246810019 * (1 << EXP static const double exp_postscale = 1./(1 << EXPTAB_SCALE); static const double exp_max_val = 3000.*(1 << EXPTAB_SCALE); // log10(DBL_MAX) < 3000 -static void Exp_32f( const float *_x, float *y, int n ) +static void Exp_32fnoipp( const float *_x, float *y, int n ) { static const float A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0), @@ -1098,7 +1096,7 @@ static void Exp_32f( const float *_x, float *y, int n ) } -static void Exp_64f( const double *_x, double *y, int n ) +static void Exp_64fnoipp( const double *_x, double *y, int n ) { static const double A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0, @@ -1275,13 +1273,26 @@ static void Exp_64f( const double *_x, double *y, int n ) #undef EXPTAB_MASK #undef EXPPOLY_32F_A0 +#ifdef HAVE_IPP +static void Exp_32f(const float *x, float *y, int n) +{ + if (ippStsNoErr == ippicvsExp_32f_A21(x, y, n)) + return; + Exp_32fnoipp(x, y, n); +} + +static void Exp_64f(const double *x, double *y, int n) +{ + if (ippStsNoErr == ippicvsExp_64f_A50(x, y, n)) + return; + Exp_64fnoipp(x, y, n); +} #else - -#define Exp_32f ippsExp_32f_A21 -#define Exp_64f ippsExp_64f_A50 - + #define Exp_32f Exp_32fnoipp + #define Exp_64f Exp_64fnoipp #endif + void exp( InputArray _src, OutputArray _dst ) { int type = _src.type(), depth = _src.depth(), cn = _src.channels(); @@ -1302,9 +1313,9 @@ void exp( InputArray _src, OutputArray _dst ) for( size_t i = 0; i < it.nplanes; i++, ++it ) { if( depth == CV_32F ) - Exp_32f( (const float*)ptrs[0], (float*)ptrs[1], len ); + Exp_32f((const float*)ptrs[0], (float*)ptrs[1], len); else - Exp_64f( (const double*)ptrs[0], (double*)ptrs[1], len ); + Exp_64f((const double*)ptrs[0], (double*)ptrs[1], len); } } @@ -1313,8 +1324,6 @@ void exp( InputArray _src, OutputArray _dst ) * L O G * \****************************************************************************************/ -#ifndef HAVE_IPP - #define LOGTAB_SCALE 8 #define LOGTAB_MASK ((1 << LOGTAB_SCALE) - 1) #define LOGTAB_MASK2 ((1 << (20 - LOGTAB_SCALE)) - 1) @@ -1584,7 +1593,7 @@ static const double CV_DECL_ALIGNED(16) icvLogTab[] = { #define LOGTAB_TRANSLATE(x,h) (((x) - 1.)*icvLogTab[(h)+1]) static const double ln_2 = 0.69314718055994530941723212145818; -static void Log_32f( const float *_x, float *y, int n ) +static void Log_32fnoipp( const float *_x, float *y, int n ) { static const float shift[] = { 0, -1.f/512 }; static const float @@ -1733,7 +1742,7 @@ static void Log_32f( const float *_x, float *y, int n ) } -static void Log_64f( const double *x, double *y, int n ) +static void Log_64fnoipp( const double *x, double *y, int n ) { static const double shift[] = { 0, -1./512 }; static const double @@ -1922,11 +1931,23 @@ static void Log_64f( const double *x, double *y, int n ) } } +#ifdef HAVE_IPP +static void Log_32f(const float *x, float *y, int n) +{ + if (ippStsNoErr == ippicvsLn_32f_A21(x, y, n)) + return; + Log_32fnoipp(x, y, n); +} + +static void Log_64f(const double *x, double *y, int n) +{ + if (ippStsNoErr == ippicvsLn_64f_A50(x, y, n)) + return; + Log_64fnoipp(x, y, n); +} #else - -#define Log_32f ippsLn_32f_A21 -#define Log_64f ippsLn_64f_A50 - + #define Log_32f Log_32fnoipp + #define Log_64f Log_64fnoipp #endif void log( InputArray _src, OutputArray _dst ) diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index daad86a0f1..60c117385b 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -44,9 +44,9 @@ #include "opencl_kernels.hpp" #include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp" -#ifdef HAVE_IPP -#include "ippversion.h" -#endif +//#ifdef HAVE_IPP +//#include "ippversion.h" +//#endif namespace cv { @@ -2803,7 +2803,7 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len) { double r = 0; #if ARITHM_USE_IPP - ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])), + ippicviDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r); return r; @@ -2864,48 +2864,52 @@ static double dotProd_8s(const schar* src1, const schar* src2, int len) static double dotProd_16u(const ushort* src1, const ushort* src2, int len) { +#if (ARITHM_USE_IPP == 1) double r = 0; - IF_IPP(ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), - src2, (int)(len*sizeof(src2[0])), - ippiSize(len, 1), &r), - r = dotProd_(src1, src2, len)); - return r; + if (0 <= ippicviDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) + return r; +#endif + return dotProd_(src1, src2, len); } static double dotProd_16s(const short* src1, const short* src2, int len) { +#if (ARITHM_USE_IPP == 1) double r = 0; - IF_IPP(ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), - src2, (int)(len*sizeof(src2[0])), - ippiSize(len, 1), &r), - r = dotProd_(src1, src2, len)); - return r; + if (0 <= ippicviDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) + return r; +#endif + return dotProd_(src1, src2, len); } static double dotProd_32s(const int* src1, const int* src2, int len) { +#if (ARITHM_USE_IPP == 1) double r = 0; - IF_IPP(ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), - src2, (int)(len*sizeof(src2[0])), - ippiSize(len, 1), &r), - r = dotProd_(src1, src2, len)); - return r; + if (0 <= ippicviDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) + return r; +#endif + return dotProd_(src1, src2, len); } static double dotProd_32f(const float* src1, const float* src2, int len) { +#if (ARITHM_USE_IPP == 1) double r = 0; - IF_IPP(ippsDotProd_32f64f(src1, src2, len, &r), - r = dotProd_(src1, src2, len)); - return r; + if (0 <= ippicvsDotProd_32f64f(src1, src2, len, &r)) + return r; +#endif + return dotProd_(src1, src2, len); } static double dotProd_64f(const double* src1, const double* src2, int len) { +#if (ARITHM_USE_IPP == 1) double r = 0; - IF_IPP(ippsDotProd_64f(src1, src2, len, &r), - r = dotProd_(src1, src2, len)); - return r; + if (0 <= ippicvsDotProd_64f(src1, src2, len, &r)) + return r; +#endif + return dotProd_(src1, src2, len); } diff --git a/modules/core/src/precomp.hpp b/modules/core/src/precomp.hpp index ff5943bc63..1c498cd012 100644 --- a/modules/core/src/precomp.hpp +++ b/modules/core/src/precomp.hpp @@ -199,10 +199,8 @@ enum { BLOCK_SIZE = 1024 }; #if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7) #define ARITHM_USE_IPP 1 -#define IF_IPP(then_call, else_call) then_call #else #define ARITHM_USE_IPP 0 -#define IF_IPP(then_call, else_call) else_call #endif inline bool checkScalar(const Mat& sc, int atype, int sckind, int akind) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index a4605d1605..6080e632dc 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -551,23 +551,23 @@ cv::Scalar cv::sum( InputArray _src ) { IppiSize sz = { cols, rows }; int type = src.type(); - typedef IppStatus (CV_STDCALL* ippiSumFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); - typedef IppStatus (CV_STDCALL* ippiSumFuncNoHint)(const void*, int, IppiSize, double *); - ippiSumFuncHint ippFuncHint = - type == CV_32FC1 ? (ippiSumFuncHint)ippiSum_32f_C1R : - type == CV_32FC3 ? (ippiSumFuncHint)ippiSum_32f_C3R : - type == CV_32FC4 ? (ippiSumFuncHint)ippiSum_32f_C4R : + typedef IppStatus (CV_STDCALL* ippicviSumFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); + typedef IppStatus (CV_STDCALL* ippicviSumFuncNoHint)(const void*, int, IppiSize, double *); + ippicviSumFuncHint ippFuncHint = + type == CV_32FC1 ? (ippicviSumFuncHint)ippicviSum_32f_C1R : + type == CV_32FC3 ? (ippicviSumFuncHint)ippicviSum_32f_C3R : + type == CV_32FC4 ? (ippicviSumFuncHint)ippicviSum_32f_C4R : 0; - ippiSumFuncNoHint ippFuncNoHint = - type == CV_8UC1 ? (ippiSumFuncNoHint)ippiSum_8u_C1R : - type == CV_8UC3 ? (ippiSumFuncNoHint)ippiSum_8u_C3R : - type == CV_8UC4 ? (ippiSumFuncNoHint)ippiSum_8u_C4R : - type == CV_16UC1 ? (ippiSumFuncNoHint)ippiSum_16u_C1R : - type == CV_16UC3 ? (ippiSumFuncNoHint)ippiSum_16u_C3R : - type == CV_16UC4 ? (ippiSumFuncNoHint)ippiSum_16u_C4R : - type == CV_16SC1 ? (ippiSumFuncNoHint)ippiSum_16s_C1R : - type == CV_16SC3 ? (ippiSumFuncNoHint)ippiSum_16s_C3R : - type == CV_16SC4 ? (ippiSumFuncNoHint)ippiSum_16s_C4R : + ippicviSumFuncNoHint ippFuncNoHint = + type == CV_8UC1 ? (ippicviSumFuncNoHint)ippicviSum_8u_C1R : + type == CV_8UC3 ? (ippicviSumFuncNoHint)ippicviSum_8u_C3R : + type == CV_8UC4 ? (ippicviSumFuncNoHint)ippicviSum_8u_C4R : + type == CV_16UC1 ? (ippicviSumFuncNoHint)ippicviSum_16u_C1R : + type == CV_16UC3 ? (ippicviSumFuncNoHint)ippicviSum_16u_C3R : + type == CV_16UC4 ? (ippicviSumFuncNoHint)ippicviSum_16u_C4R : + type == CV_16SC1 ? (ippicviSumFuncNoHint)ippicviSum_16s_C1R : + type == CV_16SC3 ? (ippicviSumFuncNoHint)ippicviSum_16s_C3R : + type == CV_16SC4 ? (ippicviSumFuncNoHint)ippicviSum_16s_C4R : 0; CV_Assert(!ippFuncHint || !ippFuncNoHint); if( ippFuncHint || ippFuncNoHint ) @@ -721,11 +721,11 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) int type = src.type(); if( !mask.empty() ) { - typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *); - ippiMaskMeanFuncC1 ippFuncC1 = - type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR : - type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR : - type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR : + typedef IppStatus (CV_STDCALL* ippicviMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *); + ippicviMaskMeanFuncC1 ippFuncC1 = + type == CV_8UC1 ? (ippicviMaskMeanFuncC1)ippicviMean_8u_C1MR : + type == CV_16UC1 ? (ippicviMaskMeanFuncC1)ippicviMean_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskMeanFuncC1)ippicviMean_32f_C1MR : 0; if( ippFuncC1 ) { @@ -735,11 +735,11 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) return Scalar(res); } } - typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *); - ippiMaskMeanFuncC3 ippFuncC3 = - type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR : - type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR : + typedef IppStatus (CV_STDCALL* ippicviMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *); + ippicviMaskMeanFuncC3 ippFuncC3 = + type == CV_8UC3 ? (ippicviMaskMeanFuncC3)ippicviMean_8u_C3CMR : + type == CV_16UC3 ? (ippicviMaskMeanFuncC3)ippicviMean_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskMeanFuncC3)ippicviMean_32f_C3CMR : 0; if( ippFuncC3 ) { @@ -754,23 +754,23 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) } else { - typedef IppStatus (CV_STDCALL* ippiMeanFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); - typedef IppStatus (CV_STDCALL* ippiMeanFuncNoHint)(const void*, int, IppiSize, double *); - ippiMeanFuncHint ippFuncHint = - type == CV_32FC1 ? (ippiMeanFuncHint)ippiMean_32f_C1R : - type == CV_32FC3 ? (ippiMeanFuncHint)ippiMean_32f_C3R : - type == CV_32FC4 ? (ippiMeanFuncHint)ippiMean_32f_C4R : + typedef IppStatus (CV_STDCALL* ippicviMeanFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); + typedef IppStatus (CV_STDCALL* ippicviMeanFuncNoHint)(const void*, int, IppiSize, double *); + ippicviMeanFuncHint ippFuncHint = + type == CV_32FC1 ? (ippicviMeanFuncHint)ippicviMean_32f_C1R : + type == CV_32FC3 ? (ippicviMeanFuncHint)ippicviMean_32f_C3R : + type == CV_32FC4 ? (ippicviMeanFuncHint)ippicviMean_32f_C4R : 0; - ippiMeanFuncNoHint ippFuncNoHint = - type == CV_8UC1 ? (ippiMeanFuncNoHint)ippiMean_8u_C1R : - type == CV_8UC3 ? (ippiMeanFuncNoHint)ippiMean_8u_C3R : - type == CV_8UC4 ? (ippiMeanFuncNoHint)ippiMean_8u_C4R : - type == CV_16UC1 ? (ippiMeanFuncNoHint)ippiMean_16u_C1R : - type == CV_16UC3 ? (ippiMeanFuncNoHint)ippiMean_16u_C3R : - type == CV_16UC4 ? (ippiMeanFuncNoHint)ippiMean_16u_C4R : - type == CV_16SC1 ? (ippiMeanFuncNoHint)ippiMean_16s_C1R : - type == CV_16SC3 ? (ippiMeanFuncNoHint)ippiMean_16s_C3R : - type == CV_16SC4 ? (ippiMeanFuncNoHint)ippiMean_16s_C4R : + ippicviMeanFuncNoHint ippFuncNoHint = + type == CV_8UC1 ? (ippicviMeanFuncNoHint)ippicviMean_8u_C1R : + type == CV_8UC3 ? (ippicviMeanFuncNoHint)ippicviMean_8u_C3R : + type == CV_8UC4 ? (ippicviMeanFuncNoHint)ippicviMean_8u_C4R : + type == CV_16UC1 ? (ippicviMeanFuncNoHint)ippicviMean_16u_C1R : + type == CV_16UC3 ? (ippicviMeanFuncNoHint)ippicviMean_16u_C3R : + type == CV_16UC4 ? (ippicviMeanFuncNoHint)ippicviMean_16u_C4R : + type == CV_16SC1 ? (ippicviMeanFuncNoHint)ippicviMean_16s_C1R : + type == CV_16SC3 ? (ippicviMeanFuncNoHint)ippicviMean_16s_C3R : + type == CV_16SC4 ? (ippicviMeanFuncNoHint)ippicviMean_16s_C4R : 0; // Make sure only zero or one version of the function pointer is valid CV_Assert(!ippFuncHint || !ippFuncNoHint); @@ -941,22 +941,22 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input int type = src.type(); if( !mask.empty() ) { - typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *, Ipp64f *); - ippiMaskMeanStdDevFuncC1 ippFuncC1 = - type == CV_8UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_8u_C1MR : - type == CV_16UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_16u_C1MR : - type == CV_32FC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_32f_C1MR : + typedef IppStatus (CV_STDCALL* ippicviMaskMeanStdDevFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *, Ipp64f *); + ippicviMaskMeanStdDevFuncC1 ippFuncC1 = + type == CV_8UC1 ? (ippicviMaskMeanStdDevFuncC1)ippicviMean_StdDev_8u_C1MR : + type == CV_16UC1 ? (ippicviMaskMeanStdDevFuncC1)ippicviMean_StdDev_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskMeanStdDevFuncC1)ippicviMean_StdDev_32f_C1MR : 0; if( ippFuncC1 ) { if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, pmean, pstddev) >= 0 ) return; } - typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *, Ipp64f *); - ippiMaskMeanStdDevFuncC3 ippFuncC3 = - type == CV_8UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_8u_C3CMR : - type == CV_16UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_32f_C3CMR : + typedef IppStatus (CV_STDCALL* ippicviMaskMeanStdDevFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *, Ipp64f *); + ippicviMaskMeanStdDevFuncC3 ippFuncC3 = + type == CV_8UC3 ? (ippicviMaskMeanStdDevFuncC3)ippicviMean_StdDev_8u_C3CMR : + type == CV_16UC3 ? (ippicviMaskMeanStdDevFuncC3)ippicviMean_StdDev_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskMeanStdDevFuncC3)ippicviMean_StdDev_32f_C3CMR : 0; if( ippFuncC3 ) { @@ -968,22 +968,22 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input } else { - typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC1)(const void *, int, IppiSize, Ipp64f *, Ipp64f *); - ippiMeanStdDevFuncC1 ippFuncC1 = - type == CV_8UC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_8u_C1R : - type == CV_16UC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_16u_C1R : - //type == CV_32FC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_32f_C1R ://Aug 2013: bug in IPP 7.1, 8.0 + typedef IppStatus (CV_STDCALL* ippicviMeanStdDevFuncC1)(const void *, int, IppiSize, Ipp64f *, Ipp64f *); + ippicviMeanStdDevFuncC1 ippFuncC1 = + type == CV_8UC1 ? (ippicviMeanStdDevFuncC1)ippicviMean_StdDev_8u_C1R : + type == CV_16UC1 ? (ippicviMeanStdDevFuncC1)ippicviMean_StdDev_16u_C1R : + //type == CV_32FC1 ? (ippicviMeanStdDevFuncC1)ippicviMean_StdDev_32f_C1R ://Aug 2013: bug in IPP 7.1, 8.0 0; if( ippFuncC1 ) { if( ippFuncC1(src.data, (int)src.step[0], sz, pmean, pstddev) >= 0 ) return; } - typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *); - ippiMeanStdDevFuncC3 ippFuncC3 = - type == CV_8UC3 ? (ippiMeanStdDevFuncC3)ippiMean_StdDev_8u_C3CR : - type == CV_16UC3 ? (ippiMeanStdDevFuncC3)ippiMean_StdDev_16u_C3CR : - type == CV_32FC3 ? (ippiMeanStdDevFuncC3)ippiMean_StdDev_32f_C3CR : + typedef IppStatus (CV_STDCALL* ippicviMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *); + ippicviMeanStdDevFuncC3 ippFuncC3 = + type == CV_8UC3 ? (ippicviMeanStdDevFuncC3)ippicviMean_StdDev_8u_C3CR : + type == CV_16UC3 ? (ippicviMeanStdDevFuncC3)ippicviMean_StdDev_16u_C3CR : + type == CV_32FC3 ? (ippicviMeanStdDevFuncC3)ippicviMean_StdDev_32f_C3CR : 0; if( ippFuncC3 ) { @@ -1346,11 +1346,11 @@ void cv::minMaxIdx(InputArray _src, double* minVal, int type = src.type(); if( !mask.empty() ) { - typedef IppStatus (CV_STDCALL* ippiMaskMinMaxIndxFuncC1)(const void *, int, const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); - ippiMaskMinMaxIndxFuncC1 ippFuncC1 = - type == CV_8UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1MR : - type == CV_16UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1MR : - type == CV_32FC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1MR : + typedef IppStatus (CV_STDCALL* ippicviMaskMinMaxIndxFuncC1)(const void *, int, const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); + ippicviMaskMinMaxIndxFuncC1 ippFuncC1 = + type == CV_8UC1 ? (ippicviMaskMinMaxIndxFuncC1)ippicviMinMaxIndx_8u_C1MR : + type == CV_16UC1 ? (ippicviMaskMinMaxIndxFuncC1)ippicviMinMaxIndx_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskMinMaxIndxFuncC1)ippicviMinMaxIndx_32f_C1MR : 0; if( ippFuncC1 ) { @@ -1380,11 +1380,11 @@ void cv::minMaxIdx(InputArray _src, double* minVal, } else { - typedef IppStatus (CV_STDCALL* ippiMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); - ippiMinMaxIndxFuncC1 ippFuncC1 = - type == CV_8UC1 ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R : - type == CV_16UC1 ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R : - type == CV_32FC1 ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : + typedef IppStatus (CV_STDCALL* ippicviMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); + ippicviMinMaxIndxFuncC1 ippFuncC1 = + type == CV_8UC1 ? (ippicviMinMaxIndxFuncC1)ippicviMinMaxIndx_8u_C1R : + type == CV_16UC1 ? (ippicviMinMaxIndxFuncC1)ippicviMinMaxIndx_16u_C1R : + type == CV_32FC1 ? (ippicviMinMaxIndxFuncC1)ippicviMinMaxIndx_32f_C1R : 0; if( ippFuncC1 ) { @@ -2023,25 +2023,25 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) int type = src.type(); if( !mask.empty() ) { - typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskNormFuncC1 ippFuncC1 = + typedef IppStatus (CV_STDCALL* ippicviMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *); + ippicviMaskNormFuncC1 ippFuncC1 = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_32f_C1MR : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_32f_C1MR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_32f_C1MR : 0) : 0; if( ippFuncC1 ) { @@ -2051,25 +2051,25 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; } } - typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); - ippiMaskNormFuncC3 ippFuncC3 = + typedef IppStatus (CV_STDCALL* ippicviMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); + ippicviMaskNormFuncC3 ippFuncC3 = normType == NORM_INF ? - (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8u_C3CMR : - type == CV_8SC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8s_C3CMR : - type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_32f_C3CMR : + (type == CV_8UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_8u_C3CMR : + type == CV_8SC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_8s_C3CMR : + type == CV_16UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_32f_C3CMR : 0) : normType == NORM_L1 ? - (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_8u_C3CMR : - type == CV_8SC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_8s_C3CMR : - type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_32f_C3CMR : + (type == CV_8UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_8u_C3CMR : + type == CV_8SC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_8s_C3CMR : + type == CV_16UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_32f_C3CMR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_8u_C3CMR : - type == CV_8SC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_8s_C3CMR : - type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_32f_C3CMR : + (type == CV_8UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_8u_C3CMR : + type == CV_8SC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_8s_C3CMR : + type == CV_16UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_32f_C3CMR : 0) : 0; if( ippFuncC3 ) { @@ -2089,55 +2089,55 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) } else { - typedef IppStatus (CV_STDCALL* ippiNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); - typedef IppStatus (CV_STDCALL* ippiNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *); - ippiNormFuncHint ippFuncHint = + typedef IppStatus (CV_STDCALL* ippicviNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); + typedef IppStatus (CV_STDCALL* ippicviNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *); + ippicviNormFuncHint ippFuncHint = normType == NORM_L1 ? - (type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L1_32f_C1R : - type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L1_32f_C3R : - type == CV_32FC4 ? (ippiNormFuncHint)ippiNorm_L1_32f_C4R : + (type == CV_32FC1 ? (ippicviNormFuncHint)ippicviNorm_L1_32f_C1R : + type == CV_32FC3 ? (ippicviNormFuncHint)ippicviNorm_L1_32f_C3R : + type == CV_32FC4 ? (ippicviNormFuncHint)ippicviNorm_L1_32f_C4R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L2_32f_C1R : - type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L2_32f_C3R : - type == CV_32FC4 ? (ippiNormFuncHint)ippiNorm_L2_32f_C4R : + (type == CV_32FC1 ? (ippicviNormFuncHint)ippicviNorm_L2_32f_C1R : + type == CV_32FC3 ? (ippicviNormFuncHint)ippicviNorm_L2_32f_C3R : + type == CV_32FC4 ? (ippicviNormFuncHint)ippicviNorm_L2_32f_C4R : 0) : 0; - ippiNormFuncNoHint ippFuncNoHint = + ippicviNormFuncNoHint ippFuncNoHint = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C1R : - type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C3R : - type == CV_8UC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C4R : - type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C1R : - type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C3R : - type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C4R : - type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C1R : - //type == CV_16SC3 ? (ippiNormFunc)ippiNorm_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 - //type == CV_16SC4 ? (ippiNormFunc)ippiNorm_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 - type == CV_32FC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C1R : - type == CV_32FC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C3R : - type == CV_32FC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C4R : + (type == CV_8UC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_8u_C1R : + type == CV_8UC3 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_8u_C3R : + type == CV_8UC4 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_8u_C4R : + type == CV_16UC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16u_C1R : + type == CV_16UC3 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16u_C3R : + type == CV_16UC4 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16u_C4R : + type == CV_16SC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16s_C1R : + //type == CV_16SC3 ? (ippicviNormFunc)ippicviNorm_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 + //type == CV_16SC4 ? (ippicviNormFunc)ippicviNorm_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 + type == CV_32FC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_32f_C1R : + type == CV_32FC3 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_32f_C3R : + type == CV_32FC4 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_32f_C4R : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C1R : - type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C3R : - type == CV_8UC4 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C4R : - type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C1R : - type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C3R : - type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C4R : - type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C1R : - type == CV_16SC3 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C3R : - type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C4R : + (type == CV_8UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L1_8u_C1R : + type == CV_8UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L1_8u_C3R : + type == CV_8UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L1_8u_C4R : + type == CV_16UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16u_C1R : + type == CV_16UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16u_C3R : + type == CV_16UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16u_C4R : + type == CV_16SC1 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16s_C1R : + type == CV_16SC3 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16s_C3R : + type == CV_16SC4 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16s_C4R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R : - type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C3R : - type == CV_8UC4 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C4R : - type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R : - type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C3R : - type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C4R : - type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C1R : - type == CV_16SC3 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C3R : - type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C4R : + (type == CV_8UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L2_8u_C1R : + type == CV_8UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L2_8u_C3R : + type == CV_8UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L2_8u_C4R : + type == CV_16UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16u_C1R : + type == CV_16UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16u_C3R : + type == CV_16UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16u_C4R : + type == CV_16SC1 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16s_C1R : + type == CV_16SC3 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16s_C3R : + type == CV_16SC4 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16s_C4R : 0) : 0; // Make sure only zero or one version of the function pointer is valid CV_Assert(!ippFuncHint || !ippFuncNoHint); @@ -2374,25 +2374,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m int type = src1.type(); if( !mask.empty() ) { - typedef IppStatus (CV_STDCALL* ippiMaskNormRelFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskNormRelFuncC1 ippFuncC1 = + typedef IppStatus (CV_STDCALL* ippicviMaskNormRelFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); + ippicviMaskNormRelFuncC1 ippFuncC1 = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_32f_C1MR : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_32f_C1MR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_32f_C1MR : 0) : 0; if( ippFuncC1 ) { @@ -2403,25 +2403,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m } else { - typedef IppStatus (CV_STDCALL* ippiNormRelFunc)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); - ippiNormRelFunc ippFunc = + typedef IppStatus (CV_STDCALL* ippicviNormRelFunc)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); + ippicviNormRelFunc ippFunc = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_Inf_8u_C1R : - type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_Inf_16u_C1R : - type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_Inf_16s_C1R : - type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_Inf_32f_C1R : + (type == CV_8UC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_8u_C1R : + type == CV_16UC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_16u_C1R : + type == CV_16SC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_16s_C1R : + type == CV_32FC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_32f_C1R : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_L1_8u_C1R : - type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_L1_16u_C1R : - type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_L1_16s_C1R : - type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_L1_32f_C1R : + (type == CV_8UC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_8u_C1R : + type == CV_16UC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_16u_C1R : + type == CV_16SC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_16s_C1R : + type == CV_32FC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_32f_C1R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_L2_8u_C1R : - type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_L2_16u_C1R : - type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_L2_16s_C1R : - type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_L2_32f_C1R : + (type == CV_8UC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_8u_C1R : + type == CV_16UC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_16u_C1R : + type == CV_16SC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_16s_C1R : + type == CV_32FC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_32f_C1R : 0) : 0; if( ippFunc ) { @@ -2455,25 +2455,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m int type = src1.type(); if( !mask.empty() ) { - typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskNormDiffFuncC1 ippFuncC1 = + typedef IppStatus (CV_STDCALL* ippicviMaskNormDiffFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); + ippicviMaskNormDiffFuncC1 ippFuncC1 = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_32f_C1MR : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_32f_C1MR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_8u_C1MR : - type == CV_8SC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_8s_C1MR : - type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_16u_C1MR : - type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_32f_C1MR : + (type == CV_8UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_8u_C1MR : + type == CV_8SC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_8s_C1MR : + type == CV_16UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_16u_C1MR : + type == CV_32FC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_32f_C1MR : 0) : 0; if( ippFuncC1 ) { @@ -2481,25 +2481,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m if( ippFuncC1(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 ) return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; } - typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC3)(const void *, int, const void *, int, const void *, int, IppiSize, int, Ipp64f *); - ippiMaskNormDiffFuncC3 ippFuncC3 = + typedef IppStatus (CV_STDCALL* ippicviMaskNormDiffFuncC3)(const void *, int, const void *, int, const void *, int, IppiSize, int, Ipp64f *); + ippicviMaskNormDiffFuncC3 ippFuncC3 = normType == NORM_INF ? - (type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_8u_C3CMR : - type == CV_8SC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_8s_C3CMR : - type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_32f_C3CMR : + (type == CV_8UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_8u_C3CMR : + type == CV_8SC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_8s_C3CMR : + type == CV_16UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_32f_C3CMR : 0) : normType == NORM_L1 ? - (type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_8u_C3CMR : - type == CV_8SC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_8s_C3CMR : - type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_32f_C3CMR : + (type == CV_8UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_8u_C3CMR : + type == CV_8SC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_8s_C3CMR : + type == CV_16UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_32f_C3CMR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_8u_C3CMR : - type == CV_8SC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_8s_C3CMR : - type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_32f_C3CMR : + (type == CV_8UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_8u_C3CMR : + type == CV_8SC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_8s_C3CMR : + type == CV_16UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_16u_C3CMR : + type == CV_32FC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_32f_C3CMR : 0) : 0; if( ippFuncC3 ) { @@ -2519,55 +2519,55 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m } else { - typedef IppStatus (CV_STDCALL* ippiNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); - typedef IppStatus (CV_STDCALL* ippiNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiNormDiffFuncHint ippFuncHint = + typedef IppStatus (CV_STDCALL* ippicviNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); + typedef IppStatus (CV_STDCALL* ippicviNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); + ippicviNormDiffFuncHint ippFuncHint = normType == NORM_L1 ? - (type == CV_32FC1 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C1R : - type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C3R : - type == CV_32FC4 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C4R : + (type == CV_32FC1 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L1_32f_C1R : + type == CV_32FC3 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L1_32f_C3R : + type == CV_32FC4 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L1_32f_C4R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_32FC1 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C1R : - type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C3R : - type == CV_32FC4 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C4R : + (type == CV_32FC1 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L2_32f_C1R : + type == CV_32FC3 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L2_32f_C3R : + type == CV_32FC4 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L2_32f_C4R : 0) : 0; - ippiNormDiffFuncNoHint ippFuncNoHint = + ippicviNormDiffFuncNoHint ippFuncNoHint = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R : - type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C3R : - type == CV_8UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C4R : - type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C1R : - type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C3R : - type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C4R : - type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R : - //type == CV_16SC3 ? (ippiNormDiffFunc)ippiNormDiff_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 - //type == CV_16SC4 ? (ippiNormDiffFunc)ippiNormDiff_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 - type == CV_32FC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C1R : - type == CV_32FC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C3R : - type == CV_32FC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C4R : + (type == CV_8UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_8u_C1R : + type == CV_8UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_8u_C3R : + type == CV_8UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_8u_C4R : + type == CV_16UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16u_C1R : + type == CV_16UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16u_C3R : + type == CV_16UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16u_C4R : + type == CV_16SC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16s_C1R : + //type == CV_16SC3 ? (ippicviNormDiffFunc)ippicviNormDiff_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 + //type == CV_16SC4 ? (ippicviNormDiffFunc)ippicviNormDiff_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 + type == CV_32FC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_32f_C1R : + type == CV_32FC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_32f_C3R : + type == CV_32FC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_32f_C4R : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R : - type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C3R : - type == CV_8UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C4R : - type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R : - type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C3R : - type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C4R : - type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C1R : - type == CV_16SC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C3R : - type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C4R : + (type == CV_8UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_8u_C1R : + type == CV_8UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_8u_C3R : + type == CV_8UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_8u_C4R : + type == CV_16UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16u_C1R : + type == CV_16UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16u_C3R : + type == CV_16UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16u_C4R : + type == CV_16SC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16s_C1R : + type == CV_16SC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16s_C3R : + type == CV_16SC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16s_C4R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R : - type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C3R : - type == CV_8UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C4R : - type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C1R : - type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C3R : - type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C4R : - type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C1R : - type == CV_16SC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C3R : - type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C4R : + (type == CV_8UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_8u_C1R : + type == CV_8UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_8u_C3R : + type == CV_8UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_8u_C4R : + type == CV_16UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16u_C1R : + type == CV_16UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16u_C3R : + type == CV_16UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16u_C4R : + type == CV_16SC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16s_C1R : + type == CV_16SC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16s_C3R : + type == CV_16SC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16s_C4R : 0) : 0; // Make sure only zero or one version of the function pointer is valid CV_Assert(!ippFuncHint || !ippFuncNoHint); diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 5b8a696491..4b3efce4a8 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -397,17 +397,17 @@ int64 getCPUTickCount(void) #else -#ifdef HAVE_IPP -int64 getCPUTickCount(void) -{ - return ippGetCpuClocks(); -} -#else +//#ifdef HAVE_IPP +//int64 getCPUTickCount(void) +//{ +// return ippGetCpuClocks(); +//} +//#else int64 getCPUTickCount(void) { return getTickCount(); } -#endif +//#endif #endif diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 3822ab3c16..b2699d22e5 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -99,7 +99,7 @@ #define MAX_IPP8u 255 #define MAX_IPP16u 65535 #define MAX_IPP32f 1.0 -static IppStatus sts = ippInit(); +static IppStatus sts = ippicvInit(); #endif namespace cv @@ -200,9 +200,9 @@ void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt) } #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) -typedef IppStatus (CV_STDCALL* ippiReorderFunc)(const void *, int, void *, int, IppiSize, const int *); -typedef IppStatus (CV_STDCALL* ippiGeneralFunc)(const void *, int, void *, int, IppiSize); -typedef IppStatus (CV_STDCALL* ippiColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *); +typedef IppStatus (CV_STDCALL* ippicviReorderFunc)(const void *, int, void *, int, IppiSize, const int *); +typedef IppStatus (CV_STDCALL* ippicviGeneralFunc)(const void *, int, void *, int, IppiSize); +typedef IppStatus (CV_STDCALL* ippicviColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *); template class CvtColorIPPLoop_Invoker : public ParallelLoopBody @@ -255,134 +255,134 @@ bool CvtColorIPPLoopCopy(Mat& src, Mat& dst, const Cvt& cvt) return ok; } -static IppStatus CV_STDCALL ippiSwapChannels_8u_C3C4Rf(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep, +static IppStatus CV_STDCALL ippicviSwapChannels_8u_C3C4Rf(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep, IppiSize roiSize, const int *dstOrder) { - return ippiSwapChannels_8u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP8u); + return ippicviSwapChannels_8u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP8u); } -static IppStatus CV_STDCALL ippiSwapChannels_16u_C3C4Rf(const Ipp16u* pSrc, int srcStep, Ipp16u* pDst, int dstStep, +static IppStatus CV_STDCALL ippicviSwapChannels_16u_C3C4Rf(const Ipp16u* pSrc, int srcStep, Ipp16u* pDst, int dstStep, IppiSize roiSize, const int *dstOrder) { - return ippiSwapChannels_16u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP16u); + return ippicviSwapChannels_16u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP16u); } -static IppStatus CV_STDCALL ippiSwapChannels_32f_C3C4Rf(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, +static IppStatus CV_STDCALL ippicviSwapChannels_32f_C3C4Rf(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, const int *dstOrder) { - return ippiSwapChannels_32f_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP32f); + return ippicviSwapChannels_32f_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP32f); } -static ippiReorderFunc ippiSwapChannelsC3C4RTab[] = +static ippicviReorderFunc ippicviSwapChannelsC3C4RTab[] = { - (ippiReorderFunc)ippiSwapChannels_8u_C3C4Rf, 0, (ippiReorderFunc)ippiSwapChannels_16u_C3C4Rf, 0, - 0, (ippiReorderFunc)ippiSwapChannels_32f_C3C4Rf, 0, 0 + (ippicviReorderFunc)ippicviSwapChannels_8u_C3C4Rf, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C3C4Rf, 0, + 0, (ippicviReorderFunc)ippicviSwapChannels_32f_C3C4Rf, 0, 0 }; -static ippiGeneralFunc ippiCopyAC4C3RTab[] = +static ippicviGeneralFunc ippicviCopyAC4C3RTab[] = { - (ippiGeneralFunc)ippiCopy_8u_AC4C3R, 0, (ippiGeneralFunc)ippiCopy_16u_AC4C3R, 0, - 0, (ippiGeneralFunc)ippiCopy_32f_AC4C3R, 0, 0 + (ippicviGeneralFunc)ippicviCopy_8u_AC4C3R, 0, (ippicviGeneralFunc)ippicviCopy_16u_AC4C3R, 0, + 0, (ippicviGeneralFunc)ippicviCopy_32f_AC4C3R, 0, 0 }; -static ippiReorderFunc ippiSwapChannelsC4C3RTab[] = +static ippicviReorderFunc ippicviSwapChannelsC4C3RTab[] = { - (ippiReorderFunc)ippiSwapChannels_8u_C4C3R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4C3R, 0, - 0, (ippiReorderFunc)ippiSwapChannels_32f_C4C3R, 0, 0 + (ippicviReorderFunc)ippicviSwapChannels_8u_C4C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C4C3R, 0, + 0, (ippicviReorderFunc)ippicviSwapChannels_32f_C4C3R, 0, 0 }; -static ippiReorderFunc ippiSwapChannelsC3RTab[] = +static ippicviReorderFunc ippicviSwapChannelsC3RTab[] = { - (ippiReorderFunc)ippiSwapChannels_8u_C3R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C3R, 0, - 0, (ippiReorderFunc)ippiSwapChannels_32f_C3R, 0, 0 + (ippicviReorderFunc)ippicviSwapChannels_8u_C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C3R, 0, + 0, (ippicviReorderFunc)ippicviSwapChannels_32f_C3R, 0, 0 }; -static ippiReorderFunc ippiSwapChannelsC4RTab[] = +static ippicviReorderFunc ippicviSwapChannelsC4RTab[] = { - (ippiReorderFunc)ippiSwapChannels_8u_AC4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_AC4R, 0, - 0, (ippiReorderFunc)ippiSwapChannels_32f_AC4R, 0, 0 + (ippicviReorderFunc)ippicviSwapChannels_8u_AC4R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_AC4R, 0, + 0, (ippicviReorderFunc)ippicviSwapChannels_32f_AC4R, 0, 0 }; -static ippiColor2GrayFunc ippiColor2GrayC3Tab[] = +static ippicviColor2GrayFunc ippicviColor2GrayC3Tab[] = { - (ippiColor2GrayFunc)ippiColorToGray_8u_C3C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_C3C1R, 0, - 0, (ippiColor2GrayFunc)ippiColorToGray_32f_C3C1R, 0, 0 + (ippicviColor2GrayFunc)ippicviColorToGray_8u_C3C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_16u_C3C1R, 0, + 0, (ippicviColor2GrayFunc)ippicviColorToGray_32f_C3C1R, 0, 0 }; -static ippiColor2GrayFunc ippiColor2GrayC4Tab[] = +static ippicviColor2GrayFunc ippicviColor2GrayC4Tab[] = { - (ippiColor2GrayFunc)ippiColorToGray_8u_AC4C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_AC4C1R, 0, - 0, (ippiColor2GrayFunc)ippiColorToGray_32f_AC4C1R, 0, 0 + (ippicviColor2GrayFunc)ippicviColorToGray_8u_AC4C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_16u_AC4C1R, 0, + 0, (ippicviColor2GrayFunc)ippicviColorToGray_32f_AC4C1R, 0, 0 }; -static ippiGeneralFunc ippiRGB2GrayC3Tab[] = +static ippicviGeneralFunc ippicviRGB2GrayC3Tab[] = { - (ippiGeneralFunc)ippiRGBToGray_8u_C3C1R, 0, (ippiGeneralFunc)ippiRGBToGray_16u_C3C1R, 0, - 0, (ippiGeneralFunc)ippiRGBToGray_32f_C3C1R, 0, 0 + (ippicviGeneralFunc)ippicviRGBToGray_8u_C3C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_16u_C3C1R, 0, + 0, (ippicviGeneralFunc)ippicviRGBToGray_32f_C3C1R, 0, 0 }; -static ippiGeneralFunc ippiRGB2GrayC4Tab[] = +static ippicviGeneralFunc ippicviRGB2GrayC4Tab[] = { - (ippiGeneralFunc)ippiRGBToGray_8u_AC4C1R, 0, (ippiGeneralFunc)ippiRGBToGray_16u_AC4C1R, 0, - 0, (ippiGeneralFunc)ippiRGBToGray_32f_AC4C1R, 0, 0 + (ippicviGeneralFunc)ippicviRGBToGray_8u_AC4C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_16u_AC4C1R, 0, + 0, (ippicviGeneralFunc)ippicviRGBToGray_32f_AC4C1R, 0, 0 }; -static ippiGeneralFunc ippiCopyP3C3RTab[] = +static ippicviGeneralFunc ippicviCopyP3C3RTab[] = { - (ippiGeneralFunc)ippiCopy_8u_P3C3R, 0, (ippiGeneralFunc)ippiCopy_16u_P3C3R, 0, - 0, (ippiGeneralFunc)ippiCopy_32f_P3C3R, 0, 0 + (ippicviGeneralFunc)ippicviCopy_8u_P3C3R, 0, (ippicviGeneralFunc)ippicviCopy_16u_P3C3R, 0, + 0, (ippicviGeneralFunc)ippicviCopy_32f_P3C3R, 0, 0 }; -static ippiGeneralFunc ippiRGB2XYZTab[] = +static ippicviGeneralFunc ippicviRGB2XYZTab[] = { - (ippiGeneralFunc)ippiRGBToXYZ_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToXYZ_16u_C3R, 0, - 0, (ippiGeneralFunc)ippiRGBToXYZ_32f_C3R, 0, 0 + (ippicviGeneralFunc)ippicviRGBToXYZ_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToXYZ_16u_C3R, 0, + 0, (ippicviGeneralFunc)ippicviRGBToXYZ_32f_C3R, 0, 0 }; -static ippiGeneralFunc ippiXYZ2RGBTab[] = +static ippicviGeneralFunc ippicviXYZ2RGBTab[] = { - (ippiGeneralFunc)ippiXYZToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiXYZToRGB_16u_C3R, 0, - 0, (ippiGeneralFunc)ippiXYZToRGB_32f_C3R, 0, 0 + (ippicviGeneralFunc)ippicviXYZToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviXYZToRGB_16u_C3R, 0, + 0, (ippicviGeneralFunc)ippicviXYZToRGB_32f_C3R, 0, 0 }; -static ippiGeneralFunc ippiRGB2HSVTab[] = +static ippicviGeneralFunc ippicviRGB2HSVTab[] = { - (ippiGeneralFunc)ippiRGBToHSV_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToHSV_16u_C3R, 0, + (ippicviGeneralFunc)ippicviRGBToHSV_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToHSV_16u_C3R, 0, 0, 0, 0, 0 }; -static ippiGeneralFunc ippiHSV2RGBTab[] = +static ippicviGeneralFunc ippicviHSV2RGBTab[] = { - (ippiGeneralFunc)ippiHSVToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiHSVToRGB_16u_C3R, 0, + (ippicviGeneralFunc)ippicviHSVToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviHSVToRGB_16u_C3R, 0, 0, 0, 0, 0 }; -static ippiGeneralFunc ippiRGB2HLSTab[] = +static ippicviGeneralFunc ippicviRGB2HLSTab[] = { - (ippiGeneralFunc)ippiRGBToHLS_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToHLS_16u_C3R, 0, - 0, (ippiGeneralFunc)ippiRGBToHLS_32f_C3R, 0, 0 + (ippicviGeneralFunc)ippicviRGBToHLS_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToHLS_16u_C3R, 0, + 0, (ippicviGeneralFunc)ippicviRGBToHLS_32f_C3R, 0, 0 }; -static ippiGeneralFunc ippiHLS2RGBTab[] = +static ippicviGeneralFunc ippicviHLS2RGBTab[] = { - (ippiGeneralFunc)ippiHLSToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiHLSToRGB_16u_C3R, 0, - 0, (ippiGeneralFunc)ippiHLSToRGB_32f_C3R, 0, 0 + (ippicviGeneralFunc)ippicviHLSToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviHLSToRGB_16u_C3R, 0, + 0, (ippicviGeneralFunc)ippicviHLSToRGB_32f_C3R, 0, 0 }; struct IPPGeneralFunctor { - IPPGeneralFunctor(ippiGeneralFunc _func) : func(_func){} + IPPGeneralFunctor(ippicviGeneralFunc _func) : func(_func){} bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { return func(src, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0; } private: - ippiGeneralFunc func; + ippicviGeneralFunc func; }; struct IPPReorderFunctor { - IPPReorderFunctor(ippiReorderFunc _func, int _order0, int _order1, int _order2) : func(_func) + IPPReorderFunctor(ippicviReorderFunc _func, int _order0, int _order1, int _order2) : func(_func) { order[0] = _order0; order[1] = _order1; @@ -394,13 +394,13 @@ struct IPPReorderFunctor return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), order) >= 0; } private: - ippiReorderFunc func; + ippicviReorderFunc func; int order[4]; }; struct IPPColor2GrayFunctor { - IPPColor2GrayFunctor(ippiColor2GrayFunc _func) : func(_func) + IPPColor2GrayFunctor(ippicviColor2GrayFunc _func) : func(_func) { coeffs[0] = 0.114f; coeffs[1] = 0.587f; @@ -411,25 +411,25 @@ struct IPPColor2GrayFunctor return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), coeffs) >= 0; } private: - ippiColor2GrayFunc func; + ippicviColor2GrayFunc func; Ipp32f coeffs[3]; }; struct IPPGray2BGRFunctor { - IPPGray2BGRFunctor(ippiGeneralFunc _func) : func(_func){} + IPPGray2BGRFunctor(ippicviGeneralFunc _func) : func(_func){} bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { const void* srcarray[3] = { src, src, src }; return func(srcarray, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0; } private: - ippiGeneralFunc func; + ippicviGeneralFunc func; }; struct IPPGray2BGRAFunctor { - IPPGray2BGRAFunctor(ippiGeneralFunc _func1, ippiReorderFunc _func2, int _depth) : func1(_func1), func2(_func2), depth(_depth){} + IPPGray2BGRAFunctor(ippicviGeneralFunc _func1, ippicviReorderFunc _func2, int _depth) : func1(_func1), func2(_func2), depth(_depth){} bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { const void* srcarray[3] = { src, src, src }; @@ -440,14 +440,14 @@ struct IPPGray2BGRAFunctor return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; } private: - ippiGeneralFunc func1; - ippiReorderFunc func2; + ippicviGeneralFunc func1; + ippicviReorderFunc func2; int depth; }; struct IPPReorderGeneralFunctor { - IPPReorderGeneralFunctor(ippiReorderFunc _func1, ippiGeneralFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth) + IPPReorderGeneralFunctor(ippicviReorderFunc _func1, ippicviGeneralFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth) { order[0] = _order0; order[1] = _order1; @@ -463,15 +463,15 @@ struct IPPReorderGeneralFunctor return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0; } private: - ippiReorderFunc func1; - ippiGeneralFunc func2; + ippicviReorderFunc func1; + ippicviGeneralFunc func2; int order[4]; int depth; }; struct IPPGeneralReorderFunctor { - IPPGeneralReorderFunctor(ippiGeneralFunc _func1, ippiReorderFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth) + IPPGeneralReorderFunctor(ippicviGeneralFunc _func1, ippicviReorderFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth) { order[0] = _order0; order[1] = _order1; @@ -487,8 +487,8 @@ struct IPPGeneralReorderFunctor return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; } private: - ippiGeneralFunc func1; - ippiReorderFunc func2; + ippicviGeneralFunc func1; + ippicviReorderFunc func2; int order[4]; int depth; }; @@ -3228,32 +3228,32 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) if( code == CV_BGR2BGRA || code == CV_RGB2RGBA) { - if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 0, 1, 2)) ) + if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2)) ) return; } else if( code == CV_BGRA2BGR ) { - if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiCopyAC4C3RTab[depth])) ) + if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviCopyAC4C3RTab[depth])) ) return; } else if( code == CV_BGR2RGBA ) { - if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 2, 1, 0)) ) + if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0)) ) return; } else if( code == CV_RGBA2BGR ) { - if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC4C3RTab[depth], 2, 1, 0)) ) + if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC4C3RTab[depth], 2, 1, 0)) ) return; } else if( code == CV_RGB2BGR ) { - if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) ) + if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3RTab[depth], 2, 1, 0)) ) return; } else if( code == CV_RGBA2BGRA ) { - if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) ) + if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippicviSwapChannelsC4RTab[depth], 2, 1, 0)) ) return; } #endif @@ -3314,22 +3314,22 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) if( code == CV_BGR2GRAY ) { - if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC3Tab[depth])) ) + if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippicviColor2GrayC3Tab[depth])) ) return; } else if( code == CV_RGB2GRAY ) { - if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC3Tab[depth])) ) + if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviRGB2GrayC3Tab[depth])) ) return; } else if( code == CV_BGRA2GRAY ) { - if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC4Tab[depth])) ) + if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippicviColor2GrayC4Tab[depth])) ) return; } else if( code == CV_RGBA2GRAY ) { - if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC4Tab[depth])) ) + if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviRGB2GrayC4Tab[depth])) ) return; } #endif @@ -3366,12 +3366,12 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) if( code == CV_GRAY2BGR ) { - if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippiCopyP3C3RTab[depth])) ) + if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippicviCopyP3C3RTab[depth])) ) return; } else if( code == CV_GRAY2BGRA ) { - if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippiCopyP3C3RTab[depth], ippiSwapChannelsC3C4RTab[depth], depth)) ) + if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippicviCopyP3C3RTab[depth], ippicviSwapChannelsC3C4RTab[depth], depth)) ) return; } #endif @@ -3459,22 +3459,22 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) if( code == CV_BGR2XYZ && scn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) ) + if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC3RTab[depth], ippicviRGB2XYZTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_BGR2XYZ && scn == 4 ) { - if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) ) + if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2XYZTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_RGB2XYZ && scn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2XYZTab[depth])) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2XYZTab[depth])) ) return; } else if( code == CV_RGB2XYZ && scn == 4 ) { - if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 0, 1, 2, depth)) ) + if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2XYZTab[depth], 0, 1, 2, depth)) ) return; } #endif @@ -3498,22 +3498,22 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) if( code == CV_XYZ2BGR && dcn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippicviXYZ2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_XYZ2BGR && dcn == 4 ) { - if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) + if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviXYZ2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; } if( code == CV_XYZ2RGB && dcn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiXYZ2RGBTab[depth])) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviXYZ2RGBTab[depth])) ) return; } else if( code == CV_XYZ2RGB && dcn == 4 ) { - if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) + if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviXYZ2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; } #endif @@ -3543,42 +3543,42 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { 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(ippicviSwapChannelsC3RTab[depth], ippicviRGB2HSVTab[depth], 2, 1, 0, depth)) ) return; } 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(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HSVTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_RGB2HSV_FULL && scn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HSVTab[depth])) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2HSVTab[depth])) ) return; } 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(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HSVTab[depth], 0, 1, 2, depth)) ) return; } 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(ippicviSwapChannelsC3RTab[depth], ippicviRGB2HLSTab[depth], 2, 1, 0, depth)) ) return; } 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(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HLSTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_RGB2HLS_FULL && scn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HLSTab[depth])) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2HLSTab[depth])) ) return; } 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(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HLSTab[depth], 0, 1, 2, depth)) ) return; } } @@ -3624,42 +3624,42 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { 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(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; } 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(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_HSV2RGB_FULL && dcn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHSV2RGBTab[depth])) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviHSV2RGBTab[depth])) ) return; } 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(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; } 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(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; } 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(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; } else if( code == CV_HLS2RGB_FULL && dcn == 3 ) { - if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHLS2RGBTab[depth])) ) + if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviHLS2RGBTab[depth])) ) return; } 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(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; } } diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index df2f371f55..0004431b10 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -44,7 +44,7 @@ #include "opencl_kernels.hpp" #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) -static IppStatus sts = ippInit(); +static IppStatus sts = ippicvInit(); #endif /****************************************************************************************\ @@ -212,10 +212,10 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, { if((dx == 1) && (dy == 0)) { - ippiFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize); + ippicviFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize); buffer.allocate(bufSize); - ippiFilterScharrVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + ippicviFilterScharrVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer); return true; @@ -223,10 +223,10 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, if((dx == 0) && (dy == 1)) { - ippiFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize); + ippicviFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize); buffer.allocate(bufSize); - ippiFilterScharrHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + ippicviFilterScharrHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer); return true; @@ -245,29 +245,29 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, case CV_32F: if((dx == 1) && (dy == 0)) { - ippiFilterScharrVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize); + ippicviFilterScharrVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize); buffer.allocate(bufSize); - ippiFilterScharrVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, + ippicviFilterScharrVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); if(scale != 1) /* IPP is fast, so MulC produce very little perf degradation */ - ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f*)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f*)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } if((dx == 0) && (dy == 1)) { - ippiFilterScharrHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize); + ippicviFilterScharrHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize); buffer.allocate(bufSize); - ippiFilterScharrHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, + ippicviFilterScharrHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); if(scale != 1) - ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } @@ -297,10 +297,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k { if((dx == 1) && (dy == 0)) { - ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelNegVertGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + ippicviFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); return true; @@ -308,10 +308,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k if((dx == 0) && (dy == 1)) { - ippiFilterSobelHorizGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelHorizGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + ippicviFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); @@ -320,10 +320,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k if((dx == 2) && (dy == 0)) { - ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + ippicviFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); @@ -332,10 +332,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k if((dx == 0) && (dy == 2)) { - ippiFilterSobelHorizSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelHorizSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + ippicviFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); @@ -347,56 +347,56 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k { if((dx == 1) && (dy == 0)) { - ippiFilterSobelNegVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), &bufSize); + ippicviFilterSobelNegVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), &bufSize); buffer.allocate(bufSize); - ippiFilterSobelNegVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, + ippicviFilterSobelNegVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); if(scale != 1) - ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } if((dx == 0) && (dy == 1)) { - ippiFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, + ippicviFilterSobelHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); if(scale != 1) - ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } if((dx == 2) && (dy == 0)) { - ippiFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelVertSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, + ippicviFilterSobelVertSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); if(scale != 1) - ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } if((dx == 0) && (dy == 2)) { - ippiFilterSobelHorizSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); + ippicviFilterSobelHorizSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize); buffer.allocate(bufSize); - ippiFilterSobelHorizSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, + ippicviFilterSobelHorizSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step, (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), ippBorderRepl, 0, (Ipp8u*)(char*)buffer); if(scale != 1) - ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } diff --git a/modules/imgproc/src/distransform.cpp b/modules/imgproc/src/distransform.cpp index 94a5592858..4c28735c05 100644 --- a/modules/imgproc/src/distransform.cpp +++ b/modules/imgproc/src/distransform.cpp @@ -748,7 +748,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe if( maskSize == CV_DIST_MASK_5 ) { IppiSize roi = { src.cols, src.rows }; - if( ippiDistanceTransform_5x5_8u32f_C1R( + if( ippicviDistanceTransform_5x5_8u32f_C1R( src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask) >= 0 ) return; diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index 2bc6b8a706..62a62ded9c 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -1420,36 +1420,16 @@ struct RowVec_32f int operator()(const uchar* _src, uchar* _dst, int width, int cn) const { +#ifdef USE_IPP_SEP_FILTERS + int ret = ippicviOperator(_src, _dst, width, cn); + if (ret > 0) + return ret; +#endif int _ksize = kernel.rows + kernel.cols - 1; const float* src0 = (const float*)_src; float* dst = (float*)_dst; const float* _kx = (const float*)kernel.data; -#ifdef USE_IPP_SEP_FILTERS - IppiSize roisz = { width, 1 }; - if( (cn == 1 || cn == 3) && width >= _ksize*8 ) - { - if( bufsz < 0 ) - { - if( (cn == 1 && ippiFilterRowBorderPipelineGetBufferSize_32f_C1R(roisz, _ksize, &bufsz) < 0) || - (cn == 3 && ippiFilterRowBorderPipelineGetBufferSize_32f_C3R(roisz, _ksize, &bufsz) < 0)) - return 0; - } - AutoBuffer buf(bufsz + 64); - uchar* bufptr = alignPtr((uchar*)buf, 32); - int step = (int)(width*sizeof(dst[0])*cn); - float borderValue[] = {0.f, 0.f, 0.f}; - // here is the trick. IPP needs border type and extrapolates the row. We did it already. - // So we pass anchor=0 and ignore the right tail of results since they are incorrect there. - if( (cn == 1 && ippiFilterRowBorderPipeline_32f_C1R(src0, step, &dst, roisz, _kx, _ksize, 0, - ippBorderRepl, borderValue[0], bufptr) < 0) || - (cn == 3 && ippiFilterRowBorderPipeline_32f_C3R(src0, step, &dst, roisz, _kx, _ksize, 0, - ippBorderRepl, borderValue, bufptr) < 0)) - return 0; - return width - _ksize + 1; - } -#endif - if( !haveSSE ) return 0; @@ -1479,7 +1459,38 @@ struct RowVec_32f Mat kernel; bool haveSSE; #ifdef USE_IPP_SEP_FILTERS +private: mutable int bufsz; + int ippicviOperator(const uchar* _src, uchar* _dst, int width, int cn) const + { + int _ksize = kernel.rows + kernel.cols - 1; + if ((1 != cn && 3 != cn) || width < _ksize*8) + return 0; + + const float* src = (const float*)_src; + float* dst = (float*)_dst; + const float* _kx = (const float*)kernel.data; + + IppiSize roisz = { width, 1 }; + if( bufsz < 0 ) + { + if( (cn == 1 && ippicviFilterRowBorderPipelineGetBufferSize_32f_C1R(roisz, _ksize, &bufsz) < 0) || + (cn == 3 && ippicviFilterRowBorderPipelineGetBufferSize_32f_C3R(roisz, _ksize, &bufsz) < 0)) + return 0; + } + AutoBuffer buf(bufsz + 64); + uchar* bufptr = alignPtr((uchar*)buf, 32); + int step = (int)(width*sizeof(dst[0])*cn); + float borderValue[] = {0.f, 0.f, 0.f}; + // here is the trick. IPP needs border type and extrapolates the row. We did it already. + // So we pass anchor=0 and ignore the right tail of results since they are incorrect there. + if( (cn == 1 && ippicviFilterRowBorderPipeline_32f_C1R(src, step, &dst, roisz, _kx, _ksize, 0, + ippBorderRepl, borderValue[0], bufptr) < 0) || + (cn == 3 && ippicviFilterRowBorderPipeline_32f_C3R(src, step, &dst, roisz, _kx, _ksize, 0, + ippBorderRepl, borderValue, bufptr) < 0)) + return 0; + return width - _ksize + 1; + } #endif }; diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 9d3eabaad3..d12c7851bd 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -50,24 +50,24 @@ #include "opencl_kernels.hpp" #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) -static IppStatus sts = ippInit(); +static IppStatus sts = ippicvInit(); #endif namespace cv { #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701) - typedef IppStatus (CV_STDCALL* ippiResizeFunc)(const void*, int, const void*, int, IppiPoint, IppiSize, IppiBorderType, void*, void*, Ipp8u*); - typedef IppStatus (CV_STDCALL* ippiResizeGetBufferSize)(void*, IppiSize, Ipp32u, int*); - typedef IppStatus (CV_STDCALL* ippiResizeGetSrcOffset)(void*, IppiPoint, IppiPoint*); + typedef IppStatus (CV_STDCALL* ippicviResizeFunc)(const void*, int, const void*, int, IppiPoint, IppiSize, IppiBorderType, void*, void*, Ipp8u*); + typedef IppStatus (CV_STDCALL* ippicviResizeGetBufferSize)(void*, IppiSize, Ipp32u, int*); + typedef IppStatus (CV_STDCALL* ippicviResizeGetSrcOffset)(void*, IppiPoint, IppiPoint*); #endif #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - typedef IppStatus (CV_STDCALL* ippiSetFunc)(const void*, void *, int, IppiSize); - typedef IppStatus (CV_STDCALL* ippiWarpPerspectiveBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [3][3], int); - typedef IppStatus (CV_STDCALL* ippiWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int); + typedef IppStatus (CV_STDCALL* ippicviSetFunc)(const void*, void *, int, IppiSize); + typedef IppStatus (CV_STDCALL* ippicviWarpPerspectiveBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [3][3], int); + typedef IppStatus (CV_STDCALL* ippicviWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int); template - bool IPPSetSimple(cv::Scalar value, void *dataPointer, int step, IppiSize &size, ippiSetFunc func) + bool IPPSetSimple(cv::Scalar value, void *dataPointer, int step, IppiSize &size, ippicviSetFunc func) { Type values[channels]; for( int i = 0; i < channels; i++ ) @@ -82,11 +82,11 @@ namespace cv switch( depth ) { case CV_8U: - return ippiSet_8u_C1R((Ipp8u)value[0], (Ipp8u *)dataPointer, step, size) >= 0; + return ippicviSet_8u_C1R((Ipp8u)value[0], (Ipp8u *)dataPointer, step, size) >= 0; case CV_16U: - return ippiSet_16u_C1R((Ipp16u)value[0], (Ipp16u *)dataPointer, step, size) >= 0; + return ippicviSet_16u_C1R((Ipp16u)value[0], (Ipp16u *)dataPointer, step, size) >= 0; case CV_32F: - return ippiSet_32f_C1R((Ipp32f)value[0], (Ipp32f *)dataPointer, step, size) >= 0; + return ippicviSet_32f_C1R((Ipp32f)value[0], (Ipp32f *)dataPointer, step, size) >= 0; } } else @@ -96,11 +96,11 @@ namespace cv switch( depth ) { case CV_8U: - return IPPSetSimple<3, Ipp8u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_8u_C3R); + return IPPSetSimple<3, Ipp8u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_8u_C3R); case CV_16U: - return IPPSetSimple<3, Ipp16u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_16u_C3R); + return IPPSetSimple<3, Ipp16u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_16u_C3R); case CV_32F: - return IPPSetSimple<3, Ipp32f>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_32f_C3R); + return IPPSetSimple<3, Ipp32f>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_32f_C3R); } } else if( channels == 4 ) @@ -108,11 +108,11 @@ namespace cv switch( depth ) { case CV_8U: - return IPPSetSimple<4, Ipp8u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_8u_C4R); + return IPPSetSimple<4, Ipp8u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_8u_C4R); case CV_16U: - return IPPSetSimple<4, Ipp16u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_16u_C4R); + return IPPSetSimple<4, Ipp16u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_16u_C4R); case CV_32F: - return IPPSetSimple<4, Ipp32f>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_32f_C4R); + return IPPSetSimple<4, Ipp32f>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_32f_C4R); } } } @@ -1880,37 +1880,37 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec #define CHECK_IPP_STATUS(STATUS) if( STATUS!=ippStsNoErr ) { *ok = false; return;} #define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \ - func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ - CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ + func = (ippicviResizeFunc)ippicviResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ + CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ specBuf.allocate(specSize);\ pSpec = (uchar*)specBuf;\ - CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_32f*)pSpec)); + CHECK_IPP_STATUS(ippicviResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_32f*)pSpec)); #define SET_IPP_RESIZE_LINEAR_FUNC_64_PTR(TYPE, CN) \ if (mode==(int)ippCubic) { *ok = false; return;}\ - func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ - CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ + func = (ippicviResizeFunc)ippicviResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ + CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ specBuf.allocate(specSize);\ pSpec = (uchar*)specBuf;\ - CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_64f*)pSpec));\ - getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\ - getSrcOffsetFunc = (ippiResizeGetSrcOffset) ippiResizeGetBufferSize_##TYPE; + CHECK_IPP_STATUS(ippicviResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_64f*)pSpec));\ + getBufferSizeFunc = (ippicviResizeGetBufferSize)ippicviResizeGetBufferSize_##TYPE;\ + getSrcOffsetFunc = (ippicviResizeGetSrcOffset) ippicviResizeGetBufferSize_##TYPE; #define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \ - func = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ - CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ + func = (ippicviResizeFunc)ippicviResizeCubic_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ + CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ specBuf.allocate(specSize);\ pSpec = (uchar*)specBuf;\ AutoBuffer buf(initSize);\ uchar* pInit = (uchar*)buf;\ - CHECK_IPP_STATUS(ippiResizeCubicInit_##TYPE(srcSize, dstSize, 0.f, 0.75f, (IppiResizeSpec_32f*)pSpec, pInit)); + CHECK_IPP_STATUS(ippicviResizeCubicInit_##TYPE(srcSize, dstSize, 0.f, 0.75f, (IppiResizeSpec_32f*)pSpec, pInit)); #define SET_IPP_RESIZE_PTR(TYPE, CN) \ if (mode == (int)ippLinear) { SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN);}\ else if (mode == (int)ippCubic) { SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN);}\ else { *ok = false; return;}\ - getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\ - getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE; + getBufferSizeFunc = (ippicviResizeGetBufferSize)ippicviResizeGetBufferSize_##TYPE;\ + getSrcOffsetFunc = (ippicviResizeGetSrcOffset)ippicviResizeGetSrcOffset_##TYPE; #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701) class IPPresizeInvoker : @@ -1929,6 +1929,7 @@ public: dstSize.width = dst.cols; dstSize.height = dst.rows; +<<<<<<< HEAD switch (type) { case CV_8UC1: SET_IPP_RESIZE_PTR(8u,C1); break; @@ -1981,6 +1982,37 @@ public: *ok = false; } +======= + ~IPPresizeInvoker() + { + } + + virtual void operator() (const Range& range) const + { + if (*ok == false) return; + + int cn = src.channels(); + int dsty = min(cvRound(range.start * inv_scale_y), dst.rows); + int dstwidth = min(cvRound(src.cols * inv_scale_x), dst.cols); + int dstheight = min(cvRound(range.end * inv_scale_y), dst.rows); + + IppiPoint dstOffset = { 0, dsty }, srcOffset = {0, 0}; + IppiSize dstSize = { dstwidth, dstheight - dsty }; + int bufsize = 0, itemSize = (int)src.elemSize1(); + + CHECK_IPP_STATUS(getBufferSizeFunc(pSpec, dstSize, cn, &bufsize)); + CHECK_IPP_STATUS(getSrcOffsetFunc(pSpec, dstOffset, &srcOffset)); + + Ipp8u* pSrc = (Ipp8u*)src.data + (int)src.step[0] * srcOffset.y + srcOffset.x * cn * itemSize; + Ipp8u* pDst = (Ipp8u*)dst.data + (int)dst.step[0] * dstOffset.y + dstOffset.x * cn * itemSize; + + AutoBuffer buf(bufsize + 64); + uchar* bufptr = alignPtr((uchar*)buf, 32); + + if( func( pSrc, (int)src.step[0], pDst, (int)dst.step[0], dstOffset, dstSize, ippBorderRepl, 0, pSpec, bufptr ) < 0 ) + *ok = false; + } +>>>>>>> Prepare codes for ippicv library private: const Mat & src; Mat & dst; @@ -1989,9 +2021,9 @@ private: void *pSpec; AutoBuffer specBuf; int mode; - ippiResizeFunc func; - ippiResizeGetBufferSize getBufferSizeFunc; - ippiResizeGetSrcOffset getSrcOffsetFunc; + ippicviResizeFunc func; + ippicviResizeGetBufferSize getBufferSizeFunc; + ippicviResizeGetSrcOffset getSrcOffsetFunc; bool *ok; const IPPresizeInvoker& operator= (const IPPresizeInvoker&); }; @@ -4019,31 +4051,31 @@ class IPPwarpAffineInvoker : public ParallelLoopBody { public: - IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpAffineBackFunc _func, bool *_ok) : + IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippicviWarpAffineBackFunc _func, bool *_ok) : ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok) { *ok = true; } - virtual void operator() (const Range& range) const - { - IppiSize srcsize = { src.cols, src.rows }; - IppiRect srcroi = { 0, 0, src.cols, src.rows }; - IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start }; - int cnn = src.channels(); - if( borderType == BORDER_CONSTANT ) - { - IppiSize setSize = { dst.cols, range.end - range.start }; - void *dataPointer = dst.data + dst.step[0] * range.start; - if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) - { - *ok = false; - return; - } - } - if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr - *ok = false; - } + virtual void operator() (const Range& range) const + { + IppiSize srcsize = { src.cols, src.rows }; + IppiRect srcroi = { 0, 0, src.cols, src.rows }; + IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start }; + int cnn = src.channels(); + if( borderType == BORDER_CONSTANT ) + { + IppiSize setSize = { dst.cols, range.end - range.start }; + void *dataPointer = dst.data + dst.step[0] * range.start; + if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) + { + *ok = false; + return; + } + } + if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr + *ok = false; + } private: Mat &src; Mat &dst; @@ -4051,7 +4083,7 @@ private: int mode; int borderType; Scalar borderValue; - ippiWarpAffineBackFunc func; + ippicviWarpAffineBackFunc func; bool *ok; const IPPwarpAffineInvoker& operator= (const IPPwarpAffineInvoker&); }; @@ -4214,16 +4246,16 @@ void cv::warpAffine( InputArray _src, OutputArray _dst, ( borderType == cv::BORDER_TRANSPARENT || ( borderType == cv::BORDER_CONSTANT ) ) ) { int type = src.type(); - ippiWarpAffineBackFunc ippFunc = - type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R : - type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R : - type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R : - type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C1R : - type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C3R : - type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C4R : - type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C1R : - type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R : - type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R : + ippicviWarpAffineBackFunc ippFunc = + type == CV_8UC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C1R : + type == CV_8UC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C3R : + type == CV_8UC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C4R : + type == CV_16UC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C1R : + type == CV_16UC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C3R : + type == CV_16UC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C4R : + type == CV_32FC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C1R : + type == CV_32FC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C3R : + type == CV_32FC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C4R : 0; int mode = flags == INTER_LINEAR ? IPPI_INTER_LINEAR : @@ -4362,32 +4394,32 @@ class IPPwarpPerspectiveInvoker : public ParallelLoopBody { public: - IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpPerspectiveBackFunc _func, bool *_ok) : + IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippicviWarpPerspectiveBackFunc _func, bool *_ok) : ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok) { *ok = true; } - virtual void operator() (const Range& range) const - { - IppiSize srcsize = {src.cols, src.rows}; - IppiRect srcroi = {0, 0, src.cols, src.rows}; - IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start}; - int cnn = src.channels(); + virtual void operator() (const Range& range) const + { + IppiSize srcsize = {src.cols, src.rows}; + IppiRect srcroi = {0, 0, src.cols, src.rows}; + IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start}; + int cnn = src.channels(); - if( borderType == BORDER_CONSTANT ) - { - IppiSize setSize = {dst.cols, range.end - range.start}; - void *dataPointer = dst.data + dst.step[0] * range.start; - if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) - { - *ok = false; - return; - } - } - if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0) - *ok = false; - } + if( borderType == BORDER_CONSTANT ) + { + IppiSize setSize = {dst.cols, range.end - range.start}; + void *dataPointer = dst.data + dst.step[0] * range.start; + if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) + { + *ok = false; + return; + } + } + if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0) + *ok = false; + } private: Mat &src; Mat &dst; @@ -4395,7 +4427,7 @@ private: int mode; int borderType; const Scalar borderValue; - ippiWarpPerspectiveBackFunc func; + ippicviWarpPerspectiveBackFunc func; bool *ok; const IPPwarpPerspectiveInvoker& operator= (const IPPwarpPerspectiveInvoker&); }; @@ -4444,16 +4476,16 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0, ( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) ) { int type = src.type(); - ippiWarpPerspectiveBackFunc ippFunc = - type == CV_8UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C1R : - type == CV_8UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C3R : - type == CV_8UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C4R : - type == CV_16UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C1R : - type == CV_16UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C3R : - type == CV_16UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C4R : - type == CV_32FC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C1R : - type == CV_32FC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C3R : - type == CV_32FC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C4R : + ippicviWarpPerspectiveBackFunc ippFunc = + type == CV_8UC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C1R : + type == CV_8UC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C3R : + type == CV_8UC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C4R : + type == CV_16UC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C1R : + type == CV_16UC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C3R : + type == CV_16UC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C4R : + type == CV_32FC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C1R : + type == CV_32FC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C3R : + type == CV_32FC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C4R : 0; int mode = flags == INTER_LINEAR ? IPPI_INTER_LINEAR : diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 1dd0a252e8..bdbffd8975 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1149,26 +1149,26 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne _src = &temp; } //DEPRECATED. Allocates and initializes morphology state structure for erosion or dilation operation. - typedef IppStatus (CV_STDCALL* ippiMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **); - typedef IppStatus (CV_STDCALL* ippiMorphologyBorderReplicateFunc)(const void*, int, void *, int, + typedef IppStatus (CV_STDCALL* ippicviMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **); + typedef IppStatus (CV_STDCALL* ippicviMorphologyBorderReplicateFunc)(const void*, int, void *, int, IppiSize, IppiBorderType, IppiMorphState *); - typedef IppStatus (CV_STDCALL* ippiFilterMinMaxGetBufferSizeFunc)(int, IppiSize, int*); - typedef IppStatus (CV_STDCALL* ippiFilterMinMaxBorderReplicateFunc)(const void*, int, void*, int, + typedef IppStatus (CV_STDCALL* ippicviFilterMinMaxGetBufferSizeFunc)(int, IppiSize, int*); + typedef IppStatus (CV_STDCALL* ippicviFilterMinMaxBorderReplicateFunc)(const void*, int, void*, int, IppiSize, IppiSize, IppiPoint, void*); - ippiMorphologyInitAllocFunc initAllocFunc = 0; - ippiMorphologyBorderReplicateFunc morphFunc = 0; - ippiFilterMinMaxGetBufferSizeFunc getBufSizeFunc = 0; - ippiFilterMinMaxBorderReplicateFunc morphRectFunc = 0; + ippicviMorphologyInitAllocFunc initAllocFunc = 0; + ippicviMorphologyBorderReplicateFunc morphFunc = 0; + ippicviFilterMinMaxGetBufferSizeFunc getBufSizeFunc = 0; + ippicviFilterMinMaxBorderReplicateFunc morphRectFunc = 0; #define IPP_MORPH_CASE(type, flavor) \ case type: \ - initAllocFunc = (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_##flavor; \ - morphFunc = op == MORPH_ERODE ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_##flavor : \ - (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_##flavor; \ - getBufSizeFunc = (ippiFilterMinMaxGetBufferSizeFunc)ippiFilterMinGetBufferSize_##flavor; \ - morphRectFunc = op == MORPH_ERODE ? (ippiFilterMinMaxBorderReplicateFunc)ippiFilterMinBorderReplicate_##flavor : \ - (ippiFilterMinMaxBorderReplicateFunc)ippiFilterMaxBorderReplicate_##flavor; \ + initAllocFunc = (ippicviMorphologyInitAllocFunc)ippicviMorphologyInitAlloc_##flavor; \ + morphFunc = op == MORPH_ERODE ? (ippicviMorphologyBorderReplicateFunc)ippicviErodeBorderReplicate_##flavor : \ + (ippicviMorphologyBorderReplicateFunc)ippicviDilateBorderReplicate_##flavor; \ + getBufSizeFunc = (ippicviFilterMinMaxGetBufferSizeFunc)ippicviFilterMinGetBufferSize_##flavor; \ + morphRectFunc = op == MORPH_ERODE ? (ippicviFilterMinMaxBorderReplicateFunc)ippicviFilterMinBorderReplicate_##flavor : \ + (ippicviFilterMinMaxBorderReplicateFunc)ippicviFilterMaxBorderReplicate_##flavor; \ break switch( type ) @@ -1196,7 +1196,7 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne bool is_ok = morphFunc( _src->data, (int)_src->step[0], dst.data, (int)dst.step[0], roiSize, ippBorderRepl, pState ) >= 0; - ippiMorphologyFree(pState); + ippicviMorphologyFree(pState); return is_ok; } else if( rectKernel && morphRectFunc && getBufSizeFunc ) diff --git a/modules/imgproc/src/samplers.cpp b/modules/imgproc/src/samplers.cpp index d6cc8a56fe..81bbf7656d 100644 --- a/modules/imgproc/src/samplers.cpp +++ b/modules/imgproc/src/samplers.cpp @@ -375,7 +375,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center, Mat patch = _patch.getMat(); #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step, + typedef IppStatus (CV_STDCALL *ippicviGetRectSubPixFunc)( const void* src, int src_step, IppiSize src_size, void* dst, int dst_step, IppiSize win_size, IppiPoint_32f center, @@ -385,10 +385,10 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center, IppiPoint_32f icenter = {center.x, center.y}; IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows}; int srctype = image.type(); - ippiGetRectSubPixFunc ippfunc = - srctype == CV_8UC1 && ddepth == CV_8U ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R : - srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R : - srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0; + ippicviGetRectSubPixFunc ippfunc = + srctype == CV_8UC1 && ddepth == CV_8U ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_8u_C1R : + srctype == CV_8UC1 && ddepth == CV_32F ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_8u32f_C1R : + srctype == CV_32FC1 && ddepth == CV_32F ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_32f_C1R : 0; if( ippfunc && ippfunc(image.data, (int)image.step, src_size, patch.data, (int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 ) diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 6a18af5c2d..28fbb42f47 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -1115,14 +1115,16 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize, Mat src = _src.getMat(), dst = _dst.getMat(); IppiSize roi = { src.cols, src.rows }; int bufSize = 0; - ippiFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize); - AutoBuffer buf(bufSize+128); - if( ippiFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step, - (Ipp32f *)dst.data, (int)dst.step, - roi, ksize.width, (Ipp32f)sigma1, - (IppiBorderType)borderType, 0.0, - alignPtr(&buf[0],32)) >= 0 ) - return; + if (ippStsNoErr == ippicviFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize)) + { + AutoBuffer buf(bufSize+128); + if( ippicviFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step, + (Ipp32f *)dst.data, (int)dst.step, + roi, ksize.width, (Ipp32f)sigma1, + (IppiBorderType)borderType, 0.0, + alignPtr(&buf[0],32)) >= 0 ) + return; + } } #endif @@ -2180,11 +2182,19 @@ public: IppiSize kernel = {d, d}; IppiSize roi={dst.cols, range.end - range.start}; int bufsize=0; - ippiFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize); + if (ippStsNoErr != ippicviFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize)) + { + *ok = false; + return; + } AutoBuffer buf(bufsize); IppiFilterBilateralSpec *pSpec = (IppiFilterBilateralSpec *)alignPtr(&buf[0], 32); - ippiFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, (Ipp32f)sigma_color, (Ipp32f)sigma_space, 1, pSpec ); - if( ippiFilterBilateral_8u_C1R( src.ptr(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr(range.start), (int)dst.step[0], roi, kernel, pSpec ) < 0) + if (ippStsNoErr != ippicviFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, (Ipp32f)sigma_color, (Ipp32f)sigma_space, 1, pSpec )) + { + *ok = false; + return; + } + if( ippicviFilterBilateral_8u_C1R( src.ptr(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr(range.start), (int)dst.step[0], roi, kernel, pSpec ) < 0) *ok = false; } private: diff --git a/modules/imgproc/src/sumpixels.cpp b/modules/imgproc/src/sumpixels.cpp index 4e18f119fa..d7bf9a0bfc 100644 --- a/modules/imgproc/src/sumpixels.cpp +++ b/modules/imgproc/src/sumpixels.cpp @@ -44,7 +44,7 @@ #include "opencl_kernels.hpp" #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) -static IppStatus sts = ippInit(); +static IppStatus sts = ippicvInit(); #endif namespace cv @@ -365,30 +365,32 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) if( ( depth == CV_8U ) && ( sdepth == CV_32F || sdepth == CV_32S ) && ( !_tilted.needed() ) && ( !_sqsum.needed() || sqdepth == CV_64F ) && ( cn == 1 ) ) { + IppStatus status; IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); if( sdepth == CV_32F ) { if( _sqsum.needed() ) { - ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); + status = ippicviSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); } else { - ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 ); + status = ippicviIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 ); } } - else if( sdepth == CV_32S ) + else// if( sdepth == CV_32S ) { if( _sqsum.needed() ) { - ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); + status = ippicviSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); } else { - ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 ); + status = ippicviIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 ); } } - return; + if (ippStsNoErr == status) + return; } #endif diff --git a/modules/objdetect/src/haar.cpp b/modules/objdetect/src/haar.cpp index 2f864797fb..2f954abece 100644 --- a/modules/objdetect/src/haar.cpp +++ b/modules/objdetect/src/haar.cpp @@ -165,7 +165,7 @@ icvReleaseHidHaarClassifierCascade( CvHidHaarClassifierCascade** _cascade ) for( i = 0; i < cascade->count; i++ ) { if( cascade->ipp_stages[i] ) - ippiHaarClassifierFree_32f( (IppiHaarClassifier_32f*)cascade->ipp_stages[i] ); + ippicviHaarClassifierFree_32f( (IppiHaarClassifier_32f*)cascade->ipp_stages[i] ); } } cvFree( &cascade->ipp_stages ); @@ -1318,7 +1318,7 @@ public: if( cascade->hid_cascade->ipp_stages ) { IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height}; - ippiRectStdDev_32f_C1R(sum1.ptr(y1), sum1.step, + ippicviRectStdDev_32f_C1R(sum1.ptr(y1), sum1.step, sqsum1.ptr(y1), sqsum1.step, norm1->ptr(y1), norm1->step, ippiSize(ssz.width, ssz.height), iequRect ); @@ -1340,7 +1340,7 @@ public: for( int j = 0; j < cascade->count; j++ ) { - if( ippiApplyHaarClassifier_32f_C1R( + if( ippicviApplyHaarClassifier_32f_C1R( sum1.ptr(y1), sum1.step, norm1->ptr(y1), norm1->step, mask1->ptr(y1), mask1->step,