Mat::setTo(Scalar::all(0))
authorIlya Lavrenov <ilya.lavrenov@itseez.com>
Sun, 13 Apr 2014 13:00:00 +0000 (17:00 +0400)
committerIlya Lavrenov <ilya.lavrenov@itseez.com>
Mon, 21 Apr 2014 09:14:55 +0000 (13:14 +0400)
modules/core/src/copy.cpp

index fc0454b..3cf1eda 100644 (file)
@@ -356,6 +356,25 @@ Mat& Mat::operator = (const Scalar& s)
 
     if( is[0] == 0 && is[1] == 0 && is[2] == 0 && is[3] == 0 )
     {
+#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
+        if (dims <= 2 || isContinuous())
+        {
+            IppiSize roisize = { cols, rows };
+            if (isContinuous())
+            {
+                roisize.width = (int)total();
+                roisize.height = 1;
+
+                if (ippsZero_8u(data, roisize.width * elemSize()) >= 0)
+                    return *this;
+            }
+            roisize.width *= elemSize();
+
+            if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
+                return *this;
+        }
+#endif
+
         for( size_t i = 0; i < it.nplanes; i++, ++it )
             memset( dptr, 0, elsize );
     }