新云软件园:请安心下载,绿色无病毒!

软件提交最近更新热门排行
您现在的位置:首页››软件教程››编程开发››编程其它››Eclipse

Eclipse Neon配置Android实例

2016-07-22 08:42作者:佚名来源:本站整理浏览:2290 评论:0

1、 打开Eclipse,File-->New-->AndroidApplication Project-->Application Name:Hello-Neon, Project Name: Hello-Neon,Package Name:com.hello_neon.Android, Minimum Required SDK:API 9:Android 2.3(Gingerbread),Next-->去掉Create custom launcher icon的勾选,Next-->Next-->ActivityName:Hello_NeonProjectActivity,Finish.


2、 打开Hello-Neon工程下的src-->com.hello_neon.android-->Hello_NeonProjectActivity.Java,将其内容改为:

package com.hello_neon.android;

import android.os.Bundle;
import android.app.Activity;
import android.widget.TextView;

public class Hello_NeonProjectActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        /* Create a TextView and set its content.
         * the text is retrieved by calling a native function.
         */
        TextView  tv = new TextView(this);
        tv.setText( stringFromJNI() );
        setContentView(tv);
    }

    /* A native method that is implemented by the
     * 'helloneon' native library, which is packaged with this application.
     */
    public native String  stringFromJNI();

    /* this is used to load the 'helloneon' library on application
     * startup. The library has already been unpacked into
     * /data/data/com.example.neon/lib/libhelloneon.so at
     * installation time by the package manager.
     */
    static {
        System.loadLibrary("helloneon");
    }

}

3、 保存Hello_NeonProjectActivity.java文件,打开命令行窗口,将其定位到\bin\classes目录下,输入命令:javah –classpath D:\ProgramFiles\Android\android-sdk\platforms\android-9\android.jar;com.hello_neon.android.Hello_NeonProjectActivity ,会在\bin\classes目录下生成com_hello_neon_android_Hello_NeonProjectActivity.h文件(说明:*.jar也可以是其它版本);

4、 选中Hello-Neon工程,点击右键-->New-->Folder新建一个jni文件夹,在此文件夹下添加Android.mk、Application.mk、helloneon.c、helloneon-intrinsics.c、helloneon-intrinsics.h五个文件,其中内容分别为:

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := helloneon

#填写要编译的源文件路径
LOCAL_SRC_FILES := helloneon.c helloneon-intrinsics.c

#默认包含的头文件路径
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..

#-g 后面的一系列项目添加了才能使用arm_neon-h头文件, -mfloat-abi=softfp -mfpu=neon 使用arm_neon.h必须
LOCAL_CFLAGS := -g -mfloat-abi=softfp -mfpu=neon -march=armv7-a -mtune=cortex-a8

LOCAL_LDLIBS := -lz -llog
TARGET_ARCH_ABI := armeabi-v7a 
LOCAL_ARM_MODE := arm

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
#采用NEON优化技术
    LOCAL_ARM_NEON := true
    #LOCAL_CFLAGS := -DHAVE_NEON=1
endif

LOCAL_STATIC_LIBRARIES := cpufeatures

#生成动态调用库
include $(BUILD_SHARED_LIBRARY)

$(call import-module,cpufeatures)

Application.mk:

APP_PROJECT_PATH := $(call my-dir)/..
APP_PLATFORM := android-10
#choose which library to compile against in your Makefile
APP_STL := stlport_static
#APP_ABI这句指定了编译的目标平台类型,可以针对不同平台进行优化,x86 or armeabi-v7a
# Build both ARMv5TE and ARMv7-A machine code.
APP_ABI := armeabi armeabi-v7a
APP_CPPFLAGS += -fexceptions
#for using c++ features,you need to enable these in your Makefile
APP_CPP_FEATURES += exceptions rtti

helloneon.c:

#include 
#include 
#include 
#include 
#include 
#include "helloneon-intrinsics.h"

#define DEBUG 0
#define HAVE_NEON

#if DEBUG
#include 
#  define  D(x...)  __android_log_print(ANDROID_LOG_INFO,"helloneon",x)
#else
#  define  D(...)  do {} while (0)
#endif

/* return current time in milliseconds */
static double
now_ms(void)
{
    struct timespec res;
    clock_gettime(CLOCK_REALTIME, &res);
    return 1000.0*res.tv_sec + (double)res.tv_nsec/1e6;
}


/* this is a FIR filter implemented in C */
static void
fir_filter_c(short *output, const short* input, const short* kernel, int width, int kernelSize)
{
    int  offset = -kernelSize/2;
    int  nn;
    for (nn = 0; nn < width; nn++) {
        int sum = 0;
        int mm;
        for (mm = 0; mm > 16);
    }
}

