From c0456df6110d012290ea4cc250a93fe0acbeb68f Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 18 Nov 2013 18:50:40 +0400 Subject: [PATCH] workaround for ocl::absSum (eliminated error: unreachable executed) --- modules/ocl/src/arithm.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/ocl/src/arithm.cpp b/modules/ocl/src/arithm.cpp index 68c5269..8a2390d 100644 --- a/modules/ocl/src/arithm.cpp +++ b/modules/ocl/src/arithm.cpp @@ -394,12 +394,16 @@ Scalar cv::ocl::sum(const oclMat &src) Scalar cv::ocl::absSum(const oclMat &src) { - if (!src.clCxt->supportsFeature(FEATURE_CL_DOUBLE) && src.depth() == CV_64F) + int sdepth = src.depth(); + if (!src.clCxt->supportsFeature(FEATURE_CL_DOUBLE) && sdepth == CV_64F) { CV_Error(CV_OpenCLDoubleNotSupported, "Selected device doesn't support double"); return cv::Scalar::all(0); } + if (sdepth == CV_8U || sdepth == CV_16U) + return sum(src); + static sumFunc functab[3] = { arithmetic_sum, @@ -407,7 +411,7 @@ Scalar cv::ocl::absSum(const oclMat &src) arithmetic_sum }; - int ddepth = std::max(src.depth(), CV_32S); + int ddepth = std::max(sdepth, CV_32S); sumFunc func = functab[ddepth - CV_32S]; return func(src, ABS_SUM, ddepth); } -- 2.7.4