diff --git a/CMakeLists.txt b/CMakeLists.txt index c00dfc562e..c1e4e7c1af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,8 +127,7 @@ OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF ) OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) -OCV_OPTION(WITH_ICV "Include Intel IPP ICV support" ON IF (NOT IOS) ) -OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (NOT IOS) ) +OCV_OPTION(WITH_IPP "Include Intel IPP support" ON IF (NOT IOS) ) OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) ) OCV_OPTION(WITH_JPEG "Include JPEG support" ON) OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS) ) @@ -917,11 +916,11 @@ endif(DEFINED WITH_INTELPERC) status("") status(" Other third-party libraries:") -if((WITH_IPP OR WITH_ICV) AND HAVE_IPP) +if(WITH_IPP AND HAVE_IPP) status(" Use IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]") status(" at:" "${IPP_ROOT_DIR}") else() - status(" Use IPP:" (WITH_IPP OR WITH_ICV) AND NOT HAVE_IPP THEN "IPP not found" ELSE NO) + status(" Use IPP:" WITH_IPP AND NOT HAVE_IPP THEN "IPP not found" ELSE NO) endif() if(DEFINED WITH_IPP_A) diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index 559f70a968..9cb6ed0183 100644 --- a/cmake/OpenCVFindIPP.cmake +++ b/cmake/OpenCVFindIPP.cmake @@ -2,15 +2,12 @@ # The script to detect Intel(R) Integrated Performance Primitives (IPP) # installation/package # -# Windows host: -# Run script like this before cmake: -# call "\bin\ippvars.bat" intel64 -# for example: -# call "C:\Program Files (x86)\Intel\Composer XE\ipp\bin\ippvars.bat" intel64 +# By default, ICV version will be used. +# To use standalone IPP update cmake command line: +# cmake ... -DIPPROOT= ... +# +# Note: Backward compatibility is broken, IPPROOT environment path is ignored # -# Linux host: -# Run script like this before cmake: -# source /opt/intel/ipp/bin/ippvars.sh [ia32|intel64] # # On return this will define: # @@ -39,14 +36,6 @@ unset(IPP_VERSION_BUILD) set(IPP_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) set(IPP_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) -set(IPP_PREFIX "ipp") -set(IPP_SUFFIX "_l") -set(IPPCORE "core") # core functionality -set(IPPS "s") # signal processing -set(IPPI "i") # image processing -set(IPPCC "cc") # color conversion -set(IPPCV "cv") # computer vision -set(IPPVM "vm") # vector math set(IPP_X64 0) if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) @@ -56,21 +45,21 @@ if(CMAKE_CL_64) set(IPP_X64 1) endif() -# This function detects IPP version by analyzing ippversion.h file -macro(ipp_get_version _ROOT_DIR) +# This function detects IPP version by analyzing .h file +macro(ipp_get_version VERSION_FILE) unset(_VERSION_STR) unset(_MAJOR) unset(_MINOR) unset(_BUILD) # read IPP version info from file - file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR1 REGEX "IPP_VERSION_MAJOR") - file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR2 REGEX "IPP_VERSION_MINOR") - file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR3 REGEX "IPP_VERSION_BUILD") + file(STRINGS ${VERSION_FILE} STR1 REGEX "IPP_VERSION_MAJOR") + file(STRINGS ${VERSION_FILE} STR2 REGEX "IPP_VERSION_MINOR") + file(STRINGS ${VERSION_FILE} STR3 REGEX "IPP_VERSION_BUILD") if("${STR3}" STREQUAL "") - file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR3 REGEX "IPP_VERSION_UPDATE") + file(STRINGS ${VERSION_FILE} STR3 REGEX "IPP_VERSION_UPDATE") endif() - file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR4 REGEX "IPP_VERSION_STR") + file(STRINGS ${VERSION_FILE} STR4 REGEX "IPP_VERSION_STR") # extract info and assign to variables string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1}) @@ -83,66 +72,92 @@ macro(ipp_get_version _ROOT_DIR) set(IPP_VERSION_MAJOR ${_MAJOR}) set(IPP_VERSION_MINOR ${_MINOR}) set(IPP_VERSION_BUILD ${_BUILD}) - - set(__msg) - if(EXISTS ${_ROOT_DIR}/include/ippicv.h) - ocv_assert(WITH_ICV AND NOT WITH_IPP) - set(__msg " ICV version") - set(HAVE_IPP_ICV_ONLY 1) - endif() - - message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]${__msg}") - message(STATUS "at: ${_ROOT_DIR}") endmacro() +macro(_ipp_not_supported) + message(STATUS ${ARGN}) + unset(HAVE_IPP) + unset(HAVE_IPP_ICV_ONLY) + unset(IPP_VERSION_STR) + return() +endmacro() -# This function sets IPP_INCLUDE_DIRS and IPP_LIBRARIES variables -macro(ipp_set_variables _LATEST_VERSION) - if(${_LATEST_VERSION} VERSION_LESS "7.0") - message(SEND_ERROR "IPP ${_LATEST_VERSION} is not supported") - unset(HAVE_IPP) - return() +# This macro uses IPP_ROOT_DIR variable +# TODO Cleanup code after ICV package stabilization +macro(ipp_detect_version) + set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include) + + set(__msg) + if(EXISTS ${IPP_ROOT_DIR}/ippicv.h) + set(__msg " (ICV version)") + set(HAVE_IPP_ICV_ONLY 1) + if(EXISTS ${IPP_ROOT_DIR}/ippversion.h) + _ipp_not_supported("Can't resolve IPP directory: ${IPP_ROOT_DIR}") + else() + ipp_get_version(${IPP_ROOT_DIR}/ippicv.h) + endif() + ocv_assert(IPP_VERSION_STR VERSION_GREATER "8.0") + set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/) + elseif(EXISTS ${IPP_ROOT_DIR}/include/ipp.h) + ipp_get_version(${IPP_ROOT_DIR}/include/ippversion.h) + ocv_assert(IPP_VERSION_STR VERSION_GREATER "1.0") + else() + _ipp_not_supported("Can't resolve IPP directory: ${IPP_ROOT_DIR}") endif() - # set INCLUDE and LIB folders - set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include) + message(STATUS "found IPP${__msg}: ${_MAJOR}.${_MINOR}.${_BUILD} [${IPP_VERSION_STR}]") + message(STATUS "at: ${IPP_ROOT_DIR}") + + if(${IPP_VERSION_STR} VERSION_LESS "7.0") + _ipp_not_supported("IPP ${IPP_VERSION_STR} is not supported") + endif() + + set(HAVE_IPP 1) + if(EXISTS ${IPP_INCLUDE_DIRS}/ipp_redefine.h) + set(HAVE_IPP_REDEFINE 1) + else() + unset(HAVE_IPP_REDEFINE) + endif() + + macro(_ipp_set_library_dir DIR) + if(NOT EXISTS ${DIR}) + _ipp_not_supported("IPP library directory not found") + endif() + set(IPP_LIBRARY_DIR ${DIR}) + endmacro() if(NOT HAVE_IPP_ICV_ONLY) if(APPLE) - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/lib) + _ipp_set_library_dir(${IPP_ROOT_DIR}/lib) elseif(IPP_X64) - if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64) - message(SEND_ERROR "IPP EM64T libraries not found") - endif() - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/lib/intel64) + _ipp_set_library_dir(${IPP_ROOT_DIR}/lib/intel64) else() - if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32) - message(SEND_ERROR "IPP IA32 libraries not found") - endif() - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/lib/ia32) + _ipp_set_library_dir(${IPP_ROOT_DIR}/lib/ia32) endif() else() - if(APPLE) - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/libs/macosx) - elseif(WIN32 AND NOT ARM) - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/libs/windows) - elseif(UNIX) - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/libs/linux) + if(EXISTS ${IPP_ROOT_DIR}/lib) + set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/lib) else() - message(MESSAGE "IPP ${_LATEST_VERSION} at ${IPP_ROOT_DIR} is not supported") - unset(HAVE_IPP) - return() + _ipp_not_supported("IPP ${IPP_VERSION_STR} at ${IPP_ROOT_DIR} is not supported") endif() if(X86_64) - set(IPP_LIBRARY_DIR ${IPP_LIBRARY_DIR}/intel64) + _ipp_set_library_dir(${IPP_LIBRARY_DIR}/intel64) else() - set(IPP_LIBRARY_DIR ${IPP_LIBRARY_DIR}/ia32) + _ipp_set_library_dir(${IPP_LIBRARY_DIR}/ia32) endif() endif() + macro(_ipp_add_library name) + if (EXISTS ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) + list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) + else() + message(STATUS "Can't find IPP library: ${name}") + endif() + endmacro() + set(IPP_PREFIX "ipp") - if(${_LATEST_VERSION} VERSION_LESS "8.0") - set(IPP_SUFFIX "_l") # static not threaded libs suffix IPP 7.x + if(${IPP_VERSION_STR} VERSION_LESS "8.0") + set(IPP_SUFFIX "_l") # static not threaded libs suffix IPP 7.x else() if(WIN32) set(IPP_SUFFIX "mt") # static not threaded libs suffix IPP 8.x for Windows @@ -150,86 +165,92 @@ macro(ipp_set_variables _LATEST_VERSION) set(IPP_SUFFIX "") # static not threaded libs suffix IPP 8.x for Linux/OS X endif() endif() - set(IPPCORE "core") # core functionality - set(IPPSP "s") # signal processing - set(IPPIP "i") # image processing - set(IPPCC "cc") # color conversion - set(IPPCV "cv") # computer vision - set(IPPVM "vm") # vector math - set(IPPM "m") # matrix math - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPS}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - if(NOT HAVE_IPP_ICV_ONLY) - list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPM}${IPP_SUFFIX}${IPP_LIB_SUFFIX}) - endif() + if(HAVE_IPP_ICV_ONLY) + _ipp_add_library(icv) + else() + _ipp_add_library(core) + _ipp_add_library(s) + _ipp_add_library(i) + _ipp_add_library(cc) + _ipp_add_library(cv) + _ipp_add_library(vm) + _ipp_add_library(m) -# FIXIT -# if(UNIX AND NOT HAVE_IPP_ICV_ONLY) -# get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH) - if(UNIX) - if(NOT HAVE_IPP_ICV_ONLY) + if(UNIX) get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH) - else() - set(INTEL_COMPILER_LIBRARY_DIR "/opt/intel/lib") - endif() - if(IPP_X64) - if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64) - message(SEND_ERROR "Intel compiler EM64T libraries not found") + if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}) + get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../compiler/lib REALPATH) + endif() + if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}) + _ipp_not_supported("IPP configuration error: can't find Intel compiler library dir ${INTEL_COMPILER_LIBRARY_DIR}") endif() if(NOT APPLE) - set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/intel64) + if(IPP_X64) + if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64) + message(SEND_ERROR "Intel compiler EM64T libraries not found") + endif() + set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/intel64) + else() + if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32) + message(SEND_ERROR "Intel compiler IA32 libraries not found") + endif() + set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/ia32) + endif() endif() - else() - if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32) - message(SEND_ERROR "Intel compiler IA32 libraries not found") - endif() - if (NOT APPLE) - set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/ia32) - endif() - endif() - list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}irc${CMAKE_SHARED_LIBRARY_SUFFIX}) - list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}imf${CMAKE_SHARED_LIBRARY_SUFFIX}) - list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}svml${CMAKE_SHARED_LIBRARY_SUFFIX}) + + macro(_ipp_add_compiler_library name) + if (EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}) + list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}) + else() + message(STATUS "Can't find compiler library: ${name}") + endif() + endmacro() + + _ipp_add_compiler_library(irc) + _ipp_add_compiler_library(imf) + _ipp_add_compiler_library(svml) + endif(UNIX) endif() #message(STATUS "IPP libs: ${IPP_LIBRARIES}") endmacro() -if(WITH_IPP) - set(IPPPATH $ENV{IPPROOT}) - if(UNIX) - list(APPEND IPPPATH /opt/intel/ipp) - endif() -elseif(WITH_ICV) - if(DEFINED ENV{IPPICVROOT}) - set(IPPPATH $ENV{IPPICVROOT}) - else() - set(IPPPATH ${OpenCV_SOURCE_DIR}/3rdparty/ippicv) +# OPENCV_IPP_PATH is an environment variable for internal usage only, do not use it +if(DEFINED ENV{OPENCV_IPP_PATH} AND NOT DEFINED IPPROOT) + set(IPPROOT "$ENV{OPENCV_IPP_PATH}") +endif() +if(NOT DEFINED IPPROOT) + set(IPPROOT "${OpenCV_SOURCE_DIR}/3rdparty/ippicv") +endif() + +# Try ICV +find_path( + IPP_ICV_H_PATH + NAMES ippicv.h + PATHS ${IPPROOT} + DOC "The path to Intel(R) IPP ICV header files" + NO_DEFAULT_PATH + NO_CMAKE_PATH) +set(IPP_ROOT_DIR ${IPP_ICV_H_PATH}) + +if(NOT IPP_ICV_H_PATH) + # Try standalone IPP + find_path( + IPP_H_PATH + NAMES ippversion.h + PATHS ${IPPROOT} + PATH_SUFFIXES include + DOC "The path to Intel(R) IPP header files" + NO_DEFAULT_PATH + NO_CMAKE_PATH) + if(IPP_H_PATH) + get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH) endif() endif() - -find_path( - IPP_H_PATH - NAMES ippversion.h - PATHS ${IPPPATH} - PATH_SUFFIXES include - DOC "The path to Intel(R) IPP header files" - NO_DEFAULT_PATH - NO_CMAKE_PATH) - -if(IPP_H_PATH) - set(HAVE_IPP 1) - - get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH) - - ipp_get_version(${IPP_ROOT_DIR}) - ipp_set_variables(${IPP_VERSION_STR}) +if(IPP_ROOT_DIR) + ipp_detect_version() endif() diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake index 7198326351..a046b8fc34 100644 --- a/cmake/OpenCVFindLibsPerf.cmake +++ b/cmake/OpenCVFindLibsPerf.cmake @@ -8,7 +8,7 @@ if(WITH_TBB) endif(WITH_TBB) # --- IPP --- -if(WITH_IPP OR WITH_ICV) +if(WITH_IPP) include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPP.cmake") if(HAVE_IPP) ocv_include_directories(${IPP_INCLUDE_DIRS}) diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index f516e64784..593ee9fd55 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -211,8 +211,8 @@ CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int un #ifdef HAVE_IPP # ifdef HAVE_IPP_ICV_ONLY +# include "ipp_redefine.h" # include "ippicv.h" -# include "ippicv_fn_map.h" # else # include "ipp.h" # endif diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 66ae7f90bf..155ca67d6f 100644 --- a/modules/core/src/convert.cpp +++ b/modules/core/src/convert.cpp @@ -1079,7 +1079,7 @@ dtype* dst, size_t dstep, Size size, double* scale) \ cvtScale_(src, sstep, dst, dstep, size, (wtype)scale[0], (wtype)scale[1]); \ } -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) #define DEF_CVT_FUNC_F(suffix, stype, dtype, ippFavor) \ static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \ dtype* dst, size_t dstep, Size size, double*) \ diff --git a/modules/core/src/copy.cpp b/modules/core/src/copy.cpp index 824508fc94..202e7a9225 100644 --- a/modules/core/src/copy.cpp +++ b/modules/core/src/copy.cpp @@ -548,7 +548,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode ) Mat dst = _dst.getMat(); size_t esz = CV_ELEM_SIZE(type); -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip); ippiMirror ippFunc = type == CV_8UC1 ? (ippiMirror)ippiMirror_8u_C1R : diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index 376cbadaea..65f78de085 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -238,7 +238,7 @@ float cubeRoot( float value ) static void Magnitude_32f(const float* x, const float* y, float* mag, int len) { -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) IppStatus status = ippsMagnitude_32f(x, y, mag, len); if (status >= 0) return; @@ -270,7 +270,7 @@ static void Magnitude_32f(const float* x, const float* y, float* mag, int len) static void Magnitude_64f(const double* x, const double* y, double* mag, int len) { -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) IppStatus status = ippsMagnitude_64f(x, y, mag, len); if (status >= 0) return; @@ -303,7 +303,7 @@ static void Magnitude_64f(const double* x, const double* y, double* mag, int len static void InvSqrt_32f(const float* src, float* dst, int len) { -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (ippsInvSqrt_32f_A21(src, dst, len) >= 0) return; #endif @@ -351,7 +351,7 @@ static void InvSqrt_64f(const double* src, double* dst, int len) static void Sqrt_32f(const float* src, float* dst, int len) { -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (ippsSqrt_32f_A21(src, dst, len) >= 0) return; #endif @@ -384,7 +384,7 @@ static void Sqrt_32f(const float* src, float* dst, int len) static void Sqrt_64f(const double* src, double* dst, int len) { -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (ippsSqrt_64f_A50(src, dst, len) >= 0) return; #endif @@ -755,7 +755,7 @@ void polarToCart( InputArray src1, InputArray src2, dst2.create( Angle.dims, Angle.size, type ); Mat X = dst1.getMat(), Y = dst2.getMat(); -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees) { typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase, @@ -2161,7 +2161,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) _src.copyTo(_dst); return; case 2: -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) || (_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) )) { Mat src = _src.getMat(); @@ -2233,7 +2233,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) } else { -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (src.isContinuous() && dst.isContinuous()) { IppStatus status = depth == CV_32F ? diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 7e2976e43f..4efba46548 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -2967,7 +2967,7 @@ void cv::transpose( InputArray _src, OutputArray _dst ) return; } -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize); ippiTranspose ippFunc = type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R : diff --git a/modules/imgproc/src/accum.cpp b/modules/imgproc/src/accum.cpp index 216ddcb395..74a63e916c 100644 --- a/modules/imgproc/src/accum.cpp +++ b/modules/imgproc/src/accum.cpp @@ -457,7 +457,7 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous()))) { typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize); @@ -535,7 +535,7 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2, Mat src1 = _src1.getMat(), src2 = _src2.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous())) { typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2, @@ -615,7 +615,7 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst, Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && mask.isContinuous())) { typedef IppStatus (CV_STDCALL * ippiAddWeighted)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 2bd2332738..287a188807 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -300,7 +300,7 @@ static ippiReorderFunc ippiSwapChannelsC3RTab[] = 0, (ippiReorderFunc)ippiSwapChannels_32f_C3R, 0, 0 }; -#if IPP_VERSION_X100 >= 801 +#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801 static ippiReorderFunc ippiSwapChannelsC4RTab[] = { (ippiReorderFunc)ippiSwapChannels_8u_C4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4R, 0, @@ -3280,7 +3280,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) ) return; } -#if (IPP_VERSION_X100 >= 801) +#if !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_X100 >= 801) else if( code == CV_RGBA2BGRA ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) ) diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index 9bfac450e2..1b3e2c417b 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -233,6 +233,9 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, } } case CV_32F: +#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R + return false; +#else { switch(dst.type()) { @@ -277,6 +280,7 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, return false; } } +#endif default: return false; } @@ -341,6 +345,9 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k if (src.type() == CV_32F && dst.type() == CV_32F) { +#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R + return false; +#else #if 0 if ((dx == 1) && (dy == 0)) { @@ -411,6 +418,7 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } +#endif } } diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 344601bf20..45a66bd83e 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -1912,7 +1912,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\ getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE; -#if IPP_VERSION_X100 >= 701 +#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701 class IPPresizeInvoker : public ParallelLoopBody { @@ -2384,7 +2384,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, double scale_x = 1./inv_scale_x, scale_y = 1./inv_scale_y; int k, sx, sy, dx, dy; -#if IPP_VERSION_X100 >= 701 +#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701 #define IPP_RESIZE_EPS 1.e-10 double ex = fabs((double)dsize.width/src.cols - inv_scale_x)/inv_scale_x; diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 07aa4c5dd3..5b13ffc29e 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1228,6 +1228,9 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne } else { +#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiFilterMin*/ippiFilterMax* + return false; +#else IppiPoint point = {anchor.x, anchor.y}; #define IPP_MORPH_CASE(cvtype, flavor, data_type) \ @@ -1257,6 +1260,7 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne } #undef IPP_MORPH_CASE +#endif } } diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index c17902cf17..4318cd1871 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -858,7 +858,7 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth, return; #endif -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) int ippBorderType = borderType & ~BORDER_ISOLATED; Point ocvAnchor, ippAnchor; ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x; @@ -2018,7 +2018,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) _dst.create( src0.size(), src0.type() ); Mat dst = _dst.getMat(); -#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1 +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801 #define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \ do \ { \ diff --git a/modules/imgproc/src/thresh.cpp b/modules/imgproc/src/thresh.cpp index 440f15a5d3..17f323a1ad 100644 --- a/modules/imgproc/src/thresh.cpp +++ b/modules/imgproc/src/thresh.cpp @@ -68,7 +68,7 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) return; #endif -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) IppiSize sz = { roi.width, roi.height }; switch( type ) { @@ -306,7 +306,7 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) return; #endif -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) IppiSize sz = { roi.width, roi.height }; switch( type ) { @@ -497,7 +497,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type ) return; #endif -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) IppiSize sz = { roi.width, roi.height }; switch( type ) { diff --git a/modules/video/src/motempl.cpp b/modules/video/src/motempl.cpp index 4dfe5d7fcc..152706b9fe 100644 --- a/modules/video/src/motempl.cpp +++ b/modules/video/src/motempl.cpp @@ -80,7 +80,7 @@ void cv::updateMotionHistory( InputArray _silhouette, InputOutputArray _mhi, Mat silh = _silhouette.getMat(), mhi = _mhi.getMat(); Size size = silh.size(); -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) int silhstep = (int)silh.step, mhistep = (int)mhi.step; #endif @@ -88,13 +88,13 @@ void cv::updateMotionHistory( InputArray _silhouette, InputOutputArray _mhi, { size.width *= size.height; size.height = 1; -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) silhstep = (int)silh.total(); mhistep = (int)mhi.total() * sizeof(Ipp32f); #endif } -#ifdef HAVE_IPP +#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) IppStatus status = ippiUpdateMotionHistory_8u32f_C1IR((const Ipp8u *)silh.data, silhstep, (Ipp32f *)mhi.data, mhistep, ippiSize(size.width, size.height), (Ipp32f)timestamp, (Ipp32f)duration); if (status >= 0)