From bd8894002e0bc16097918422a0c050954df7cdf9 Mon Sep 17 00:00:00 2001 From: vbystricky Date: Wed, 30 Jul 2014 11:56:28 +0400 Subject: [PATCH] Fix some problems --- modules/imgproc/src/morph.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 328d03de1f..977be679dd 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1352,6 +1352,9 @@ static bool ocl_morphSmall( InputArray _src, OutputArray _dst, InputArray _kerne _src.offset() % esz != 0 || _src.step() % esz != 0) return false; + bool haveExtraMat = !_extraMat.empty(); + CV_Assert(actual_op <= 3 || haveExtraMat); + Size ksize = _kernel.size(); if (anchor.x < 0) anchor.x = ksize.width / 2; @@ -1369,9 +1372,6 @@ static bool ocl_morphSmall( InputArray _src, OutputArray _dst, InputArray _kerne } char cvt[2][40]; - bool haveExtraMat = !_extraMat.empty(); - CV_Assert(actual_op <= 3 || haveExtraMat); - const char * const borderMap[] = { "BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", 0, "BORDER_REFLECT_101" }; size_t globalsize[2] = { size.width, size.height }; @@ -1506,6 +1506,13 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel, Mat kernel = _kernel.getMat(); Size ksize = kernel.data ? kernel.size() : Size(3, 3), ssize = _src.size(); + bool doubleSupport = dev.doubleFPConfig() > 0; + if ((depth == CV_64F && !doubleSupport) || borderType != BORDER_CONSTANT) + return false; + + bool haveExtraMat = !_extraMat.empty(); + CV_Assert(actual_op <= 3 || haveExtraMat); + // try to use OpenCL kernel adopted for small morph kernel if (dev.isIntel() && !(dev.type() & ocl::Device::TYPE_CPU) && ((ksize.width < 5 && ksize.height < 5 && esz <= 4) || @@ -1516,13 +1523,6 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel, return true; } - bool doubleSupport = dev.doubleFPConfig() > 0; - if ((depth == CV_64F && !doubleSupport) || borderType != BORDER_CONSTANT) - return false; - - bool haveExtraMat = !_extraMat.empty(); - CV_Assert(actual_op <= 3 || haveExtraMat); - if (iterations == 0 || kernel.rows*kernel.cols == 1) { _src.copyTo(_dst);