Score
0
1 Unstar Star 0 Fork 0

chenjim / NeonTestAndroidApache-2.0

Clone or download
README.md
Copy Edit Web IDE Raw Normal History
chenjim   add test code and readme.md 2020-03-17
## NeonTest
chenjim   Initial commit 2020-03-17
#### 介绍
chenjim   add test code and readme.md 2020-03-17
通过NDK(JNI)测试android 平台中neon性能对比
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
#### 测试代码测试代码仓库地址 https://gitee.com/chenjimcom/NeonTest  参考自 https://github.com/Lakers2005/test-neon
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
主要修改说明:1. 此处不支持x86、arm64-v8a等so,只支持armeabi-v7,需要在**build.gradle**增加如下内容```    ndk {        abiFilters "armeabi-v7a"    } ```2. 增加汇编支持,**CMakeLists.txt**需要增加以下内容```    ……    ENABLE_LANGUAGE(ASM)    ……    convert_asm.s    ……```3. 增加日志在android控制台输出,修改参见**native-lib.cpp**4. 主要函数说明如下```……//模拟1920x1080的YUV数据#define N   (1920*1080*3)……
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
/** * C 版本测试函数 */void reference_convert(uint8_t *__restrict dest, uint8_t *__restrict src, int n)
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
……
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
/** * 修改部分为ARM指令后的测试函数 */void neon_convert(uint8_t *__restrict dest, uint8_t *__restrict src, int n) 
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
……
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
//纯ARM指令(汇编)版本函数extern "C" void convert_asm_neon(uint8_t *dest, uint8_t *src, int n) __asm__("convert_asm_neon");
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
```
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
#### 测试结果``` D/TEST_NEON: C version Time:22.684000ms D/TEST_NEON: Neon version Time:13.888000ms D/TEST_NEON: ASM version Time:0.986000ms
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
 D/TEST_NEON: C version Time:21.759001ms D/TEST_NEON: Neon version Time:13.948000ms D/TEST_NEON: ASM version Time:0.641000ms
chenjim   Initial commit 2020-03-17
chenjim   add test code and readme.md 2020-03-17
 D/TEST_NEON: C version Time:21.688000ms D/TEST_NEON: Neon version Time:13.920000ms D/TEST_NEON: ASM version Time:0.656000ms D/TEST_NEON: C version Time:21.735001ms D/TEST_NEON: Neon version Time:13.958000ms D/TEST_NEON: ASM version Time:0.945000ms```#### 测试结论Neon相比C快1倍左右,ASM相比C快差不多20倍  备注:不同的CPU手机测试结果有一定差距,但ASM快很多倍是毋容置疑的。#### 参考https://github.com/Lakers2005/test-neon  https://www.cnblogs.com/welen/articles/5155946.html  https://blog.csdn.net/u011913612/article/details/82495309
chenjim   update README.md for link Google NDK示例中的neon 2020-03-17
[Google NDK示例中的neon]https://github.com/android/ndk-samples/tree/master/hello-neon
chenjim   add test code and readme.md 2020-03-17
#### 相关连接[ARM和NEON指令:NEON 技术可加速多媒体和信号处理算法  (如视频编码/解码、2D/3D 图形、游戏、音频和语音处理、图像处理技术、电话和声音合成)  ,其性能至少为ARMv5 性能的3倍,为 ARMv6 SIMD性能的2倍。](https://blog.csdn.net/chshplp_liaoping/article/details/12752749)
Android
1
https://gitee.com/chenjim/NeonTest.git
git@gitee.com:chenjim/NeonTest.git
chenjim
NeonTest
NeonTest
master

Search

131423 f1aaba0b 1899542 094922 1c74bed3 1899542