Prepare codes for ippicv library

This commit is contained in:
vbystricky 2014-03-21 15:27:56 +04:00
parent c2f859569c
commit 01a66a2938
19 changed files with 913 additions and 748 deletions

View File

@ -917,9 +917,14 @@ endif(DEFINED WITH_INTELPERC)
status("") status("")
status(" Other third-party libraries:") status(" Other third-party libraries:")
<<<<<<< HEAD
if((WITH_IPP OR WITH_ICV) AND HAVE_IPP) 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(" Use IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]")
status(" at:" "${IPP_ROOT_DIR}") 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() else()
status(" Use IPP:" (WITH_IPP OR WITH_ICV) AND NOT HAVE_IPP THEN "IPP not found" ELSE NO) status(" Use IPP:" (WITH_IPP OR WITH_ICV) AND NOT HAVE_IPP THEN "IPP not found" ELSE NO)
endif() endif()

View File

@ -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 # installation/package
# #
# Windows host: # Windows host:
@ -19,10 +19,10 @@
# IPP_ROOT_DIR - root of IPP installation # IPP_ROOT_DIR - root of IPP installation
# IPP_INCLUDE_DIRS - IPP include folder # IPP_INCLUDE_DIRS - IPP include folder
# IPP_LIBRARIES - IPP libraries that are used by OpenCV # IPP_LIBRARIES - IPP libraries that are used by OpenCV
# IPP_VERSION_STR - string with the newest detected IPP version # IPP_FOUND - True if Intel IPP found
# IPP_VERSION_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD) # IPP_INCLUDE_DIR - IPP include folder
# IPP_VERSION_MINOR # IPP_LIBRARY_DIR - IPP libraries folder
# IPP_VERSION_BUILD # IPP_LIBRARIES - IPP libraries names that are used by OpenCV
# #
# Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com) # 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_get_version(${IPP_ROOT_DIR})
ipp_set_variables(${IPP_VERSION_STR}) 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() 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) if(WIN32 AND MINGW AND NOT IPP_VERSION_MAJOR LESS 7)
# Since IPP built with Microsoft compiler and /GS option # 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(MSV_NTDLL "ntdll")
set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_NTDLL}${IPP_LIB_SUFFIX}) set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_NTDLL}${IPP_LIB_SUFFIX})
endif() 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

View File

