cv::blur
authorIlya Lavrenov <ilya.lavrenov@itseez.com>
Sun, 6 Apr 2014 12:09:38 +0000 (16:09 +0400)
committerIlya Lavrenov <ilya.lavrenov@itseez.com>
Tue, 8 Apr 2014 20:11:28 +0000 (00:11 +0400)
modules/core/src/mathfuncs.cpp
modules/core/src/matmul.cpp
modules/core/src/matrix.cpp
modules/imgproc/src/accum.cpp
modules/imgproc/src/imgwarp.cpp
modules/imgproc/src/smooth.cpp
modules/imgproc/test/ocl/test_boxfilter.cpp

index 9871491..376cbad 100644 (file)
@@ -766,7 +766,7 @@ void polarToCart( InputArray src1, InputArray src2,
         CV_Assert(ippFunc != 0);
 
         IppStatus status = ippFunc(Mag.data, Angle.data, X.data, Y.data, static_cast<int>(cn * X.total()));
-        if (status == ippStsNoErr)
+        if (status >= 0)
             return;
     }
 #endif
@@ -2240,7 +2240,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
                         ippsPowx_32f_A21((const Ipp32f *)src.data, (Ipp32f)power, (Ipp32f*)dst.data, (Ipp32s)(src.total() * cn)) :
                         ippsPowx_64f_A50((const Ipp64f *)src.data, power, (Ipp64f*)dst.data, (Ipp32s)(src.total() * cn));
 
-            if (status == ippStsNoErr)
+            if (status >= 0)
                 return;
         }
 #endif
index 8891bb0..e099e61 100644 (file)
@@ -2212,7 +2212,7 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray
     Mat src1 = _src1.getMat(), src2 = _src2.getMat();
     CV_Assert(src1.size == src2.size);
 
-    _dst.create(src1.dims, src1.size, src1.type());
+    _dst.create(src1.dims, src1.size, type);
     Mat dst = _dst.getMat();
 
     float falpha = (float)alpha;
@@ -2223,6 +2223,16 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray
     if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
     {
         size_t len = src1.total()*cn;
+//#ifdef HAVE_IPP
+//        if (depth == CV_32F)
+//        {
+//            IppStatus status = ippmSaxpy_vava_32f((const Ipp32f *)src1.data, 1, 0, falpha,
+//                                                  (const Ipp32f *)src2.data, 1, 0, (Ipp32f *)dst.data, 1, 0, (int)len, 1);
+//            printf("%s\n", ippGetStatusString(status));
+//            if (status >= 0)
+//                return;
+//        }
+//#endif
         func(src1.data, src2.data, dst.data, (int)len, palpha);
         return;
     }
index 67a2b9a..7e2976e 100644 (file)
@@ -2987,7 +2987,7 @@ void cv::transpose( InputArray _src, OutputArray _dst )
     type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0;
 
     IppiSize roiSize = { src.cols, src.rows };
-    if (ippFunc != 0 && ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, roiSize) == ippStsNoErr)
+    if (ippFunc != 0 && ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, roiSize) >= 0)
         return;
 #endif
 
index 41d0807..c431a65 100644 (file)
@@ -501,7 +501,7 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m
                 status = ippFuncMask(src.data, srcstep, (Ipp8u *)mask.data, maskstep,
                                      (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
 
-            if (status == ippStsNoErr)
+            if (status >= 0)
                 return;
         }
     }
@@ -582,7 +582,7 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2,
                 status = ippFuncMask(src1.data, src1step, src2.data, src2step, (Ipp8u *)mask.data, maskstep,
                                      (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
 
-            if (status == ippStsNoErr)
+            if (status >= 0)
                 return;
         }
     }
@@ -661,7 +661,7 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst,
                 status = ippFuncMask(src.data, srcstep, (Ipp8u *)mask.data, maskstep,
                                      (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
 
-            if (status == ippStsNoErr)
+            if (status >= 0)
                 return;
         }
     }
