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
3dee87b6
Commit
3dee87b6
authored
Jun 09, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update CPU detection on ANDROID patch
parent
bb3a4163
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
18 deletions
+42
-18
CMakeLists.txt
3rdparty/cpufeatures/CMakeLists.txt
+12
-10
LICENSE
3rdparty/cpufeatures/LICENSE
+13
-0
README.md
3rdparty/cpufeatures/README.md
+4
-0
CMakeLists.txt
3rdparty/libwebp/CMakeLists.txt
+1
-1
CMakeLists.txt
CMakeLists.txt
+4
-0
CMakeLists.txt
modules/core/CMakeLists.txt
+1
-1
system.cpp
modules/core/src/system.cpp
+7
-6
No files found.
3rdparty/cpufeatures/CMakeLists.txt
View file @
3dee87b6
if
(
NOT ANDROID
)
message
(
"cpufeatures is ANDROID project"
)
endif
()
ocv_include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
file
(
GLOB cpuf_s *.c
)
file
(
GLOB cpuf_h *.h
)
set
(
lib_srcs
${
cpuf_s
}
)
set
(
lib_hdrs
${
cpuf_h
}
)
set
(
CPUFEATURES_ROOT
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
CACHE PATH
"Android cpufeatures project sources (for example, <android-ndk>/sources/android/cpufeatures)"
)
set
(
CPUFEATURES_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
CACHE INTERNAL
""
)
set
(
CPUFEATURES_INCLUDE_DIR
S
${
CPUFEATURES_ROOT
}
CACHE INTERNAL
""
)
set
(
CPUFEATURES_LIBRARIES cpufeatures CACHE INTERNAL
""
)
add_library
(
cpufeatures STATIC
${
lib_srcs
}
${
lib_hdrs
}
)
if
(
NOT DEFINED CPUFEATURES_SOURCES
)
set
(
CPUFEATURES_SOURCES
${
CPUFEATURES_ROOT
}
/cpu-features.c
${
CPUFEATURES_ROOT
}
/cpu-features.h
)
endif
()
include_directories
(
${
CPUFEATURES_INCLUDE_DIRS
}
)
add_library
(
cpufeatures STATIC
${
CPUFEATURES_SOURCES
}
)
set_target_properties
(
cpufeatures
PROPERTIES OUTPUT_NAME cpufeatures
...
...
@@ -17,7 +20,7 @@ set_target_properties(cpufeatures
COMPILE_PDB_NAME cpufeatures
COMPILE_PDB_NAME_DEBUG
"cpufeatures
${
OPENCV_DEBUG_POSTFIX
}
"
ARCHIVE_OUTPUT_DIRECTORY
${
3P_LIBRARY_OUTPUT_PATH
}
)
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
cpufeatures PROPERTIES FOLDER
"3rdparty"
)
...
...
@@ -26,4 +29,3 @@ endif()
if
(
NOT BUILD_SHARED_LIBS
)
ocv_install_target
(
cpufeatures EXPORT OpenCVModules ARCHIVE DESTINATION
${
OPENCV_3P_LIB_INSTALL_PATH
}
COMPONENT dev
)
endif
()
3rdparty/cpufeatures/LICENSE
0 → 100644
View file @
3dee87b6
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
3rdparty/cpufeatures/README.md
0 → 100644
View file @
3dee87b6
The Android NDK provides a small library named cpufeatures that your app can use at runtime to detect the target device's CPU family and the optional features it supports.
It is designed to work as-is on all official Android platform versions.
https://developer.android.com/ndk/guides/cpu-features.html
3rdparty/libwebp/CMakeLists.txt
View file @
3dee87b6
...
...
@@ -5,7 +5,7 @@
project
(
${
WEBP_LIBRARY
}
)
ocv_include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
ocv_include_directories
(
"
${
CPUFEATURES_INCLUDE_DIR
}
"
)
ocv_include_directories
(
${
CPUFEATURES_INCLUDE_DIRS
}
)
file
(
GLOB lib_srcs dec/*.c demux/*.c dsp/*.c enc/*.c mux/*.c utils/*.c webp/*.c
)
file
(
GLOB lib_hdrs dec/*.h demux/*.h dsp/*.h enc/*.h mux/*.h utils/*.h webp/*.h
)
...
...
CMakeLists.txt
View file @
3dee87b6
...
...
@@ -98,6 +98,10 @@ if(POLICY CMP0042)
cmake_policy
(
SET CMP0042 NEW
)
endif
()
if
(
POLICY CMP0046
)
cmake_policy
(
SET CMP0046 OLD
)
endif
()
if
(
POLICY CMP0051
)
cmake_policy
(
SET CMP0051 NEW
)
endif
()
...
...
modules/core/CMakeLists.txt
View file @
3dee87b6
...
...
@@ -32,7 +32,7 @@ source_group("Src" FILES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version_string
ocv_glob_module_sources
(
SOURCES
"
${
OPENCV_MODULE_opencv_core_BINARY_DIR
}
/version_string.inc"
HEADERS
${
lib_cuda_hdrs
}
${
lib_cuda_hdrs_detail
}
)
ocv_module_include_directories
(
${
the_module
}
${
ZLIB_INCLUDE_DIRS
}
${
OPENCL_INCLUDE_DIRS
}
${
CPUFEATURES_INCLUDE_DIR
}
)
ocv_module_include_directories
(
${
the_module
}
${
ZLIB_INCLUDE_DIRS
}
${
OPENCL_INCLUDE_DIRS
}
${
CPUFEATURES_INCLUDE_DIR
S
}
)
ocv_create_module
(
${
extra_libs
}
)
ocv_target_link_libraries
(
${
the_module
}
${
ZLIB_LIBRARIES
}
"
${
OPENCL_LIBRARIES
}
"
"
${
VA_LIBRARIES
}
"
"
${
LAPACK_LIBRARIES
}
"
"
${
CPUFEATURES_LIBRARIES
}
"
)
...
...
modules/core/src/system.cpp
View file @
3dee87b6
...
...
@@ -447,10 +447,16 @@ struct HWFeatures
CV_UNUSED
(
cpuid_data_ex
);
#endif // OPENCV_HAVE_X86_CPUID
#if defined
ANDROID
|| defined __linux__
#if defined
__ANDROID__
|| defined __linux__
#ifdef __aarch64__
have
[
CV_CPU_NEON
]
=
true
;
have
[
CV_CPU_FP16
]
=
true
;
#elif defined __arm__ && defined __ANDROID__
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"calling android_getCpuFeatures() ..."
);
uint64_t
features
=
android_getCpuFeatures
();
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"calling android_getCpuFeatures() ... Done (%llx)"
,
features
);
have
[
CV_CPU_NEON
]
=
(
features
&
ANDROID_CPU_ARM_FEATURE_NEON
)
!=
0
;
have
[
CV_CPU_FP16
]
=
(
features
&
ANDROID_CPU_ARM_FEATURE_VFP_FP16
)
!=
0
;
#elif defined __arm__
int
cpufile
=
open
(
"/proc/self/auxv"
,
O_RDONLY
);
...
...
@@ -471,11 +477,6 @@ struct HWFeatures
close
(
cpufile
);
}
#ifdef ANDROID
uint64_t
features
=
android_getCpuFeatures
();
have
[
CV_CPU_NEON
]
=
(
features
&
ANDROID_CPU_ARM_FEATURE_NEON
)
!=
0
;
have
[
CV_CPU_FP16
]
=
(
features
&
ANDROID_CPU_ARM_FEATURE_VFP_FP16
)
!=
0
;
#endif
#endif
#elif (defined __clang__ || defined __APPLE__)
#if (defined __ARM_NEON__ || (defined __ARM_NEON && defined __aarch64__))
...
...
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