Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
fd152879
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
fd152879
编写于
4月 13, 2013
作者:
P
Peng Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass query type T into kernel
上级
63813e83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
14 deletion
+38
-14
modules/ocl/src/brute_force_matcher.cpp
modules/ocl/src/brute_force_matcher.cpp
+28
-8
modules/ocl/src/opencl/brute_force_match.cl
modules/ocl/src/opencl/brute_force_match.cl
+10
-6
未找到文件。
modules/ocl/src/brute_force_matcher.cpp
浏览文件 @
fd152879
...
...
@@ -64,6 +64,8 @@ namespace cv
static
const
int
OPT_SIZE
=
100
;
static
const
char
*
T_ARR
[]
=
{
"uchar"
,
"char"
,
"ushort"
,
"short"
,
"int"
,
"float"
,
"double"
};
template
<
int
BLOCK_SIZE
,
int
MAX_DESC_LEN
/*, typename Mask*/
>
void
matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
int
distType
)
...
...
@@ -78,7 +80,9 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
distType
,
block_size
,
m_size
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
,
m_size
);
if
(
globalSize
[
0
]
!=
0
)
{
...
...
@@ -119,7 +123,9 @@ void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/,
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
distType
,
block_size
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
);
if
(
globalSize
[
0
]
!=
0
)
{
...
...
@@ -162,7 +168,9 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
distType
,
block_size
,
m_size
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
,
m_size
);
if
(
globalSize
[
0
]
!=
0
)
{
...
...
@@ -202,7 +210,9 @@ void radius_match(const oclMat &query, const oclMat &train, float maxDistance, c
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
distType
,
block_size
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
);
if
(
globalSize
[
0
]
!=
0
)
{
...
...
@@ -300,7 +310,9 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
distType
,
block_size
,
m_size
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
,
m_size
);
if
(
globalSize
[
0
]
!=
0
)
{
...
...
@@ -334,7 +346,9 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/,
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
distType
,
block_size
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
);
if
(
globalSize
[
0
]
!=
0
)
{
...
...
@@ -368,7 +382,10 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d"
,
distType
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d -D MAX_DESC_LEN=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
,
m_size
);
if
(
globalSize
[
0
]
!=
0
)
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
...
...
@@ -401,7 +418,10 @@ void calcDistance(const oclMat &query, const oclMat &train, const oclMat &/*mask
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
char
opt
[
OPT_SIZE
]
=
""
;
sprintf
(
opt
,
"-D DIST_TYPE=%d"
,
distType
);
sprintf
(
opt
,
"-D T=%s -D DIST_TYPE=%d -D BLOCK_SIZE=%d"
,
T_ARR
[
query
.
depth
()],
distType
,
block_size
);
if
(
globalSize
[
0
]
!=
0
)
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
...
...
modules/ocl/src/opencl/brute_force_match.cl
浏览文件 @
fd152879
...
...
@@ -47,6 +47,10 @@
#
pragma
OPENCL
EXTENSION
cl_khr_global_int32_base_atomics:enable
#
define
MAX_FLOAT
3.40282e+038f
#
ifndef
T
#
define
T
float
#
endif
#
ifndef
BLOCK_SIZE
#
define
BLOCK_SIZE
16
#
endif
...
...
@@ -54,7 +58,11 @@
#
define
MAX_DESC_LEN
64
#
endif
int
bit1Count
(
float
x
)
#
ifndef
DIST_TYPE
#
define
DIST_TYPE
0
#
endif
int
bit1Count
(
int
x
)
{
int
c
=
0
;
int
ix
=
(
int
)
x
;
...
...
@@ -63,13 +71,9 @@ int bit1Count(float x)
c
+=
ix
&
0x1
;
ix
>>=
1
;
}
return
(
float
)
c
;
return
c
;
}
#
ifndef
DIST_TYPE
#
define
DIST_TYPE
0
#
endif
#
if
(
DIST_TYPE
==
0
)
#
define
DIST
(
x,
y
)
fabs
((
x
)
-
(
y
))
#
elif
(
DIST_TYPE
==
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录