Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
d0114b24
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d0114b24
编写于
11月 21, 2013
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core/ocl: replace dynamic runtime
上级
9f388a2b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
89 addition
and
2 deletion
+89
-2
modules/core/include/opencv2/core/opencl/runtime/ocl_runtime.hpp
.../core/include/opencv2/core/opencl/runtime/ocl_runtime.hpp
+34
-0
modules/core/src/ocl.cpp
modules/core/src/ocl.cpp
+55
-2
未找到文件。
modules/core/include/opencv2/core/opencl/runtime/ocl_runtime.hpp
0 → 100644
浏览文件 @
d0114b24
#ifndef __OPENCV_CORE_OCL_RUNTIME_HPP__
#define __OPENCV_CORE_OCL_RUNTIME_HPP__
#ifdef HAVE_OPENCL
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#else // HAVE_OPENCL_STATIC
#include "ocl_runtime_opencl.hpp"
#endif // HAVE_OPENCL_STATIC
#ifndef CL_DEVICE_DOUBLE_FP_CONFIG
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
#endif
#ifndef CL_DEVICE_HALF_FP_CONFIG
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
#endif
#ifndef CL_VERSION_1_2
#define CV_REQUIRE_OPENCL_1_2_ERROR CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2")
#endif
#endif // HAVE_OPENCL
#endif // __OPENCV_CORE_OCL_RUNTIME_HPP__
modules/core/src/ocl.cpp
浏览文件 @
d0114b24
...
...
@@ -42,6 +42,11 @@
#include "precomp.hpp"
#include <map>
#ifdef HAVE_OPENCL
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#else
// TODO FIXIT: This file can't be build without OPENCL
/*
Part of the file is an extract from the standard OpenCL headers from Khronos site.
Below is the original copyright.
...
...
@@ -1220,6 +1225,12 @@ OCL_FUNC(cl_int, clReleaseEvent, (cl_event event), (event))
#endif
#ifndef CL_VERSION_1_2
#define CL_VERSION_1_2
#endif
#endif
namespace
cv
{
namespace
ocl
{
struct
UMat2D
...
...
@@ -1298,10 +1309,31 @@ inline bool operator < (const HashKey& h1, const HashKey& h2)
return
h1
.
a
<
h2
.
a
||
(
h1
.
a
==
h2
.
a
&&
h1
.
b
<
h2
.
b
);
}
static
bool
g_isInitialized
=
false
;
static
bool
g_isOpenCLAvailable
=
false
;
bool
haveOpenCL
()
{
initOpenCLAndLoad
(
0
);
return
g_haveOpenCL
;
if
(
!
g_isInitialized
)
{
if
(
!
g_isInitialized
)
{
try
{
cl_uint
n
=
0
;
cl_int
err
=
::
clGetPlatformIDs
(
0
,
NULL
,
&
n
);
if
(
err
!=
CL_SUCCESS
)
g_isOpenCLAvailable
=
false
;
else
g_isOpenCLAvailable
=
true
;
}
catch
(...)
{
g_isOpenCLAvailable
=
false
;
}
g_isInitialized
=
true
;
}
}
return
g_isOpenCLAvailable
;
}
bool
useOpenCL
()
...
...
@@ -1549,7 +1581,11 @@ bool Device::compilerAvailable() const
{
return
p
?
p
->
getBoolProp
(
CL_DEVICE_COMPILER_AVAILABLE
)
:
false
;
}
bool
Device
::
linkerAvailable
()
const
#ifdef CL_VERSION_1_2
{
return
p
?
p
->
getBoolProp
(
CL_DEVICE_LINKER_AVAILABLE
)
:
false
;
}
#else
{
CV_REQUIRE_OPENCL_1_2_ERROR
;
}
#endif
int
Device
::
doubleFPConfig
()
const
{
return
p
?
p
->
getProp
<
cl_device_fp_config
,
int
>
(
CL_DEVICE_DOUBLE_FP_CONFIG
)
:
0
;
}
...
...
@@ -1558,7 +1594,11 @@ int Device::singleFPConfig() const
{
return
p
?
p
->
getProp
<
cl_device_fp_config
,
int
>
(
CL_DEVICE_SINGLE_FP_CONFIG
)
:
0
;
}
int
Device
::
halfFPConfig
()
const
#ifdef CL_VERSION_1_2
{
return
p
?
p
->
getProp
<
cl_device_fp_config
,
int
>
(
CL_DEVICE_HALF_FP_CONFIG
)
:
0
;
}
#else
{
CV_REQUIRE_OPENCL_1_2_ERROR
;
}
#endif
bool
Device
::
endianLittle
()
const
{
return
p
?
p
->
getBoolProp
(
CL_DEVICE_ENDIAN_LITTLE
)
:
false
;
}
...
...
@@ -1609,10 +1649,18 @@ size_t Device::image3DMaxDepth() const
{
return
p
?
p
->
getProp
<
size_t
,
size_t
>
(
CL_DEVICE_IMAGE3D_MAX_DEPTH
)
:
0
;
}
size_t
Device
::
imageMaxBufferSize
()
const
#ifdef CL_VERSION_1_2
{
return
p
?
p
->
getProp
<
size_t
,
size_t
>
(
CL_DEVICE_IMAGE_MAX_BUFFER_SIZE
)
:
0
;
}
#else
{
CV_REQUIRE_OPENCL_1_2_ERROR
;
}
#endif
size_t
Device
::
imageMaxArraySize
()
const
#ifdef CL_VERSION_1_2
{
return
p
?
p
->
getProp
<
size_t
,
size_t
>
(
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE
)
:
0
;
}
#else
{
CV_REQUIRE_OPENCL_1_2_ERROR
;
}
#endif
int
Device
::
maxClockFrequency
()
const
{
return
p
?
p
->
getProp
<
cl_uint
,
int
>
(
CL_DEVICE_MAX_CLOCK_FREQUENCY
)
:
0
;
}
...
...
@@ -1704,7 +1752,12 @@ int Device::preferredVectorWidthHalf() const
{
return
p
?
p
->
getProp
<
cl_uint
,
int
>
(
CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
)
:
0
;
}
size_t
Device
::
printfBufferSize
()
const
#ifdef CL_VERSION_1_2
{
return
p
?
p
->
getProp
<
size_t
,
size_t
>
(
CL_DEVICE_PRINTF_BUFFER_SIZE
)
:
0
;
}
#else
{
CV_REQUIRE_OPENCL_1_2_ERROR
;
}
#endif
size_t
Device
::
profilingTimerResolution
()
const
{
return
p
?
p
->
getProp
<
size_t
,
size_t
>
(
CL_DEVICE_PROFILING_TIMER_RESOLUTION
)
:
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录