Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
fb3140ce
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,发现更多精彩内容 >>
提交
fb3140ce
编写于
9月 08, 2016
作者:
V
Vitaly Tuzov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed compilation. Changed value returned by functions called with unsuported parameters.
上级
5ec47299
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
28 deletion
+47
-28
3rdparty/openvx/include/openvx_hal.hpp
3rdparty/openvx/include/openvx_hal.hpp
+47
-28
未找到文件。
3rdparty/openvx/include/openvx_hal.hpp
浏览文件 @
fb3140ce
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#include <string>
#include <string>
#include <vector>
#include <vector>
#include <algorithm>
#include <opencv2/core/saturate.hpp>
#include <opencv2/core/saturate.hpp>
//==================================================================================================
//==================================================================================================
...
@@ -168,7 +170,7 @@ struct vxImage
...
@@ -168,7 +170,7 @@ struct vxImage
addr
.
dim_x
=
w
;
addr
.
dim_x
=
w
;
addr
.
dim_y
=
h
;
addr
.
dim_y
=
h
;
addr
.
stride_x
=
sizeof
(
T
);
addr
.
stride_x
=
sizeof
(
T
);
addr
.
stride_y
=
step
;
addr
.
stride_y
=
(
vx_int32
)
step
;
addr
.
scale_x
=
VX_SCALE_UNITY
;
addr
.
scale_x
=
VX_SCALE_UNITY
;
addr
.
scale_y
=
VX_SCALE_UNITY
;
addr
.
scale_y
=
VX_SCALE_UNITY
;
addr
.
step_x
=
1
;
addr
.
step_x
=
1
;
...
@@ -193,7 +195,7 @@ struct vxMatrix
...
@@ -193,7 +195,7 @@ struct vxMatrix
{
{
mtx
=
vxCreateMatrix
(
ctx
.
ctx
,
VX_Traits
<
T
>::
DataType
,
w
,
h
);
mtx
=
vxCreateMatrix
(
ctx
.
ctx
,
VX_Traits
<
T
>::
DataType
,
w
,
h
);
vxErr
::
check
(
mtx
);
vxErr
::
check
(
mtx
);
vxErr
::
check
(
vxCopyMatrix
(
mtx
,
data
,
VX_WRITE_ONLY
,
VX_MEMORY_TYPE_HOST
);
vxErr
::
check
(
vxCopyMatrix
(
mtx
,
const_cast
<
T
*>
(
data
),
VX_WRITE_ONLY
,
VX_MEMORY_TYPE_HOST
)
);
}
}
~
vxMatrix
()
~
vxMatrix
()
{
{
...
@@ -209,7 +211,7 @@ struct vxConvolution
...
@@ -209,7 +211,7 @@ struct vxConvolution
{
{
cnv
=
vxCreateConvolution
(
ctx
.
ctx
,
w
,
h
);
cnv
=
vxCreateConvolution
(
ctx
.
ctx
,
w
,
h
);
vxErr
::
check
(
cnv
);
vxErr
::
check
(
cnv
);
vxErr
::
check
(
vxCopyConvolutionCoefficients
(
cnv
,
(
void
*
)
data
,
VX_WRITE_ONLY
,
VX_MEMORY_TYPE_HOST
);
vxErr
::
check
(
vxCopyConvolutionCoefficients
(
cnv
,
const_cast
<
short
*>
(
data
),
VX_WRITE_ONLY
,
VX_MEMORY_TYPE_HOST
)
);
}
}
~
vxConvolution
()
~
vxConvolution
()
{
{
...
@@ -221,24 +223,24 @@ struct vxConvolution
...
@@ -221,24 +223,24 @@ struct vxConvolution
// real code starts here
// real code starts here
// ...
// ...
#define OVX_BINARY_OP(hal_func, ovx_call
, ...)
\
#define OVX_BINARY_OP(hal_func, ovx_call
)
\
template <typename T>
\
template <typename T> \
inline int ovx_hal_##hal_func(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h
, __VA_ARGS__
) \
inline int ovx_hal_##hal_func(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h) \
{
\
{ \
try
\
try \
{
\
{ \
vxContext * ctx = vxContext::getContext();
\
vxContext * ctx = vxContext::getContext(); \
vxImage ia(*ctx, a, astep, w, h);
\
vxImage ia(*ctx, a, astep, w, h); \
vxImage ib(*ctx, b, bstep, w, h);
\
vxImage ib(*ctx, b, bstep, w, h); \
vxImage ic(*ctx, c, cstep, w, h);
\
vxImage ic(*ctx, c, cstep, w, h); \
ovx_call
\
ovx_call \
}
\
} \
catch (vxErr & e)
\
catch (vxErr & e) \
{
\
{ \
e.print();
\
e.print(); \
return CV_HAL_ERROR_UNKNOWN;
\
return CV_HAL_ERROR_UNKNOWN; \
}
\
} \
return CV_HAL_ERROR_OK;
\
return CV_HAL_ERROR_OK; \
}
}
OVX_BINARY_OP
(
add
,
{
vxErr
::
check
(
vxuAdd
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
VX_CONVERT_POLICY_SATURATE
,
ic
.
img
));})
OVX_BINARY_OP
(
add
,
{
vxErr
::
check
(
vxuAdd
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
VX_CONVERT_POLICY_SATURATE
,
ic
.
img
));})
...
@@ -250,7 +252,24 @@ OVX_BINARY_OP(and, {vxErr::check(vxuAnd(ctx->ctx, ia.img, ib.img, ic.img));})
...
@@ -250,7 +252,24 @@ OVX_BINARY_OP(and, {vxErr::check(vxuAnd(ctx->ctx, ia.img, ib.img, ic.img));})
OVX_BINARY_OP
(
or
,
{
vxErr
::
check
(
vxuOr
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
ic
.
img
));})
OVX_BINARY_OP
(
or
,
{
vxErr
::
check
(
vxuOr
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
ic
.
img
));})
OVX_BINARY_OP
(
xor
,
{
vxErr
::
check
(
vxuXor
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
ic
.
img
));})
OVX_BINARY_OP
(
xor
,
{
vxErr
::
check
(
vxuXor
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
ic
.
img
));})
OVX_BINARY_OP
(
mul
,
{
vxErr
::
check
(
vxuMultiply
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
(
float
)
scale
,
VX_CONVERT_POLICY_SATURATE
,
VX_ROUND_POLICY_TO_ZERO
,
ic
.
img
));},
double
scale
)
template
<
typename
T
>
inline
int
ovx_hal_mul
(
const
T
*
a
,
size_t
astep
,
const
T
*
b
,
size_t
bstep
,
T
*
c
,
size_t
cstep
,
int
w
,
int
h
,
double
scale
)
{
try
{
vxContext
*
ctx
=
vxContext
::
getContext
();
vxImage
ia
(
*
ctx
,
a
,
astep
,
w
,
h
);
vxImage
ib
(
*
ctx
,
b
,
bstep
,
w
,
h
);
vxImage
ic
(
*
ctx
,
c
,
cstep
,
w
,
h
);
vxErr
::
check
(
vxuMultiply
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
(
float
)
scale
,
VX_CONVERT_POLICY_SATURATE
,
VX_ROUND_POLICY_TO_ZERO
,
ic
.
img
));
}
catch
(
vxErr
&
e
)
{
e
.
print
();
return
CV_HAL_ERROR_UNKNOWN
;
}
return
CV_HAL_ERROR_OK
;
}
inline
int
ovx_hal_not
(
const
uchar
*
a
,
size_t
astep
,
uchar
*
c
,
size_t
cstep
,
int
w
,
int
h
)
inline
int
ovx_hal_not
(
const
uchar
*
a
,
size_t
astep
,
uchar
*
c
,
size_t
cstep
,
int
w
,
int
h
)
{
{
...
@@ -291,7 +310,7 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a
...
@@ -291,7 +310,7 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a
(
bw
-
0.5
)
/
inv_scale_x
-
0.5
<
aw
&&
(
bh
-
0.5
)
/
inv_scale_y
-
0.5
<
ah
&&
(
bw
-
0.5
)
/
inv_scale_x
-
0.5
<
aw
&&
(
bh
-
0.5
)
/
inv_scale_y
-
0.5
<
ah
&&
(
bw
+
0.5
)
/
inv_scale_x
+
0.5
>=
aw
&&
(
bh
+
0.5
)
/
inv_scale_y
+
0.5
>=
ah
&&
(
bw
+
0.5
)
/
inv_scale_x
+
0.5
>=
aw
&&
(
bh
+
0.5
)
/
inv_scale_y
+
0.5
>=
ah
&&
std
::
abs
(
bw
/
inv_scale_x
-
aw
)
<
0.1
&&
std
::
abs
(
bh
/
inv_scale_y
-
ah
)
<
0.1
))
std
::
abs
(
bw
/
inv_scale_x
-
aw
)
<
0.1
&&
std
::
abs
(
bh
/
inv_scale_y
-
ah
)
<
0.1
))
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"Bad scale"
).
check
()
;
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
int
mode
;
int
mode
;
if
(
interpolation
==
CV_HAL_INTER_LINEAR
)
if
(
interpolation
==
CV_HAL_INTER_LINEAR
)
...
@@ -301,7 +320,7 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a
...
@@ -301,7 +320,7 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a
else
if
(
interpolation
==
CV_HAL_INTER_NEAREST
)
else
if
(
interpolation
==
CV_HAL_INTER_NEAREST
)
mode
=
VX_INTERPOLATION_NEAREST_NEIGHBOR
;
mode
=
VX_INTERPOLATION_NEAREST_NEIGHBOR
;
else
else
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"Bad interpolation mode"
).
check
()
;
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
vxErr
::
check
(
vxuScaleImage
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
mode
));
vxErr
::
check
(
vxuScaleImage
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
mode
));
}
}
...
@@ -322,7 +341,7 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i
...
@@ -322,7 +341,7 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i
vxImage
ib
(
*
ctx
,
b
,
bstep
,
bw
,
bh
);
vxImage
ib
(
*
ctx
,
b
,
bstep
,
bw
,
bh
);
if
(
!
(
atype
==
CV_8UC1
||
atype
==
CV_8SC1
))
if
(
!
(
atype
==
CV_8UC1
||
atype
==
CV_8SC1
))
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"Bad input type"
).
check
()
;
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
vx_border_t
border
;
vx_border_t
border
;
switch
(
borderType
)
switch
(
borderType
)
...
@@ -346,7 +365,7 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i
...
@@ -346,7 +365,7 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i
else
if
(
interpolation
==
CV_HAL_INTER_NEAREST
)
else
if
(
interpolation
==
CV_HAL_INTER_NEAREST
)
mode
=
VX_INTERPOLATION_NEAREST_NEIGHBOR
;
mode
=
VX_INTERPOLATION_NEAREST_NEIGHBOR
;
else
else
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"Bad interpolation mode"
).
check
()
;
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
std
::
vector
<
float
>
data
;
std
::
vector
<
float
>
data
;
data
.
reserve
(
6
);
data
.
reserve
(
6
);
...
@@ -380,7 +399,7 @@ inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int a
...
@@ -380,7 +399,7 @@ inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int a
vxImage
ib
(
*
ctx
,
b
,
bstep
,
bw
,
bh
);
vxImage
ib
(
*
ctx
,
b
,
bstep
,
bw
,
bh
);
if
(
!
(
atype
==
CV_8UC1
||
atype
==
CV_8SC1
))
if
(
!
(
atype
==
CV_8UC1
||
atype
==
CV_8SC1
))
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"Bad input type"
).
check
()
;
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
vx_border_t
border
;
vx_border_t
border
;
switch
(
borderType
)
switch
(
borderType
)
...
@@ -404,7 +423,7 @@ inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int a
...
@@ -404,7 +423,7 @@ inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int a
else
if
(
interpolation
==
CV_HAL_INTER_NEAREST
)
else
if
(
interpolation
==
CV_HAL_INTER_NEAREST
)
mode
=
VX_INTERPOLATION_NEAREST_NEIGHBOR
;
mode
=
VX_INTERPOLATION_NEAREST_NEIGHBOR
;
else
else
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"Bad interpolation mode"
).
check
()
;
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
std
::
vector
<
float
>
data
;
std
::
vector
<
float
>
data
;
data
.
reserve
(
9
);
data
.
reserve
(
9
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录