@ -458,9 +458,12 @@ static void add8u( const uchar* src1, size_t step1,
const uchar* src2, size_t step2, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<uchar, OpAdd<uchar>, IF_SIMD(VAdd<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0))
return;
#endif
(vBinOp<uchar, OpAdd<uchar>, IF_SIMD(VAdd<uchar>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void add8s( const schar* src1, size_t step1, 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, const ushort* src2, size_t step2,
ushort* dst, size_t step, Size sz, void* ) ushort* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<ushort, OpAdd<ushort>, IF_SIMD(VAdd<ushort>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0))
return;
#endif
(vBinOp<ushort, OpAdd<ushort>, IF_SIMD(VAdd<ushort>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void add16s( const short* src1, size_t step1, static void add16s( const short* src1, size_t step1,
const short* src2, size_t step2, const short* src2, size_t step2,
short* dst, size_t step, Size sz, void* ) short* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<short, OpAdd<short>, IF_SIMD(VAdd<short>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0))
return;
#endif
(vBinOp<short, OpAdd<short>, IF_SIMD(VAdd<short>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void add32s( const int* src1, size_t step1, 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, const float* src2, size_t step2,
float* dst, size_t step, Size sz, void* ) float* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp32<float, OpAdd<float>, IF_SIMD(VAdd<float>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp32<float, OpAdd<float>, IF_SIMD(VAdd<float>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void add64f( const double* src1, size_t step1, 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, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<uchar, OpSub<uchar>, IF_SIMD(VSub<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0))
return;
#endif
(vBinOp<uchar, OpSub<uchar>, IF_SIMD(VSub<uchar>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void sub8s( const schar* src1, size_t step1, 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, const ushort* src2, size_t step2,
ushort* dst, size_t step, Size sz, void* ) ushort* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<ushort, OpSub<ushort>, IF_SIMD(VSub<ushort>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0))
return;
#endif
(vBinOp<ushort, OpSub<ushort>, IF_SIMD(VSub<ushort>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void sub16s( const short* src1, size_t step1, static void sub16s( const short* src1, size_t step1,
const short* src2, size_t step2, const short* src2, size_t step2,
short* dst, size_t step, Size sz, void* ) short* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<short, OpSub<short>, IF_SIMD(VSub<short>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0))
return;
#endif
(vBinOp<short, OpSub<short>, IF_SIMD(VSub<short>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void sub32s( const int* src1, size_t step1, 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, const float* src2, size_t step2,
float* dst, size_t step, Size sz, void* ) float* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp32<float, OpSub<float>, IF_SIMD(VSub<float>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp32<float, OpSub<float>, IF_SIMD(VSub<float>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void sub64f( const double* src1, size_t step1, 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* ) uchar* dst, size_t step, Size sz, void* )
{ {
#if (ARITHM_USE_IPP == 1) #if (ARITHM_USE_IPP == 1)
{
uchar* s1 = (uchar*)src1; uchar* s1 = (uchar*)src1;
uchar* s2 = (uchar*)src2; uchar* s2 = (uchar*)src2;
uchar* d = dst; uchar* d = dst;
fixSteps(sz, sizeof(dst[0]), step1, step2, step); 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); if (0 > ippicvsMaxEvery_8u(s1, s2, d, sz.width))
s1 += step1; break;
s2 += step2; s1 += step1;
d += step; s2 += step2;
d += step;
} }
} if (i == sz.height)
#else return;
vBinOp<uchar, OpMax<uchar>, IF_SIMD(VMax<uchar>)>(src1, step1, src2, step2, dst, step, sz);
#endif #endif
vBinOp<uchar, OpMax<uchar>, IF_SIMD(VMax<uchar>)>(src1, step1, src2, step2, dst, step, sz);
// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step);
// ippiMaxEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz),
// (vBinOp8<uchar, OpMax<uchar>, IF_SIMD(_VMax8u)>(src1, step1, src2, step2, dst, step, sz)));
} }
static void max8s( const schar* src1, size_t step1, 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* ) ushort* dst, size_t step, Size sz, void* )
{ {
#if (ARITHM_USE_IPP == 1) #if (ARITHM_USE_IPP == 1)
{
ushort* s1 = (ushort*)src1; ushort* s1 = (ushort*)src1;
ushort* s2 = (ushort*)src2; ushort* s2 = (ushort*)src2;
ushort* d = dst; ushort* d = dst;
fixSteps(sz, sizeof(dst[0]), step1, step2, step); 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); if (0 > ippicvsMaxEvery_16u(s1, s2, d, sz.width))
s1 = (ushort*)((uchar*)s1 + step1); break;
s2 = (ushort*)((uchar*)s2 + step2); s1 = (ushort*)((uchar*)s1 + step1);
d = (ushort*)((uchar*)d + step); s2 = (ushort*)((uchar*)s2 + step2);
d = (ushort*)((uchar*)d + step);
} }
} if (i == sz.height)
#else return;
vBinOp<ushort, OpMax<ushort>, IF_SIMD(VMax<ushort>)>(src1, step1, src2, step2, dst, step, sz);
#endif #endif
vBinOp<ushort, OpMax<ushort>, IF_SIMD(VMax<ushort>)>(src1, step1, src2, step2, dst, step, sz);
// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step);
// ippiMaxEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz),
// (vBinOp16<ushort, OpMax<ushort>, IF_SIMD(_VMax16u)>(src1, step1, src2, step2, dst, step, sz)));
} }
static void max16s( const short* src1, size_t step1, 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* ) float* dst, size_t step, Size sz, void* )
{ {
#if (ARITHM_USE_IPP == 1) #if (ARITHM_USE_IPP == 1)
{
float* s1 = (float*)src1; float* s1 = (float*)src1;
float* s2 = (float*)src2; float* s2 = (float*)src2;
float* d = dst; float* d = dst;
fixSteps(sz, sizeof(dst[0]), step1, step2, step); 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); if (0 > ippicvsMaxEvery_32f(s1, s2, d, sz.width))
s1 = (float*)((uchar*)s1 + step1); break;
s2 = (float*)((uchar*)s2 + step2); s1 = (float*)((uchar*)s1 + step1);
d = (float*)((uchar*)d + step); s2 = (float*)((uchar*)s2 + step2);
d = (float*)((uchar*)d + step);
} }
} if (i == sz.height)
#else return;
vBinOp32<float, OpMax<float>, IF_SIMD(VMax<float>)>(src1, step1, src2, step2, dst, step, sz);
#endif #endif
// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); vBinOp32<float, OpMax<float>, IF_SIMD(VMax<float>)>(src1, step1, src2, step2, dst, step, sz);
// ippiMaxEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz),
// (vBinOp32f<OpMax<float>, IF_SIMD(_VMax32f)>(src1, step1, src2, step2, dst, step, sz)));
} }
static void max64f( const double* src1, size_t step1, 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* ) uchar* dst, size_t step, Size sz, void* )
{ {
#if (ARITHM_USE_IPP == 1) #if (ARITHM_USE_IPP == 1)
{
uchar* s1 = (uchar*)src1; uchar* s1 = (uchar*)src1;
uchar* s2 = (uchar*)src2; uchar* s2 = (uchar*)src2;
uchar* d = dst; uchar* d = dst;
fixSteps(sz, sizeof(dst[0]), step1, step2, step); 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); if (0 > ippicvsMinEvery_8u(s1, s2, d, sz.width))
s1 += step1; break;
s2 += step2; s1 += step1;
d += step; s2 += step2;
d += step;
} }
} if (i == sz.height)
#else return;
vBinOp<uchar, OpMin<uchar>, IF_SIMD(VMin<uchar>)>(src1, step1, src2, step2, dst, step, sz);
#endif #endif
vBinOp<uchar, OpMin<uchar>, IF_SIMD(VMin<uchar>)>(src1, step1, src2, step2, dst, step, sz);
// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step);
// ippiMinEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz),
// (vBinOp8<uchar, OpMin<uchar>, IF_SIMD(_VMin8u)>(src1, step1, src2, step2, dst, step, sz)));
} }
static void min8s( const schar* src1, size_t step1, 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* ) ushort* dst, size_t step, Size sz, void* )
{ {
#if (ARITHM_USE_IPP == 1) #if (ARITHM_USE_IPP == 1)
{
ushort* s1 = (ushort*)src1; ushort* s1 = (ushort*)src1;
ushort* s2 = (ushort*)src2; ushort* s2 = (ushort*)src2;
ushort* d = dst; ushort* d = dst;
fixSteps(sz, sizeof(dst[0]), step1, step2, step); 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); if (0 > ippicvsMinEvery_16u(s1, s2, d, sz.width))
s1 = (ushort*)((uchar*)s1 + step1); break;
s2 = (ushort*)((uchar*)s2 + step2); s1 = (ushort*)((uchar*)s1 + step1);
d = (ushort*)((uchar*)d + step); s2 = (ushort*)((uchar*)s2 + step2);
d = (ushort*)((uchar*)d + step);
} }
} if (i == sz.height)
#else return;
vBinOp<ushort, OpMin<ushort>, IF_SIMD(VMin<ushort>)>(src1, step1, src2, step2, dst, step, sz);
#endif #endif
vBinOp<ushort, OpMin<ushort>, IF_SIMD(VMin<ushort>)>(src1, step1, src2, step2, dst, step, sz);
// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step);
// ippiMinEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz),
// (vBinOp16<ushort, OpMin<ushort>, IF_SIMD(_VMin16u)>(src1, step1, src2, step2, dst, step, sz)));
} }
static void min16s( const short* src1, size_t step1, 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* ) float* dst, size_t step, Size sz, void* )
{ {
#if (ARITHM_USE_IPP == 1) #if (ARITHM_USE_IPP == 1)
{
float* s1 = (float*)src1; float* s1 = (float*)src1;
float* s2 = (float*)src2; float* s2 = (float*)src2;
float* d = dst; float* d = dst;
fixSteps(sz, sizeof(dst[0]), step1, step2, step); 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); if (0 > ippicvsMinEvery_32f(s1, s2, d, sz.width))
s1 = (float*)((uchar*)s1 + step1); break;
s2 = (float*)((uchar*)s2 + step2); s1 = (float*)((uchar*)s1 + step1);
d = (float*)((uchar*)d + step); s2 = (float*)((uchar*)s2 + step2);
d = (float*)((uchar*)d + step);
} }
} if (i == sz.height)
#else return;
vBinOp32<float, OpMin<float>, IF_SIMD(VMin<float>)>(src1, step1, src2, step2, dst, step, sz);
#endif #endif
// IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); vBinOp32<float, OpMin<float>, IF_SIMD(VMin<float>)>(src1, step1, src2, step2, dst, step, sz);
// ippiMinEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz),
// (vBinOp32f<OpMin<float>, IF_SIMD(_VMin32f)>(src1, step1, src2, step2, dst, step, sz)));
} }
static void min64f( const double* src1, size_t step1, 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, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<uchar, OpAbsDiff<uchar>, IF_SIMD(VAbsDiff<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp<uchar, OpAbsDiff<uchar>, IF_SIMD(VAbsDiff<uchar>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void absdiff8s( const schar* src1, size_t step1, 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, const ushort* src2, size_t step2,
ushort* dst, size_t step, Size sz, void* ) ushort* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<ushort, OpAbsDiff<ushort>, IF_SIMD(VAbsDiff<ushort>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp<ushort, OpAbsDiff<ushort>, IF_SIMD(VAbsDiff<ushort>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void absdiff16s( const short* src1, size_t step1, 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, const float* src2, size_t step2,
float* dst, size_t step, Size sz, void* ) float* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp32<float, OpAbsDiff<float>, IF_SIMD(VAbsDiff<float>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp32<float, OpAbsDiff<float>, IF_SIMD(VAbsDiff<float>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void absdiff64f( const double* src1, size_t step1, 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, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<uchar, OpAnd<uchar>, IF_SIMD(VAnd<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp<uchar, OpAnd<uchar>, IF_SIMD(VAnd<uchar>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void or8u( const uchar* src1, size_t step1, static void or8u( const uchar* src1, size_t step1,
const uchar* src2, size_t step2, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<uchar, OpOr<uchar>, IF_SIMD(VOr<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp<uchar, OpOr<uchar>, IF_SIMD(VOr<uchar>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void xor8u( const uchar* src1, size_t step1, static void xor8u( const uchar* src1, size_t step1,
const uchar* src2, size_t step2, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); #if (ARITHM_USE_IPP == 1)
ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step);
(vBinOp<uchar, OpXor<uchar>, IF_SIMD(VXor<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp<uchar, OpXor<uchar>, IF_SIMD(VXor<uchar>)>(src1, step1, src2, step2, dst, step, sz));
} }
static void not8u( const uchar* src1, size_t step1, static void not8u( const uchar* src1, size_t step1,
const uchar* src2, size_t step2, const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz, void* ) uchar* dst, size_t step, Size sz, void* )
{ {
IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void *)src2; #if (ARITHM_USE_IPP == 1)
ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, (IppiSize&)sz), fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void *)src2;
(vBinOp<uchar, OpNot<uchar>, IF_SIMD(VNot<uchar>)>(src1, step1, src2, step2, dst, step, sz))); if (0 <= ippicviNot_8u_C1R(src1, (int)step1, dst, (int)step, (IppiSize&)sz))
return;
#endif
(vBinOp<uchar, OpNot<uchar>, IF_SIMD(VNot<uchar>)>(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 ) if( op >= 0 )
{ {
fixSteps(size, sizeof(dst[0]), step1, step2, step); 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; return;
} }
#endif #endif
@ -2440,7 +2469,7 @@ static void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t
if( op >= 0 ) if( op >= 0 )
{ {
fixSteps(size, sizeof(dst[0]), step1, step2, step); 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; return;
} }
#endif #endif
@ -2455,7 +2484,7 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st
if( op > 0 ) if( op > 0 )
{ {
fixSteps(size, sizeof(dst[0]), step1, step2, step); 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; return;
} }
#endif #endif
@ -2561,7 +2590,7 @@ static void cmp32f(const float* src1, size_t step1, const float* src2, size_t st
if( op >= 0 ) if( op >= 0 )
{ {
fixSteps(size, sizeof(dst[0]), step1, step2, step); 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; return;
} }
#endif #endif

View File

@ -466,56 +466,56 @@ template<> struct DFT_VecR4<float>
#endif #endif
#ifdef USE_IPP_DFT #ifdef USE_IPP_DFT
static void ippsDFTFwd_CToC( const Complex<float>* src, Complex<float>* dst, static void ippicvsDFTFwd_CToC( const Complex<float>* src, Complex<float>* dst,
const void* spec, uchar* buf) 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); (const IppsDFTSpec_C_32fc*)spec, buf);
} }
static void ippsDFTFwd_CToC( const Complex<double>* src, Complex<double>* dst, static void ippicvsDFTFwd_CToC( const Complex<double>* src, Complex<double>* dst,
const void* spec, uchar* buf) 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); (const IppsDFTSpec_C_64fc*)spec, buf);
} }
static void ippsDFTInv_CToC( const Complex<float>* src, Complex<float>* dst, static void ippicvsDFTInv_CToC( const Complex<float>* src, Complex<float>* dst,
const void* spec, uchar* buf) 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); (const IppsDFTSpec_C_32fc*)spec, buf);
} }
static void ippsDFTInv_CToC( const Complex<double>* src, Complex<double>* dst, static void ippicvsDFTInv_CToC( const Complex<double>* src, Complex<double>* dst,
const void* spec, uchar* buf) 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); (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) 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) 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) 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) 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 #endif
@ -551,9 +551,9 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
if( spec ) if( spec )
{ {
if( !inv ) if( !inv )
ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf ); ippicvsDFTFwd_CToC( src, dst, spec, (uchar*)buf );
else else
ippsDFTInv_CToC( src, dst, spec, (uchar*)buf ); ippicvsDFTInv_CToC( src, dst, spec, (uchar*)buf );
return; return;
} }
#endif #endif
@ -981,7 +981,7 @@ RealDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab,
#ifdef USE_IPP_DFT #ifdef USE_IPP_DFT
if( spec ) if( spec )
{ {
ippsDFTFwd_RToPack( src, dst, spec, (uchar*)buf ); ippicvsDFTFwd_RToPack( src, dst, spec, (uchar*)buf );
if( complex_output ) if( complex_output )
{ {
dst[-1] = dst[0]; 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 #ifdef USE_IPP_DFT
if( spec ) if( spec )
{ {
ippsDFTInv_PackToR( src, dst, spec, (uchar*)buf ); ippicvsDFTInv_PackToR( src, dst, spec, (uchar*)buf );
goto finalize; goto finalize;
} }
#endif #endif
@ -1824,26 +1824,26 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
{ {
if( depth == CV_32F ) if( depth == CV_32F )
{ {
getSizeFunc = ippsDFTGetSize_R_32f; getSizeFunc = ippicvsDFTGetSize_R_32f;
initFunc = (IppDFTInitFunc)ippsDFTInit_R_32f; initFunc = (IppDFTInitFunc)ippicvsDFTInit_R_32f;
} }
else else
{ {
getSizeFunc = ippsDFTGetSize_R_64f; getSizeFunc = ippicvsDFTGetSize_R_64f;
initFunc = (IppDFTInitFunc)ippsDFTInit_R_64f; initFunc = (IppDFTInitFunc)ippicvsDFTInit_R_64f;
} }
} }
else else
{ {
if( depth == CV_32F ) if( depth == CV_32F )
{ {
getSizeFunc = ippsDFTGetSize_C_32fc; getSizeFunc = ippicvsDFTGetSize_C_32fc;
initFunc = (IppDFTInitFunc)ippsDFTInit_C_32fc; initFunc = (IppDFTInitFunc)ippicvsDFTInit_C_32fc;
} }
else else
{ {
getSizeFunc = ippsDFTGetSize_C_64fc; getSizeFunc = ippicvsDFTGetSize_C_64fc;
initFunc = (IppDFTInitFunc)ippsDFTInit_C_64fc; initFunc = (IppDFTInitFunc)ippicvsDFTInit_C_64fc;
} }
} }
if( getSizeFunc(len, ipp_norm_flag, ippAlgHintNone, &specsize, &initsize, &worksize) >= 0 ) if( getSizeFunc(len, ipp_norm_flag, ippAlgHintNone, &specsize, &initsize, &worksize) >= 0 )

View File

@ -812,8 +812,6 @@ typedef union
} }
DBLINT; DBLINT;
#ifndef HAVE_IPP
#define EXPTAB_SCALE 6 #define EXPTAB_SCALE 6
#define EXPTAB_MASK ((1 << EXPTAB_SCALE) - 1) #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_postscale = 1./(1 << EXPTAB_SCALE);
static const double exp_max_val = 3000.*(1 << EXPTAB_SCALE); // log10(DBL_MAX) < 3000 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 static const float
A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0), 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 static const double
A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0, A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0,
@ -1275,13 +1273,26 @@ static void Exp_64f( const double *_x, double *y, int n )
#undef EXPTAB_MASK #undef EXPTAB_MASK
#undef EXPPOLY_32F_A0 #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 #else
#define Exp_32f Exp_32fnoipp
#define Exp_32f ippsExp_32f_A21 #define Exp_64f Exp_64fnoipp
#define Exp_64f ippsExp_64f_A50
#endif #endif
void exp( InputArray _src, OutputArray _dst ) void exp( InputArray _src, OutputArray _dst )
{ {
int type = _src.type(), depth = _src.depth(), cn = _src.channels(); 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 ) for( size_t i = 0; i < it.nplanes; i++, ++it )
{ {
if( depth == CV_32F ) 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 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 * * L O G *
\****************************************************************************************/ \****************************************************************************************/
#ifndef HAVE_IPP
#define LOGTAB_SCALE 8 #define LOGTAB_SCALE 8
#define LOGTAB_MASK ((1 << LOGTAB_SCALE) - 1) #define LOGTAB_MASK ((1 << LOGTAB_SCALE) - 1)
#define LOGTAB_MASK2 ((1 << (20 - 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]) #define LOGTAB_TRANSLATE(x,h) (((x) - 1.)*icvLogTab[(h)+1])
static const double ln_2 = 0.69314718055994530941723212145818; 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 shift[] = { 0, -1.f/512 };
static const float 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 shift[] = { 0, -1./512 };
static const double 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 #else
#define Log_32f Log_32fnoipp
#define Log_32f ippsLn_32f_A21 #define Log_64f Log_64fnoipp
#define Log_64f ippsLn_64f_A50
#endif #endif
void log( InputArray _src, OutputArray _dst ) void log( InputArray _src, OutputArray _dst )

View File

@ -44,9 +44,9 @@
#include "opencl_kernels.hpp" #include "opencl_kernels.hpp"
#include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp" #include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp"
#ifdef HAVE_IPP //#ifdef HAVE_IPP
#include "ippversion.h" //#include "ippversion.h"
#endif //#endif
namespace cv namespace cv
{ {
@ -2803,7 +2803,7 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len)
{ {
double r = 0; double r = 0;
#if ARITHM_USE_IPP #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])), src2, (int)(len*sizeof(src2[0])),
ippiSize(len, 1), &r); ippiSize(len, 1), &r);
return 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) static double dotProd_16u(const ushort* src1, const ushort* src2, int len)
{ {
#if (ARITHM_USE_IPP == 1)
double r = 0; double r = 0;
IF_IPP(ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), if (0 <= ippicviDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
src2, (int)(len*sizeof(src2[0])), return r;
ippiSize(len, 1), &r), #endif
r = dotProd_(src1, src2, len)); return dotProd_(src1, src2, len);
return r;
} }
static double dotProd_16s(const short* src1, const short* src2, int len) static double dotProd_16s(const short* src1, const short* src2, int len)
{ {
#if (ARITHM_USE_IPP == 1)
double r = 0; double r = 0;
IF_IPP(ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), if (0 <= ippicviDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
src2, (int)(len*sizeof(src2[0])), return r;
ippiSize(len, 1), &r), #endif
r = dotProd_(src1, src2, len)); return dotProd_(src1, src2, len);
return r;
} }
static double dotProd_32s(const int* src1, const int* src2, int len) static double dotProd_32s(const int* src1, const int* src2, int len)
{ {
#if (ARITHM_USE_IPP == 1)
double r = 0; double r = 0;
IF_IPP(ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), if (0 <= ippicviDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r))
src2, (int)(len*sizeof(src2[0])), return r;
ippiSize(len, 1), &r), #endif
r = dotProd_(src1, src2, len)); return dotProd_(src1, src2, len);
return r;
} }
static double dotProd_32f(const float* src1, const float* src2, int len) static double dotProd_32f(const float* src1, const float* src2, int len)
{ {
#if (ARITHM_USE_IPP == 1)
double r = 0; double r = 0;
IF_IPP(ippsDotProd_32f64f(src1, src2, len, &r), if (0 <= ippicvsDotProd_32f64f(src1, src2, len, &r))
r = dotProd_(src1, src2, len)); return r;
return r; #endif
return dotProd_(src1, src2, len);
} }
static double dotProd_64f(const double* src1, const double* src2, int len) static double dotProd_64f(const double* src1, const double* src2, int len)
{ {
#if (ARITHM_USE_IPP == 1)
double r = 0; double r = 0;
IF_IPP(ippsDotProd_64f(src1, src2, len, &r), if (0 <= ippicvsDotProd_64f(src1, src2, len, &r))
r = dotProd_(src1, src2, len)); return r;
return r; #endif
return dotProd_(src1, src2, len);
} }

