remove g_isOpenCVActivated assign and clarify

This commit is contained in:
Dale Phurrough 2020-12-16 00:27:32 +01:00
parent 619cc01ca1
commit bb59b81d82
No known key found for this signature in database
GPG Key ID: E53384A29713D41F

View File

@ -1150,7 +1150,7 @@ void OpenCLExecutionContext::release()
// true if we have initialized OpenCL subsystem with available platforms // true if we have initialized OpenCL subsystem with available platforms
static bool g_isOpenCVActivated = false; static bool g_isOpenCLActivated = false;
bool haveOpenCL() bool haveOpenCL()
{ {
@ -1178,7 +1178,7 @@ bool haveOpenCL()
{ {
cl_uint n = 0; cl_uint n = 0;
g_isOpenCLAvailable = ::clGetPlatformIDs(0, NULL, &n) == CL_SUCCESS; g_isOpenCLAvailable = ::clGetPlatformIDs(0, NULL, &n) == CL_SUCCESS;
g_isOpenCVActivated = n > 0; g_isOpenCLActivated = n > 0;
CV_LOG_INFO(NULL, "OpenCL: found " << n << " platforms"); CV_LOG_INFO(NULL, "OpenCL: found " << n << " platforms");
} }
catch (...) catch (...)
@ -1214,7 +1214,7 @@ bool useOpenCL()
bool isOpenCLActivated() bool isOpenCLActivated()
{ {
if (!g_isOpenCVActivated) if (!g_isOpenCLActivated)
return false; // prevent unnecessary OpenCL activation via useOpenCL()->haveOpenCL() calls return false; // prevent unnecessary OpenCL activation via useOpenCL()->haveOpenCL() calls
return useOpenCL(); return useOpenCL();
} }
@ -6370,7 +6370,6 @@ public:
static OpenCLAllocator* getOpenCLAllocator_() // call once guarantee static OpenCLAllocator* getOpenCLAllocator_() // call once guarantee
{ {
static OpenCLAllocator* g_allocator = new OpenCLAllocator(); // avoid destructor call (using of this object is too wide) static OpenCLAllocator* g_allocator = new OpenCLAllocator(); // avoid destructor call (using of this object is too wide)
g_isOpenCVActivated = true;
return g_allocator; return g_allocator;
} }
MatAllocator* getOpenCLAllocator() MatAllocator* getOpenCLAllocator()