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
c6e92803
Commit
c6e92803
authored
Mar 16, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3816 from ilya-lavrenov:il/cvround
parents
f9b24447
6f8b3fc6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
8 deletions
+53
-8
cvdef.h
modules/core/include/opencv2/core/cvdef.h
+8
-8
perf_cvround.cpp
modules/core/perf/perf_cvround.cpp
+45
-0
No files found.
modules/core/include/opencv2/core/cvdef.h
View file @
c6e92803
...
@@ -480,16 +480,14 @@ CV_INLINE int cvRound( double value )
...
@@ -480,16 +480,14 @@ CV_INLINE int cvRound( double value )
fistp
t
;
fistp
t
;
}
}
return
t
;
return
t
;
#elif
defined _MSC_VER && defined _M_ARM
&& defined HAVE_TEGRA_OPTIMIZATION
#elif
((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || defined __GNUC__)
&& defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND
(
value
);
TEGRA_ROUND
_DBL
(
value
);
#elif defined CV_ICC || defined __GNUC__
#elif defined CV_ICC || defined __GNUC__
# ifdef HAVE_TEGRA_OPTIMIZATION
# if CV_VFP
TEGRA_ROUND
(
value
);
# elif CV_VFP
ARM_ROUND_DBL
(
value
)
ARM_ROUND_DBL
(
value
)
#
else
# else
return
(
int
)
lrint
(
value
);
return
(
int
)
lrint
(
value
);
#
endif
# endif
#else
#else
double
intpart
,
fractpart
;
double
intpart
,
fractpart
;
fractpart
=
modf
(
value
,
&
intpart
);
fractpart
=
modf
(
value
,
&
intpart
);
...
@@ -505,7 +503,9 @@ CV_INLINE int cvRound( double value )
...
@@ -505,7 +503,9 @@ CV_INLINE int cvRound( double value )
/** @overload */
/** @overload */
CV_INLINE
int
cvRound
(
float
value
)
CV_INLINE
int
cvRound
(
float
value
)
{
{
#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
#if defined ANDROID && (defined CV_ICC || defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND_FLT
(
value
);
#elif CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
ARM_ROUND_FLT
(
value
)
ARM_ROUND_FLT
(
value
)
#else
#else
return
cvRound
((
double
)
value
);
return
cvRound
((
double
)
value
);
...
...
modules/core/perf/perf_cvround.cpp
0 → 100644
View file @
c6e92803
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
template
<
typename
T
>
static
void
CvRoundMat
(
const
cv
::
Mat
&
src
,
cv
::
Mat
&
dst
)
{
for
(
int
y
=
0
;
y
<
dst
.
rows
;
++
y
)
{
const
T
*
sptr
=
src
.
ptr
<
T
>
(
y
);
int
*
dptr
=
dst
.
ptr
<
int
>
(
y
);
for
(
int
x
=
0
;
x
<
dst
.
cols
;
++
x
)
dptr
[
x
]
=
cvRound
(
sptr
[
x
]);
}
}
PERF_TEST_P
(
Size_MatType
,
CvRound_Float
,
testing
::
Combine
(
testing
::
Values
(
TYPICAL_MAT_SIZES
),
testing
::
Values
(
CV_32FC1
,
CV_64FC1
)))
{
Size
size
=
get
<
0
>
(
GetParam
());
int
type
=
get
<
1
>
(
GetParam
()),
depth
=
CV_MAT_DEPTH
(
type
);
cv
::
Mat
src
(
size
,
type
),
dst
(
size
,
CV_32SC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
depth
==
CV_32F
)
{
TEST_CYCLE
()
CvRoundMat
<
float
>
(
src
,
dst
);
}
else
if
(
depth
==
CV_64F
)
{
TEST_CYCLE
()
CvRoundMat
<
double
>
(
src
,
dst
);
}
SANITY_CHECK_NOTHING
();
}
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