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
baf191fa
Commit
baf191fa
authored
Mar 09, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3771 from mshabunin:arm-round
parents
3ee03a86
ee2d7a1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
4 deletions
+51
-4
cvdef.h
modules/core/include/opencv2/core/cvdef.h
+47
-0
bgfg_KNN.cpp
modules/video/src/bgfg_KNN.cpp
+4
-4
No files found.
modules/core/include/opencv2/core/cvdef.h
View file @
baf191fa
...
...
@@ -196,6 +196,10 @@
# define CV_NEON 1
#endif
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__)
# define CV_VFP 1
#endif
#endif // __CUDACC__
#ifndef CV_POPCNT
...
...
@@ -263,6 +267,10 @@
# define CV_NEON 0
#endif
#ifndef CV_VFP
# define CV_VFP 0
#endif
/* primitive types */
/*
schar - signed 1 byte integer
...
...
@@ -437,6 +445,23 @@ typedef signed char schar;
//! @addtogroup core_utils
//! @{
#if CV_VFP
// 1. general scheme
#define ARM_ROUND(_value, _asm_string) \
int res; \
float temp; \
asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
return res;
// 2. version for double
#ifdef __clang__
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]")
#else
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]")
#endif
// 3. version for float
#define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]")
#endif // CV_VFP
/** @brief Rounds floating-point number to the nearest integer
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
...
...
@@ -460,6 +485,8 @@ CV_INLINE int cvRound( double value )
#elif defined CV_ICC || defined __GNUC__
# ifdef HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND
(
value
);
# elif CV_VFP
ARM_ROUND_DBL
(
value
)
# else
return
(
int
)
lrint
(
value
);
# endif
...
...
@@ -473,6 +500,26 @@ CV_INLINE int cvRound( double value )
#endif
}
#ifdef __cplusplus
/** @overload */
CV_INLINE
int
cvRound
(
float
value
)
{
#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
ARM_ROUND_FLT
(
value
)
#else
return
cvRound
((
double
)
value
);
#endif
}
/** @overload */
CV_INLINE
int
cvRound
(
int
value
)
{
return
value
;
}
#endif // __cplusplus
/** @brief Rounds floating-point number to the nearest integer not larger than the original.
The function computes an integer i such that:
...
...
modules/video/src/bgfg_KNN.cpp
View file @
baf191fa
...
...
@@ -512,7 +512,7 @@ CV_INLINE void
{
for
(
long
x
=
0
;
x
<
_src
.
cols
;
x
++
)
{
const
uchar
*
data
=
_src
.
ptr
(
y
,
x
);
const
uchar
*
data
=
_src
.
ptr
(
(
int
)
y
,
(
int
)
x
);
//update model+ background subtract
uchar
include
=
0
;
...
...
@@ -539,15 +539,15 @@ CV_INLINE void
{
case
0
:
//foreground
*
_dst
.
ptr
(
y
,
x
)
=
255
;
*
_dst
.
ptr
(
(
int
)
y
,
(
int
)
x
)
=
255
;
break
;
case
1
:
//background
*
_dst
.
ptr
(
y
,
x
)
=
0
;
*
_dst
.
ptr
(
(
int
)
y
,
(
int
)
x
)
=
0
;
break
;
case
2
:
//shadow
*
_dst
.
ptr
(
y
,
x
)
=
nShadowDetection
;
*
_dst
.
ptr
(
(
int
)
y
,
(
int
)
x
)
=
nShadowDetection
;
break
;
}
i
++
;
...
...
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