fix bitwise ops and mask support

This commit is contained in:
Ilya Lavrenov 2014-02-25 19:32:55 +04:00
parent d1d451c952
commit 0e2cc5ef63
2 changed files with 12 additions and 12 deletions

View File

@ -935,7 +935,7 @@ static bool ocl_binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0; bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0;
if( oclop < 0 || ((haveMask || haveScalar) && cn > 4) || if( oclop < 0 || ((haveMask || haveScalar) && cn > 4) ||
(!doubleSupport && srcdepth == CV_64F)) (!doubleSupport && srcdepth == CV_64F && !bitwise))
return false; return false;
char opts[1024]; char opts[1024];

View File

@ -533,7 +533,7 @@ cv::Scalar cv::sum( InputArray _src )
{ {
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
Scalar _res; Scalar _res;
CV_OCL_RUN_( _src.isUMat() && _src.dims() <= 2, CV_OCL_RUN_(_src.isUMat() && _src.dims() <= 2,
ocl_sum(_src, _res, OCL_OP_SUM), ocl_sum(_src, _res, OCL_OP_SUM),
_res) _res)
#endif #endif
@ -2299,7 +2299,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
namespace cv { namespace cv {
static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, double & result ) static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result )
{ {
int type = _src1.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); int type = _src1.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0; bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0;
@ -2329,9 +2329,9 @@ static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, double &
if (!k.run(2, globalsize, NULL, false)) if (!k.run(2, globalsize, NULL, false))
return false; return false;
result = cv::norm(diff, normType); result = cv::norm(diff, normType, _mask);
if (relative) if (relative)
result /= cv::norm(src2, normType) + DBL_EPSILON; result /= cv::norm(src2, normType, _mask) + DBL_EPSILON;
return true; return true;
} }
@ -2346,9 +2346,9 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
double _result = 0; double _result = 0;
CV_OCL_RUN_(_mask.empty() && _src1.isUMat() && _src2.isUMat() && CV_OCL_RUN_(_src1.isUMat() && _src2.isUMat() &&
_src1.dims() <= 2 && _src2.dims() <= 2, _src1.dims() <= 2 && _src2.dims() <= 2,
ocl_norm(_src1, _src2, normType, _result), ocl_norm(_src1, _src2, normType, _mask, _result),
_result) _result)
#endif #endif