Merge pull request #3003 from ElenaGvozdeva:ocl_sum
This commit is contained in:
@@ -379,7 +379,7 @@
|
|||||||
#define REDUCE_GLOBAL \
|
#define REDUCE_GLOBAL \
|
||||||
dstTK temp = convertToDT(loadpix(srcptr + src_index)); \
|
dstTK temp = convertToDT(loadpix(srcptr + src_index)); \
|
||||||
dstTK temp2 = convertToDT(loadpix(src2ptr + src2_index)); \
|
dstTK temp2 = convertToDT(loadpix(src2ptr + src2_index)); \
|
||||||
temp = SUM_ABS2(temp, temp2)); \
|
temp = SUM_ABS2(temp, temp2); \
|
||||||
FUNC(accumulator, temp.s0); \
|
FUNC(accumulator, temp.s0); \
|
||||||
FUNC(accumulator, temp.s1); \
|
FUNC(accumulator, temp.s1); \
|
||||||
FUNC(accumulator, temp.s2); \
|
FUNC(accumulator, temp.s2); \
|
||||||
|
|||||||
@@ -479,9 +479,10 @@ static bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask
|
|||||||
haveMask = _mask.kind() != _InputArray::NONE,
|
haveMask = _mask.kind() != _InputArray::NONE,
|
||||||
haveSrc2 = _src2.kind() != _InputArray::NONE;
|
haveSrc2 = _src2.kind() != _InputArray::NONE;
|
||||||
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type),
|
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type),
|
||||||
kercn = cn == 1 && !haveMask ? ocl::predictOptimalVectorWidth(_src) : 1,
|
kercn = cn == 1 && !haveMask ? ocl::predictOptimalVectorWidth(_src, _src2) : 1,
|
||||||
mcn = std::max(cn, kercn);
|
mcn = std::max(cn, kercn);
|
||||||
CV_Assert(!haveSrc2 || _src2.type() == type);
|
CV_Assert(!haveSrc2 || _src2.type() == type);
|
||||||
|
int convert_cn = haveSrc2 ? mcn : cn;
|
||||||
|
|
||||||
if ( (!doubleSupport && depth == CV_64F) || cn > 4 )
|
if ( (!doubleSupport && depth == CV_64F) || cn > 4 )
|
||||||
return false;
|
return false;
|
||||||
@@ -513,7 +514,7 @@ static bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask
|
|||||||
haveMask && _mask.isContinuous() ? " -D HAVE_MASK_CONT" : "", kercn,
|
haveMask && _mask.isContinuous() ? " -D HAVE_MASK_CONT" : "", kercn,
|
||||||
haveSrc2 ? " -D HAVE_SRC2" : "", calc2 ? " -D OP_CALC2" : "",
|
haveSrc2 ? " -D HAVE_SRC2" : "", calc2 ? " -D OP_CALC2" : "",
|
||||||
haveSrc2 && _src2.isContinuous() ? " -D HAVE_SRC2_CONT" : "",
|
haveSrc2 && _src2.isContinuous() ? " -D HAVE_SRC2_CONT" : "",
|
||||||
depth <= CV_32S && ddepth == CV_32S ? ocl::convertTypeStr(CV_8U, ddepth, mcn, cvt[1]) : "noconvert");
|
depth <= CV_32S && ddepth == CV_32S ? ocl::convertTypeStr(CV_8U, ddepth, convert_cn, cvt[1]) : "noconvert");
|
||||||
|
|
||||||
ocl::Kernel k("reduce", ocl::core::reduce_oclsrc, opts);
|
ocl::Kernel k("reduce", ocl::core::reduce_oclsrc, opts);
|
||||||
if (k.empty())
|
if (k.empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user