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
11a09ef5
Commit
11a09ef5
authored
Jun 06, 2014
by
Richard Yoo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to support Intel AVX/AVX2 in cvResize().
parent
9a5e9d34
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
3 deletions
+58
-3
CMakeLists.txt
CMakeLists.txt
+1
-0
OpenCVCompilerOptions.cmake
cmake/OpenCVCompilerOptions.cmake
+11
-3
core_c.h
modules/core/include/opencv2/core/core_c.h
+1
-0
internal.hpp
modules/core/include/opencv2/core/internal.hpp
+7
-0
system.cpp
modules/core/src/system.cpp
+35
-0
imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+0
-0
ts_func.cpp
modules/ts/src/ts_func.cpp
+3
-0
No files found.
CMakeLists.txt
View file @
11a09ef5
...
...
@@ -217,6 +217,7 @@ OCV_OPTION(ENABLE_SSSE3 "Enable SSSE3 instructions"
OCV_OPTION
(
ENABLE_SSE41
"Enable SSE4.1 instructions"
OFF
IF
((
CV_ICC OR CMAKE_COMPILER_IS_GNUCXX
)
AND
(
X86 OR X86_64
))
)
OCV_OPTION
(
ENABLE_SSE42
"Enable SSE4.2 instructions"
OFF
IF
(
CMAKE_COMPILER_IS_GNUCXX
AND
(
X86 OR X86_64
))
)
OCV_OPTION
(
ENABLE_AVX
"Enable AVX instructions"
OFF
IF
((
MSVC OR CMAKE_COMPILER_IS_GNUCXX
)
AND
(
X86 OR X86_64
))
)
OCV_OPTION
(
ENABLE_AVX2
"Enable AVX2 instructions"
OFF
IF
((
MSVC OR CMAKE_COMPILER_IS_GNUCXX
)
AND
(
X86 OR X86_64
))
)
OCV_OPTION
(
ENABLE_NEON
"Enable NEON instructions"
OFF IF CMAKE_COMPILER_IS_GNUCXX AND ARM
)
OCV_OPTION
(
ENABLE_VFPV3
"Enable VFPv3-D32 instructions"
OFF IF CMAKE_COMPILER_IS_GNUCXX AND ARM
)
OCV_OPTION
(
ENABLE_NOISY_WARNINGS
"Show all warnings even if they are too noisy"
OFF
)
...
...
cmake/OpenCVCompilerOptions.cmake
View file @
11a09ef5
...
...
@@ -143,8 +143,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option
(
-mavx
)
endif
()
if
(
ENABLE_AVX2
)
add_extra_compiler_option
(
-mavx2
)
endif
()
# GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
if
(
NOT OPENCV_EXTRA_CXX_FLAGS MATCHES
"-m
avx
"
)
if
(
NOT OPENCV_EXTRA_CXX_FLAGS MATCHES
"-m
(avx|avx2)
"
)
if
(
ENABLE_SSE3
)
add_extra_compiler_option
(
-msse3
)
endif
()
...
...
@@ -165,7 +169,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
if
(
X86 OR X86_64
)
if
(
NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4
)
if
(
OPENCV_EXTRA_CXX_FLAGS MATCHES
"-m(sse2|avx)"
)
if
(
OPENCV_EXTRA_CXX_FLAGS MATCHES
"-m(sse2|avx
|avx2
)"
)
add_extra_compiler_option
(
-mfpmath=sse
)
# !! important - be on the same wave with x64 compilers
else
()
add_extra_compiler_option
(
-mfpmath=387
)
...
...
@@ -220,6 +224,10 @@ if(MSVC)
set
(
OPENCV_EXTRA_FLAGS
"
${
OPENCV_EXTRA_FLAGS
}
/arch:AVX"
)
endif
()
if
(
ENABLE_AVX2 AND NOT MSVC_VERSION LESS 1800
)
set
(
OPENCV_EXTRA_FLAGS
"
${
OPENCV_EXTRA_FLAGS
}
/arch:AVX2"
)
endif
()
if
(
ENABLE_SSE4_1 AND CV_ICC AND NOT OPENCV_EXTRA_FLAGS MATCHES
"/arch:"
)
set
(
OPENCV_EXTRA_FLAGS
"
${
OPENCV_EXTRA_FLAGS
}
/arch:SSE4.1"
)
endif
()
...
...
@@ -238,7 +246,7 @@ if(MSVC)
endif
()
endif
()
if
(
ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1 OR ENABLE_AVX
)
if
(
ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1 OR ENABLE_AVX
OR ENABLE_AVX2
)
set
(
OPENCV_EXTRA_FLAGS
"
${
OPENCV_EXTRA_FLAGS
}
/Oi"
)
endif
()
...
...
modules/core/include/opencv2/core/core_c.h
View file @
11a09ef5
...
...
@@ -1706,6 +1706,7 @@ CVAPI(double) cvGetTickFrequency( void );
#define CV_CPU_SSE4_2 7
#define CV_CPU_POPCNT 8
#define CV_CPU_AVX 10
#define CV_CPU_AVX2 11
#define CV_HARDWARE_MAX_FEATURE 255
CVAPI
(
int
)
cvCheckHardwareSupport
(
int
feature
);
...
...
modules/core/include/opencv2/core/internal.hpp
View file @
11a09ef5
...
...
@@ -141,6 +141,10 @@ CV_INLINE IppiSize ippiSize(const cv::Size & _size)
# define __xgetbv() 0
# endif
# endif
# if defined __AVX2__
# include <immintrin.h>
# define CV_AVX2 1
# endif
#endif
...
...
@@ -176,6 +180,9 @@ CV_INLINE IppiSize ippiSize(const cv::Size & _size)
#ifndef CV_AVX
# define CV_AVX 0
#endif
#ifndef CV_AVX2
# define CV_AVX2 0
#endif
#ifndef CV_NEON
# define CV_NEON 0
#endif
...
...
modules/core/src/system.cpp
View file @
11a09ef5
...
...
@@ -253,6 +253,41 @@ 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 CV_AVX2
#if defined _MSC_VER && (defined _M_IX86 || defined _M_X64)
__cpuidex
(
cpuid_data
,
7
,
0
);
#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__)
#ifdef __x86_64__
asm
__volatile__
(
"movl $7, %%eax
\n\t
"
"movl $0, %%ecx
\n\t
"
"cpuid
\n\t
"
:
[
eax
]
"=a"
(
cpuid_data
[
0
]),[
ebx
]
"=b"
(
cpuid_data
[
1
]),[
ecx
]
"=c"
(
cpuid_data
[
2
]),[
edx
]
"=d"
(
cpuid_data
[
3
])
:
:
"cc"
);
#else
asm
volatile
(
"pushl %%ebx
\n\t
"
"movl $7,%%eax
\n\t
"
"movl $0,%%ecx
\n\t
"
"cpuid
\n\t
"
"popl %%ebx
\n\t
"
:
"=a"
(
cpuid_data
[
0
]),
"=b"
(
cpuid_data
[
1
]),
"=c"
(
cpuid_data
[
2
]),
"=d"
(
cpuid_data
[
3
])
:
:
"cc"
);
#endif
#endif
if
(
f
.
x86_family
>=
6
)
{
f
.
have
[
CV_CPU_AVX2
]
=
(
cpuid_data
[
1
]
&
(
1
<<
5
))
!=
0
;
}
#endif
return
f
;
}
...
...
modules/imgproc/src/imgwarp.cpp
View file @
11a09ef5
This diff is collapsed.
Click to expand it.
modules/ts/src/ts_func.cpp
View file @
11a09ef5
...
...
@@ -3005,6 +3005,9 @@ void printVersionInfo(bool useStdOut)
#if CV_AVX
if
(
checkHardwareSupport
(
CV_CPU_AVX
))
cpu_features
+=
" avx"
;
#endif
#if CV_AVX2
if
(
checkHardwareSupport
(
CV_CPU_AVX2
))
cpu_features
+=
" avx2"
;
#endif
#if CV_NEON
cpu_features
+=
" neon"
;
// NEON is currently not checked at runtime
#endif
...
...
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