Fix some problems

This commit is contained in:
vbystricky 2014-07-30 11:56:28 +04:00
parent 878dec65c8
commit bd8894002e

View File

@ -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);