View File

@ -199,10 +199,8 @@ enum { BLOCK_SIZE = 1024 };
#if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7) #if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7)
#define ARITHM_USE_IPP 1 #define ARITHM_USE_IPP 1
#define IF_IPP(then_call, else_call) then_call
#else #else
#define ARITHM_USE_IPP 0 #define ARITHM_USE_IPP 0
#define IF_IPP(then_call, else_call) else_call
#endif #endif
inline bool checkScalar(const Mat& sc, int atype, int sckind, int akind) inline bool checkScalar(const Mat& sc, int atype, int sckind, int akind)

View File

@ -551,23 +551,23 @@ cv::Scalar cv::sum( InputArray _src )
{ {
IppiSize sz = { cols, rows }; IppiSize sz = { cols, rows };
int type = src.type(); int type = src.type();
typedef IppStatus (CV_STDCALL* ippiSumFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); typedef IppStatus (CV_STDCALL* ippicviSumFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm);
typedef IppStatus (CV_STDCALL* ippiSumFuncNoHint)(const void*, int, IppiSize, double *); typedef IppStatus (CV_STDCALL* ippicviSumFuncNoHint)(const void*, int, IppiSize, double *);
ippiSumFuncHint ippFuncHint = ippicviSumFuncHint ippFuncHint =
type == CV_32FC1 ? (ippiSumFuncHint)ippiSum_32f_C1R : type == CV_32FC1 ? (ippicviSumFuncHint)ippicviSum_32f_C1R :
type == CV_32FC3 ? (ippiSumFuncHint)ippiSum_32f_C3R : type == CV_32FC3 ? (ippicviSumFuncHint)ippicviSum_32f_C3R :
type == CV_32FC4 ? (ippiSumFuncHint)ippiSum_32f_C4R : type == CV_32FC4 ? (ippicviSumFuncHint)ippicviSum_32f_C4R :
0; 0;
ippiSumFuncNoHint ippFuncNoHint = ippicviSumFuncNoHint ippFuncNoHint =
type == CV_8UC1 ? (ippiSumFuncNoHint)ippiSum_8u_C1R : type == CV_8UC1 ? (ippicviSumFuncNoHint)ippicviSum_8u_C1R :
type == CV_8UC3 ? (ippiSumFuncNoHint)ippiSum_8u_C3R : type == CV_8UC3 ? (ippicviSumFuncNoHint)ippicviSum_8u_C3R :
type == CV_8UC4 ? (ippiSumFuncNoHint)ippiSum_8u_C4R : type == CV_8UC4 ? (ippicviSumFuncNoHint)ippicviSum_8u_C4R :
type == CV_16UC1 ? (ippiSumFuncNoHint)ippiSum_16u_C1R : type == CV_16UC1 ? (ippicviSumFuncNoHint)ippicviSum_16u_C1R :
type == CV_16UC3 ? (ippiSumFuncNoHint)ippiSum_16u_C3R : type == CV_16UC3 ? (ippicviSumFuncNoHint)ippicviSum_16u_C3R :
type == CV_16UC4 ? (ippiSumFuncNoHint)ippiSum_16u_C4R : type == CV_16UC4 ? (ippicviSumFuncNoHint)ippicviSum_16u_C4R :
type == CV_16SC1 ? (ippiSumFuncNoHint)ippiSum_16s_C1R : type == CV_16SC1 ? (ippicviSumFuncNoHint)ippicviSum_16s_C1R :
type == CV_16SC3 ? (ippiSumFuncNoHint)ippiSum_16s_C3R : type == CV_16SC3 ? (ippicviSumFuncNoHint)ippicviSum_16s_C3R :
type == CV_16SC4 ? (ippiSumFuncNoHint)ippiSum_16s_C4R : type == CV_16SC4 ? (ippicviSumFuncNoHint)ippicviSum_16s_C4R :
0; 0;
CV_Assert(!ippFuncHint || !ippFuncNoHint); CV_Assert(!ippFuncHint || !ippFuncNoHint);
if( ippFuncHint || ippFuncNoHint ) if( ippFuncHint || ippFuncNoHint )
@ -721,11 +721,11 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
int type = src.type(); int type = src.type();
if( !mask.empty() ) if( !mask.empty() )
{ {
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *);
ippiMaskMeanFuncC1 ippFuncC1 = ippicviMaskMeanFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR : type == CV_8UC1 ? (ippicviMaskMeanFuncC1)ippicviMean_8u_C1MR :
type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR : type == CV_16UC1 ? (ippicviMaskMeanFuncC1)ippicviMean_16u_C1MR :
type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR : type == CV_32FC1 ? (ippicviMaskMeanFuncC1)ippicviMean_32f_C1MR :
0; 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
@ -735,11 +735,11 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
return Scalar(res); return Scalar(res);
} }
} }
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *);
ippiMaskMeanFuncC3 ippFuncC3 = ippicviMaskMeanFuncC3 ippFuncC3 =
type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR : type == CV_8UC3 ? (ippicviMaskMeanFuncC3)ippicviMean_8u_C3CMR :
type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskMeanFuncC3)ippicviMean_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskMeanFuncC3)ippicviMean_32f_C3CMR :
0; 0;
if( ippFuncC3 ) if( ippFuncC3 )
{ {
@ -754,23 +754,23 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
} }
else else
{ {
typedef IppStatus (CV_STDCALL* ippiMeanFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); typedef IppStatus (CV_STDCALL* ippicviMeanFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm);
typedef IppStatus (CV_STDCALL* ippiMeanFuncNoHint)(const void*, int, IppiSize, double *); typedef IppStatus (CV_STDCALL* ippicviMeanFuncNoHint)(const void*, int, IppiSize, double *);
ippiMeanFuncHint ippFuncHint = ippicviMeanFuncHint ippFuncHint =
type == CV_32FC1 ? (ippiMeanFuncHint)ippiMean_32f_C1R : type == CV_32FC1 ? (ippicviMeanFuncHint)ippicviMean_32f_C1R :
type == CV_32FC3 ? (ippiMeanFuncHint)ippiMean_32f_C3R : type == CV_32FC3 ? (ippicviMeanFuncHint)ippicviMean_32f_C3R :
type == CV_32FC4 ? (ippiMeanFuncHint)ippiMean_32f_C4R : type == CV_32FC4 ? (ippicviMeanFuncHint)ippicviMean_32f_C4R :
0; 0;
ippiMeanFuncNoHint ippFuncNoHint = ippicviMeanFuncNoHint ippFuncNoHint =
type == CV_8UC1 ? (ippiMeanFuncNoHint)ippiMean_8u_C1R : type == CV_8UC1 ? (ippicviMeanFuncNoHint)ippicviMean_8u_C1R :
type == CV_8UC3 ? (ippiMeanFuncNoHint)ippiMean_8u_C3R : type == CV_8UC3 ? (ippicviMeanFuncNoHint)ippicviMean_8u_C3R :
type == CV_8UC4 ? (ippiMeanFuncNoHint)ippiMean_8u_C4R : type == CV_8UC4 ? (ippicviMeanFuncNoHint)ippicviMean_8u_C4R :
type == CV_16UC1 ? (ippiMeanFuncNoHint)ippiMean_16u_C1R : type == CV_16UC1 ? (ippicviMeanFuncNoHint)ippicviMean_16u_C1R :
type == CV_16UC3 ? (ippiMeanFuncNoHint)ippiMean_16u_C3R : type == CV_16UC3 ? (ippicviMeanFuncNoHint)ippicviMean_16u_C3R :
type == CV_16UC4 ? (ippiMeanFuncNoHint)ippiMean_16u_C4R : type == CV_16UC4 ? (ippicviMeanFuncNoHint)ippicviMean_16u_C4R :
type == CV_16SC1 ? (ippiMeanFuncNoHint)ippiMean_16s_C1R : type == CV_16SC1 ? (ippicviMeanFuncNoHint)ippicviMean_16s_C1R :
type == CV_16SC3 ? (ippiMeanFuncNoHint)ippiMean_16s_C3R : type == CV_16SC3 ? (ippicviMeanFuncNoHint)ippicviMean_16s_C3R :
type == CV_16SC4 ? (ippiMeanFuncNoHint)ippiMean_16s_C4R : type == CV_16SC4 ? (ippicviMeanFuncNoHint)ippicviMean_16s_C4R :
0; 0;
// Make sure only zero or one version of the function pointer is valid // Make sure only zero or one version of the function pointer is valid
CV_Assert(!ippFuncHint || !ippFuncNoHint); CV_Assert(!ippFuncHint || !ippFuncNoHint);
@ -941,22 +941,22 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
int type = src.type(); int type = src.type();
if( !mask.empty() ) if( !mask.empty() )
{ {
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskMeanStdDevFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *, Ipp64f *);
ippiMaskMeanStdDevFuncC1 ippFuncC1 = ippicviMaskMeanStdDevFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_8u_C1MR : type == CV_8UC1 ? (ippicviMaskMeanStdDevFuncC1)ippicviMean_StdDev_8u_C1MR :
type == CV_16UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_16u_C1MR : type == CV_16UC1 ? (ippicviMaskMeanStdDevFuncC1)ippicviMean_StdDev_16u_C1MR :
type == CV_32FC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_32f_C1MR : type == CV_32FC1 ? (ippicviMaskMeanStdDevFuncC1)ippicviMean_StdDev_32f_C1MR :
0; 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, pmean, pstddev) >= 0 ) if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, pmean, pstddev) >= 0 )
return; return;
} }
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskMeanStdDevFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
ippiMaskMeanStdDevFuncC3 ippFuncC3 = ippicviMaskMeanStdDevFuncC3 ippFuncC3 =
type == CV_8UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_8u_C3CMR : type == CV_8UC3 ? (ippicviMaskMeanStdDevFuncC3)ippicviMean_StdDev_8u_C3CMR :
type == CV_16UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskMeanStdDevFuncC3)ippicviMean_StdDev_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskMeanStdDevFuncC3)ippicviMean_StdDev_32f_C3CMR :
0; 0;
if( ippFuncC3 ) if( ippFuncC3 )
{ {
@ -968,22 +968,22 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
} }
else else
{ {
typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC1)(const void *, int, IppiSize, Ipp64f *, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMeanStdDevFuncC1)(const void *, int, IppiSize, Ipp64f *, Ipp64f *);
ippiMeanStdDevFuncC1 ippFuncC1 = ippicviMeanStdDevFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_8u_C1R : type == CV_8UC1 ? (ippicviMeanStdDevFuncC1)ippicviMean_StdDev_8u_C1R :
type == CV_16UC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_16u_C1R : type == CV_16UC1 ? (ippicviMeanStdDevFuncC1)ippicviMean_StdDev_16u_C1R :
//type == CV_32FC1 ? (ippiMeanStdDevFuncC1)ippiMean_StdDev_32f_C1R ://Aug 2013: bug in IPP 7.1, 8.0 //type == CV_32FC1 ? (ippicviMeanStdDevFuncC1)ippicviMean_StdDev_32f_C1R ://Aug 2013: bug in IPP 7.1, 8.0
0; 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
if( ippFuncC1(src.data, (int)src.step[0], sz, pmean, pstddev) >= 0 ) if( ippFuncC1(src.data, (int)src.step[0], sz, pmean, pstddev) >= 0 )
return; return;
} }
typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
ippiMeanStdDevFuncC3 ippFuncC3 = ippicviMeanStdDevFuncC3 ippFuncC3 =
type == CV_8UC3 ? (ippiMeanStdDevFuncC3)ippiMean_StdDev_8u_C3CR : type == CV_8UC3 ? (ippicviMeanStdDevFuncC3)ippicviMean_StdDev_8u_C3CR :
type == CV_16UC3 ? (ippiMeanStdDevFuncC3)ippiMean_StdDev_16u_C3CR : type == CV_16UC3 ? (ippicviMeanStdDevFuncC3)ippicviMean_StdDev_16u_C3CR :
type == CV_32FC3 ? (ippiMeanStdDevFuncC3)ippiMean_StdDev_32f_C3CR : type == CV_32FC3 ? (ippicviMeanStdDevFuncC3)ippicviMean_StdDev_32f_C3CR :
0; 0;
if( ippFuncC3 ) if( ippFuncC3 )
{ {
@ -1346,11 +1346,11 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
int type = src.type(); int type = src.type();
if( !mask.empty() ) if( !mask.empty() )
{ {
typedef IppStatus (CV_STDCALL* ippiMaskMinMaxIndxFuncC1)(const void *, int, const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); typedef IppStatus (CV_STDCALL* ippicviMaskMinMaxIndxFuncC1)(const void *, int, const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *);
ippiMaskMinMaxIndxFuncC1 ippFuncC1 = ippicviMaskMinMaxIndxFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1MR : type == CV_8UC1 ? (ippicviMaskMinMaxIndxFuncC1)ippicviMinMaxIndx_8u_C1MR :
type == CV_16UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1MR : type == CV_16UC1 ? (ippicviMaskMinMaxIndxFuncC1)ippicviMinMaxIndx_16u_C1MR :
type == CV_32FC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1MR : type == CV_32FC1 ? (ippicviMaskMinMaxIndxFuncC1)ippicviMinMaxIndx_32f_C1MR :
0; 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
@ -1380,11 +1380,11 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
} }
else else
{ {
typedef IppStatus (CV_STDCALL* ippiMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); typedef IppStatus (CV_STDCALL* ippicviMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *);
ippiMinMaxIndxFuncC1 ippFuncC1 = ippicviMinMaxIndxFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R : type == CV_8UC1 ? (ippicviMinMaxIndxFuncC1)ippicviMinMaxIndx_8u_C1R :
type == CV_16UC1 ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R : type == CV_16UC1 ? (ippicviMinMaxIndxFuncC1)ippicviMinMaxIndx_16u_C1R :
type == CV_32FC1 ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : type == CV_32FC1 ? (ippicviMinMaxIndxFuncC1)ippicviMinMaxIndx_32f_C1R :
0; 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
@ -2023,25 +2023,25 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
int type = src.type(); int type = src.type();
if( !mask.empty() ) if( !mask.empty() )
{ {
typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *);
ippiMaskNormFuncC1 ippFuncC1 = ippicviMaskNormFuncC1 ippFuncC1 =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormFuncC1)ippicviNorm_Inf_32f_C1MR :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L1_32f_C1MR :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormFuncC1)ippicviNorm_L2_32f_C1MR :
0) : 0; 0) : 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
@ -2051,25 +2051,25 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
} }
} }
typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
ippiMaskNormFuncC3 ippFuncC3 = ippicviMaskNormFuncC3 ippFuncC3 =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8u_C3CMR : (type == CV_8UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_8u_C3CMR :
type == CV_8SC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8s_C3CMR : type == CV_8SC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_8s_C3CMR :
type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskNormFuncC3)ippicviNorm_Inf_32f_C3CMR :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_8u_C3CMR : (type == CV_8UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_8u_C3CMR :
type == CV_8SC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_8s_C3CMR : type == CV_8SC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_8s_C3CMR :
type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L1_32f_C3CMR :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_8u_C3CMR : (type == CV_8UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_8u_C3CMR :
type == CV_8SC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_8s_C3CMR : type == CV_8SC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_8s_C3CMR :
type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskNormFuncC3)ippicviNorm_L2_32f_C3CMR :
0) : 0; 0) : 0;
if( ippFuncC3 ) if( ippFuncC3 )
{ {
@ -2089,55 +2089,55 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
} }
else else
{ {
typedef IppStatus (CV_STDCALL* ippiNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippicviNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint);
typedef IppStatus (CV_STDCALL* ippiNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *);
ippiNormFuncHint ippFuncHint = ippicviNormFuncHint ippFuncHint =
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L1_32f_C1R : (type == CV_32FC1 ? (ippicviNormFuncHint)ippicviNorm_L1_32f_C1R :
type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L1_32f_C3R : type == CV_32FC3 ? (ippicviNormFuncHint)ippicviNorm_L1_32f_C3R :
type == CV_32FC4 ? (ippiNormFuncHint)ippiNorm_L1_32f_C4R : type == CV_32FC4 ? (ippicviNormFuncHint)ippicviNorm_L1_32f_C4R :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L2_32f_C1R : (type == CV_32FC1 ? (ippicviNormFuncHint)ippicviNorm_L2_32f_C1R :
type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L2_32f_C3R : type == CV_32FC3 ? (ippicviNormFuncHint)ippicviNorm_L2_32f_C3R :
type == CV_32FC4 ? (ippiNormFuncHint)ippiNorm_L2_32f_C4R : type == CV_32FC4 ? (ippicviNormFuncHint)ippicviNorm_L2_32f_C4R :
0) : 0; 0) : 0;
ippiNormFuncNoHint ippFuncNoHint = ippicviNormFuncNoHint ippFuncNoHint =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C1R : (type == CV_8UC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_8u_C1R :
type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C3R : type == CV_8UC3 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_8u_C3R :
type == CV_8UC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C4R : type == CV_8UC4 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_8u_C4R :
type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C1R : type == CV_16UC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16u_C1R :
type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C3R : type == CV_16UC3 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16u_C3R :
type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C4R : type == CV_16UC4 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16u_C4R :
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C1R : type == CV_16SC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_16s_C1R :
//type == CV_16SC3 ? (ippiNormFunc)ippiNorm_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 //type == CV_16SC3 ? (ippicviNormFunc)ippicviNorm_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_16SC4 ? (ippicviNormFunc)ippicviNorm_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768
type == CV_32FC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C1R : type == CV_32FC1 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_32f_C1R :
type == CV_32FC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C3R : type == CV_32FC3 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_32f_C3R :
type == CV_32FC4 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C4R : type == CV_32FC4 ? (ippicviNormFuncNoHint)ippicviNorm_Inf_32f_C4R :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C1R : (type == CV_8UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L1_8u_C1R :
type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C3R : type == CV_8UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L1_8u_C3R :
type == CV_8UC4 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C4R : type == CV_8UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L1_8u_C4R :
type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C1R : type == CV_16UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16u_C1R :
type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C3R : type == CV_16UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16u_C3R :
type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C4R : type == CV_16UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16u_C4R :
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C1R : type == CV_16SC1 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16s_C1R :
type == CV_16SC3 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C3R : type == CV_16SC3 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16s_C3R :
type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C4R : type == CV_16SC4 ? (ippicviNormFuncNoHint)ippicviNorm_L1_16s_C4R :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R : (type == CV_8UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L2_8u_C1R :
type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C3R : type == CV_8UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L2_8u_C3R :
type == CV_8UC4 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C4R : type == CV_8UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L2_8u_C4R :
type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R : type == CV_16UC1 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16u_C1R :
type == CV_16UC3 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C3R : type == CV_16UC3 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16u_C3R :
type == CV_16UC4 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C4R : type == CV_16UC4 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16u_C4R :
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C1R : type == CV_16SC1 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16s_C1R :
type == CV_16SC3 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C3R : type == CV_16SC3 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16s_C3R :
type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C4R : type == CV_16SC4 ? (ippicviNormFuncNoHint)ippicviNorm_L2_16s_C4R :
0) : 0; 0) : 0;
// Make sure only zero or one version of the function pointer is valid // Make sure only zero or one version of the function pointer is valid
CV_Assert(!ippFuncHint || !ippFuncNoHint); CV_Assert(!ippFuncHint || !ippFuncNoHint);
@ -2374,25 +2374,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
int type = src1.type(); int type = src1.type();
if( !mask.empty() ) if( !mask.empty() )
{ {
typedef IppStatus (CV_STDCALL* ippiMaskNormRelFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskNormRelFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *);
ippiMaskNormRelFuncC1 ippFuncC1 = ippicviMaskNormRelFuncC1 ippFuncC1 =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_Inf_32f_C1MR :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L1_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L1_32f_C1MR :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormRelFuncC1)ippicviNormRel_L2_32f_C1MR :
0) : 0; 0) : 0;
if( ippFuncC1 ) if( ippFuncC1 )
{ {
@ -2403,25 +2403,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
} }
else else
{ {
typedef IppStatus (CV_STDCALL* ippiNormRelFunc)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippicviNormRelFunc)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint);
ippiNormRelFunc ippFunc = ippicviNormRelFunc ippFunc =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_Inf_8u_C1R : (type == CV_8UC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_8u_C1R :
type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_Inf_16u_C1R : type == CV_16UC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_16u_C1R :
type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_Inf_16s_C1R : type == CV_16SC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_16s_C1R :
type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_Inf_32f_C1R : type == CV_32FC1 ? (ippicviNormRelFunc)ippicviNormRel_Inf_32f_C1R :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_L1_8u_C1R : (type == CV_8UC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_8u_C1R :
type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_L1_16u_C1R : type == CV_16UC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_16u_C1R :
type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_L1_16s_C1R : type == CV_16SC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_16s_C1R :
type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_L1_32f_C1R : type == CV_32FC1 ? (ippicviNormRelFunc)ippicviNormRel_L1_32f_C1R :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_L2_8u_C1R : (type == CV_8UC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_8u_C1R :
type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_L2_16u_C1R : type == CV_16UC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_16u_C1R :
type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_L2_16s_C1R : type == CV_16SC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_16s_C1R :
type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_L2_32f_C1R : type == CV_32FC1 ? (ippicviNormRelFunc)ippicviNormRel_L2_32f_C1R :
0) : 0; 0) : 0;
if( ippFunc ) if( ippFunc )
{ {
@ -2455,25 +2455,25 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
int type = src1.type(); int type = src1.type();
if( !mask.empty() ) if( !mask.empty() )
{ {
typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviMaskNormDiffFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *);
ippiMaskNormDiffFuncC1 ippFuncC1 = ippicviMaskNormDiffFuncC1 ippFuncC1 =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_Inf_32f_C1MR :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L1_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L1_32f_C1MR :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_8u_C1MR : (type == CV_8UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_8u_C1MR :
type == CV_8SC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_8s_C1MR : type == CV_8SC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_8s_C1MR :
type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_16u_C1MR : type == CV_16UC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_16u_C1MR :
type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_32f_C1MR : type == CV_32FC1 ? (ippicviMaskNormDiffFuncC1)ippicviNormDiff_L2_32f_C1MR :
0) : 0; 0) : 0;
if( ippFuncC1 ) 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 ) 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; 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 *); typedef IppStatus (CV_STDCALL* ippicviMaskNormDiffFuncC3)(const void *, int, const void *, int, const void *, int, IppiSize, int, Ipp64f *);
ippiMaskNormDiffFuncC3 ippFuncC3 = ippicviMaskNormDiffFuncC3 ippFuncC3 =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_8u_C3CMR : (type == CV_8UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_8u_C3CMR :
type == CV_8SC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_8s_C3CMR : type == CV_8SC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_8s_C3CMR :
type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_Inf_32f_C3CMR :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_8u_C3CMR : (type == CV_8UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_8u_C3CMR :
type == CV_8SC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_8s_C3CMR : type == CV_8SC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_8s_C3CMR :
type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L1_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L1_32f_C3CMR :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_8u_C3CMR : (type == CV_8UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_8u_C3CMR :
type == CV_8SC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_8s_C3CMR : type == CV_8SC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_8s_C3CMR :
type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_16u_C3CMR : type == CV_16UC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_32f_C3CMR : type == CV_32FC3 ? (ippicviMaskNormDiffFuncC3)ippicviNormDiff_L2_32f_C3CMR :
0) : 0; 0) : 0;
if( ippFuncC3 ) if( ippFuncC3 )
{ {
@ -2519,55 +2519,55 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
} }
else else
{ {
typedef IppStatus (CV_STDCALL* ippiNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippicviNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint);
typedef IppStatus (CV_STDCALL* ippiNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippicviNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *);
ippiNormDiffFuncHint ippFuncHint = ippicviNormDiffFuncHint ippFuncHint =
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_32FC1 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C1R : (type == CV_32FC1 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L1_32f_C1R :
type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C3R : type == CV_32FC3 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L1_32f_C3R :
type == CV_32FC4 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C4R : type == CV_32FC4 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L1_32f_C4R :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_32FC1 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C1R : (type == CV_32FC1 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L2_32f_C1R :
type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C3R : type == CV_32FC3 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L2_32f_C3R :
type == CV_32FC4 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C4R : type == CV_32FC4 ? (ippicviNormDiffFuncHint)ippicviNormDiff_L2_32f_C4R :
0) : 0; 0) : 0;
ippiNormDiffFuncNoHint ippFuncNoHint = ippicviNormDiffFuncNoHint ippFuncNoHint =
normType == NORM_INF ? normType == NORM_INF ?
(type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R : (type == CV_8UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_8u_C1R :
type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C3R : type == CV_8UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_8u_C3R :
type == CV_8UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C4R : type == CV_8UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_8u_C4R :
type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C1R : type == CV_16UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16u_C1R :
type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C3R : type == CV_16UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16u_C3R :
type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C4R : type == CV_16UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16u_C4R :
type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R : type == CV_16SC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_16s_C1R :
//type == CV_16SC3 ? (ippiNormDiffFunc)ippiNormDiff_Inf_16s_C3R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768 //type == CV_16SC3 ? (ippicviNormDiffFunc)ippicviNormDiff_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_16SC4 ? (ippicviNormDiffFunc)ippicviNormDiff_Inf_16s_C4R : //Aug 2013: problem in IPP 7.1, 8.0 : -32768
type == CV_32FC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C1R : type == CV_32FC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_32f_C1R :
type == CV_32FC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C3R : type == CV_32FC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_32f_C3R :
type == CV_32FC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C4R : type == CV_32FC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_Inf_32f_C4R :
0) : 0) :
normType == NORM_L1 ? normType == NORM_L1 ?
(type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R : (type == CV_8UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_8u_C1R :
type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C3R : type == CV_8UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_8u_C3R :
type == CV_8UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C4R : type == CV_8UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_8u_C4R :
type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R : type == CV_16UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16u_C1R :
type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C3R : type == CV_16UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16u_C3R :
type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C4R : type == CV_16UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16u_C4R :
type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C1R : type == CV_16SC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16s_C1R :
type == CV_16SC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C3R : type == CV_16SC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16s_C3R :
type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C4R : type == CV_16SC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L1_16s_C4R :
0) : 0) :
normType == NORM_L2 || normType == NORM_L2SQR ? normType == NORM_L2 || normType == NORM_L2SQR ?
(type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R : (type == CV_8UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_8u_C1R :
type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C3R : type == CV_8UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_8u_C3R :
type == CV_8UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C4R : type == CV_8UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_8u_C4R :
type == CV_16UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C1R : type == CV_16UC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16u_C1R :
type == CV_16UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C3R : type == CV_16UC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16u_C3R :
type == CV_16UC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C4R : type == CV_16UC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16u_C4R :
type == CV_16SC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C1R : type == CV_16SC1 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16s_C1R :
type == CV_16SC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C3R : type == CV_16SC3 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16s_C3R :
type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C4R : type == CV_16SC4 ? (ippicviNormDiffFuncNoHint)ippicviNormDiff_L2_16s_C4R :
0) : 0; 0) : 0;
// Make sure only zero or one version of the function pointer is valid // Make sure only zero or one version of the function pointer is valid
CV_Assert(!ippFuncHint || !ippFuncNoHint); CV_Assert(!ippFuncHint || !ippFuncNoHint);

View File

@ -397,17 +397,17 @@ int64 getCPUTickCount(void)
#else #else
#ifdef HAVE_IPP //#ifdef HAVE_IPP
int64 getCPUTickCount(void) //int64 getCPUTickCount(void)
{ //{
return ippGetCpuClocks(); // return ippGetCpuClocks();
} //}
#else //#else
int64 getCPUTickCount(void) int64 getCPUTickCount(void)
{ {
return getTickCount(); return getTickCount();
} }
#endif //#endif
#endif #endif

View File

@ -99,7 +99,7 @@
#define MAX_IPP8u 255 #define MAX_IPP8u 255
#define MAX_IPP16u 65535 #define MAX_IPP16u 65535
#define MAX_IPP32f 1.0 #define MAX_IPP32f 1.0
static IppStatus sts = ippInit(); static IppStatus sts = ippicvInit();
#endif #endif
namespace cv namespace cv
@ -200,9 +200,9 @@ void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt)
} }
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #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* ippicviReorderFunc)(const void *, int, void *, int, IppiSize, const int *);
typedef IppStatus (CV_STDCALL* ippiGeneralFunc)(const void *, int, void *, int, IppiSize); typedef IppStatus (CV_STDCALL* ippicviGeneralFunc)(const void *, int, void *, int, IppiSize);
typedef IppStatus (CV_STDCALL* ippiColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *); typedef IppStatus (CV_STDCALL* ippicviColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *);
template <typename Cvt> template <typename Cvt>
class CvtColorIPPLoop_Invoker : public ParallelLoopBody class CvtColorIPPLoop_Invoker : public ParallelLoopBody
@ -255,134 +255,134 @@ bool CvtColorIPPLoopCopy(Mat& src, Mat& dst, const Cvt& cvt)
return ok; 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) 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) 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) 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, (ippicviReorderFunc)ippicviSwapChannels_8u_C3C4Rf, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C3C4Rf, 0,
0, (ippiReorderFunc)ippiSwapChannels_32f_C3C4Rf, 0, 0 0, (ippicviReorderFunc)ippicviSwapChannels_32f_C3C4Rf, 0, 0
}; };
static ippiGeneralFunc ippiCopyAC4C3RTab[] = static ippicviGeneralFunc ippicviCopyAC4C3RTab[] =
{ {
(ippiGeneralFunc)ippiCopy_8u_AC4C3R, 0, (ippiGeneralFunc)ippiCopy_16u_AC4C3R, 0, (ippicviGeneralFunc)ippicviCopy_8u_AC4C3R, 0, (ippicviGeneralFunc)ippicviCopy_16u_AC4C3R, 0,
0, (ippiGeneralFunc)ippiCopy_32f_AC4C3R, 0, 0 0, (ippicviGeneralFunc)ippicviCopy_32f_AC4C3R, 0, 0
}; };
static ippiReorderFunc ippiSwapChannelsC4C3RTab[] = static ippicviReorderFunc ippicviSwapChannelsC4C3RTab[] =
{ {
(ippiReorderFunc)ippiSwapChannels_8u_C4C3R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_8u_C4C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C4C3R, 0,
0, (ippiReorderFunc)ippiSwapChannels_32f_C4C3R, 0, 0 0, (ippicviReorderFunc)ippicviSwapChannels_32f_C4C3R, 0, 0
}; };
static ippiReorderFunc ippiSwapChannelsC3RTab[] = static ippicviReorderFunc ippicviSwapChannelsC3RTab[] =
{ {
(ippiReorderFunc)ippiSwapChannels_8u_C3R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_8u_C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C3R, 0,
0, (ippiReorderFunc)ippiSwapChannels_32f_C3R, 0, 0 0, (ippicviReorderFunc)ippicviSwapChannels_32f_C3R, 0, 0
}; };
static ippiReorderFunc ippiSwapChannelsC4RTab[] = static ippicviReorderFunc ippicviSwapChannelsC4RTab[] =
{ {
(ippiReorderFunc)ippiSwapChannels_8u_AC4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_AC4R, 0, (ippicviReorderFunc)ippicviSwapChannels_8u_AC4R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_AC4R, 0,
0, (ippiReorderFunc)ippiSwapChannels_32f_AC4R, 0, 0 0, (ippicviReorderFunc)ippicviSwapChannels_32f_AC4R, 0, 0
}; };
static ippiColor2GrayFunc ippiColor2GrayC3Tab[] = static ippicviColor2GrayFunc ippicviColor2GrayC3Tab[] =
{ {
(ippiColor2GrayFunc)ippiColorToGray_8u_C3C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_C3C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_8u_C3C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_16u_C3C1R, 0,
0, (ippiColor2GrayFunc)ippiColorToGray_32f_C3C1R, 0, 0 0, (ippicviColor2GrayFunc)ippicviColorToGray_32f_C3C1R, 0, 0
}; };
static ippiColor2GrayFunc ippiColor2GrayC4Tab[] = static ippicviColor2GrayFunc ippicviColor2GrayC4Tab[] =
{ {
(ippiColor2GrayFunc)ippiColorToGray_8u_AC4C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_AC4C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_8u_AC4C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_16u_AC4C1R, 0,
0, (ippiColor2GrayFunc)ippiColorToGray_32f_AC4C1R, 0, 0 0, (ippicviColor2GrayFunc)ippicviColorToGray_32f_AC4C1R, 0, 0
}; };
static ippiGeneralFunc ippiRGB2GrayC3Tab[] = static ippicviGeneralFunc ippicviRGB2GrayC3Tab[] =
{ {
(ippiGeneralFunc)ippiRGBToGray_8u_C3C1R, 0, (ippiGeneralFunc)ippiRGBToGray_16u_C3C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_8u_C3C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_16u_C3C1R, 0,
0, (ippiGeneralFunc)ippiRGBToGray_32f_C3C1R, 0, 0 0, (ippicviGeneralFunc)ippicviRGBToGray_32f_C3C1R, 0, 0
}; };
static ippiGeneralFunc ippiRGB2GrayC4Tab[] = static ippicviGeneralFunc ippicviRGB2GrayC4Tab[] =
{ {
(ippiGeneralFunc)ippiRGBToGray_8u_AC4C1R, 0, (ippiGeneralFunc)ippiRGBToGray_16u_AC4C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_8u_AC4C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_16u_AC4C1R, 0,
0, (ippiGeneralFunc)ippiRGBToGray_32f_AC4C1R, 0, 0 0, (ippicviGeneralFunc)ippicviRGBToGray_32f_AC4C1R, 0, 0
}; };
static ippiGeneralFunc ippiCopyP3C3RTab[] = static ippicviGeneralFunc ippicviCopyP3C3RTab[] =
{ {
(ippiGeneralFunc)ippiCopy_8u_P3C3R, 0, (ippiGeneralFunc)ippiCopy_16u_P3C3R, 0, (ippicviGeneralFunc)ippicviCopy_8u_P3C3R, 0, (ippicviGeneralFunc)ippicviCopy_16u_P3C3R, 0,
0, (ippiGeneralFunc)ippiCopy_32f_P3C3R, 0, 0 0, (ippicviGeneralFunc)ippicviCopy_32f_P3C3R, 0, 0
}; };
static ippiGeneralFunc ippiRGB2XYZTab[] = static ippicviGeneralFunc ippicviRGB2XYZTab[] =
{ {
(ippiGeneralFunc)ippiRGBToXYZ_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToXYZ_16u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToXYZ_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToXYZ_16u_C3R, 0,
0, (ippiGeneralFunc)ippiRGBToXYZ_32f_C3R, 0, 0 0, (ippicviGeneralFunc)ippicviRGBToXYZ_32f_C3R, 0, 0
}; };
static ippiGeneralFunc ippiXYZ2RGBTab[] = static ippicviGeneralFunc ippicviXYZ2RGBTab[] =
{ {
(ippiGeneralFunc)ippiXYZToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiXYZToRGB_16u_C3R, 0, (ippicviGeneralFunc)ippicviXYZToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviXYZToRGB_16u_C3R, 0,
0, (ippiGeneralFunc)ippiXYZToRGB_32f_C3R, 0, 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 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 0, 0, 0, 0
}; };
static ippiGeneralFunc ippiRGB2HLSTab[] = static ippicviGeneralFunc ippicviRGB2HLSTab[] =
{ {
(ippiGeneralFunc)ippiRGBToHLS_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToHLS_16u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToHLS_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToHLS_16u_C3R, 0,
0, (ippiGeneralFunc)ippiRGBToHLS_32f_C3R, 0, 0 0, (ippicviGeneralFunc)ippicviRGBToHLS_32f_C3R, 0, 0
}; };
static ippiGeneralFunc ippiHLS2RGBTab[] = static ippicviGeneralFunc ippicviHLS2RGBTab[] =
{ {
(ippiGeneralFunc)ippiHLSToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiHLSToRGB_16u_C3R, 0, (ippicviGeneralFunc)ippicviHLSToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviHLSToRGB_16u_C3R, 0,
0, (ippiGeneralFunc)ippiHLSToRGB_32f_C3R, 0, 0 0, (ippicviGeneralFunc)ippicviHLSToRGB_32f_C3R, 0, 0
}; };
struct IPPGeneralFunctor 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 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; return func(src, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0;
} }
private: private:
ippiGeneralFunc func; ippicviGeneralFunc func;
}; };
struct IPPReorderFunctor 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[0] = _order0;
order[1] = _order1; order[1] = _order1;
@ -394,13 +394,13 @@ struct IPPReorderFunctor
return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), order) >= 0; return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), order) >= 0;
} }
private: private:
ippiReorderFunc func; ippicviReorderFunc func;
int order[4]; int order[4];
}; };
struct IPPColor2GrayFunctor struct IPPColor2GrayFunctor
{ {
IPPColor2GrayFunctor(ippiColor2GrayFunc _func) : func(_func) IPPColor2GrayFunctor(ippicviColor2GrayFunc _func) : func(_func)
{ {
coeffs[0] = 0.114f; coeffs[0] = 0.114f;
coeffs[1] = 0.587f; coeffs[1] = 0.587f;
@ -411,25 +411,25 @@ struct IPPColor2GrayFunctor
return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), coeffs) >= 0; return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), coeffs) >= 0;
} }
private: private:
ippiColor2GrayFunc func; ippicviColor2GrayFunc func;
Ipp32f coeffs[3]; Ipp32f coeffs[3];
}; };
struct IPPGray2BGRFunctor 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 bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const
{ {
const void* srcarray[3] = { src, src, src }; const void* srcarray[3] = { src, src, src };
return func(srcarray, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0; return func(srcarray, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0;
} }
private: private:
ippiGeneralFunc func; ippicviGeneralFunc func;
}; };
struct IPPGray2BGRAFunctor 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 bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const
{ {
const void* srcarray[3] = { src, src, src }; 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; return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
} }
private: private:
ippiGeneralFunc func1; ippicviGeneralFunc func1;
ippiReorderFunc func2; ippicviReorderFunc func2;
int depth; int depth;
}; };
struct IPPReorderGeneralFunctor 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[0] = _order0;
order[1] = _order1; order[1] = _order1;
@ -463,15 +463,15 @@ struct IPPReorderGeneralFunctor
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0; return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0;
} }
private: private:
ippiReorderFunc func1; ippicviReorderFunc func1;
ippiGeneralFunc func2; ippicviGeneralFunc func2;
int order[4]; int order[4];
int depth; int depth;
}; };
struct IPPGeneralReorderFunctor 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[0] = _order0;
order[1] = _order1; order[1] = _order1;
@ -487,8 +487,8 @@ struct IPPGeneralReorderFunctor
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
} }
private: private:
ippiGeneralFunc func1; ippicviGeneralFunc func1;
ippiReorderFunc func2; ippicviReorderFunc func2;
int order[4]; int order[4];
int depth; 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 defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( code == CV_BGR2BGRA || code == CV_RGB2RGBA) 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; return;
} }
else if( code == CV_BGRA2BGR ) else if( code == CV_BGRA2BGR )
{ {
if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiCopyAC4C3RTab[depth])) ) if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviCopyAC4C3RTab[depth])) )
return; return;
} }
else if( code == CV_BGR2RGBA ) else if( code == CV_BGR2RGBA )
{ {
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 2, 1, 0)) ) if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0)) )
return; return;
} }
else if( code == CV_RGBA2BGR ) else if( code == CV_RGBA2BGR )
{ {
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC4C3RTab[depth], 2, 1, 0)) ) if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC4C3RTab[depth], 2, 1, 0)) )
return; return;
} }
else if( code == CV_RGB2BGR ) else if( code == CV_RGB2BGR )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) ) if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3RTab[depth], 2, 1, 0)) )
return; return;
} }
else if( code == CV_RGBA2BGRA ) else if( code == CV_RGBA2BGRA )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) ) if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippicviSwapChannelsC4RTab[depth], 2, 1, 0)) )
return; return;
} }
#endif #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 defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( code == CV_BGR2GRAY ) if( code == CV_BGR2GRAY )
{ {
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC3Tab[depth])) ) if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippicviColor2GrayC3Tab[depth])) )
return; return;
} }
else if( code == CV_RGB2GRAY ) else if( code == CV_RGB2GRAY )
{ {
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC3Tab[depth])) ) if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviRGB2GrayC3Tab[depth])) )
return; return;
} }
else if( code == CV_BGRA2GRAY ) else if( code == CV_BGRA2GRAY )
{ {
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC4Tab[depth])) ) if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippicviColor2GrayC4Tab[depth])) )
return; return;
} }
else if( code == CV_RGBA2GRAY ) else if( code == CV_RGBA2GRAY )
{ {
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC4Tab[depth])) ) if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviRGB2GrayC4Tab[depth])) )
return; return;
} }
#endif #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 defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( code == CV_GRAY2BGR ) if( code == CV_GRAY2BGR )
{ {
if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippiCopyP3C3RTab[depth])) ) if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippicviCopyP3C3RTab[depth])) )
return; return;
} }
else if( code == CV_GRAY2BGRA ) else if( code == CV_GRAY2BGRA )
{ {
if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippiCopyP3C3RTab[depth], ippiSwapChannelsC3C4RTab[depth], depth)) ) if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippicviCopyP3C3RTab[depth], ippicviSwapChannelsC3C4RTab[depth], depth)) )
return; return;
} }
#endif #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 defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( code == CV_BGR2XYZ && scn == 3 ) 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; return;
} }
else if( code == CV_BGR2XYZ && scn == 4 ) 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; return;
} }
else if( code == CV_RGB2XYZ && scn == 3 ) else if( code == CV_RGB2XYZ && scn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2XYZTab[depth])) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2XYZTab[depth])) )
return; return;
} }
else if( code == CV_RGB2XYZ && scn == 4 ) 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; return;
} }
#endif #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 defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( code == CV_XYZ2BGR && dcn == 3 ) 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; return;
} }
else if( code == CV_XYZ2BGR && dcn == 4 ) 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; return;
} }
if( code == CV_XYZ2RGB && dcn == 3 ) if( code == CV_XYZ2RGB && dcn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiXYZ2RGBTab[depth])) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviXYZ2RGBTab[depth])) )
return; return;
} }
else if( code == CV_XYZ2RGB && dcn == 4 ) 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; return;
} }
#endif #endif
@ -3543,42 +3543,42 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
{ {
if( code == CV_BGR2HSV_FULL && scn == 3 ) if( code == CV_BGR2HSV_FULL && scn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC3RTab[depth], ippicviRGB2HSVTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_BGR2HSV_FULL && scn == 4 ) else if( code == CV_BGR2HSV_FULL && scn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HSVTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_RGB2HSV_FULL && scn == 3 ) else if( code == CV_RGB2HSV_FULL && scn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HSVTab[depth])) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2HSVTab[depth])) )
return; return;
} }
else if( code == CV_RGB2HSV_FULL && scn == 4 ) else if( code == CV_RGB2HSV_FULL && scn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 0, 1, 2, depth)) ) if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HSVTab[depth], 0, 1, 2, depth)) )
return; return;
} }
else if( code == CV_BGR2HLS_FULL && scn == 3 ) else if( code == CV_BGR2HLS_FULL && scn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC3RTab[depth], ippicviRGB2HLSTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_BGR2HLS_FULL && scn == 4 ) else if( code == CV_BGR2HLS_FULL && scn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HLSTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_RGB2HLS_FULL && scn == 3 ) else if( code == CV_RGB2HLS_FULL && scn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HLSTab[depth])) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2HLSTab[depth])) )
return; return;
} }
else if( code == CV_RGB2HLS_FULL && scn == 4 ) else if( code == CV_RGB2HLS_FULL && scn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 0, 1, 2, depth)) ) if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HLSTab[depth], 0, 1, 2, depth)) )
return; return;
} }
} }
@ -3624,42 +3624,42 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
{ {
if( code == CV_HSV2BGR_FULL && dcn == 3 ) if( code == CV_HSV2BGR_FULL && dcn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_HSV2BGR_FULL && dcn == 4 ) else if( code == CV_HSV2BGR_FULL && dcn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_HSV2RGB_FULL && dcn == 3 ) else if( code == CV_HSV2RGB_FULL && dcn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHSV2RGBTab[depth])) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviHSV2RGBTab[depth])) )
return; return;
} }
else if( code == CV_HSV2RGB_FULL && dcn == 4 ) else if( code == CV_HSV2RGB_FULL && dcn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
return; return;
} }
else if( code == CV_HLS2BGR_FULL && dcn == 3 ) else if( code == CV_HLS2BGR_FULL && dcn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_HLS2BGR_FULL && dcn == 4 ) else if( code == CV_HLS2BGR_FULL && dcn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
return; return;
} }
else if( code == CV_HLS2RGB_FULL && dcn == 3 ) else if( code == CV_HLS2RGB_FULL && dcn == 3 )
{ {
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHLS2RGBTab[depth])) ) if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviHLS2RGBTab[depth])) )
return; return;
} }
else if( code == CV_HLS2RGB_FULL && dcn == 4 ) else if( code == CV_HLS2RGB_FULL && dcn == 4 )
{ {
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
return; return;
} }
} }

View File

@ -44,7 +44,7 @@
#include "opencl_kernels.hpp" #include "opencl_kernels.hpp"
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
static IppStatus sts = ippInit(); static IppStatus sts = ippicvInit();
#endif #endif
/****************************************************************************************\ /****************************************************************************************\
@ -212,10 +212,10 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy,
{ {
if((dx == 1) && (dy == 0)) if((dx == 1) && (dy == 0))
{ {
ippiFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize); ippicviFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize);
buffer.allocate(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); (Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
return true; 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)) if((dx == 0) && (dy == 1))
{ {
ippiFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize); ippicviFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize);
buffer.allocate(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); (Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
return true; return true;
@ -245,29 +245,29 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy,
case CV_32F: case CV_32F:
if((dx == 1) && (dy == 0)) 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); 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), (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
if(scale != 1) if(scale != 1)
/* IPP is fast, so MulC produce very little perf degradation */ /* 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; return true;
} }
if((dx == 0) && (dy == 1)) 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); 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), (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
if(scale != 1) 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; 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)) 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); 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), (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
return true; 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)) 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); 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), (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); 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)) 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); 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), (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); 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)) 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); 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), (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); 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)) 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); 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), (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
if(scale != 1) 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; return true;
} }
if((dx == 0) && (dy == 1)) 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); 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), (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
if(scale != 1) 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; return true;
} }
if((dx == 2) && (dy == 0)) 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); 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), (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
if(scale != 1) 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; return true;
} }
if((dx == 0) && (dy == 2)) 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); 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), (Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
ippBorderRepl, 0, (Ipp8u*)(char*)buffer); ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
if(scale != 1) 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; return true;
} }

View File

@ -748,7 +748,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
if( maskSize == CV_DIST_MASK_5 ) if( maskSize == CV_DIST_MASK_5 )
{ {
IppiSize roi = { src.cols, src.rows }; IppiSize roi = { src.cols, src.rows };
if( ippiDistanceTransform_5x5_8u32f_C1R( if( ippicviDistanceTransform_5x5_8u32f_C1R(
src.ptr<uchar>(), (int)src.step, src.ptr<uchar>(), (int)src.step,
dst.ptr<float>(), (int)dst.step, roi, _mask) >= 0 ) dst.ptr<float>(), (int)dst.step, roi, _mask) >= 0 )
return; return;

View File

@ -1420,36 +1420,16 @@ struct RowVec_32f
int operator()(const uchar* _src, uchar* _dst, int width, int cn) const int operator()(const uchar* _src, uchar* _dst, int width, int cn) const
{ {
#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; int _ksize = kernel.rows + kernel.cols - 1;
const float* src0 = (const float*)_src; const float* src0 = (const float*)_src;
float* dst = (float*)_dst; float* dst = (float*)_dst;
const float* _kx = (const float*)kernel.data; 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<uchar> 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 ) if( !haveSSE )
return 0; return 0;
@ -1479,7 +1459,38 @@ struct RowVec_32f
Mat kernel; Mat kernel;
bool haveSSE; bool haveSSE;
#ifdef USE_IPP_SEP_FILTERS #ifdef USE_IPP_SEP_FILTERS
private:
mutable int bufsz; 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<uchar> 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 #endif
}; };

View File

@ -50,24 +50,24 @@
#include "opencl_kernels.hpp" #include "opencl_kernels.hpp"
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
static IppStatus sts = ippInit(); static IppStatus sts = ippicvInit();
#endif #endif
namespace cv namespace cv
{ {
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701) #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* ippicviResizeFunc)(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* ippicviResizeGetBufferSize)(void*, IppiSize, Ipp32u, int*);
typedef IppStatus (CV_STDCALL* ippiResizeGetSrcOffset)(void*, IppiPoint, IppiPoint*); typedef IppStatus (CV_STDCALL* ippicviResizeGetSrcOffset)(void*, IppiPoint, IppiPoint*);
#endif #endif
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
typedef IppStatus (CV_STDCALL* ippiSetFunc)(const void*, void *, int, IppiSize); typedef IppStatus (CV_STDCALL* ippicviSetFunc)(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* ippicviWarpPerspectiveBackFunc)(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* ippicviWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int);
template <int channels, typename Type> template <int channels, typename Type>
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]; Type values[channels];
for( int i = 0; i < channels; i++ ) for( int i = 0; i < channels; i++ )
@ -82,11 +82,11 @@ namespace cv
switch( depth ) switch( depth )
{ {
case CV_8U: 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: 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: 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 else
@ -96,11 +96,11 @@ namespace cv
switch( depth ) switch( depth )
{ {
case CV_8U: 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: 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: 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 ) else if( channels == 4 )
@ -108,11 +108,11 @@ namespace cv
switch( depth ) switch( depth )
{ {
case CV_8U: 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: 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: 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 CHECK_IPP_STATUS(STATUS) if( STATUS!=ippStsNoErr ) { *ok = false; return;}
#define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \ #define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ func = (ippicviResizeFunc)ippicviResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
specBuf.allocate(specSize);\ specBuf.allocate(specSize);\
pSpec = (uchar*)specBuf;\ 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) \ #define SET_IPP_RESIZE_LINEAR_FUNC_64_PTR(TYPE, CN) \
if (mode==(int)ippCubic) { *ok = false; return;}\ if (mode==(int)ippCubic) { *ok = false; return;}\
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ func = (ippicviResizeFunc)ippicviResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
specBuf.allocate(specSize);\ specBuf.allocate(specSize);\
pSpec = (uchar*)specBuf;\ pSpec = (uchar*)specBuf;\
CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_64f*)pSpec));\ CHECK_IPP_STATUS(ippicviResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_64f*)pSpec));\
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\ getBufferSizeFunc = (ippicviResizeGetBufferSize)ippicviResizeGetBufferSize_##TYPE;\
getSrcOffsetFunc = (ippiResizeGetSrcOffset) ippiResizeGetBufferSize_##TYPE; getSrcOffsetFunc = (ippicviResizeGetSrcOffset) ippicviResizeGetBufferSize_##TYPE;
#define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \ #define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \
func = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\ func = (ippicviResizeFunc)ippicviResizeCubic_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
specBuf.allocate(specSize);\ specBuf.allocate(specSize);\
pSpec = (uchar*)specBuf;\ pSpec = (uchar*)specBuf;\
AutoBuffer<uchar> buf(initSize);\ AutoBuffer<uchar> buf(initSize);\
uchar* pInit = (uchar*)buf;\ 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) \ #define SET_IPP_RESIZE_PTR(TYPE, CN) \
if (mode == (int)ippLinear) { SET_IPP_RESIZE_LINEAR_FUNC_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 if (mode == (int)ippCubic) { SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN);}\
else { *ok = false; return;}\ else { *ok = false; return;}\
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\ getBufferSizeFunc = (ippicviResizeGetBufferSize)ippicviResizeGetBufferSize_##TYPE;\
getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE; getSrcOffsetFunc = (ippicviResizeGetSrcOffset)ippicviResizeGetSrcOffset_##TYPE;
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701)
class IPPresizeInvoker : class IPPresizeInvoker :
@ -1929,6 +1929,7 @@ public:
dstSize.width = dst.cols; dstSize.width = dst.cols;
dstSize.height = dst.rows; dstSize.height = dst.rows;
<<<<<<< HEAD
switch (type) switch (type)
{ {
case CV_8UC1: SET_IPP_RESIZE_PTR(8u,C1); break; case CV_8UC1: SET_IPP_RESIZE_PTR(8u,C1); break;
@ -1981,6 +1982,37 @@ public:
*ok = false; *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<uchar> 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: private:
const Mat & src; const Mat & src;
Mat & dst; Mat & dst;
@ -1989,9 +2021,9 @@ private:
void *pSpec; void *pSpec;
AutoBuffer<uchar> specBuf; AutoBuffer<uchar> specBuf;
int mode; int mode;
ippiResizeFunc func; ippicviResizeFunc func;
ippiResizeGetBufferSize getBufferSizeFunc; ippicviResizeGetBufferSize getBufferSizeFunc;
ippiResizeGetSrcOffset getSrcOffsetFunc; ippicviResizeGetSrcOffset getSrcOffsetFunc;
bool *ok; bool *ok;
const IPPresizeInvoker& operator= (const IPPresizeInvoker&); const IPPresizeInvoker& operator= (const IPPresizeInvoker&);
}; };
@ -4019,31 +4051,31 @@ class IPPwarpAffineInvoker :
public ParallelLoopBody public ParallelLoopBody
{ {
public: 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) ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
{ {
*ok = true; *ok = true;
} }
virtual void operator() (const Range& range) const virtual void operator() (const Range& range) const
{ {
IppiSize srcsize = { src.cols, src.rows }; IppiSize srcsize = { src.cols, src.rows };
IppiRect srcroi = { 0, 0, src.cols, src.rows }; IppiRect srcroi = { 0, 0, src.cols, src.rows };
IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start }; IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start };
int cnn = src.channels(); int cnn = src.channels();
if( borderType == BORDER_CONSTANT ) if( borderType == BORDER_CONSTANT )
{ {
IppiSize setSize = { dst.cols, range.end - range.start }; IppiSize setSize = { dst.cols, range.end - range.start };
void *dataPointer = dst.data + dst.step[0] * range.start; void *dataPointer = dst.data + dst.step[0] * range.start;
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
{ {
*ok = false; *ok = false;
return; 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 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; *ok = false;
} }
private: private:
Mat &src; Mat &src;
Mat &dst; Mat &dst;
@ -4051,7 +4083,7 @@ private:
int mode; int mode;
int borderType; int borderType;
Scalar borderValue; Scalar borderValue;
ippiWarpAffineBackFunc func; ippicviWarpAffineBackFunc func;
bool *ok; bool *ok;
const IPPwarpAffineInvoker& operator= (const IPPwarpAffineInvoker&); const IPPwarpAffineInvoker& operator= (const IPPwarpAffineInvoker&);
}; };
@ -4214,16 +4246,16 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
( borderType == cv::BORDER_TRANSPARENT || ( borderType == cv::BORDER_CONSTANT ) ) ) ( borderType == cv::BORDER_TRANSPARENT || ( borderType == cv::BORDER_CONSTANT ) ) )
{ {
int type = src.type(); int type = src.type();
ippiWarpAffineBackFunc ippFunc = ippicviWarpAffineBackFunc ippFunc =
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R : type == CV_8UC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C1R :
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R : type == CV_8UC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C3R :
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R : type == CV_8UC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C4R :
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C1R : type == CV_16UC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C1R :
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C3R : type == CV_16UC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C3R :
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C4R : type == CV_16UC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C4R :
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C1R : type == CV_32FC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C1R :
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R : type == CV_32FC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C3R :
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R : type == CV_32FC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C4R :
0; 0;
int mode = int mode =
flags == INTER_LINEAR ? IPPI_INTER_LINEAR : flags == INTER_LINEAR ? IPPI_INTER_LINEAR :
@ -4362,32 +4394,32 @@ class IPPwarpPerspectiveInvoker :
public ParallelLoopBody public ParallelLoopBody
{ {
public: 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) ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
{ {
*ok = true; *ok = true;
} }
virtual void operator() (const Range& range) const virtual void operator() (const Range& range) const
{ {
IppiSize srcsize = {src.cols, src.rows}; IppiSize srcsize = {src.cols, src.rows};
IppiRect srcroi = {0, 0, src.cols, src.rows}; IppiRect srcroi = {0, 0, src.cols, src.rows};
IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start}; IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start};
int cnn = src.channels(); int cnn = src.channels();
if( borderType == BORDER_CONSTANT ) if( borderType == BORDER_CONSTANT )
{ {
IppiSize setSize = {dst.cols, range.end - range.start}; IppiSize setSize = {dst.cols, range.end - range.start};
void *dataPointer = dst.data + dst.step[0] * range.start; void *dataPointer = dst.data + dst.step[0] * range.start;
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
{ {
*ok = false; *ok = false;
return; return;
} }
} }
if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0) if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0)
*ok = false; *ok = false;
} }
private: private:
Mat &src; Mat &src;
Mat &dst; Mat &dst;
@ -4395,7 +4427,7 @@ private:
int mode; int mode;
int borderType; int borderType;
const Scalar borderValue; const Scalar borderValue;
ippiWarpPerspectiveBackFunc func; ippicviWarpPerspectiveBackFunc func;
bool *ok; bool *ok;
const IPPwarpPerspectiveInvoker& operator= (const IPPwarpPerspectiveInvoker&); 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 ) ) ( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) )
{ {
int type = src.type(); int type = src.type();
ippiWarpPerspectiveBackFunc ippFunc = ippicviWarpPerspectiveBackFunc ippFunc =
type == CV_8UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C1R : type == CV_8UC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C1R :
type == CV_8UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C3R : type == CV_8UC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C3R :
type == CV_8UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C4R : type == CV_8UC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C4R :
type == CV_16UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C1R : type == CV_16UC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C1R :
type == CV_16UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C3R : type == CV_16UC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C3R :
type == CV_16UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C4R : type == CV_16UC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C4R :
type == CV_32FC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C1R : type == CV_32FC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C1R :
type == CV_32FC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C3R : type == CV_32FC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C3R :
type == CV_32FC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C4R : type == CV_32FC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C4R :
0; 0;
int mode = int mode =
flags == INTER_LINEAR ? IPPI_INTER_LINEAR : flags == INTER_LINEAR ? IPPI_INTER_LINEAR :

View File

@ -1149,26 +1149,26 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
_src = &temp; _src = &temp;
} }
//DEPRECATED. Allocates and initializes morphology state structure for erosion or dilation operation. //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* ippicviMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **);
typedef IppStatus (CV_STDCALL* ippiMorphologyBorderReplicateFunc)(const void*, int, void *, int, typedef IppStatus (CV_STDCALL* ippicviMorphologyBorderReplicateFunc)(const void*, int, void *, int,
IppiSize, IppiBorderType, IppiMorphState *); IppiSize, IppiBorderType, IppiMorphState *);
typedef IppStatus (CV_STDCALL* ippiFilterMinMaxGetBufferSizeFunc)(int, IppiSize, int*); typedef IppStatus (CV_STDCALL* ippicviFilterMinMaxGetBufferSizeFunc)(int, IppiSize, int*);
typedef IppStatus (CV_STDCALL* ippiFilterMinMaxBorderReplicateFunc)(const void*, int, void*, int, typedef IppStatus (CV_STDCALL* ippicviFilterMinMaxBorderReplicateFunc)(const void*, int, void*, int,
IppiSize, IppiSize, IppiPoint, void*); IppiSize, IppiSize, IppiPoint, void*);
ippiMorphologyInitAllocFunc initAllocFunc = 0; ippicviMorphologyInitAllocFunc initAllocFunc = 0;
ippiMorphologyBorderReplicateFunc morphFunc = 0; ippicviMorphologyBorderReplicateFunc morphFunc = 0;
ippiFilterMinMaxGetBufferSizeFunc getBufSizeFunc = 0; ippicviFilterMinMaxGetBufferSizeFunc getBufSizeFunc = 0;
ippiFilterMinMaxBorderReplicateFunc morphRectFunc = 0; ippicviFilterMinMaxBorderReplicateFunc morphRectFunc = 0;
#define IPP_MORPH_CASE(type, flavor) \ #define IPP_MORPH_CASE(type, flavor) \
case type: \ case type: \
initAllocFunc = (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_##flavor; \ initAllocFunc = (ippicviMorphologyInitAllocFunc)ippicviMorphologyInitAlloc_##flavor; \
morphFunc = op == MORPH_ERODE ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_##flavor : \ morphFunc = op == MORPH_ERODE ? (ippicviMorphologyBorderReplicateFunc)ippicviErodeBorderReplicate_##flavor : \
(ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_##flavor; \ (ippicviMorphologyBorderReplicateFunc)ippicviDilateBorderReplicate_##flavor; \
getBufSizeFunc = (ippiFilterMinMaxGetBufferSizeFunc)ippiFilterMinGetBufferSize_##flavor; \ getBufSizeFunc = (ippicviFilterMinMaxGetBufferSizeFunc)ippicviFilterMinGetBufferSize_##flavor; \
morphRectFunc = op == MORPH_ERODE ? (ippiFilterMinMaxBorderReplicateFunc)ippiFilterMinBorderReplicate_##flavor : \ morphRectFunc = op == MORPH_ERODE ? (ippicviFilterMinMaxBorderReplicateFunc)ippicviFilterMinBorderReplicate_##flavor : \
(ippiFilterMinMaxBorderReplicateFunc)ippiFilterMaxBorderReplicate_##flavor; \ (ippicviFilterMinMaxBorderReplicateFunc)ippicviFilterMaxBorderReplicate_##flavor; \
break break
switch( type ) 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], bool is_ok = morphFunc( _src->data, (int)_src->step[0],
dst.data, (int)dst.step[0], dst.data, (int)dst.step[0],
roiSize, ippBorderRepl, pState ) >= 0; roiSize, ippBorderRepl, pState ) >= 0;
ippiMorphologyFree(pState); ippicviMorphologyFree(pState);
return is_ok; return is_ok;
} }
else if( rectKernel && morphRectFunc && getBufSizeFunc ) else if( rectKernel && morphRectFunc && getBufSizeFunc )

View File

@ -375,7 +375,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
Mat patch = _patch.getMat(); Mat patch = _patch.getMat();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step, typedef IppStatus (CV_STDCALL *ippicviGetRectSubPixFunc)( const void* src, int src_step,
IppiSize src_size, void* dst, IppiSize src_size, void* dst,
int dst_step, IppiSize win_size, int dst_step, IppiSize win_size,
IppiPoint_32f center, IppiPoint_32f center,
@ -385,10 +385,10 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
IppiPoint_32f icenter = {center.x, center.y}; IppiPoint_32f icenter = {center.x, center.y};
IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows}; IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows};
int srctype = image.type(); int srctype = image.type();
ippiGetRectSubPixFunc ippfunc = ippicviGetRectSubPixFunc ippfunc =
srctype == CV_8UC1 && ddepth == CV_8U ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R : srctype == CV_8UC1 && ddepth == CV_8U ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_8u_C1R :
srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R : srctype == CV_8UC1 && ddepth == CV_32F ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_8u32f_C1R :
srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0; srctype == CV_32FC1 && ddepth == CV_32F ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_32f_C1R : 0;
if( ippfunc && ippfunc(image.data, (int)image.step, src_size, patch.data, if( ippfunc && ippfunc(image.data, (int)image.step, src_size, patch.data,
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 ) (int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )

View File

@ -1115,14 +1115,16 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
Mat src = _src.getMat(), dst = _dst.getMat(); Mat src = _src.getMat(), dst = _dst.getMat();
IppiSize roi = { src.cols, src.rows }; IppiSize roi = { src.cols, src.rows };
int bufSize = 0; int bufSize = 0;
ippiFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize); if (ippStsNoErr == ippicviFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize))
AutoBuffer<uchar> buf(bufSize+128); {
if( ippiFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step, AutoBuffer<uchar> buf(bufSize+128);
(Ipp32f *)dst.data, (int)dst.step, if( ippicviFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step,
roi, ksize.width, (Ipp32f)sigma1, (Ipp32f *)dst.data, (int)dst.step,
(IppiBorderType)borderType, 0.0, roi, ksize.width, (Ipp32f)sigma1,
alignPtr(&buf[0],32)) >= 0 ) (IppiBorderType)borderType, 0.0,
return; alignPtr(&buf[0],32)) >= 0 )
return;
}
} }
#endif #endif
@ -2180,11 +2182,19 @@ public:
IppiSize kernel = {d, d}; IppiSize kernel = {d, d};
IppiSize roi={dst.cols, range.end - range.start}; IppiSize roi={dst.cols, range.end - range.start};
int bufsize=0; int bufsize=0;
ippiFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize); if (ippStsNoErr != ippicviFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize))
{
*ok = false;
return;
}
AutoBuffer<uchar> buf(bufsize); AutoBuffer<uchar> buf(bufsize);
IppiFilterBilateralSpec *pSpec = (IppiFilterBilateralSpec *)alignPtr(&buf[0], 32); IppiFilterBilateralSpec *pSpec = (IppiFilterBilateralSpec *)alignPtr(&buf[0], 32);
ippiFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, (Ipp32f)sigma_color, (Ipp32f)sigma_space, 1, pSpec ); if (ippStsNoErr != ippicviFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, (Ipp32f)sigma_color, (Ipp32f)sigma_space, 1, pSpec ))
if( ippiFilterBilateral_8u_C1R( src.ptr<uchar>(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr<uchar>(range.start), (int)dst.step[0], roi, kernel, pSpec ) < 0) {
*ok = false;
return;
}
if( ippicviFilterBilateral_8u_C1R( src.ptr<uchar>(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr<uchar>(range.start), (int)dst.step[0], roi, kernel, pSpec ) < 0)
*ok = false; *ok = false;
} }
private: private:

View File

@ -44,7 +44,7 @@
#include "opencl_kernels.hpp" #include "opencl_kernels.hpp"
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
static IppStatus sts = ippInit(); static IppStatus sts = ippicvInit();
#endif #endif
namespace cv 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 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 ) ) 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 ); IppiSize srcRoiSize = ippiSize( src.cols, src.rows );
if( sdepth == CV_32F ) if( sdepth == CV_32F )
{ {
if( _sqsum.needed() ) 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 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() ) 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 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 #endif

View File

@ -165,7 +165,7 @@ icvReleaseHidHaarClassifierCascade( CvHidHaarClassifierCascade** _cascade )
for( i = 0; i < cascade->count; i++ ) for( i = 0; i < cascade->count; i++ )
{ {
if( cascade->ipp_stages[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 ); cvFree( &cascade->ipp_stages );
@ -1318,7 +1318,7 @@ public:
if( cascade->hid_cascade->ipp_stages ) if( cascade->hid_cascade->ipp_stages )
{ {
IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height}; IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height};
ippiRectStdDev_32f_C1R(sum1.ptr<float>(y1), sum1.step, ippicviRectStdDev_32f_C1R(sum1.ptr<float>(y1), sum1.step,
sqsum1.ptr<double>(y1), sqsum1.step, sqsum1.ptr<double>(y1), sqsum1.step,
norm1->ptr<float>(y1), norm1->step, norm1->ptr<float>(y1), norm1->step,
ippiSize(ssz.width, ssz.height), iequRect ); ippiSize(ssz.width, ssz.height), iequRect );
@ -1340,7 +1340,7 @@ public:
for( int j = 0; j < cascade->count; j++ ) for( int j = 0; j < cascade->count; j++ )
{ {
if( ippiApplyHaarClassifier_32f_C1R( if( ippicviApplyHaarClassifier_32f_C1R(
sum1.ptr<float>(y1), sum1.step, sum1.ptr<float>(y1), sum1.step,
norm1->ptr<float>(y1), norm1->step, norm1->ptr<float>(y1), norm1->step,
mask1->ptr<uchar>(y1), mask1->step, mask1->ptr<uchar>(y1), mask1->step,