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
eccf2fa4
Commit
eccf2fa4
authored
Jun 05, 2016
by
Tomoaki Teshima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
follow other interface
* remove useHW option * update test
parent
b2ad7cd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
core.hpp
modules/core/include/opencv2/core.hpp
+1
-1
convert.cpp
modules/core/src/convert.cpp
+3
-2
test_arithm.cpp
modules/core/test/test_arithm.cpp
+10
-8
No files found.
modules/core/include/opencv2/core.hpp
View file @
eccf2fa4
...
...
@@ -533,7 +533,7 @@ CV_16S to represent the bit depth. If the input array is neither of them, it'll
@param dst output array.
@param useHW if possible use HW SIMD instruction to convert
*/
CV_EXPORTS_W
void
convertFp16
(
InputArray
src
,
OutputArray
dst
,
bool
useHW
=
true
);
CV_EXPORTS_W
void
convertFp16
(
InputArray
src
,
OutputArray
dst
);
/** @brief Performs a look-up table transform of an array.
...
...
modules/core/src/convert.cpp
View file @
eccf2fa4
...
...
@@ -5117,9 +5117,10 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl
}
}
void
cv
::
convertFp16
(
InputArray
_src
,
OutputArray
_dst
,
bool
useHW
)
void
cv
::
convertFp16
(
InputArray
_src
,
OutputArray
_dst
)
{
if
(
checkHardwareSupport
(
CV_CPU_FP16
)
==
false
)
bool
useHW
=
true
;
if
(
checkHardwareSupport
(
CV_CPU_FP16
)
==
false
)
{
useHW
=
false
;
}
...
...
modules/core/test/test_arithm.cpp
View file @
eccf2fa4
...
...
@@ -742,27 +742,29 @@ struct ConvertScaleFp16Op : public BaseElemWiseOp
ConvertScaleFp16Op
()
:
BaseElemWiseOp
(
1
,
FIX_BETA
+
REAL_GAMMA
,
1
,
1
,
Scalar
::
all
(
0
)),
nextRange
(
0
)
{
}
void
op
(
const
vector
<
Mat
>&
src
,
Mat
&
dst
,
const
Mat
&
)
{
convertFp16
(
src
[
0
],
dst
,
true
);
Mat
m
;
convertFp16
(
src
[
0
],
m
);
convertFp16
(
m
,
dst
);
}
void
refop
(
const
vector
<
Mat
>&
src
,
Mat
&
dst
,
const
Mat
&
)
{
c
onvertFp16
(
src
[
0
],
dst
,
false
);
c
vtest
::
copy
(
src
[
0
],
dst
);
}
int
getRandomType
(
RNG
&
)
{
// 0: FP32 -> FP16
// 1: FP16 -> FP32
// 0: FP32 -> FP16
-> FP32
// 1: FP16 -> FP32
-> FP16
int
srctype
=
(
nextRange
&
1
)
==
0
?
CV_32F
:
CV_16S
;
return
srctype
;
}
void
getValueRange
(
int
,
double
&
minval
,
double
&
maxval
)
{
// 0: FP32 -> FP16
// 1: FP16 -> FP32
// 0: FP32 -> FP16
-> FP32
// 1: FP16 -> FP32
-> FP16
if
(
(
nextRange
&
1
)
==
0
)
{
// largest integer number that fp16 can express
maxval
=
65504
.
f
;
// largest integer number that fp16 can express
exactly
maxval
=
2048
.
f
;
minval
=
-
maxval
;
}
else
...
...
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