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
b0d2217c
Commit
b0d2217c
authored
Dec 01, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7515 from terfendail:ovxhal_graytobgr
parents
1d45726f
8098e5b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
1 deletion
+51
-1
openvx_hal.hpp
3rdparty/openvx/include/openvx_hal.hpp
+51
-1
No files found.
3rdparty/openvx/include/openvx_hal.hpp
View file @
b0d2217c
...
...
@@ -225,6 +225,26 @@ struct vxImage
void
*
ptrs
[]
=
{
(
void
*
)
data
};
img
=
vxCreateImageFromHandle
(
ctx
.
ctx
,
VX_Traits
<
T
>::
ImgType
,
&
addr
,
ptrs
,
VX_MEMORY_TYPE_HOST
);
vxErr
::
check
(
img
);
swapMemory
=
true
;
}
template
<
typename
T
>
vxImage
(
vxContext
&
ctx
,
T
value
,
int
w
,
int
h
)
{
#if VX_VERSION > VX_VERSION_1_0
vx_pixel_value_t
pixel
;
switch
((
int
)(
VX_Traits
<
T
>::
DataType
))
{
case
VX_TYPE_UINT8
:
pixel
.
U8
=
value
;
break
;
case
VX_TYPE_UINT16
:
pixel
.
U16
=
value
;
break
;
case
VX_TYPE_INT16
:
pixel
.
S16
=
value
;
break
;
default
:
vxErr
(
VX_ERROR_INVALID_PARAMETERS
,
"uniform image creation"
).
check
();
}
img
=
vxCreateUniformImage
(
ctx
.
ctx
,
w
,
h
,
VX_Traits
<
T
>::
ImgType
,
&
pixel
);
#else
img
=
vxCreateUniformImage
(
ctx
.
ctx
,
w
,
h
,
VX_Traits
<
T
>::
ImgType
,
&
value
);
#endif
vxErr
::
check
(
img
);
swapMemory
=
false
;
}
vxImage
(
vxContext
&
ctx
,
int
imgType
,
const
uchar
*
data
,
size_t
step
,
int
w
,
int
h
)
{
...
...
@@ -295,14 +315,18 @@ struct vxImage
}
img
=
vxCreateImageFromHandle
(
ctx
.
ctx
,
imgType
,
addr
,
ptrs
,
VX_MEMORY_TYPE_HOST
);
vxErr
::
check
(
img
);
swapMemory
=
true
;
}
~
vxImage
()
{
#if VX_VERSION > VX_VERSION_1_0
vxErr
::
check
(
vxSwapImageHandle
(
img
,
NULL
,
NULL
,
1
));
if
(
swapMemory
)
vxErr
::
check
(
vxSwapImageHandle
(
img
,
NULL
,
NULL
,
1
));
#endif
vxReleaseImage
(
&
img
);
}
private
:
bool
swapMemory
;
};
struct
vxMatrix
...
...
@@ -999,6 +1023,30 @@ inline int ovx_hal_cvtBGRtoBGR(const uchar * a, size_t astep, uchar * b, size_t
return
CV_HAL_ERROR_OK
;
}
inline
int
ovx_hal_cvtGraytoBGR
(
const
uchar
*
a
,
size_t
astep
,
uchar
*
b
,
size_t
bstep
,
int
w
,
int
h
,
int
depth
,
int
bcn
)
{
if
(
dimTooBig
(
w
)
||
dimTooBig
(
h
))
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
if
(
depth
!=
CV_8U
||
(
bcn
!=
3
&&
bcn
!=
4
))
return
CV_HAL_ERROR_NOT_IMPLEMENTED
;
try
{
vxContext
*
ctx
=
vxContext
::
getContext
();
vxImage
ia
(
*
ctx
,
a
,
astep
,
w
,
h
);
vxImage
ib
(
*
ctx
,
bcn
==
3
?
VX_DF_IMAGE_RGB
:
VX_DF_IMAGE_RGBX
,
b
,
bstep
,
w
,
h
);
vxErr
::
check
(
vxuChannelCombine
(
ctx
->
ctx
,
ia
.
img
,
ia
.
img
,
ia
.
img
,
bcn
==
4
?
vxImage
(
*
ctx
,
uchar
(
255
),
w
,
h
).
img
:
NULL
,
ib
.
img
));
}
catch
(
vxErr
&
e
)
{
e
.
print
();
return
CV_HAL_ERROR_UNKNOWN
;
}
return
CV_HAL_ERROR_OK
;
}
inline
int
ovx_hal_cvtTwoPlaneYUVtoBGR
(
const
uchar
*
a
,
size_t
astep
,
uchar
*
b
,
size_t
bstep
,
int
w
,
int
h
,
int
bcn
,
bool
swapBlue
,
int
uIdx
)
{
if
(
dimTooBig
(
w
)
||
dimTooBig
(
h
))
...
...
@@ -1183,6 +1231,8 @@ inline int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b,
#undef cv_hal_cvtBGRtoBGR
#define cv_hal_cvtBGRtoBGR ovx_hal_cvtBGRtoBGR
#undef cv_hal_cvtGraytoBGR
#define cv_hal_cvtGraytoBGR ovx_hal_cvtGraytoBGR
#undef cv_hal_cvtTwoPlaneYUVtoBGR
#define cv_hal_cvtTwoPlaneYUVtoBGR ovx_hal_cvtTwoPlaneYUVtoBGR
#undef cv_hal_cvtThreePlaneYUVtoBGR
...
...
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