From: Alexander Alekhin Date: Mon, 15 Oct 2018 18:06:06 +0000 (+0000) Subject: ocl: bailout from unsupported types X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~508^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc45c10f3df3131e55258e68e39a756090dbb317;p=platform%2Fupstream%2Fopencv.git ocl: bailout from unsupported types --- diff --git a/modules/core/include/opencv2/core/opencl/ocl_defs.hpp b/modules/core/include/opencv2/core/opencl/ocl_defs.hpp index 605a65f..14df750 100644 --- a/modules/core/include/opencv2/core/opencl/ocl_defs.hpp +++ b/modules/core/include/opencv2/core/opencl/ocl_defs.hpp @@ -59,11 +59,18 @@ static inline bool isOpenCLActivated() { return false; } } #else #define CV_OCL_RUN_(condition, func, ...) \ +try \ +{ \ if (cv::ocl::isOpenCLActivated() && (condition) && func) \ { \ CV_IMPL_ADD(CV_IMPL_OCL); \ return __VA_ARGS__; \ - } + } \ +} \ +catch (const cv::Exception& e) \ +{ \ + CV_UNUSED(e); /* TODO: Add some logging here */ \ +} #endif #else diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 1dc06bc..4844000 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -6005,6 +6005,7 @@ const char* typeToStr(int type) "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" }; int cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type); + CV_Assert(depth != CV_16F); // Workaround for: https://github.com/opencv/opencv/issues/12824 return cn > 16 ? "?" : tab[depth*16 + cn-1]; } @@ -6022,6 +6023,7 @@ const char* memopTypeToStr(int type) "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" }; int cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type); + CV_Assert(depth != CV_16F); // Workaround for: https://github.com/opencv/opencv/issues/12824 return cn > 16 ? "?" : tab[depth*16 + cn-1]; } @@ -6039,6 +6041,7 @@ const char* vecopTypeToStr(int type) "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" }; int cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type); + CV_Assert(depth != CV_16F); // Workaround for: https://github.com/opencv/opencv/issues/12824 return cn > 16 ? "?" : tab[depth*16 + cn-1]; }