Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
7c870014
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,发现更多精彩内容 >>
提交
7c870014
编写于
11月 07, 2014
作者:
A
Alexander Karsakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Correctly unrolled some cycles
上级
0ec0aeb7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
15 deletion
+32
-15
modules/imgproc/src/opencl/canny.cl
modules/imgproc/src/opencl/canny.cl
+32
-15
未找到文件。
modules/imgproc/src/opencl/canny.cl
浏览文件 @
7c870014
...
...
@@ -382,12 +382,12 @@ __constant short move_dir[2][8] = {
{ -1, 0, 1, -1, 1, -1, 0, 1 }
};
__kernel void stage2_hysteresis(__global uchar *map, int map_step, int map_offset, int rows, int cols)
__kernel void stage2_hysteresis(__global uchar *map
_ptr
, int map_step, int map_offset, int rows, int cols)
{
map += map_offset;
map
_ptr
+= map_offset;
int x = get_global_id(0);
int y
0
= get_global_id(1) * PIX_PER_WI;
int y = get_global_id(1) * PIX_PER_WI;
int lid = get_local_id(0) + get_local_id(1) * LOCAL_X;
...
...
@@ -400,13 +400,21 @@ __kernel void stage2_hysteresis(__global uchar *map, int map_step, int map_offse
if (x < cols)
{
__global uchar* map = map_ptr + mad24(y, map_step, x * (int)sizeof(int));
#pragma unroll
for (int
y = y0; y < min(y0 + PIX_PER_WI, rows); ++
y)
for (int
cy = 0; cy < PIX_PER_WI; ++c
y)
{
int type = loadpix(map + mad24(y, map_step, x * (int)sizeof(int)));
if (type == 2)
if (y < rows)
{
l_stack[atomic_inc(&l_counter)] = (ushort2)(x, y);
int type = loadpix(map);
if (type == 2)
{
l_stack[atomic_inc(&l_counter)] = (ushort2)(x, y);
}
y++;
map += map_step;
}
}
}
...
...
@@ -420,7 +428,6 @@ __kernel void stage2_hysteresis(__global uchar *map, int map_step, int map_offse
int mod = l_counter % LOCAL_TOTAL;
int pix_per_thr = l_counter / LOCAL_TOTAL + ((lid < mod) ? 1 : 0);
#pragma unroll
for (int i = 0; i < pix_per_thr; ++i)
{
ushort2 pos = l_stack[ atomic_dec(&l_counter) - 1 ];
...
...
@@ -432,7 +439,7 @@ __kernel void stage2_hysteresis(__global uchar *map, int map_step, int map_offse
ushort posy = pos.y + move_dir[1][j];
if (posx < 0 || posy < 0 || posx >= cols |
|
posy
>=
rows
)
continue
;
__global
uchar
*addr
=
map
+
mad24
(
posy,
map_step,
posx
*
(
int
)
sizeof
(
int
))
;
__global
uchar
*addr
=
map
_ptr
+
mad24
(
posy,
map_step,
posx
*
(
int
)
sizeof
(
int
))
;
int
type
=
loadpix
(
addr
)
;
if
(
type
==
0
)
{
...
...
@@ -461,16 +468,26 @@ __kernel void getEdges(__global const uchar *mapptr, int map_step, int map_offse
__global
uchar
*dst,
int
dst_step,
int
dst_offset
)
{
int
x
=
get_global_id
(
0
)
;
int
y
0
=
get_global_id
(
1
)
*
PIX_PER_WI
;
int
y
=
get_global_id
(
1
)
*
PIX_PER_WI
;
#
pragma
unroll
for
(
int
y
=
y0
; y < min(y0 + PIX_PER_WI, rows); ++y)
if
(
x
<
cols
)
{
int
map_index
=
mad24
(
map_step,
y,
mad24
(
x,
(
int
)
sizeof
(
int
)
,
map_offset
))
;
int
dst_index
=
mad24
(
dst_step,
y,
x
)
+
dst_offset
;
int
dst_index
=
mad24
(
dst_step,
y,
x
+
dst_offset
)
;
__global
const
int
*
map
=
(
__global
const
int
*
)(
mapptr
+
map_index
)
;
dst[dst_index]
=
(
uchar
)(
-
(
map[0]
>>
1
))
;
#
pragma
unroll
for
(
int
cy
=
0
; cy < PIX_PER_WI; ++cy)
{
if
(
y
<
rows
)
{
__global
const
int
*
map
=
(
__global
const
int
*
)(
mapptr
+
map_index
)
;
dst[dst_index]
=
(
uchar
)(
-
(
map[0]
>>
1
))
;
y++
;
map_index
+=
map_step
;
dst_index
+=
dst_step
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录