#define  FIR_KERNEL_SIZE   32
#define  FIR_OUTPUT_SIZE   2560
#define  FIR_INPUT_SIZE    (FIR_OUTPUT_SIZE + FIR_KERNEL_SIZE)
#define  FIR_ITERATIONS    600

static const short  fir_kernel[FIR_KERNEL_SIZE] = {
    0x10, 0x20, 0x40, 0x70, 0x8c, 0xa2, 0xce, 0xf0, 0xe9, 0xce, 0xa2, 0x8c, 070, 0x40, 0x20, 0x10,
    0x10, 0x20, 0x40, 0x70, 0x8c, 0xa2, 0xce, 0xf0, 0xe9, 0xce, 0xa2, 0x8c, 070, 0x40, 0x20, 0x10 };

static short        fir_output[FIR_OUTPUT_SIZE];
static short        fir_input_0[FIR_INPUT_SIZE];
static const short* fir_input = fir_input_0 + (FIR_KERNEL_SIZE/2);
static short        fir_output_expected[FIR_OUTPUT_SIZE];

/* This is a trivial JNI example where we use a native method
 * to return a new VM String. See the corresponding Java source
 * file located at:
 *
 *   apps/samples/hello-neon/project/src/com/example/neon/HelloNeon.java
 */
JNIEXPORT jstring JNICALL Java_com_hello_1neon_android_Hello_1NeonProjectActivity_stringFromJNI(JNIEnv *env, jobject thiz)
{
    char*  str;
    uint64_t features;
    char buffer[512];
    char tryNeon = 0;
    double  t0, t1, time_c, time_neon;

    /* setup FIR input - whatever */
    {
        int  nn;
        for (nn = 0; nn  0; count--) {
            fir_filter_c(fir_output, fir_input, fir_kernel, FIR_OUTPUT_SIZE, FIR_KERNEL_SIZE);
        }
    }
    t1 = now_ms();
    time_c = t1 - t0;

    asprintf(&str, "FIR Filter benchmark:\nC version          : %g ms\n", time_c);
    strlcpy(buffer, str, sizeof buffer);
    free(str);

    strlcat(buffer, "Neon version   : ", sizeof buffer);

    if (android_getCpuFamily() != ANDROID_CPU_FAMILY_ARM) {
        strlcat(buffer, "Not an ARM CPU !\n", sizeof buffer);
        goto EXIT;
    }

    features = android_getCpuFeatures();
    if ((features & ANDROID_CPU_ARM_FEATURE_ARMv7) == 0) {
        strlcat(buffer, "Not an ARMv7 CPU !\n", sizeof buffer);
        goto EXIT;
    }

    /* HAVE_NEON is defined in Android.mk ! */
#ifdef HAVE_NEON
    if ((features & ANDROID_CPU_ARM_FEATURE_NEON) == 0) {
        strlcat(buffer, "CPU doesn't support NEON !\n", sizeof buffer);
        goto EXIT;
    }

    /* Benchmark small FIR filter loop - Neon version */
    t0 = now_ms();
    {
        int  count = FIR_ITERATIONS;
        for (; count > 0; count--) {
            fir_filter_neon_intrinsics(fir_output, fir_input, fir_kernel, FIR_OUTPUT_SIZE, FIR_KERNEL_SIZE);
        }
    }
    t1 = now_ms();
    time_neon = t1 - t0;
    asprintf(&str, "%g ms (x%g faster)\n", time_neon, time_c / (time_neon < 1e-6 ? 1. : time_neon));
    strlcat(buffer, str, sizeof buffer);
    free(str);

    /* check the result, just in case */
    {
        int  nn, fails = 0;
        for (nn = 0; nn < FIR_OUTPUT_SIZE; nn++) {
            if (fir_output[nn] != fir_output_expected[nn]) {
                if (++fails NewStringUTF(env, buffer);
}

helloneon-intrinsics.h:

#ifndef HELLONEON_INTRINSICS_H
#define HELLONEON_INTRINSICS_H

void fir_filter_neon_intrinsics(short *output, const short* input, const short* kernel, int width, int kernelSize);

#endif /* HELLONEON_INTRINSICS_H */

helloneon-intrinsics.c:

#include "helloneon-intrinsics.h"
#include 

/* this source file should only be compiled by Android.mk when targeting
 * the armeabi-v7a ABI, and should be built in NEON mode
 */
void
fir_filter_neon_intrinsics(short *output, const short* input, const short* kernel, int width, int kernelSize)
{
#if 1
   int nn, offset = -kernelSize/2;

   for (nn = 0; nn < width; nn++)
   {
        int mm, sum = 0;
        int32x4_t sum_vec = vdupq_n_s32(0);
        for(mm = 0; mm < kernelSize/4; mm++)
        {
            int16x4_t  kernel_vec = vld1_s16(kernel + mm*4);
            int16x4_t  input_vec = vld1_s16(input + (nn+offset+mm*4));
            sum_vec = vmlal_s16(sum_vec, kernel_vec, input_vec);
        }

        sum += vgetq_lane_s32(sum_vec, 0);
        sum += vgetq_lane_s32(sum_vec, 1);
        sum += vgetq_lane_s32(sum_vec, 2);
        sum += vgetq_lane_s32(sum_vec, 3);

        if(kernelSize & 3)
        {
            for(mm = kernelSize - (kernelSize & 3); mm > 16);
    }
#else /* for comparison purposes only */
    int nn, offset = -kernelSize/2;
    for (nn = 0; nn < width; nn++) {
        int sum = 0;
        int mm;
        for (mm = 0; mm > 16);
    }
#endif
}
Tags:Eclipse汉化包 Eclipse插件 Eclipse 责任编辑:colin
顶一下(8)
66.67%
    1. Photoshop中文版Photoshop中文版

      Adobe Photoshop,简称“PS”,是一个由Adobe Systems开发和发行的图像处理软件。Photoshop主要处理以像素所构成的数字图像。使用其众多的编修与绘图工具,可以更有效的进行图片编辑工作。Photoshop的应用领域很...

    1. photoshop cs5中文版Photoshop cs5 中文版

      Photoshop cs5 官方中文正式原版下载专区提供了Photoshop cs5 官方中文正式原版下载和Photoshop cs5 官方中文破解版下载。

    1. FCPX转场插件FCPX转场插件

      新云软件园为大家带来FCPX转场插件专题,为大家免费提供FCPX的各种转场特效插件下载,无论是你需要什么样的转场特效,在这里都会找到适合的插件使用,需要的朋友赶紧下载吧。...

    文章评论 新云下载QQ群:① 7551827使用手机微信搜索 微信号:xinyunshouyou 关注我们 有更多惊喜!!

    请自觉遵守互联网相关政策法规,评论内容只代表网友观点,与本站立场无关!
      验证码:     登录   注册
    网友评论

    关注新云安卓游戏网

    彩票33平台怎么样 www.525889.com-彩色3d打印-| www.001904.com-快三跨度表走势图| www.131293.com-彩礼和嫁妆的区别| www.965691.com-福彩3d最新走势图| www.yl09.cc-万彩吧_彩票高手| 开心彩票www.126730.com| www.pc73.com-彩票追遗漏-| www.74so.com-福彩3d兑奖限制| www.8208.vip-北京pk彩票客服| www.40872.com-黑客彩票中奖法| www.97753.cc-幸运时时彩60秒| www.080019.com-彩票纳税规则| www.140226.com-时时彩赛车计划网站| www.223050.com-五分快三好彩网计划| www.303732.com-虎扑足彩讨论区| www.376203.com-彩票停售时间几点| www.397341.com-彩票中奖视频故事| www.cq42.com-彩客网是正规平台吗| www.57qw.com-体彩大乐透80期| www.986461.com-nba竟彩-| www.288337.com-上海爱彩乐开奖| www.620523.com-福利彩票双色球买法| www.873363.com-大乐透彩票方法| www.290877.com-彩票复式投注计算器| www.553117.com-体彩日进斗金| www.740474.com-今日3d老虎图彩报| www.974843.com-南京彩票店吧| www.14ac.com-五分和彩连码计划| www.5369.cm-在淘宝怎么买彩票| www.39hz.com-博彩包网服务| www.64809.com-竞彩输钱害人| www.937187.com-乐福彩票真的假的| www.558471.com-彩铅作品简单| www.86999.com-福彩3d组六-| www.23237.cc-国彩是骗局吗| www.2699.pw-牛蛙彩app下载| www.17916.cc-彩票3d结果-| www.832666.com-77彩票网站-| www.cp08.com-新快三-| 13e彩票www.807860.com| www.359827.com-网友带我玩福彩| www.560997.com-福彩3d九宝图| www.984196.com-今日太湖字谜多彩网| www.00853.cc-福盈门彩票官网| www.272400.cc-传统型彩票图片| www.496206.com-现在足彩在哪里买| www.672657.com-买了彩票掉了| www.828525.com-6118网络彩票| www.977634.com-世界杯足彩平台| www.nn49.cc-竞彩官网下载| www.116.tv-内蒙古体彩竞彩| www.213421.com-信博彩票快三| www.428896.com-镇江体彩网-| www.591987.com-分分彩刷流水思路| www.763115.com-极速时时彩骗局| www.899252.com-8期彩票-| 大赢家彩票平台www.268993.com| www.6gl.com-168彩票网页登录| www.0503.cn-全国福彩快3| www.11926.cc-体体彩彩大大乐乐| www.019429.com-贵州体彩中心公告| www.173203.com-江苏快三下载| www.374134.com-河南福彩刮刮乐| www.600096.cc-最低充1元彩票| www.750413.com-时时彩攻略技巧集锦| www.926444.com-手机哪里买彩票安全| www.912007.com-天天种彩票可信吗| www.043163.com-中国体育彩票宣传语| www.875212.com-福彩3d彩报全图| www.285018.com-彩票店开在哪里最好| www.457744.com-代理广东福彩中心| www.476422.com-六福彩票注册| www.568146.com-彩票网站不能提现| www.663458.com-3d乐彩关注码| www.807480.com-福彩双色球守号技巧| www.880562.com-百胜彩票网站打不开| www.975920.com-洛阳结婚彩礼多少| www.sa4.com-看快三跨度技巧| www.ta97.com-霸气十足的彩票网名| www.10kt.com-cc233彩票-| www.73192.com-如何在手机上买福彩| www.61jz.com-最棒的移动彩票软件| www.5051.vip-彩界精英独胆| www.38227.cc-福彩双色球应用下载| www.027906.com-足彩设胆有什么好处| www.152760.com-新彩121彩票网| www.44465.cc-创富彩票是陷阱吗| www.92812.cc-东莞体彩网点申报| www.066253.com-3d彩票鬼六神算| www.130671.com-捷豹彩票365网址| www.232121.com-肥强彩经app| www.309344.com-体彩排列3怎么玩| www.388636.com-首批网络彩票牌照| www.954781.com-今晚开的彩票是什么| www.921.net-彩票总是输怎么办| www.7743.pw-趣彩分分彩-| www.36948.com-竞彩2串1的技巧| www.116202.com-菠萝彩软件靠谱吗| www.231811.com-51中彩app下载| www.775691.com-江西快三计划软件| www.386759.com-牛彩网彩票网站| www.589335.com-体彩大乐透复式玩法| www.695206.com-快三今天开奖| 百姓彩票www.www.bxcp3333.com| www.708640.com-大发时时彩记录| www.179625.com-广西快三开奖走势图| www.255169.com-买时时彩稳赢办法| www.7626.vip-福建福彩时时开奖| www.qe93.com-60彩票娱乐-| www.186181.com-快三中2个号有钱吗| www.365002.cc-彩典宝库免费下载| www.689637.com-保定有几家彩票站| www.905515.com-世界杯足彩怎么投注| www.217.live-三彩家托管靠谱吗| www.9884.cm-严打高频率彩票| www.048910.com-福彩排列3开奖号| www.292931.com-3d新彩吧字谜总汇| www.507388.com-时时彩和值单双大小| www.953956.com-彩票开奖排列三预测| www.40mr.com-彩票密码线图片| www.4642.vip-河北体彩提成是多少| www.049995.com-体育彩票拍列五| www.236500.com-大发快三网上计划| www.791808.com-三分时时彩开奖查询| www.442654.com-贵宾中彩开奖记录| www.716349.com-彩铅人物古风| www.910795.com-蓝彩竞猜分析预测| www.20336.com-盛发彩票在哪| www.fc93.com-今天七星彩开什么奖| www.761545.com-好彩妹电视剧简介| www.025995.com-金口诀测彩-| www.wc89.com-内蒙古快三新规则| www.051195.com-159竞彩足球下载| www.690098.com-重庆时时彩竞彩| www.943317.com-重庆彩票网官网彩| www.678606.com-足彩赔率-| www.365134.cc-彩票弃奖一览表| www.516278.com-乐彩33软件可靠吗| www.660769.com-彩神好喷绘机速度快| www.771796.com-竞彩店怎么申请退款| www.876323.com-体彩排列三断组分解| www.e10.org-海南七星彩直播网站| www.026813.com-c58彩票下载安装| www.020690.com-大发快三豹子| 亿龍彩票www.1368z.cc| www.48al.com-惨无星彩漫画| www.6890.xyz-彩票平台制作的优质| www.89151.com-132彩票软件| www.60552.cc-福彩中心下载安装| www.061566.com-彩客彩票靠谱吗| www.017192.com-152彩票正规吗| www.75221.cc-福彩刮刮乐过期| www.177385.com-百盈共享彩票| www.cp8113.com-易彩app-| www.919000.com-杀码3d专家家彩网| www.962423.com-福利彩票随机选的| www.873953.com-乐和彩官网下载| www.19ot.com-2019体彩点转让| www.99638.cc-时时彩判断单双技巧| www.986346.com-彩票助手吧-| www.182536.com-宁夏快三中奖技巧| www.110176.com-帝王彩色马桶| www.26uh.com-外省彩票怎么兑奖| www.2781.top-天猫彩票app|