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
81f78639
Commit
81f78639
authored
Dec 30, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NEON detection in runtime
parent
61991a33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
18 deletions
+42
-18
system.cpp
modules/core/src/system.cpp
+30
-0
filter.cpp
modules/imgproc/src/filter.cpp
+11
-17
ts_func.cpp
modules/ts/src/ts_func.cpp
+1
-1
No files found.
modules/core/src/system.cpp
View file @
81f78639
...
...
@@ -48,6 +48,13 @@
# endif
#endif
#if defined ANDROID || defined __linux__
# include <unistd.h>
# include <fcntl.h>
# include <elf.h>
# include <linux/auxvec.h>
#endif
#if defined WIN32 || defined _WIN32 || defined WINCE
#ifndef _WIN32_WINNT // This is needed for the declaration of TryEnterCriticalSection in winbase.h with Visual Studio 2005 (and older?)
#define _WIN32_WINNT 0x0400 // http://msdn.microsoft.com/en-us/library/ms686857(VS.85).aspx
...
...
@@ -253,6 +260,29 @@ struct HWFeatures
f
.
have
[
CV_CPU_AVX
]
=
(((
cpuid_data
[
2
]
&
(
1
<<
28
))
!=
0
)
&&
((
cpuid_data
[
2
]
&
(
1
<<
27
))
!=
0
));
//OS uses XSAVE_XRSTORE and CPU support AVX
}
#if defined ANDROID || defined __linux__
int
cpufile
=
open
(
"/proc/self/auxv"
,
O_RDONLY
);
if
(
cpufile
>=
0
)
{
Elf32_auxv_t
auxv
;
const
size_t
size_auxv_t
=
sizeof
(
Elf32_auxv_t
);
while
(
read
(
cpufile
,
&
auxv
,
sizeof
(
Elf32_auxv_t
))
==
size_auxv_t
)
{
if
(
auxv
.
a_type
==
AT_HWCAP
)
{
f
.
have
[
CV_CPU_NEON
]
=
(
auxv
.
a_un
.
a_val
&
4096
)
!=
0
;
break
;
}
}
close
(
cpufile
);
}
#elif (defined __clang__ || defined __APPLE__) && defined __ARM_NEON__
f
.
have
[
CV_CPU_NEON
]
=
true
;
#endif
return
f
;
}
...
...
modules/imgproc/src/filter.cpp
View file @
81f78639
...
...
@@ -2231,9 +2231,8 @@ struct SymmRowSmallVec_8u32s
int
operator
()(
const
uchar
*
src
,
uchar
*
_dst
,
int
width
,
int
cn
)
const
{
//Uncomment the two following lines when runtime support for neon is implemented.
// if( !checkHardwareSupport(CV_CPU_NEON) )
// return 0;
if
(
!
checkHardwareSupport
(
CV_CPU_NEON
)
)
return
0
;
int
i
=
0
,
_ksize
=
kernel
.
rows
+
kernel
.
cols
-
1
;
int
*
dst
=
(
int
*
)
_dst
;
...
...
@@ -2459,9 +2458,8 @@ struct SymmColumnVec_32s8u
int
operator
()(
const
uchar
**
_src
,
uchar
*
dst
,
int
width
)
const
{
//Uncomment the two following lines when runtime support for neon is implemented.
// if( !checkHardwareSupport(CV_CPU_NEON) )
// return 0;
if
(
!
checkHardwareSupport
(
CV_CPU_NEON
)
)
return
0
;
int
_ksize
=
kernel
.
rows
+
kernel
.
cols
-
1
;
int
ksize2
=
_ksize
/
2
;
...
...
@@ -2612,9 +2610,8 @@ struct SymmColumnSmallVec_32s16s
int
operator
()(
const
uchar
**
_src
,
uchar
*
_dst
,
int
width
)
const
{
//Uncomment the two following lines when runtime support for neon is implemented.
// if( !checkHardwareSupport(CV_CPU_NEON) )
// return 0;
if
(
!
checkHardwareSupport
(
CV_CPU_NEON
)
)
return
0
;
int
ksize2
=
(
kernel
.
rows
+
kernel
.
cols
-
1
)
/
2
;
const
float
*
ky
=
kernel
.
ptr
<
float
>
()
+
ksize2
;
...
...
@@ -2788,15 +2785,13 @@ struct SymmColumnVec_32f16s
kernel
=
_kernel
;
delta
=
(
float
)
_delta
;
CV_Assert
(
(
symmetryType
&
(
KERNEL_SYMMETRICAL
|
KERNEL_ASYMMETRICAL
))
!=
0
);
//Uncomment the following line when runtime support for neon is implemented.
// neon_supported = checkHardwareSupport(CV_CPU_NEON);
neon_supported
=
checkHardwareSupport
(
CV_CPU_NEON
);
}
int
operator
()(
const
uchar
**
_src
,
uchar
*
_dst
,
int
width
)
const
{
//Uncomment the two following lines when runtime support for neon is implemented.
// if( !neon_supported )
// return 0;
if
(
!
neon_supported
)
return
0
;
int
_ksize
=
kernel
.
rows
+
kernel
.
cols
-
1
;
int
ksize2
=
_ksize
/
2
;
...
...
@@ -2943,9 +2938,8 @@ struct SymmRowSmallVec_32f
int
operator
()(
const
uchar
*
_src
,
uchar
*
_dst
,
int
width
,
int
cn
)
const
{
//Uncomment the two following lines when runtime support for neon is implemented.
// if( !checkHardwareSupport(CV_CPU_NEON) )
// return 0;
if
(
!
checkHardwareSupport
(
CV_CPU_NEON
)
)
return
0
;
int
i
=
0
,
_ksize
=
kernel
.
rows
+
kernel
.
cols
-
1
;
float
*
dst
=
(
float
*
)
_dst
;
...
...
modules/ts/src/ts_func.cpp
View file @
81f78639
...
...
@@ -3020,7 +3020,7 @@ void printVersionInfo(bool useStdOut)
if
(
checkHardwareSupport
(
CV_CPU_AVX
))
cpu_features
+=
" avx"
;
#endif
#if CV_NEON
cpu_features
+=
" neon"
;
// NEON is currently not checked at runtime
if
(
checkHardwareSupport
(
CV_CPU_NEON
))
cpu_features
+=
" neon"
;
#endif
cpu_features
.
erase
(
0
,
1
);
// erase initial space
...
...
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