Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
2a0909ac
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,发现更多精彩内容 >>
提交
2a0909ac
编写于
8月 30, 2010
作者:
A
Anatoly Baksheev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed bugs in STEREOBM (added syncs and volatiles, prevent reading from uninitialized memory)
上级
0a73af8e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
8 deletion
+15
-8
modules/gpu/src/cuda/stereobm.cu
modules/gpu/src/cuda/stereobm.cu
+15
-8
未找到文件。
modules/gpu/src/cuda/stereobm.cu
浏览文件 @
2a0909ac
...
...
@@ -75,8 +75,8 @@ __device__ int SQ(int a)
}
template
<
int
RADIUS
>
__device__
unsigned
int
CalcSSD
(
unsigned
int
*
col_ssd_cache
,
unsigned
int
*
col_ssd
)
{
__device__
unsigned
int
CalcSSD
(
volatile
unsigned
int
*
col_ssd_cache
,
volatile
unsigned
int
*
col_ssd
)
{
unsigned
int
cache
=
0
;
unsigned
int
cache2
=
0
;
...
...
@@ -97,18 +97,25 @@ __device__ unsigned int CalcSSD(unsigned int *col_ssd_cache, unsigned int *col_s
}
template
<
int
RADIUS
>
__device__
uint2
MinSSD
(
unsigned
int
*
col_ssd_cache
,
unsigned
int
*
col_ssd
)
__device__
uint2
MinSSD
(
volatile
unsigned
int
*
col_ssd_cache
,
volatile
unsigned
int
*
col_ssd
)
{
unsigned
int
ssd
[
N_DISPARITIES
];
//See above: #define COL_SSD_SIZE (BLOCK_W + 2 * RADIUS)
ssd
[
0
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
0
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
1
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
1
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
2
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
2
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
3
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
3
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
4
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
4
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
5
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
5
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
6
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
6
*
(
BLOCK_W
+
2
*
RADIUS
));
__syncthreads
();
ssd
[
7
]
=
CalcSSD
<
RADIUS
>
(
col_ssd_cache
,
col_ssd
+
7
*
(
BLOCK_W
+
2
*
RADIUS
));
int
mssd
=
min
(
min
(
min
(
ssd
[
0
],
ssd
[
1
]),
min
(
ssd
[
4
],
ssd
[
5
])),
min
(
min
(
ssd
[
2
],
ssd
[
3
]),
min
(
ssd
[
6
],
ssd
[
7
])));
...
...
@@ -124,7 +131,7 @@ __device__ uint2 MinSSD(unsigned int *col_ssd_cache, unsigned int *col_ssd)
}
template
<
int
RADIUS
>
__device__
void
StepDown
(
int
idx1
,
int
idx2
,
unsigned
char
*
imageL
,
unsigned
char
*
imageR
,
int
d
,
unsigned
int
*
col_ssd
)
__device__
void
StepDown
(
int
idx1
,
int
idx2
,
unsigned
char
*
imageL
,
unsigned
char
*
imageR
,
int
d
,
volatile
unsigned
int
*
col_ssd
)
{
unsigned
char
leftPixel1
;
unsigned
char
leftPixel2
;
...
...
@@ -191,7 +198,7 @@ __device__ void StepDown(int idx1, int idx2, unsigned char* imageL, unsigned cha
}
template
<
int
RADIUS
>
__device__
void
InitColSSD
(
int
x_tex
,
int
y_tex
,
int
im_pitch
,
unsigned
char
*
imageL
,
unsigned
char
*
imageR
,
int
d
,
unsigned
int
*
col_ssd
)
__device__
void
InitColSSD
(
int
x_tex
,
int
y_tex
,
int
im_pitch
,
unsigned
char
*
imageL
,
unsigned
char
*
imageR
,
int
d
,
volatile
unsigned
int
*
col_ssd
)
{
unsigned
char
leftPixel1
;
int
idx
;
...
...
@@ -229,11 +236,11 @@ template<int RADIUS>
__global__
void
stereoKernel
(
unsigned
char
*
left
,
unsigned
char
*
right
,
size_t
img_step
,
unsigned
char
*
disp
,
size_t
disp_pitch
,
int
maxdisp
)
{
extern
__shared__
unsigned
int
col_ssd_cache
[];
unsigned
int
*
col_ssd
=
col_ssd_cache
+
BLOCK_W
+
threadIdx
.
x
;
unsigned
int
*
col_ssd_extra
=
threadIdx
.
x
<
(
2
*
RADIUS
)
?
col_ssd
+
BLOCK_W
:
0
;
//#define N_DIRTY_PIXELS (2 * RADIUS)
volatile
unsigned
int
*
col_ssd
=
col_ssd_cache
+
BLOCK_W
+
threadIdx
.
x
;
volatile
unsigned
int
*
col_ssd_extra
=
threadIdx
.
x
<
(
2
*
RADIUS
)
?
col_ssd
+
BLOCK_W
:
0
;
//#define N_DIRTY_PIXELS (2 * RADIUS)
//#define X (blockIdx.x * BLOCK_W + threadIdx.x + STEREO_MAXD)
int
X
=
(
blockIdx
.
x
*
BLOCK_W
+
threadIdx
.
x
+
maxdisp
);
int
X
=
(
blockIdx
.
x
*
BLOCK_W
+
threadIdx
.
x
+
maxdisp
+
RADIUS
);
//#define Y (__mul24(blockIdx.y, ROWSperTHREAD) + RADIUS)
#define Y (blockIdx.y * ROWSperTHREAD + RADIUS)
//int Y = blockIdx.y * ROWSperTHREAD + RADIUS;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录