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
aa00b5a0
Commit
aa00b5a0
authored
Aug 23, 2013
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New Tegra detector with Android 4.3 support added. Manager version++.
parent
7cefb6f5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
77 deletions
+50
-77
AndroidManifest.xml
platforms/android/service/engine/AndroidManifest.xml
+2
-2
CMakeLists.txt
platforms/android/service/engine/CMakeLists.txt
+27
-6
HardwareDetector.cpp
...d/service/engine/jni/BinderComponent/HardwareDetector.cpp
+5
-2
TegraDetector.cpp
...roid/service/engine/jni/BinderComponent/TegraDetector.cpp
+0
-61
TegraDetector.h
...ndroid/service/engine/jni/BinderComponent/TegraDetector.h
+6
-1
HardwareDetector.java
...ervice/engine/src/org/opencv/engine/HardwareDetector.java
+6
-5
ManagerActivity.java
...engine/src/org/opencv/engine/manager/ManagerActivity.java
+4
-0
No files found.
platforms/android/service/engine/AndroidManifest.xml
View file @
aa00b5a0
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.opencv.engine"
android:versionCode=
"2
9
@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName=
"2.
9
"
>
android:versionCode=
"2
10
@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName=
"2.
10
"
>
<uses-sdk
android:minSdkVersion=
"@ANDROID_NATIVE_API_LEVEL@"
/>
<uses-feature
android:name=
"android.hardware.touchscreen"
android:required=
"false"
/>
...
...
platforms/android/service/engine/CMakeLists.txt
View file @
aa00b5a0
...
...
@@ -26,19 +26,32 @@ endif()
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
ANDROID_MANIFEST_FILE
}
"
"
${
OpenCV_BINARY_DIR
}
/platforms/android/service/engine/.build/
${
ANDROID_MANIFEST_FILE
}
"
@ONLY
)
link_directories
(
"
${
ANDROID_SOURCE_TREE
}
/out/target/product/generic/system/lib"
"
${
ANDROID_SOURCE_TREE
}
/out/target/product/
${
ANDROID_PRODUCT
}
/system/lib"
"
${
ANDROID_SOURCE_TREE
}
/bin/
${
ANDROID_ARCH_NAME
}
"
)
link_directories
(
"
${
ANDROID_SOURCE_TREE
}
/out/target/product/generic/system/lib"
"
${
ANDROID_SOURCE_TREE
}
/out/target/product/
${
ANDROID_PRODUCT
}
/system/lib"
"
${
ANDROID_SOURCE_TREE
}
/bin/
${
ANDROID_ARCH_NAME
}
"
)
file
(
GLOB engine_files
"jni/BinderComponent/*.cpp"
"jni/BinderComponent/*.h"
"jni/include/*.h"
)
set
(
engine_libs
"z"
"binder"
"log"
"utils"
)
if
(
TEGRA_DETECTOR
)
if
(
ANDROID_NATIVE_API_LEVEL GREATER 8
)
add_definitions
(
-DUSE_TEGRA_HW_DETECTOR
)
list
(
APPEND engine_libs
${
TEGRA_DETECTOR
}
GLESv2 EGL
)
else
()
message
(
FATAL_ERROR
"Tegra detector required native api level 9 or above"
)
endif
()
endif
()
# -D__SUPPORT_ARMEABI_FEATURES key is also available
add_definitions
(
-DPLATFORM_ANDROID -D__SUPPORT_ARMEABI_V7A_FEATURES -D__SUPPORT_TEGRA3 -D__SUPPORT_MIPS
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-rtti -fno-exceptions"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-Wl,-allow-shlib-undefined"
)
file
(
GLOB engine_files
"jni/BinderComponent/*.cpp"
"jni/BinderComponent/*.h"
"jni/include/*.h"
)
include_directories
(
jni/BinderComponent jni/include
)
include_directories
(
"jni/BinderComponent"
"jni/include"
)
include_directories
(
SYSTEM
"
${
ANDROID_SOURCE_TREE
}
/frameworks/base/include"
"
${
ANDROID_SOURCE_TREE
}
/system/core/include"
)
add_library
(
${
engine
}
SHARED
${
engine_files
}
)
target_link_libraries
(
${
engine
}
z binder log utils
)
target_link_libraries
(
${
engine
}
${
engine_libs
}
)
set_target_properties
(
${
engine
}
PROPERTIES
OUTPUT_NAME
${
engine
}
...
...
@@ -51,7 +64,15 @@ add_custom_command(TARGET ${engine} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-un
file
(
GLOB engine_jni_files
"jni/JNIWrapper/*.cpp"
"jni/JNIWrapper/*.h"
"jni/include/*.h"
)
list
(
APPEND engine_jni_files jni/NativeService/CommonPackageManager.cpp jni/NativeService/PackageInfo.cpp
)
include_directories
(
jni/include jni/JNIWrapper jni/NativeService jni/BinderComponent
"
${
ANDROID_SOURCE_TREE
}
/frameworks/base/include"
"
${
ANDROID_SOURCE_TREE
}
/system/core/include"
"
${
ANDROID_SOURCE_TREE
}
/frameworks/base/core/jni"
)
include_directories
(
jni/include jni/JNIWrapper
jni/NativeService
jni/BinderComponent
"
${
ANDROID_SOURCE_TREE
}
/frameworks/base/include"
"
${
ANDROID_SOURCE_TREE
}
/system/core/include"
"
${
ANDROID_SOURCE_TREE
}
/frameworks/base/core/jni"
)
add_library
(
${
engine
}
_jni SHARED
${
engine_jni_files
}
)
target_link_libraries
(
${
engine
}
_jni z binder log utils android_runtime
${
engine
}
)
...
...
platforms/android/service/engine/jni/BinderComponent/HardwareDetector.cpp
View file @
aa00b5a0
...
...
@@ -13,7 +13,7 @@ int GetCpuID()
map
<
string
,
string
>
cpu_info
=
GetCpuInfo
();
map
<
string
,
string
>::
const_iterator
it
;
#if defined(__i386__)
#if defined(__i386__)
LOGD
(
"Using X86 HW detector"
);
result
|=
ARCH_X86
;
it
=
cpu_info
.
find
(
"flags"
);
...
...
@@ -161,8 +161,11 @@ int GetProcessorCount()
int
DetectKnownPlatforms
()
{
#if defined(__arm__) && defined(USE_TEGRA_HW_DETECTOR)
int
tegra_status
=
DetectTegra
();
#else
int
tegra_status
=
NOT_TEGRA
;
#endif
// All Tegra platforms since Tegra3
if
(
2
<
tegra_status
)
{
...
...
platforms/android/service/engine/jni/BinderComponent/TegraDetector.cpp
deleted
100644 → 0
View file @
7cefb6f5
#include "TegraDetector.h"
#include <zlib.h>
#include <string.h>
#define KERNEL_CONFIG "/proc/config.gz"
#define KERNEL_CONFIG_MAX_LINE_WIDTH 512
#define KERNEL_CONFIG_TEGRA_MAGIC "CONFIG_ARCH_TEGRA=y"
#define KERNEL_CONFIG_TEGRA2_MAGIC "CONFIG_ARCH_TEGRA_2x_SOC=y"
#define KERNEL_CONFIG_TEGRA3_MAGIC "CONFIG_ARCH_TEGRA_3x_SOC=y"
#define KERNEL_CONFIG_TEGRA4_MAGIC "CONFIG_ARCH_TEGRA_11x_SOC=y"
#define MAX_DATA_LEN 4096
int
DetectTegra
()
{
int
result
=
TEGRA_NOT_TEGRA
;
gzFile
kernelConfig
=
gzopen
(
KERNEL_CONFIG
,
"r"
);
if
(
kernelConfig
!=
0
)
{
char
tmpbuf
[
KERNEL_CONFIG_MAX_LINE_WIDTH
];
const
char
*
tegra_config
=
KERNEL_CONFIG_TEGRA_MAGIC
;
const
char
*
tegra2_config
=
KERNEL_CONFIG_TEGRA2_MAGIC
;
const
char
*
tegra3_config
=
KERNEL_CONFIG_TEGRA3_MAGIC
;
const
char
*
tegra4_config
=
KERNEL_CONFIG_TEGRA4_MAGIC
;
int
len
=
strlen
(
tegra_config
);
int
len2
=
strlen
(
tegra2_config
);
int
len3
=
strlen
(
tegra3_config
);
int
len4
=
strlen
(
tegra4_config
);
while
(
0
!=
gzgets
(
kernelConfig
,
tmpbuf
,
KERNEL_CONFIG_MAX_LINE_WIDTH
))
{
if
(
0
==
strncmp
(
tmpbuf
,
tegra_config
,
len
))
{
result
=
1
;
}
if
(
0
==
strncmp
(
tmpbuf
,
tegra2_config
,
len2
))
{
result
=
2
;
break
;
}
if
(
0
==
strncmp
(
tmpbuf
,
tegra3_config
,
len3
))
{
result
=
3
;
break
;
}
if
(
0
==
strncmp
(
tmpbuf
,
tegra4_config
,
len4
))
{
result
=
4
;
break
;
}
}
gzclose
(
kernelConfig
);
}
else
{
result
=
TEGRA_DETECTOR_ERROR
;
}
return
result
;
}
platforms/android/service/engine/jni/BinderComponent/TegraDetector.h
View file @
aa00b5a0
...
...
@@ -2,7 +2,12 @@
#define __TEGRA_DETECTOR_H__
#define TEGRA_DETECTOR_ERROR -2
#define TEGRA_NOT_TEGRA -1
#define NOT_TEGRA -1
#define TEGRA2 2
#define TEGRA3 3
#define TEGRA4i 4
#define TEGRA4 5
#define TEGRA5 6
int
DetectTegra
();
...
...
platforms/android/service/engine/src/org/opencv/engine/HardwareDetector.java
View file @
aa00b5a0
...
...
@@ -30,11 +30,12 @@ public class HardwareDetector
// GPU Acceleration options
public
static
final
int
FEATURES_HAS_GPU
=
0x010000
;
public
static
final
int
PLATFORM_TEGRA
=
1
;
public
static
final
int
PLATFORM_TEGRA2
=
2
;
public
static
final
int
PLATFORM_TEGRA3
=
3
;
public
static
final
int
PLATFORM_TEGRA4
=
4
;
public
static
final
int
PLATFORM_TEGRA
=
1
;
public
static
final
int
PLATFORM_TEGRA2
=
2
;
public
static
final
int
PLATFORM_TEGRA3
=
3
;
public
static
final
int
PLATFORM_TEGRA4i
=
4
;
public
static
final
int
PLATFORM_TEGRA4
=
5
;
public
static
final
int
PLATFORM_TEGRA5
=
6
;
public
static
final
int
PLATFORM_UNKNOWN
=
0
;
...
...
platforms/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java
View file @
aa00b5a0
...
...
@@ -107,6 +107,10 @@ public class ManagerActivity extends Activity
{
HardwarePlatformView
.
setText
(
"Tegra 3"
);
}
else
if
(
HardwareDetector
.
PLATFORM_TEGRA4i
==
Platfrom
)
{
HardwarePlatformView
.
setText
(
"Tegra 4i"
);
}
else
{
HardwarePlatformView
.
setText
(
"Tegra 4"
);
...
...
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