[opencv] 133/251: IPP: update minMaxIdx, disable some AVX optimizations with mask

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.

commit 544eb4be1f82410459106fc84e83df7968ed238c
Author: Alexander Alekhin <alexander.alekhin at intel.com>
Date:   Thu Jul 20 18:10:36 2017 +0300

    IPP: update minMaxIdx, disable some AVX optimizations with mask
---
 modules/core/src/stat.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp
index 3936daf..e324f85 100644
--- a/modules/core/src/stat.cpp
+++ b/modules/core/src/stat.cpp
@@ -2530,6 +2530,12 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
         return false;
 #endif
 
+    // cv::minMaxIdx problem with index positions on AVX
+#if IPP_VERSION_X100 < 201810
+    if(!mask.empty() && _maxIdx && ipp::getIppFeatures()&ippCPUID_AVX)
+        return false;
+#endif
+
     IppStatus   status;
     IppDataType dataType = ippiGetDataType(src.depth());
     float       minVal = 0;
@@ -2561,7 +2567,7 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
         size.width *= src.channels();
 
         status = ippMinMaxFun(src.ptr(), (int)src.step, size, dataType, pMinVal, pMaxVal, pMinIdx, pMaxIdx, (Ipp8u*)mask.ptr(), (int)mask.step);
-        if(status < 0 || status == ippStsNoOperation)
+        if(status < 0)
             return false;
         if(_minVal)
             *_minVal = minVal;
@@ -2569,7 +2575,8 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
             *_maxVal = maxVal;
         if(_minIdx)
         {
-            if(!mask.empty() && !minIdx.y && !minIdx.x)
+            // Should be just ippStsNoOperation check, but there is a bug in the function so we need additional checks
+            if(status == ippStsNoOperation && !mask.empty() && !pMinIdx->x && !pMinIdx->y)
             {
                 _minIdx[0] = -1;
                 _minIdx[1] = -1;
@@ -2582,7 +2589,8 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
         }
         if(_maxIdx)
         {
-            if(!mask.empty() && !maxIdx.y && !maxIdx.x)
+            // Should be just ippStsNoOperation check, but there is a bug in the function so we need additional checks
+            if(status == ippStsNoOperation && !mask.empty() && !pMaxIdx->x && !pMaxIdx->y)
             {
                 _maxIdx[0] = -1;
                 _maxIdx[1] = -1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list