Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4170c979
Commit
4170c979
authored
Aug 16, 2016
by
Vitaly Tuzov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several HAL API functions are implemented as immediate mode OpenVX calls
parent
11a65475
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
5 deletions
+57
-5
openvx_hal.hpp
3rdparty/openvx/include/openvx_hal.hpp
+57
-5
No files found.
3rdparty/openvx/include/openvx_hal.hpp
View file @
4170c979
...
...
@@ -156,7 +156,7 @@ struct vxImage
}
~
vxImage
()
{
vx
SwapImageHandle
(
img
,
NULL
,
NULL
,
1
);
vx
Err
::
check
(
vxSwapImageHandle
(
img
,
NULL
,
NULL
,
1
)
);
vxReleaseImage
(
&
img
);
}
};
...
...
@@ -165,16 +165,45 @@ struct vxImage
// real code starts here
// ...
template
<
typename
T
>
inline
int
ovx_hal_add
(
const
T
*
a
,
size_t
astep
,
const
T
*
b
,
size_t
bstep
,
T
*
c
,
size_t
cstep
,
int
w
,
int
h
)
#define OVX_BINARY_OP(hal_func, ovx_call, ...) \
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__) \
{ \
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); \
ovx_call \
} \
catch (vxErr & e) \
{ \
e.print(); \
return CV_HAL_ERROR_UNKNOWN; \
} \
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
(
sub
,
{
vxErr
::
check
(
vxuSubtract
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
VX_CONVERT_POLICY_SATURATE
,
ic
.
img
));})
OVX_BINARY_OP
(
absdiff
,
{
vxErr
::
check
(
vxuAbsDiff
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
ic
.
img
));})
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
(
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
)
inline
int
ovx_hal_not
(
const
uchar
*
a
,
size_t
astep
,
uchar
*
c
,
size_t
cstep
,
int
w
,
int
h
)
{
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
(
vxu
Add
(
ctx
->
ctx
,
ia
.
img
,
ib
.
img
,
VX_CONVERT_POLICY_SATURATE
,
ic
.
img
));
vxErr
::
check
(
vxu
Not
(
ctx
->
ctx
,
ia
.
img
,
ic
.
img
));
}
catch
(
vxErr
&
e
)
{
...
...
@@ -192,5 +221,28 @@ inline int ovx_hal_add(const T *a, size_t astep, const T *b, size_t bstep, T *c,
#define cv_hal_add8u ovx_hal_add<uchar>
#undef cv_hal_add16s
#define cv_hal_add16s ovx_hal_add<short>
#undef cv_hal_sub8u
#define cv_hal_sub8u ovx_hal_sub<uchar>
#undef cv_hal_sub16s
#define cv_hal_sub16s ovx_hal_sub<short>
#undef cv_hal_absdiff8u
#define cv_hal_absdiff8u ovx_hal_absdiff<uchar>
#undef cv_hal_absdiff16s
#define cv_hal_absdiff16s ovx_hal_absdiff<short>
#undef cv_hal_and8u
#define cv_hal_and8u ovx_hal_and<uchar>
#undef cv_hal_or8u
#define cv_hal_or8u ovx_hal_or<uchar>
#undef cv_hal_xor8u
#define cv_hal_xor8u ovx_hal_xor<uchar>
#undef cv_hal_not8u
#define cv_hal_not8u ovx_hal_not
#undef cv_hal_mul8u
#define cv_hal_mul8u ovx_hal_mul<uchar>
#undef cv_hal_mul16s
#define cv_hal_mul16s ovx_hal_mul<short>
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment