From 3e0c72ea84f8612f3d2a5e63724926d9f4318acc Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 26 Oct 2018 14:57:20 +0300 Subject: [PATCH] core(ipp): disable SSE4.2 meanStdDev() optimization for CV_32F --- modules/core/src/mean.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/core/src/mean.cpp b/modules/core/src/mean.cpp index b488ee230a..aed5f76ac5 100644 --- a/modules/core/src/mean.cpp +++ b/modules/core/src/mean.cpp @@ -674,10 +674,23 @@ static bool ipp_meanStdDev(Mat& src, OutputArray _mean, OutputArray _sdv, Mat& m if (cn > 1) return false; #endif -#if IPP_VERSION_X100 < 201901 +#if IPP_VERSION_X100 >= 201900 && IPP_VERSION_X100 < 201901 // IPP_DISABLE: 32f C3C functions can read outside of allocated memory if (cn > 1 && src.depth() == CV_32F) return false; + + // SSE4.2 buffer overrun +#if defined(_WIN32) && !defined(_WIN64) + // IPPICV doesn't have AVX2 in 32-bit builds + // However cv::ipp::getIppTopFeatures() may return AVX2 value on AVX2 capable H/W + // details #12959 +#else + if (cv::ipp::getIppTopFeatures() == ippCPUID_SSE42) // Linux x64 + OPENCV_IPP=SSE42 is affected too +#endif + { + if (src.depth() == CV_32F && src.dims > 1 && src.size[src.dims - 1] == 6) + return false; + } #endif size_t total_size = src.total();