1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

ocl: avoid unnecessary loading/initializing OpenCL subsystem

If there are no OpenCL/UMat methods calls from application.

OpenCL subsystem is initialized:
- haveOpenCL() is called from application
- useOpenCL() is called from application
- access to OpenCL allocator: UMat is created (empty UMat is ignored) or UMat <-> Mat conversions are called

Don't call OpenCL functions if OPENCV_OPENCL_RUNTIME=disabled
(independent from OpenCL linkage type)
This commit is contained in:
Alexander Alekhin
2017-11-24 17:34:02 +03:00
parent 92be112388
commit 0ed3209b00
20 changed files with 114 additions and 64 deletions
+2 -2
View File
@@ -478,7 +478,7 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl)
{
Rect rc(x_tl, y_tl, x_br - x_tl, y_br - y_tl);
#ifdef HAVE_OPENCL
if ( !cv::ocl::useOpenCL() ||
if ( !cv::ocl::isOpenCLActivated() ||
!ocl_MultiBandBlender_feed(src_pyr_laplace[i], weight_pyr_gauss[i],
dst_pyr_laplace_[i](rc), dst_band_weights_[i](rc)) )
#endif
@@ -633,7 +633,7 @@ void normalizeUsingWeightMap(InputArray _weight, InputOutputArray _src)
#endif
#ifdef HAVE_OPENCL
if ( !cv::ocl::useOpenCL() ||
if ( !cv::ocl::isOpenCLActivated() ||
!ocl_normalizeUsingWeightMap(_weight, _src) )
#endif
{