@@ -2241,6 +2241,53 @@ static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
2241
2241
#endif
2242
2242
2243
2243
#ifdef HAVE_IPP
2244
+ #define IPP_GAUSSIANBLUR_PARALLEL 1
2245
+
2246
+ #ifdef HAVE_IPP_IW
2247
+
2248
+ class ipp_gaussianBlurParallel : public ParallelLoopBody
2249
+ {
2250
+ public:
2251
+ ipp_gaussianBlurParallel (::ipp::IwiImage &src, ::ipp::IwiImage &dst, int kernelSize, float sigma, ::ipp::IwiBorderType &border, bool *pOk):
2252
+ m_src (src), m_dst(dst), m_kernelSize(kernelSize), m_sigma(sigma), m_border(border), m_pOk(pOk) {
2253
+ *m_pOk = true ;
2254
+ }
2255
+ ~ipp_gaussianBlurParallel ()
2256
+ {
2257
+ }
2258
+
2259
+ virtual void operator () (const Range& range) const
2260
+ {
2261
+ CV_INSTRUMENT_REGION_IPP ()
2262
+
2263
+ if (!*m_pOk)
2264
+ return ;
2265
+
2266
+ try
2267
+ {
2268
+ ::ipp::IwiRoi roi = ::ipp::IwiRect (0 , range.start , m_dst.m_size .width , range.end - range.start );
2269
+ CV_INSTRUMENT_FUN_IPP (::ipp::iwiFilterGaussian, &m_src, &m_dst, m_kernelSize, m_sigma, m_border, &roi);
2270
+ }
2271
+ catch (::ipp::IwException e)
2272
+ {
2273
+ *m_pOk = false ;
2274
+ return ;
2275
+ }
2276
+ }
2277
+ private:
2278
+ ::ipp::IwiImage &m_src;
2279
+ ::ipp::IwiImage &m_dst;
2280
+
2281
+ int m_kernelSize;
2282
+ float m_sigma;
2283
+ ::ipp::IwiBorderType &m_border;
2284
+
2285
+ volatile bool *m_pOk;
2286
+ const ipp_gaussianBlurParallel& operator = (const ipp_gaussianBlurParallel&);
2287
+ };
2288
+
2289
+ #endif
2290
+
2244
2291
static bool ipp_GaussianBlur (InputArray _src, OutputArray _dst, Size ksize,
2245
2292
double sigma1, double sigma2, int borderType )
2246
2293
{
@@ -2272,7 +2319,26 @@ static bool ipp_GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
2272
2319
if (!ippBorder.m_borderType )
2273
2320
return false ;
2274
2321
2275
- CV_INSTRUMENT_FUN_IPP (::ipp::iwiFilterGaussian, &iwSrc, &iwDst, ksize.width , (float )sigma1, ippBorder);
2322
+ // IW 2017u2 has bug which doesn't allow use of partial inMem with tiling
2323
+ if ((((ippBorder.m_borderFlags )&ippBorderInMem) && ((ippBorder.m_borderFlags )&ippBorderInMem) != ippBorderInMem)) {
2324
+ return false ;
2325
+ }
2326
+
2327
+ bool ok;
2328
+ ipp_gaussianBlurParallel invoker (iwSrc, iwDst, ksize.width , (float ) sigma1, ippBorder, &ok);
2329
+
2330
+ if (!ok)
2331
+ return false ;
2332
+
2333
+ const Range range (0 , (int ) iwDst.m_size .height );
2334
+ const int threads = ippiSuggestThreadsNum (iwDst, 2 );
2335
+ if (IPP_GAUSSIANBLUR_PARALLEL && threads > 1 )
2336
+ parallel_for_ (range, invoker, threads*4 );
2337
+ else
2338
+ invoker (range);
2339
+
2340
+ if (!ok)
2341
+ return false ;
2276
2342
}
2277
2343
catch (::ipp::IwException ex)
2278
2344
{
0 commit comments