From 5658ba0002e5d550d309577f862be207f1906e5b Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 28 Apr 2014 18:36:58 +0400 Subject: [PATCH 1/4] icv: update package --- 3rdparty/ippicv/.gitignore | 4 +- 3rdparty/ippicv/downloader.cmake | 38 ++++++++------- cmake/OpenCVFindIPP.cmake | 47 +++++-------------- modules/core/include/opencv2/core/private.hpp | 8 +--- modules/core/src/dxt.cpp | 2 +- modules/imgproc/src/deriv.cpp | 6 ++- modules/imgproc/src/smooth.cpp | 2 +- 7 files changed, 44 insertions(+), 63 deletions(-) diff --git a/3rdparty/ippicv/.gitignore b/3rdparty/ippicv/.gitignore index c7decd2419..ea720dd57d 100644 --- a/3rdparty/ippicv/.gitignore +++ b/3rdparty/ippicv/.gitignore @@ -1,4 +1,2 @@ downloads/ -macosx/ -linux/ -windows/ +unpack/ diff --git a/3rdparty/ippicv/downloader.cmake b/3rdparty/ippicv/downloader.cmake index 849c03881c..3e830fe7ef 100644 --- a/3rdparty/ippicv/downloader.cmake +++ b/3rdparty/ippicv/downloader.cmake @@ -8,22 +8,26 @@ function(_icv_downloader) # Define actual ICV versions if(APPLE) - set(OPENCV_ICV_PACKAGE_NAME "ippicv_macosx.tar.gz") - set(OPENCV_ICV_PACKAGE_HASH "d489e447906de7808a9a9d7e3f225f7a") + set(OPENCV_ICV_PACKAGE_NAME "ippicv_macosx_20140429.tgz") + set(OPENCV_ICV_PACKAGE_HASH "f2195a60829899983acd4a45794e1717") set(OPENCV_ICV_PLATFORM "macosx") + set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_osx") elseif(UNIX AND NOT ANDROID) - set(OPENCV_ICV_PACKAGE_NAME "ippicv_linux.tar.gz") - set(OPENCV_ICV_PACKAGE_HASH "42798c6cd6348bd40e74c425dc23338a") + set(OPENCV_ICV_PACKAGE_NAME "ippicv_linux_20140429.tgz") + set(OPENCV_ICV_PACKAGE_HASH "f6481b8695a56ad27a84db1e44ea0f00") set(OPENCV_ICV_PLATFORM "linux") + set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_lnx") elseif(WIN32 AND NOT ARM) - set(OPENCV_ICV_PACKAGE_NAME "ippicv_windows.zip") - set(OPENCV_ICV_PACKAGE_HASH "2715f39ae65dc09bae3648bffe538706") + set(OPENCV_ICV_PACKAGE_NAME "ippicv_windows_20140429.zip") + set(OPENCV_ICV_PACKAGE_HASH "b5028a92224ec1fbc554010c52eb3ec8") set(OPENCV_ICV_PLATFORM "windows") + set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_win") else() return() # Not supported endif() - set(OPENCV_ICV_PATH "${CMAKE_CURRENT_LIST_DIR}/${OPENCV_ICV_PLATFORM}") + set(OPENCV_ICV_UNPACK_PATH "${CMAKE_CURRENT_LIST_DIR}/unpack") + set(OPENCV_ICV_PATH "${OPENCV_ICV_UNPACK_PATH}${OPENCV_ICV_PACKAGE_SUBDIR}") if(DEFINED OPENCV_ICV_PACKAGE_DOWNLOADED AND OPENCV_ICV_PACKAGE_DOWNLOADED STREQUAL OPENCV_ICV_PACKAGE_HASH @@ -32,9 +36,9 @@ function(_icv_downloader) set(OPENCV_ICV_PATH "${OPENCV_ICV_PATH}" PARENT_SCOPE) return() else() - if(EXISTS ${OPENCV_ICV_PATH}) - message(STATUS "ICV: Removing previous unpacked package: ${OPENCV_ICV_PATH}") - file(REMOVE_RECURSE ${OPENCV_ICV_PATH}) + if(EXISTS ${OPENCV_ICV_UNPACK_PATH}) + message(STATUS "ICV: Removing previous unpacked package: ${OPENCV_ICV_UNPACK_PATH}") + file(REMOVE_RECURSE ${OPENCV_ICV_UNPACK_PATH}) endif() endif() unset(OPENCV_ICV_PACKAGE_DOWNLOADED CACHE) @@ -78,19 +82,21 @@ function(_icv_downloader) endif() ocv_assert(EXISTS "${OPENCV_ICV_PACKAGE_ARCHIVE}") - ocv_assert(NOT EXISTS "${OPENCV_ICV_PATH}") - file(MAKE_DIRECTORY ${OPENCV_ICV_PATH}) - ocv_assert(EXISTS "${OPENCV_ICV_PATH}") + ocv_assert(NOT EXISTS "${OPENCV_ICV_UNPACK_PATH}") + file(MAKE_DIRECTORY ${OPENCV_ICV_UNPACK_PATH}) + ocv_assert(EXISTS "${OPENCV_ICV_UNPACK_PATH}") - message(STATUS "ICV: Unpacking ${OPENCV_ICV_PACKAGE_NAME} to ${OPENCV_ICV_PATH}...") + message(STATUS "ICV: Unpacking ${OPENCV_ICV_PACKAGE_NAME} to ${OPENCV_ICV_UNPACK_PATH}...") execute_process(COMMAND ${CMAKE_COMMAND} -E tar xz "${OPENCV_ICV_PACKAGE_ARCHIVE}" - WORKING_DIRECTORY "${OPENCV_ICV_PATH}" + WORKING_DIRECTORY "${OPENCV_ICV_UNPACK_PATH}" RESULT_VARIABLE __result) if(NOT __result EQUAL 0) - message(FATAL_ERROR "ICV: Failed to unpack ICV package from ${OPENCV_ICV_PACKAGE_ARCHIVE} to ${OPENCV_ICV_PATH} with error ${__result}") + message(FATAL_ERROR "ICV: Failed to unpack ICV package from ${OPENCV_ICV_PACKAGE_ARCHIVE} to ${OPENCV_ICV_UNPACK_PATH} with error ${__result}") endif() + ocv_assert(EXISTS "${OPENCV_ICV_PATH}") + set(OPENCV_ICV_PACKAGE_DOWNLOADED "${OPENCV_ICV_PACKAGE_HASH}" CACHE INTERNAL "ICV package hash") message(STATUS "ICV: Package successfully downloaded") diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index 6ad6c28618..31d64abe56 100644 --- a/cmake/OpenCVFindIPP.cmake +++ b/cmake/OpenCVFindIPP.cmake @@ -35,7 +35,7 @@ unset(IPP_VERSION_MINOR) unset(IPP_VERSION_BUILD) set(IPP_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) -set(IPP_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(IPP_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) set(IPP_X64 0) if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) @@ -88,23 +88,18 @@ macro(ipp_detect_version) set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include) set(__msg) - if(EXISTS ${IPP_ROOT_DIR}/ippicv.h) + if(EXISTS ${IPP_ROOT_DIR}/include/ippicv_redefs.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") + # nothing else() _ipp_not_supported("Can't resolve IPP directory: ${IPP_ROOT_DIR}") endif() + ipp_get_version(${IPP_INCLUDE_DIRS}/ippversion.h) + ocv_assert(IPP_VERSION_STR VERSION_GREATER "1.0") + message(STATUS "found IPP${__msg}: ${_MAJOR}.${_MINOR}.${_BUILD} [${IPP_VERSION_STR}]") message(STATUS "at: ${IPP_ROOT_DIR}") @@ -113,11 +108,6 @@ macro(ipp_detect_version) 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}) @@ -126,32 +116,19 @@ macro(ipp_detect_version) set(IPP_LIBRARY_DIR ${DIR}) endmacro() - if(NOT HAVE_IPP_ICV_ONLY) - if(APPLE) - _ipp_set_library_dir(${IPP_ROOT_DIR}/lib) - elseif(IPP_X64) - _ipp_set_library_dir(${IPP_ROOT_DIR}/lib/intel64) - else() - _ipp_set_library_dir(${IPP_ROOT_DIR}/lib/ia32) - endif() + if(APPLE) + _ipp_set_library_dir(${IPP_ROOT_DIR}/lib) + elseif(IPP_X64) + _ipp_set_library_dir(${IPP_ROOT_DIR}/lib/intel64) else() - if(EXISTS ${IPP_ROOT_DIR}/lib) - set(IPP_LIBRARY_DIR ${IPP_ROOT_DIR}/lib) - else() - _ipp_not_supported("IPP ${IPP_VERSION_STR} at ${IPP_ROOT_DIR} is not supported") - endif() - if(IPP_X64) - _ipp_set_library_dir(${IPP_LIBRARY_DIR}/intel64) - else() - _ipp_set_library_dir(${IPP_LIBRARY_DIR}/ia32) - endif() + _ipp_set_library_dir(${IPP_ROOT_DIR}/lib/ia32) 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}") + message(STATUS "Can't find IPP library: ${name} at ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}") endif() endmacro() diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index eea2281dc2..6678716405 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -210,12 +210,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" -# else -# include "ipp.h" -# endif +# include "ipp.h" + # define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR) #define IPP_ALIGN 32 // required for AVX optimization diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index e3525b98aa..fd263aaaf2 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -53,7 +53,7 @@ namespace cv # pragma warning(disable: 4748) #endif -#if IPP_VERSION_X100 >= 701 +#if IPP_VERSION_X100 >= 701 && !defined(HAVE_IPP_ICV_ONLY) #define USE_IPP_DFT 1 #else #undef USE_IPP_DFT diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index f232eb5d9c..51f017b628 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -193,7 +193,7 @@ namespace cv static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType) { #if defined(HAVE_IPP_ICV_ONLY) - _src; _dst; ddepth; dx; dy; scale; delta; borderType; + (void)_src; (void)_dst; (void)ddepth; (void)dx; (void)dy; (void)scale; (void)delta; (void)borderType; return false; #else if ((0 > dx) || (0 > dy) || (1 != dx + dy)) @@ -460,6 +460,9 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, return true; } +#if defined(HAVE_IPP_ICV_ONLY) + return false; +#else if ((dx == 2) && (dy == 0)) { if (0 > ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) @@ -485,6 +488,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, IPP_RETURN_ERROR return true; } +#endif } if (src.type() == CV_32F && dst.type() == CV_32F) diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 50d1250322..58075be65b 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -2274,7 +2274,7 @@ private: float *space_weight, *color_weight; }; -#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) +#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined(HAVE_IPP_ICV_ONLY) class IPPBilateralFilter_8u_Invoker : public ParallelLoopBody { From b62e59aac008c722de350bb85367aa93ceb79880 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 28 Apr 2014 19:31:18 +0400 Subject: [PATCH 2/4] icv: enable functions --- modules/calib3d/src/stereosgbm.cpp | 2 +- modules/core/src/arithm.cpp | 12 ++++++------ modules/core/src/convert.cpp | 6 +++--- modules/core/src/copy.cpp | 12 ++++++------ modules/core/src/dxt.cpp | 8 +++++--- modules/core/src/mathfuncs.cpp | 16 ++++++++-------- modules/core/src/matrix.cpp | 14 +++++++------- modules/core/src/stat.cpp | 4 ---- modules/imgproc/src/accum.cpp | 8 ++++---- modules/imgproc/src/color.cpp | 16 +++++++--------- modules/imgproc/src/corner.cpp | 2 +- modules/imgproc/src/deriv.cpp | 25 ++++++------------------- modules/imgproc/src/distransform.cpp | 6 +++--- modules/imgproc/src/histogram.cpp | 4 ++-- modules/imgproc/src/imgwarp.cpp | 4 ++-- modules/imgproc/src/moments.cpp | 2 +- modules/imgproc/src/morph.cpp | 4 ---- modules/imgproc/src/pyramids.cpp | 6 +++--- modules/imgproc/src/smooth.cpp | 7 +++---- modules/imgproc/src/templmatch.cpp | 6 +++--- modules/imgproc/src/thresh.cpp | 8 ++++---- modules/video/src/motempl.cpp | 6 +++--- 22 files changed, 78 insertions(+), 100 deletions(-) diff --git a/modules/calib3d/src/stereosgbm.cpp b/modules/calib3d/src/stereosgbm.cpp index 985d81a280..8374edeac2 100644 --- a/modules/calib3d/src/stereosgbm.cpp +++ b/modules/calib3d/src/stereosgbm.cpp @@ -1084,7 +1084,7 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi int newVal = cvRound(_newval), maxDiff = cvRound(_maxDiff); -#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 >= 801 Ipp32s bufsize = 0; IppiSize roisize = { img.cols, img.rows }; IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s; diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 009b4e4219..0c6c432956 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -705,7 +705,7 @@ static void max64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, Size sz, void* ) { -#if ARITHM_USE_IPP == 1 && !defined HAVE_IPP_ICV_ONLY +#if ARITHM_USE_IPP == 1 double* s1 = (double*)src1; double* s2 = (double*)src2; double* d = dst; @@ -826,7 +826,7 @@ static void min64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, Size sz, void* ) { -#if ARITHM_USE_IPP == 1 && !defined HAVE_IPP_ICV_ONLY +#if ARITHM_USE_IPP == 1 double* s1 = (double*)src1; double* s2 = (double*)src2; double* d = dst; @@ -2014,7 +2014,7 @@ static void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t st uchar* dst, size_t step, Size sz, void* scale) { float fscale = (float)*(const double*)scale; -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (std::fabs(fscale - 1) <= FLT_EPSILON) { if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0) @@ -2035,7 +2035,7 @@ static void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t ushort* dst, size_t step, Size sz, void* scale) { float fscale = (float)*(const double*)scale; -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (std::fabs(fscale - 1) <= FLT_EPSILON) { if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0) @@ -2050,7 +2050,7 @@ static void mul16s( const short* src1, size_t step1, const short* src2, size_t s short* dst, size_t step, Size sz, void* scale) { float fscale = (float)*(const double*)scale; -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (std::fabs(fscale - 1) <= FLT_EPSILON) { if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0) @@ -2071,7 +2071,7 @@ static void mul32f( const float* src1, size_t step1, const float* src2, size_t s float* dst, size_t step, Size sz, void* scale) { float fscale = (float)*(const double*)scale; -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (std::fabs(fscale - 1) <= FLT_EPSILON) { if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0) diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 6684dedd70..d88e422799 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]); \ } -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) #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*) \ @@ -1564,7 +1564,7 @@ static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst) #endif -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) namespace ipp { #if 0 // there are no performance benefits (PR #2653) @@ -1781,7 +1781,7 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst ) { bool ok = false; Ptr body; -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) size_t elemSize1 = CV_ELEM_SIZE1(dst.depth()); #if 0 // there are no performance benefits (PR #2653) if (lutcn == 1) diff --git a/modules/core/src/copy.cpp b/modules/core/src/copy.cpp index 3ff0005623..b007f3cd60 100644 --- a/modules/core/src/copy.cpp +++ b/modules/core/src/copy.cpp @@ -81,7 +81,7 @@ copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, ucha template<> void copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size) { -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0) return; setIppErrorStatus(); @@ -117,7 +117,7 @@ copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mste template<> void copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size) { -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0) return; setIppErrorStatus(); @@ -177,7 +177,7 @@ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, copyMask_(src, sstep, mask, mstep, dst, dstep, size); \ } -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP #define DEF_COPY_MASK_F(suffix, type, ippfavor, ipptype) \ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \ uchar* dst, size_t dstep, Size size, void*) \ @@ -281,7 +281,7 @@ void Mat::copyTo( OutputArray _dst ) const Size sz = getContinuousSize(*this, dst); size_t len = sz.width*elemSize(); -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0) return; setIppErrorStatus(); @@ -419,7 +419,7 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask) CV_Assert( checkScalar(value, type(), _value.kind(), _InputArray::MAT )); CV_Assert( mask.empty() || (mask.type() == CV_8U && size == mask.size) ); -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP int cn = channels(), depth0 = depth(); if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) && @@ -681,7 +681,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode ) Mat dst = _dst.getMat(); size_t esz = CV_ELEM_SIZE(type); -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip); typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip); ippiMirror ippFunc = 0; diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index fd263aaaf2..0071bf7de5 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -53,7 +53,7 @@ namespace cv # pragma warning(disable: 4748) #endif -#if IPP_VERSION_X100 >= 701 && !defined(HAVE_IPP_ICV_ONLY) +#if IPP_VERSION_X100 >= 701 #define USE_IPP_DFT 1 #else #undef USE_IPP_DFT @@ -1478,7 +1478,7 @@ typedef IppStatus (CV_STDCALL* IppDFTInitFunc)(int, int, IppHintAlgorithm, void* namespace cv { -#if defined USE_IPP_DFT && !defined HAVE_IPP_ICV_ONLY +#if defined USE_IPP_DFT typedef IppStatus (CV_STDCALL* ippiDFT_C_Func)(const Ipp32fc*, int, Ipp32fc*, int, const IppiDFTSpec_C_32fc*, Ipp8u*); typedef IppStatus (CV_STDCALL* ippiDFT_R_Func)(const Ipp32f* , int, Ipp32f* , int, const IppiDFTSpec_R_32f* , Ipp8u*); @@ -2063,9 +2063,10 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) Mat dst = _dst.getMat(); -#if defined USE_IPP_DFT && !defined HAVE_IPP_ICV_ONLY +#if defined USE_IPP_DFT if ((src.depth() == CV_32F) && (src.total()>(int)(1<<6)) && nonzero_rows == 0) + { if ((flags & DFT_ROWS) == 0) { if (!real_transform) @@ -2098,6 +2099,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) setIppErrorStatus(); } } + } #endif if( !real_transform ) diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index 3b45855a5a..fe3b77a370 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -237,7 +237,7 @@ float cubeRoot( float value ) static void Magnitude_32f(const float* x, const float* y, float* mag, int len) { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) 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) { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) IppStatus status = ippsMagnitude_64f(x, y, mag, len); if (status >= 0) return; @@ -304,7 +304,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) { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (ippsInvSqrt_32f_A21(src, dst, len) >= 0) return; setIppErrorStatus(); @@ -353,7 +353,7 @@ static void InvSqrt_64f(const double* src, double* dst, int len) static void Sqrt_32f(const float* src, float* dst, int len) { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (ippsSqrt_32f_A21(src, dst, len) >= 0) return; setIppErrorStatus(); @@ -387,7 +387,7 @@ static void Sqrt_32f(const float* src, float* dst, int len) static void Sqrt_64f(const double* src, double* dst, int len) { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (ippsSqrt_64f_A50(src, dst, len) >= 0) return; setIppErrorStatus(); @@ -759,7 +759,7 @@ void polarToCart( InputArray src1, InputArray src2, dst2.create( Angle.dims, Angle.size, type ); Mat X = dst1.getMat(), Y = dst2.getMat(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees) { typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase, @@ -2170,7 +2170,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) _src.copyTo(_dst); return; case 2: -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (depth == CV_32F && !same && ( (_src.dims() <= 2 && !ocl::useOpenCL()) || (_src.dims() > 2 && _src.isContinuous() && _dst.isContinuous()) )) { Mat src = _src.getMat(); @@ -2243,7 +2243,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) } else { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) 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 ff7abf16c6..e5449cd0af 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -3019,7 +3019,7 @@ void cv::transpose( InputArray _src, OutputArray _dst ) return; } -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize); typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize); ippiTranspose ippFunc = 0; @@ -3268,7 +3268,7 @@ typedef void (*ReduceFunc)( const Mat& src, Mat& dst ); #define reduceMinR32f reduceR_ > #define reduceMinR64f reduceR_ > -#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 > 0 static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& dstmat) { @@ -3342,7 +3342,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds #define reduceSumC32f32f reduceC_ > #define reduceSumC64f64f reduceC_ > -#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 > 0 #define reduceSumC8u64f reduceSumC_8u16u16s32f_64f #define reduceSumC16u64f reduceSumC_8u16u16s32f_64f #define reduceSumC16s64f reduceSumC_8u16u16s32f_64f @@ -3354,7 +3354,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds #define reduceSumC32f64f reduceC_ > #endif -#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 > 0 #define REDUCE_OP(favor, optype, type1, type2) \ static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstmat) \ { \ @@ -3378,7 +3378,7 @@ static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstm } #endif -#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 > 0 REDUCE_OP(8u, Max, uchar, uchar) REDUCE_OP(16u, Max, ushort, ushort) REDUCE_OP(16s, Max, short, short) @@ -3391,7 +3391,7 @@ REDUCE_OP(32f, Max, float, float) #endif #define reduceMaxC64f reduceC_ > -#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 > 0 REDUCE_OP(8u, Min, uchar, uchar) REDUCE_OP(16u, Min, ushort, ushort) REDUCE_OP(16s, Min, short, short) @@ -3614,7 +3614,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) namespace cv { -#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 > 0 #define USE_IPP_SORT typedef IppStatus (CV_STDCALL *IppSortFunc)(void *, int); diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 8c57bbe3f1..1e23ae9abf 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -1383,9 +1383,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal, CV_SUPPRESS_DEPRECATED_START ippiMaskMinMaxIndxFuncC1 ippFuncC1 = type == CV_8UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1MR : -#ifndef HAVE_IPP_ICV_ONLY type == CV_8SC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1MR : -#endif type == CV_16UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1MR : type == CV_32FC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1MR : 0; CV_SUPPRESS_DEPRECATED_END @@ -1424,9 +1422,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal, CV_SUPPRESS_DEPRECATED_START ippiMinMaxIndxFuncC1 ippFuncC1 = depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R : -#ifndef HAVE_IPP_ICV_ONLY depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R : -#endif depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R : depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : 0; CV_SUPPRESS_DEPRECATED_END diff --git a/modules/imgproc/src/accum.cpp b/modules/imgproc/src/accum.cpp index e0cce1f594..04a70128bb 100644 --- a/modules/imgproc/src/accum.cpp +++ b/modules/imgproc/src/accum.cpp @@ -431,7 +431,7 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask ) Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous()))) { typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize); @@ -510,7 +510,7 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) 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); @@ -589,7 +589,7 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2, Mat src1 = _src1.getMat(), src2 = _src2.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (src1.dims <= 2 || (src1.isContinuous() && src2.isContinuous() && dst.isContinuous())) { typedef IppStatus (CV_STDCALL * ippiAddProduct)(const void * pSrc1, int src1Step, const void * pSrc2, @@ -670,7 +670,7 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst, Mat src = _src.getMat(), dst = _dst.getMat(), mask = _mask.getMat(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) 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 9c04d1cd63..7fde36309e 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 !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801 +#if IPP_VERSION_X100 >= 801 static ippiReorderFunc ippiSwapChannelsC4RTab[] = { (ippiReorderFunc)ippiSwapChannels_8u_C4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4R, 0, @@ -3314,7 +3314,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) return; setIppErrorStatus(); } -#if !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_X100 >= 801) +#if IPP_VERSION_X100 >= 801 else if( code == CV_RGBA2BGRA ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) ) @@ -3343,7 +3343,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) _dst.create(sz, CV_8UC2); dst = _dst.getMat(); -#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY) +#ifdef HAVE_IPP CV_SUPPRESS_DEPRECATED_START #if 0 if (code == CV_BGR2BGR565 && scn == 3) @@ -3400,7 +3400,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) _dst.create(sz, CV_MAKETYPE(depth, dcn)); dst = _dst.getMat(); -#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY) +#ifdef HAVE_IPP CV_SUPPRESS_DEPRECATED_START if (code == CV_BGR5652BGR && dcn == 3) { @@ -3919,7 +3919,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) _dst.create(sz, CV_MAKETYPE(depth, 3)); dst = _dst.getMat(); -#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY) +#ifdef HAVE_IPP #if 0 if (code == CV_LBGR2Lab && scn == 3 && depth == CV_8U) { @@ -4012,8 +4012,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) _dst.create(sz, CV_MAKETYPE(depth, dcn)); dst = _dst.getMat(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) -#if 0 +#if defined(HAVE_IPP) && 0 if( code == CV_Lab2LBGR && dcn == 3 && depth == CV_8U) { if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R)) ) @@ -4064,7 +4063,6 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; } -#endif #endif if( code == CV_Lab2BGR || code == CV_Lab2RGB || @@ -4264,7 +4262,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) if( depth == CV_8U ) { -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiAlphaPremul_8u_AC4R))) return; setIppErrorStatus(); diff --git a/modules/imgproc/src/corner.cpp b/modules/imgproc/src/corner.cpp index edc3504fb1..2a0f1cbc10 100644 --- a/modules/imgproc/src/corner.cpp +++ b/modules/imgproc/src/corner.cpp @@ -473,7 +473,7 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi _dst.create( src.size(), CV_32FC1 ); Mat dst = _dst.getMat(); -#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 >= 801 int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); int borderTypeNI = borderType & ~BORDER_ISOLATED; bool isolated = (borderType & BORDER_ISOLATED) != 0; diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index 51f017b628..c0b6e0853a 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -189,13 +189,9 @@ cv::Ptr cv::createDerivFilter(int srcType, int dstType, namespace cv { -#if (IPP_VERSION_X100 >= 801) +#if IPP_VERSION_X100 >= 801 static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType) { -#if defined(HAVE_IPP_ICV_ONLY) - (void)_src; (void)_dst; (void)ddepth; (void)dx; (void)dy; (void)scale; (void)delta; (void)borderType; - return false; -#else if ((0 > dx) || (0 > dy) || (1 != dx + dy)) return false; if (fabs(delta) > FLT_EPSILON) @@ -306,9 +302,8 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx sts = ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, roiSize); } return (0 <= sts); -#endif } -#elif (IPP_VERSION_MAJOR >= 7) +#elif IPP_VERSION_X100 >= 700 static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType) { if (BORDER_REPLICATE != borderType) @@ -363,9 +358,6 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx } } case CV_32FC1: -#if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R - return false; -#else { switch(dst.type()) { @@ -410,7 +402,6 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx return false; } } -#endif default: return false; } @@ -460,9 +451,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, return true; } -#if defined(HAVE_IPP_ICV_ONLY) - return false; -#else +#if !defined(HAVE_IPP_ICV_ONLY) if ((dx == 2) && (dy == 0)) { if (0 > ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) @@ -493,9 +482,6 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, 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)) { @@ -526,6 +512,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, return true; } #endif +#if !defined(HAVE_IPP_ICV_ONLY) if((dx == 2) && (dy == 0)) { if (0 > ippiFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) @@ -585,7 +572,7 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, } #endif -#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) +#ifdef HAVE_IPP if (ksize < 0) { if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType)) @@ -713,7 +700,7 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize, ddepth = sdepth; _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) ); -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#ifdef HAVE_IPP if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) && ((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1))) { diff --git a/modules/imgproc/src/distransform.cpp b/modules/imgproc/src/distransform.cpp index c03d4b9a8e..7d2e4bfd0e 100644 --- a/modules/imgproc/src/distransform.cpp +++ b/modules/imgproc/src/distransform.cpp @@ -688,7 +688,7 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst) _dst.create( src.size(), CV_8UC1); Mat dst = _dst.getMat(); - #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined HAVE_IPP_ICV_ONLY + #ifdef HAVE_IPP IppiSize roi = { src.cols, src.rows }; Ipp32s pMetrics[2] = { 1, 2 }; //L1, 3x3 mask if (ippiDistanceTransform_3x3_8u_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, pMetrics)>=0) @@ -734,7 +734,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe if( maskSize == CV_DIST_MASK_PRECISE ) { -#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) +#ifdef HAVE_IPP if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14))) { IppStatus status; @@ -773,7 +773,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe { if( maskSize == CV_DIST_MASK_3 ) { - #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined HAVE_IPP_ICV_ONLY + #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) IppiSize roi = { src.cols, src.rows }; if (ippiDistanceTransform_3x3_8u32f_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask)>=0) return; diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 339546f9a2..e7e03ceeb2 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1175,7 +1175,7 @@ calcHist_8u( std::vector& _ptrs, const std::vector& _deltas, } } -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#ifdef HAVE_IPP class IPPCalcHistInvoker : public ParallelLoopBody @@ -1232,7 +1232,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels, Mat hist = _hist.getMat(), ihist = hist; ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S; -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY +#ifdef HAVE_IPP if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels && channels[0] == 0 && mask.empty() && images[0].dims <= 2 && !accumulate && uniform) diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index b37dcb8045..128c2c9adb 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -1911,7 +1911,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE; \ getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE; -#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701 +#if IPP_VERSION_X100 >= 701 class IPPresizeInvoker : public ParallelLoopBody { @@ -2395,7 +2395,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 !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701 +#if IPP_VERSION_X100 >= 701 #define IPP_RESIZE_EPS 1e-10 double ex = fabs((double)dsize.width / src.cols - inv_scale_x) / inv_scale_x; diff --git a/modules/imgproc/src/moments.cpp b/modules/imgproc/src/moments.cpp index f65d6d906e..ebc9a00c9e 100644 --- a/modules/imgproc/src/moments.cpp +++ b/modules/imgproc/src/moments.cpp @@ -462,7 +462,7 @@ cv::Moments cv::moments( InputArray _src, bool binary ) if( cn > 1 ) CV_Error( CV_StsBadArg, "Invalid image type (must be single-channel)" ); -#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY +#if IPP_VERSION_X100 >= 801 if (!binary) { IppiSize roi = { mat.cols, mat.rows }; diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 4747c60f51..55ca666265 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1228,9 +1228,6 @@ 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) \ @@ -1262,7 +1259,6 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne #if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8 return false; /// It disables false positive warning in GCC 4.8.2 -#endif #endif } } diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index cbbe66aa73..d77c4fcfa6 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -508,7 +508,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde return; #endif -#if (defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801) +#if IPP_VERSION_X100 >= 801 bool isolated = (borderType & BORDER_ISOLATED) != 0; int borderTypeNI = borderType & ~BORDER_ISOLATED; if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size((src.cols + 1)/2, (src.rows + 1)/2)) @@ -577,7 +577,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT return; #endif -#if (defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801) +#if IPP_VERSION_X100 >= 801 bool isolated = (borderType & BORDER_ISOLATED) != 0; int borderTypeNI = borderType & ~BORDER_ISOLATED; if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated) && dsz == Size(src.cols*2, src.rows*2)) @@ -648,7 +648,7 @@ void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel, int i=1; -#if (defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801) +#if IPP_VERSION_X100 >= 801 bool isolated = (borderType & BORDER_ISOLATED) != 0; int borderTypeNI = borderType & ~BORDER_ISOLATED; if (borderTypeNI == BORDER_DEFAULT && (!src.isSubmatrix() || isolated)) diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 58075be65b..694981dfcc 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 -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) int ippBorderType = borderType & ~BORDER_ISOLATED; Point ocvAnchor, ippAnchor; ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x; @@ -885,7 +885,6 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth, (int)dst.step, roiSize, maskSize, \ (IppiBorderType)ippBorderType, borderValue, buffer); \ ippsFree(buffer); \ - printf("%s %d %d\n", ippGetStatusString(status), (int)src.step, (int)dst.step); \ if (status >= 0) \ return; \ } \ @@ -2025,7 +2024,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) _dst.create( src0.size(), src0.type() ); Mat dst = _dst.getMat(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801 +#if IPP_VERSION_X100 >= 801 #define IPP_FILTER_MEDIAN_BORDER(ippType, ippDataType, flavor) \ do \ { \ @@ -2274,7 +2273,7 @@ private: float *space_weight, *color_weight; }; -#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) && !defined(HAVE_IPP_ICV_ONLY) +#if defined (HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && 0 class IPPBilateralFilter_8u_Invoker : public ParallelLoopBody { diff --git a/modules/imgproc/src/templmatch.cpp b/modules/imgproc/src/templmatch.cpp index 05e31f14e4..3565eee9ae 100644 --- a/modules/imgproc/src/templmatch.cpp +++ b/modules/imgproc/src/templmatch.cpp @@ -341,7 +341,7 @@ static bool ocl_matchTemplate( InputArray _img, InputArray _templ, OutputArray _ #endif -#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP typedef IppStatus (CV_STDCALL * ippimatchTemplate)(const void*, int, IppiSize, const void*, int, IppiSize, Ipp32f* , int , IppEnum , Ipp8u*); @@ -633,7 +633,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, return; #endif -#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (method == CV_TM_SQDIFF && cn == 1) { if (ipp_sqrDistance(img, templ, result)) @@ -642,7 +642,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, } #endif -#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY +#if defined HAVE_IPP if (cn == 1) { if (!ipp_crossCorr(img, templ, result)) diff --git a/modules/imgproc/src/thresh.cpp b/modules/imgproc/src/thresh.cpp index 5a02452f1f..08241d050b 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 -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) IppiSize sz = { roi.width, roi.height }; switch( type ) { @@ -309,7 +309,7 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) return; #endif -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) IppiSize sz = { roi.width, roi.height }; switch( type ) { @@ -503,7 +503,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type ) return; #endif -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) IppiSize sz = { roi.width, roi.height }; switch( type ) { @@ -683,7 +683,7 @@ getThreshVal_Otsu_8u( const Mat& _src ) step = size.width; } -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 801 +#if IPP_VERSION_X100 >= 801 && !defined(HAVE_IPP_ICV_ONLY) IppiSize srcSize = { size.width, size.height }; Ipp8u thresh; CV_SUPPRESS_DEPRECATED_START diff --git a/modules/video/src/motempl.cpp b/modules/video/src/motempl.cpp index 152706b9fe..bb48206ecf 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(); -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) 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; -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) silhstep = (int)silh.total(); mhistep = (int)mhi.total() * sizeof(Ipp32f); #endif } -#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) +#if defined(HAVE_IPP) 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) From e8d3ebecc74f07d06ba603594a17e8012409077d Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 29 Apr 2014 14:57:44 +0400 Subject: [PATCH 3/4] fix IPPDerivSobel condition --- modules/imgproc/src/deriv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index c0b6e0853a..5e920ec0b8 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -410,7 +410,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType) { - if ((borderType != BORDER_REPLICATE) || (3 != ksize) || (5 != ksize)) + if ((borderType != BORDER_REPLICATE) || ((3 != ksize) && (5 != ksize))) return false; if (fabs(delta) > FLT_EPSILON) return false; From 71f871fafde115d1caa79c02f49675fefaae6067 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 30 Apr 2014 18:01:25 +0400 Subject: [PATCH 4/4] replaced sanity check condition for stitching perf test --- modules/stitching/perf/perf_stich.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/stitching/perf/perf_stich.cpp b/modules/stitching/perf/perf_stich.cpp index 8cf89651fe..1a37472e98 100644 --- a/modules/stitching/perf/perf_stich.cpp +++ b/modules/stitching/perf/perf_stich.cpp @@ -56,11 +56,10 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS) stopTimer(); } - Mat pano_small; - if (!pano.empty()) - resize(pano, pano_small, Size(320, 240), 0, 0, INTER_AREA); + EXPECT_NEAR(pano.size().width, 1182, 50); + EXPECT_NEAR(pano.size().height, 682, 30); - SANITY_CHECK(pano_small, 5); + SANITY_CHECK_NOTHING(); } PERF_TEST_P(stitch, b12, TEST_DETECTORS)