Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
64f9f7f2
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64f9f7f2
编写于
11月 28, 2010
作者:
E
Ethan Rublee
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding optimization for brief and android using NEON SIMD intrinsics
上级
91d8b2aa
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
81 addition
and
23 deletion
+81
-23
android/Android.mk.in
android/Android.mk.in
+5
-1
android/android-jni/jni/Android.mk
android/android-jni/jni/Android.mk
+10
-1
android/android-jni/jni/image_pool.cpp
android/android-jni/jni/image_pool.cpp
+26
-11
android/android-jni/jni/image_pool.h
android/android-jni/jni/image_pool.h
+2
-0
android/android-jni/jni/yuv420sp2rgb.c
android/android-jni/jni/yuv420sp2rgb.c
+1
-1
android/android-jni/jni/yuv420sp2rgb.h
android/android-jni/jni/yuv420sp2rgb.h
+1
-1
android/android-jni/src/com/opencv/camera/CameraConfig.java
android/android-jni/src/com/opencv/camera/CameraConfig.java
+1
-1
modules/features2d/src/brief.cpp
modules/features2d/src/brief.cpp
+35
-7
未找到文件。
android/Android.mk.in
浏览文件 @
64f9f7f2
...
...
@@ -4,6 +4,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := ${android_module_name}
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
endif
LOCAL_SRC_FILES := ${android_srcs}
LOCAL_CFLAGS := ${android_defs}
...
...
android/android-jni/jni/Android.mk
浏览文件 @
64f9f7f2
...
...
@@ -16,7 +16,16 @@ LOCAL_C_INCLUDES += $(OPENCV_INCLUDES)
LOCAL_MODULE
:=
android-opencv
LOCAL_SRC_FILES
:=
gen/android_cv_wrap.cpp image_pool.cpp
\
yuv420sp2rgb.c gl_code.cpp Calibration.cpp
gl_code.cpp Calibration.cpp
#ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
# LOCAL_CFLAGS := -DHAVE_NEON=1
# LOCAL_SRC_FILES += yuv2rgb_neon.c.neon
#else
LOCAL_SRC_FILES
+=
yuv420sp2rgb.c
#endif
include
$(BUILD_SHARED_LIBRARY)
android/android-jni/jni/image_pool.cpp
浏览文件 @
64f9f7f2
...
...
@@ -18,17 +18,17 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
return
JNI_VERSION_1_4
;
}
JNIEXPORT
void
JNICALL
Java_com_opencv_jni_opencvJNI_addYUVtoPool
(
JNIEnv
*
env
,
jclass
thiz
,
jlong
ppool
,
jobject
_jpool
,
jbyteArray
jbuffer
,
jint
jidx
,
jint
jwidth
,
jint
jheight
,
jboolean
jgrey
)
JNIEXPORT
void
JNICALL
Java_com_opencv_jni_opencvJNI_addYUVtoPool
(
JNIEnv
*
env
,
jclass
thiz
,
jlong
ppool
,
jobject
_jpool
,
jbyteArray
jbuffer
,
jint
jidx
,
jint
jwidth
,
jint
jheight
,
jboolean
jgrey
)
{
int
buff_height
=
jheight
+
(
jheight
/
2
);
Size
buff_size
(
jwidth
,
buff_height
);
image_pool
*
pool
=
(
image_pool
*
)
ppool
;
int
buff_height
=
jheight
+
(
jheight
/
2
);
Size
buff_size
(
jwidth
,
buff_height
);
image_pool
*
pool
=
(
image_pool
*
)
ppool
;
Mat
mat
=
pool
->
getYUV
(
jidx
);
if
(
mat
.
empty
()
||
mat
.
size
()
!=
buff_size
)
if
(
mat
.
empty
()
||
mat
.
size
()
!=
buff_size
)
{
mat
.
create
(
buff_size
,
CV_8UC1
);
}
...
...
@@ -36,7 +36,7 @@ JNIEXPORT void JNICALL Java_com_opencv_jni_opencvJNI_addYUVtoPool(JNIEnv * env,
jsize
sz
=
env
->
GetArrayLength
(
jbuffer
);
uchar
*
buff
=
mat
.
ptr
<
uchar
>
(
0
);
env
->
GetByteArrayRegion
(
jbuffer
,
0
,
sz
,
(
jbyte
*
)
buff
);
env
->
GetByteArrayRegion
(
jbuffer
,
0
,
sz
,
(
jbyte
*
)
buff
);
pool
->
addYUVMat
(
jidx
,
mat
);
...
...
@@ -51,8 +51,7 @@ JNIEXPORT void JNICALL Java_com_opencv_jni_opencvJNI_addYUVtoPool(JNIEnv * env,
}
//doesn't work unfortunately..
//TODO cvtColor(mat,color, CV_YCrCb2RGB);
color_convert_common
(
buff
,
buff
+
jwidth
*
jheight
,
jwidth
,
jheight
,
color
.
ptr
<
uchar
>
(
0
),
false
);
color_convert_common
(
buff
,
buff
+
jwidth
*
jheight
,
jwidth
,
jheight
,
color
.
ptr
<
uchar
>
(
0
),
false
);
}
if
(
jgrey
)
...
...
@@ -84,7 +83,7 @@ Mat image_pool::getGrey(int i)
Mat
tm
=
yuvImagesMap
[
i
];
if
(
tm
.
empty
())
return
tm
;
return
tm
(
Range
(
0
,
tm
.
rows
*
(
2.0
f
/
3
)),
Range
::
all
());
return
tm
(
Range
(
0
,
tm
.
rows
*
(
2.0
f
/
3
)),
Range
::
all
());
}
Mat
image_pool
::
getYUV
(
int
i
)
{
...
...
@@ -99,3 +98,19 @@ void image_pool::addImage(int i, Mat mat)
imagesmap
[
i
]
=
mat
;
}
void
image_pool
::
convertYUVtoColor
(
int
i
,
cv
::
Mat
&
out
)
{
Mat
yuv
=
getYUV
(
i
);
if
(
yuv
.
empty
())
return
;
int
width
=
yuv
.
cols
;
int
height
=
yuv
.
rows
*
(
2.0
f
/
3
);
out
.
create
(
height
,
width
,
CV_8UC3
);
const
unsigned
char
*
buff
=
yuv
.
ptr
<
unsigned
char
>
(
0
);
unsigned
char
*
out_buff
=
out
.
ptr
<
unsigned
char
>
(
0
);
//doesn't work unfortunately..
//TODO cvtColor(mat,color, CV_YCrCb2RGB);
color_convert_common
(
buff
,
buff
+
width
*
height
,
width
,
height
,
out_buff
,
false
);
}
android/android-jni/jni/image_pool.h
浏览文件 @
64f9f7f2
...
...
@@ -53,6 +53,8 @@ public:
*/
void
addYUVMat
(
int
i
,
cv
::
Mat
mat
);
void
convertYUVtoColor
(
int
i
,
cv
::
Mat
&
out
);
// int addYUV(uchar* buffer, int size, int width, int height, bool grey,int idx);
//
// void getBitmap(int * outintarray, int size, int idx);
...
...
android/android-jni/jni/yuv420sp2rgb.c
浏览文件 @
64f9f7f2
...
...
@@ -25,7 +25,7 @@
#endif
const
int
bytes_per_pixel
=
2
;
void
color_convert_common
(
unsigned
char
*
pY
,
unsigned
char
*
pUV
,
int
width
,
int
height
,
unsigned
char
*
buffer
,
int
grey
)
void
color_convert_common
(
const
unsigned
char
*
pY
,
const
unsigned
char
*
pUV
,
int
width
,
int
height
,
unsigned
char
*
buffer
,
int
grey
)
{
int
i
,
j
;
...
...
android/android-jni/jni/yuv420sp2rgb.h
浏览文件 @
64f9f7f2
...
...
@@ -7,7 +7,7 @@ extern "C" {
#endif
void
color_convert_common
(
unsigned
char
*
pY
,
unsigned
char
*
pUV
,
const
unsigned
char
*
pY
,
const
unsigned
char
*
pUV
,
int
width
,
int
height
,
unsigned
char
*
buffer
,
int
grey
);
...
...
android/android-jni/src/com/opencv/camera/CameraConfig.java
浏览文件 @
64f9f7f2
...
...
@@ -24,7 +24,7 @@ public class CameraConfig extends Activity {
// Restore preferences
SharedPreferences
settings
=
ctx
.
getSharedPreferences
(
CAMERA_SETTINGS
,
0
);
int
mode
=
settings
.
getInt
(
CAMERA_MODE
,
CAMERA_MODE_
COLOR
);
int
mode
=
settings
.
getInt
(
CAMERA_MODE
,
CAMERA_MODE_
BW
);
return
mode
;
}
...
...
modules/features2d/src/brief.cpp
浏览文件 @
64f9f7f2
...
...
@@ -44,6 +44,11 @@
#include <algorithm>
#include <vector>
#if ANDROID && HAVE_NEON
#include <cpu-features.h>
#include <arm_neon.h>
#endif
using
namespace
cv
;
inline
int
smoothedSum
(
const
Mat
&
sum
,
const
KeyPoint
&
pt
,
int
y
,
int
x
)
...
...
@@ -107,6 +112,29 @@ Hamming::ResultType Hamming::operator()(const unsigned char* a, const unsigned c
{
#if __GNUC__
ResultType
result
=
0
;
#if ANDROID && HAVE_NEON
static
uint64_t
features
=
android_getCpuFeatures
();
if
((
features
&
ANDROID_CPU_ARM_FEATURE_NEON
))
{
for
(
int
i
=
0
;
i
<
size
;
i
+=
16
)
{
uint8x16_t
A_vec
=
vld1q_u8
(
a
+
i
);
uint8x16_t
B_vec
=
vld1q_u8
(
b
+
i
);
//uint8x16_t veorq_u8 (uint8x16_t, uint8x16_t)
uint8x16_t
AxorB
=
veorq_u8
(
A_vec
,
B_vec
);
uint8x16_t
bitsSet
+=
vcntq_u8
(
AxorB
);
//uint16x8_t vpadalq_u8 (uint16x8_t, uint8x16_t)
uint16x8_t
bitSet8
=
vpaddlq_u8
(
bitsSet
);
uint32x4_t
bitSet4
=
vpaddlq_u16
(
bitSet8
);
uint64x2_t
bitSet2
=
vpaddlq_u32
(
bitSet4
);
result
+=
vgetq_lane_u64
(
bitSet2
,
0
);
result
+=
vgetq_lane_u64
(
bitSet2
,
1
);
}
}
else
#endif
for
(
int
i
=
0
;
i
<
size
;
i
+=
sizeof
(
unsigned
long
))
{
unsigned
long
a2
=
*
reinterpret_cast
<
const
unsigned
long
*>
(
a
+
i
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录