From 5ebfb52a4a3bb327a09852533e4fd00602ad3f91 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 12 Jul 2017 16:06:18 +0300 Subject: [PATCH] ipp(minmaxIdx): disable SSE4.2 optimizations for 32f datatype NaN values handling issue --- modules/core/include/opencv2/core/private.hpp | 2 ++ modules/core/src/stat.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index 418e1faf0f..61059fa965 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -209,6 +209,8 @@ CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int un #define IPP_DISABLE_RESIZE_NEAREST 1 // Accuracy mismatch (max diff 1) #define IPP_DISABLE_RESIZE_AREA 1 // Accuracy mismatch (max diff 1) +#define IPP_DISABLE_MINMAX_NAN_SSE42 1 // cv::minMaxIdx problem with NaN input + // Temporary disabled named IPP region. Performance #define IPP_DISABLE_PERF_COPYMAKE 1 // performance variations #define IPP_DISABLE_PERF_LUT 1 // there are no performance benefits (PR #2653) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index d40e91af14..06e3d4632a 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2534,6 +2534,12 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI #if IPP_VERSION_X100 >= 700 CV_INSTRUMENT_REGION_IPP() +#if IPP_DISABLE_MINMAX_NAN_SSE42 + // Disable 32F processing only + if(src.depth() == CV_32F && !(ipp::getIppFeatures()&ippCPUID_AVX)) + return false; +#endif + IppStatus status; IppDataType dataType = ippiGetDataType(src.depth()); float minVal = 0;