index fef02e7..c8e7a09 100644 (file)
@@ -4048,8 +4048,12 @@ public:
         ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
         IppStatus status = func( src.data, srcsize, (int)src.step[0], srcroi, dst.data,
                                 (int)dst.step[0], dstroi, coeffs, mode );
+<<<<<<< HEAD
         printf("%d\n", status);
         if( status != ippStsNoErr)
+=======
+        if( status < 0)
+>>>>>>> cv::blur
             *ok = false;
     }
 private:
index 7138a84..bd2f9d8 100644 (file)
@@ -858,11 +858,17 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
         return;
 #endif
 
-    /*
 #ifdef HAVE_IPP
-    bool isolated = (borderType & BORDER_ISOLATED) != 0;
-    if (!normalize && !isolated && (borderType & ~BORDER_ISOLATED) == BORDER_REPLICATE && ddepth == sdepth &&
-        (anchor == Point(-1, -1) || anchor == Point(ksize.width >> 1, ksize.height >> 1)) && ksize.width == ksize.width)
+    int ippBorderType = borderType & ~BORDER_ISOLATED;
+    Point ocvAnchor, ippAnchor;
+    ocvAnchor.x = anchor.x < 0 ? ksize.width / 2 : anchor.x;
+    ocvAnchor.y = anchor.y < 0 ? ksize.height / 2 : anchor.y;
+    ippAnchor.x = ksize.width / 2 - (ksize.width % 2 == 0 ? 1 : 0);
+    ippAnchor.y = ksize.height / 2 - (ksize.height % 2 == 0 ? 1 : 0);
+
+    if (normalize && !src.isSubmatrix() && ddepth == sdepth &&
+        (ippBorderType == BORDER_REPLICATE || ippBorderType == BORDER_CONSTANT) &&
+        ocvAnchor == ippAnchor )
     {
         Ipp32s bufSize;
         IppiSize roiSize = ippiSize(dst.cols, dst.rows), maskSize = ippiSize(ksize.width, ksize.height);
@@ -874,11 +880,11 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
             { \
                 Ipp8u * buffer = ippsMalloc_8u(bufSize); \
                 ippType borderValue[4] = { 0, 0, 0, 0 }; \
+                ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorderType == BORDER_REPLICATE ? ippBorderRepl : -1; \
+                CV_Assert(ippBorderType >= 0); \
                 IppStatus status = ippiFilterBoxBorder_##flavor((ippType *)src.data, (int)src.step, (ippType *)dst.data, (int)dst.step, roiSize, maskSize, \
-                                                              ippBorderRepl, borderValue, buffer); \
-                ippFree(buffer); \
-                printf("%d\n", status); \
-                IPPI_CALL(status); \
+                                                                (IppiBorderType)ippBorderType, borderValue, buffer); \
+                ippsFree(buffer); \
                 if (status >= 0) \
                     return; \
             } \
@@ -914,7 +920,6 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
     }
 #undef IPP_FILTER_BOX_BORDER
 #endif
-    */
 
     Ptr<FilterEngine> f = createBoxFilter( src.type(), dst.type(),
                         ksize, anchor, normalize, borderType );
@@ -2024,7 +2029,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
             IppStatus status = ippiFilterMedianBorder_##flavor((const ippType *)src0.data, (int)src0.step, \
                 (ippType *)dst.data, (int)dst.step, dstRoiSize, maskSize, \
                 ippBorderRepl, (ippType)0, buffer); \
-            ippiFree(buffer); \
+            ippsFree(buffer); \
             if (status >= 0) \
                 return; \
         } \
index aa8b3d2..63f4ebf 100644 (file)
@@ -102,7 +102,7 @@ typedef BoxFilterBase BoxFilter;
 
 OCL_TEST_P(BoxFilter, Mat)
 {
-    for (int j = 0; j < 100; j++)
+    for (int j = 0; j < test_loop_times; j++)
     {
         random_roi();