mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 14:29:49 +08:00
remove g_isOpenCVActivated assign and clarify
This commit is contained in:
parent
619cc01ca1
commit
bb59b81d82
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user