mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03: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:
@@ -1226,7 +1226,7 @@ void SparsePyrLKOpticalFlowImpl::calc( InputArray _prevImg, InputArray _nextImg,
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_OCL_RUN(ocl::useOpenCL() &&
|
||||
CV_OCL_RUN(ocl::isOpenCLActivated() &&
|
||||
(_prevImg.isUMat() || _nextImg.isUMat()) &&
|
||||
ocl::Image2D::isFormatSupported(CV_32F, 1, false),
|
||||
ocl_calcOpticalFlowPyrLK(_prevImg, _nextImg, _prevPts, _nextPts, _status, _err))
|
||||
|
||||
Reference in New Issue
Block a user