- if (cn == 1 || !haveMask)
- ocl_minMaxIdx(_src, NULL, &result, NULL, NULL, _mask,
- std::max(depth, CV_32S), depth != CV_8U && depth != CV_16U);
- else
- {
- int dbsize = d.maxComputeUnits();
- size_t wgs = d.maxWorkGroupSize();
-
- int wgs2_aligned = 1;
- while (wgs2_aligned < (int)wgs)
- wgs2_aligned <<= 1;
- wgs2_aligned >>= 1;
-
- ocl::Kernel k("reduce", ocl::core::reduce_oclsrc,
- format("-D OP_NORM_INF_MASK -D HAVE_MASK -D DEPTH_%d"
- " -D srcT=%s -D srcT1=%s -D WGS=%d -D cn=%d -D WGS2_ALIGNED=%d%s%s%s",
- depth, ocl::typeToStr(type), ocl::typeToStr(depth),
- wgs, cn, wgs2_aligned, doubleSupport ? " -D DOUBLE_SUPPORT" : "",
- src.isContinuous() ? " -D HAVE_CONT_SRC" : "",
- _mask.isContinuous() ? " -D HAVE_MASK_CONT" : ""));
- if (k.empty())
- return false;
-
- UMat db(1, dbsize, type), mask = _mask.getUMat();
- k.args(ocl::KernelArg::ReadOnlyNoSize(src), src.cols, (int)src.total(),
- dbsize, ocl::KernelArg::PtrWriteOnly(db), ocl::KernelArg::ReadOnlyNoSize(mask));
-
- size_t globalsize = dbsize * wgs;
- if (!k.run(1, &globalsize, &wgs, true))
- return false;
-
- minMaxIdx(db.getMat(ACCESS_READ), NULL, &result, NULL, NULL, noArray());
- }
+ if (!ocl_minMaxIdx(_src, NULL, &result, NULL, NULL, _mask,
+ std::max(depth, CV_32S), depth != CV_8U && depth != CV_16U))
+ return false;