@@ -2241,6 +2241,7 @@ static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
2241
2241
#endif
2242
2242
2243
2243
#ifdef HAVE_IPP
2244
+ #define IPP_DISABLE_FILTERING_INMEM_PARTIAL 1 // IW 2017u2 has bug which doesn't allow use of partial inMem with tiling
2244
2245
#define IPP_GAUSSIANBLUR_PARALLEL 1
2245
2246
2246
2247
#ifdef HAVE_IPP_IW
@@ -2319,26 +2320,23 @@ static bool ipp_GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
2319
2320
if (!ippBorder.m_borderType )
2320
2321
return false ;
2321
2322
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 );
2323
+ const bool disableThreading = IPP_DISABLE_FILTERING_INMEM_PARTIAL &&
2324
+ ((ippBorder.m_borderFlags )&ippBorderInMem) && ((ippBorder.m_borderFlags )&ippBorderInMem) != ippBorderInMem;
2334
2325
const int threads = ippiSuggestThreadsNum (iwDst, 2 );
2335
- if (IPP_GAUSSIANBLUR_PARALLEL && threads > 1 )
2326
+ if (!disableThreading && IPP_GAUSSIANBLUR_PARALLEL && threads > 1 ) {
2327
+ bool ok;
2328
+ ipp_gaussianBlurParallel invoker (iwSrc, iwDst, ksize.width , (float ) sigma1, ippBorder, &ok);
2329
+
2330
+ if (!ok)
2331
+ return false ;
2332
+ const Range range (0 , (int ) iwDst.m_size .height );
2336
2333
parallel_for_ (range, invoker, threads*4 );
2337
- else
2338
- invoker (range);
2339
2334
2340
- if (!ok)
2341
- return false ;
2335
+ if (!ok)
2336
+ return false ;
2337
+ } else {
2338
+ CV_INSTRUMENT_FUN_IPP (::ipp::iwiFilterGaussian, &iwSrc, &iwDst, ksize.width , (float ) sigma1, ippBorder);
2339
+ }
2342
2340
}
2343
2341
catch (::ipp::IwException ex)
2344
2342
{
@@ -4321,24 +4319,23 @@ static bool ipp_bilateralFilter(Mat &src, Mat &dst, int d, double sigmaColor, do
4321
4319
if (!ippBorder.m_borderType )
4322
4320
return false ;
4323
4321
4324
- // IW 2017u2 has bug which doesn't allow use of partial inMem with tiling
4325
- if ((((ippBorder.m_borderFlags )&ippBorderInMem) && ((ippBorder.m_borderFlags )&ippBorderInMem) != ippBorderInMem))
4326
- return false ;
4327
-
4328
- bool ok = true ;
4329
- int threads = ippiSuggestThreadsNum (iwDst, 2 );
4330
- Range range (0 , (int )iwDst.m_size .height );
4331
- ipp_bilateralFilterParallel invoker (iwSrc, iwDst, radius, valSquareSigma, posSquareSigma, ippBorder, &ok);
4332
- if (!ok)
4333
- return false ;
4322
+ const bool disableThreading = IPP_DISABLE_FILTERING_INMEM_PARTIAL &&
4323
+ ((ippBorder.m_borderFlags )&ippBorderInMem) && ((ippBorder.m_borderFlags )&ippBorderInMem) != ippBorderInMem;
4324
+ const int threads = ippiSuggestThreadsNum (iwDst, 2 );
4325
+ if (!disableThreading && IPP_BILATERAL_PARALLEL && threads > 1 ) {
4326
+ bool ok = true ;
4327
+ Range range (0 , (int )iwDst.m_size .height );
4328
+ ipp_bilateralFilterParallel invoker (iwSrc, iwDst, radius, valSquareSigma, posSquareSigma, ippBorder, &ok);
4329
+ if (!ok)
4330
+ return false ;
4334
4331
4335
- if (IPP_BILATERAL_PARALLEL && threads > 1 )
4336
4332
parallel_for_ (range, invoker, threads*4 );
4337
- else
4338
- invoker (range);
4339
4333
4340
- if (!ok)
4341
- return false ;
4334
+ if (!ok)
4335
+ return false ;
4336
+ } else {
4337
+ CV_INSTRUMENT_FUN_IPP (::ipp::iwiFilterBilateral, &iwSrc, &iwDst, radius, valSquareSigma, posSquareSigma, ippiFilterBilateralGauss, ippDistNormL1, ippBorder);
4338
+ }
4342
4339
}
4343
4340
catch (::ipp::IwException)
4344
4341
{
0 commit comments