Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
c8aed499
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 10 个月
通知
995
Star
71100
Fork
55580
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c8aed499
编写于
10月 31, 2013
作者:
I
Ilya Lavrenov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed ocl::warpPerspective
上级
ef9f6905
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
31 deletion
+25
-31
modules/ocl/src/opencl/imgproc_warpPerspective.cl
modules/ocl/src/opencl/imgproc_warpPerspective.cl
+25
-31
未找到文件。
modules/ocl/src/opencl/imgproc_warpPerspective.cl
浏览文件 @
c8aed499
...
...
@@ -100,8 +100,8 @@ __kernel void warpPerspectiveNN_C1_D0(__global uchar const * restrict src, __glo
F4
Y0
=
M[3]*DX
+
M[4]*dy
+
M[5]
;
F4
W
=
M[6]*DX
+
M[7]*dy
+
M[8],one=1,zero=0
;
W
=
(
W!=zero
)
?
one/W
:
zero
;
short4
X
=
convert_short4
(
rint
(
X0*W
)
)
;
short4
Y
=
convert_short4
(
rint
(
Y0*W
)
)
;
short4
X
=
convert_short4
_sat_rte
(
X0*W
)
;
short4
Y
=
convert_short4
_sat_rte
(
Y0*W
)
;
int4
sx
=
convert_int4
(
X
)
;
int4
sy
=
convert_int4
(
Y
)
;
...
...
@@ -137,8 +137,8 @@ __kernel void warpPerspectiveLinear_C1_D0(__global const uchar * restrict src, _
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
int
sx
=
(
short
)
(
X
>>
INTER_BITS
)
;
int
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
;
int
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
;
int
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
;
int
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
int
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -159,7 +159,7 @@ __kernel void warpPerspectiveLinear_C1_D0(__global const uchar * restrict src, _
for
(
i=0
; i<4; i++)
{
float
v
=
tab1y[
(
i>>1
)
]
*
tab1x[
(
i&1
)
]
;
itab[i]
=
convert_short_sat
(
rint
(
v
*
INTER_REMAP_COEF_SCALE
)
)
;
itab[i]
=
convert_short_sat
_rte
(
v
*
INTER_REMAP_COEF_SCALE
)
;
}
if
(
dx
>=0
&&
dx
<
dst_cols
&&
dy
>=
0
&&
dy
<
dst_rows
)
{
...
...
@@ -189,8 +189,8 @@ __kernel void warpPerspectiveCubic_C1_D0(__global uchar * src, __global uchar *
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
(
X
>>
INTER_BITS
)
-
1
;
short
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
-
1
;
short
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
-
1
;
short
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
-
1
;
short
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -266,10 +266,8 @@ __kernel void warpPerspectiveNN_C4_D0(__global uchar4 const * restrict src, __gl
F
Y0
=
M[3]*dx
+
M[4]*dy
+
M[5]
;
F
W
=
M[6]*dx
+
M[7]*dy
+
M[8]
;
W
=
(
W
!=
0.0
)
?
1./W
:
0.0
;
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
X
;
short
sy
=
(
short
)
Y
;
short
sx
=
convert_short_sat_rte
(
X0*W
)
;
short
sy
=
convert_short_sat_rte
(
Y0*W
)
;
if
(
dx
>=
0
&&
dx
<
dst_cols
&&
dy
>=
0
&&
dy
<
dst_rows
)
dst[
(
dst_offset>>2
)
+dy*
(
dstStep>>2
)
+dx]=
(
sx>=0
&&
sx<src_cols
&&
sy>=0
&&
sy<src_rows
)
?
src[
(
src_offset>>2
)
+sy*
(
srcStep>>2
)
+sx]
:
(
uchar4
)
0
;
...
...
@@ -295,8 +293,8 @@ __kernel void warpPerspectiveLinear_C4_D0(__global uchar4 const * restrict src,
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
(
X
>>
INTER_BITS
)
;
short
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
;
short
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
;
short
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
;
short
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -347,8 +345,8 @@ __kernel void warpPerspectiveCubic_C4_D0(__global uchar4 const * restrict src, _
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
(
X
>>
INTER_BITS
)
-
1
;
short
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
-
1
;
short
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
-
1
;
short
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
-
1
;
short
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -427,10 +425,8 @@ __kernel void warpPerspectiveNN_C1_D5(__global float * src, __global float * dst
F
Y0
=
M[3]*dx
+
M[4]*dy
+
M[5]
;
F
W
=
M[6]*dx
+
M[7]*dy
+
M[8]
;
W
=
(
W
!=
0.0
)
?
1./W
:
0.0
;
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
X
;
short
sy
=
(
short
)
Y
;
short
sx
=
convert_short_sat_rte
(
X0*W
)
;
short
sy
=
convert_short_sat_rte
(
Y0*W
)
;
if
(
dx
>=
0
&&
dx
<
dst_cols
&&
dy
>=
0
&&
dy
<
dst_rows
)
dst[
(
dst_offset>>2
)
+dy*dstStep+dx]=
(
sx>=0
&&
sx<src_cols
&&
sy>=0
&&
sy<src_rows
)
?
src[
(
src_offset>>2
)
+sy*srcStep+sx]
:
0
;
...
...
@@ -455,8 +451,8 @@ __kernel void warpPerspectiveLinear_C1_D5(__global float * src, __global float *
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
(
X
>>
INTER_BITS
)
;
short
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
;
short
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
;
short
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
;
short
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -505,8 +501,8 @@ __kernel void warpPerspectiveCubic_C1_D5(__global float * src, __global float *
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
(
X
>>
INTER_BITS
)
-
1
;
short
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
-
1
;
short
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
-
1
;
short
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
-
1
;
short
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -562,10 +558,8 @@ __kernel void warpPerspectiveNN_C4_D5(__global float4 * src, __global float4 * d
F
Y0
=
M[3]*dx
+
M[4]*dy
+
M[5]
;
F
W
=
M[6]*dx
+
M[7]*dy
+
M[8]
;
W
=
(
W
!=
0.0
)
?
1./W
:
0.0
;
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
X
;
short
sy
=
(
short
)
Y
;
short
sx
=
convert_short_sat_rte
(
X0*W
)
;
short
sy
=
convert_short_sat_rte
(
Y0*W
)
;
if
(
dx
>=
0
&&
dx
<
dst_cols
&&
dy
>=
0
&&
dy
<
dst_rows
)
dst[
(
dst_offset>>4
)
+dy*
(
dstStep>>2
)
+dx]=
(
sx>=0
&&
sx<src_cols
&&
sy>=0
&&
sy<src_rows
)
?
src[
(
src_offset>>4
)
+sy*
(
srcStep>>2
)
+sx]
:
(
float
)
0
;
...
...
@@ -593,8 +587,8 @@ __kernel void warpPerspectiveLinear_C4_D5(__global float4 * src, __global float4
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx0
=
(
short
)
(
X
>>
INTER_BITS
)
;
short
sy0
=
(
short
)
(
Y
>>
INTER_BITS
)
;
short
sx0
=
convert_short_sat
(
X
>>
INTER_BITS
)
;
short
sy0
=
convert_short_sat
(
Y
>>
INTER_BITS
)
;
short
ay0
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax0
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
@@ -646,8 +640,8 @@ __kernel void warpPerspectiveCubic_C4_D5(__global float4 * src, __global float4
int
X
=
rint
(
X0*W
)
;
int
Y
=
rint
(
Y0*W
)
;
short
sx
=
(
short
)
(
X
>>
INTER_BITS
)
-1
;
short
sy
=
(
short
)
(
Y
>>
INTER_BITS
)
-1
;
short
sx
=
convert_short_sat
(
X
>>
INTER_BITS
)
-1
;
short
sy
=
convert_short_sat
(
Y
>>
INTER_BITS
)
-1
;
short
ay
=
(
short
)(
Y
&
(
INTER_TAB_SIZE-1
))
;
short
ax
=
(
short
)(
X
&
(
INTER_TAB_SIZE-1
))
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录