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

软件提交最近更新热门排行
您现在的位置:首页››软件教程››编程开发››编程其它››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 关注我们 有更多惊喜!!

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

    关注新云安卓游戏网

    东京五分彩 www.744040.com-中彩网彩票走势图| www.736034.com-优惠活动彩票送28| www.823922.com-天气网福彩预测总汇| www.896419.com-十分彩官方下载| www.972418.com-人物彩铅画大全| www.cai8897.com河北快三电视走势图| www.34ao.com-彩票兼职靠谱吗| www.3755.in-七星彩今晚出什么| www.jr88.com-关于王者彩票被骗| www.23004.com-王者彩票快三破解| www.166428.com-福彩快3下载| www.777.club-福彩3d杀一码高手| www.8235.loan-江西快三预测一定牛| www.4461.com-亚洲彩票网站是真的| www.022585.com-京彩集团app下载| www.659124.com-江苏e球彩赛事| www.784778.com-小米彩票改名字了| www.648600.com-看看福彩3d走势图| www.587628.com-旺彩双色球怎么支付| www.672942.com-七星彩中奖哪里兑换| www.027636.com-159彩票手机版| www.278079.com-559彩票公司| www.412854.com-竞彩十四场开奖结果| www.4616.com-每天买一注彩票| www.442333.com-银彩娱乐客户端| www.594377.com-竟彩比分500| www.318248.com-简单水彩画-| www.644012.com-体彩大乐透人工计划| www.859071.com-筒井彩芽-| www.ru39.com-福彩3d中彩网站| www.291784.com-下载彩3-| www.33pe.com-用彩铅画荷花图片| www.83516.com-彩票店活动送什么好| www.254632.com-好彩是正规的平台吗| www.988081.com-腾讯天天中彩吧| www.bc14.com-一定牛彩票软件| www.f80.cn-吉隆坡博彩合法吗| www.80lo.com-5块钱彩票能中多少| www.nh57.com-福彩3的开奖号结果| www.8046.pw-水彩画画教程| www.70wf.com-彩易达出租-| www.178990.com-彩神2app-| www.549969.com-网购足彩-| www.35671.cc-彩票99安卓105| www.004893.com-二分快三计划| www.930591.com-福彩3d之新彩网| www.cp981.com-爱乐彩福建-| www.928269.com-高频彩票软件| www.057818.com-福彩3d第三版彩图| www.632482.com-七星彩下期出什么奖| www.726267.com-河北省体彩兑奖中心| www.799728.com-彩票中奖都是命| www.871733.com-苏州彩票兑奖中心| www.947085.com-体彩高频彩票| 双龙娱乐www.slyl1.com| www.82066.cc-特彩吧高手网天下彩| www.062986.com-体彩福彩加盟条件| www.152570.com-彩神争霸网址是多少| www.230995.com-北京快三预测号码| www.241148.com-吉林福利彩票快三| www.328484.com-双彩网彩票论坛| www.410999.com-足彩竞彩开奖时间表| www.524013.com-内蒙福彩官方网站| www.599985.com-彩票网址导航| www.670363.com-山东福利彩票七彩乐| www.752710.com-网络彩票推广技巧| www.825833.com-彩票vlll-| www.890554.com-中彩网统计图表| www.956082.com-万豪彩票助手苹果版| 购彩堂www.458178.com| www.t49.com-湖北第1彩票报| www.086648.com-全发彩票平台| www.66081.com-开体彩店要准备什么| www.828255.com-红包彩票下载| www.450480.com-三亚七星彩代理| www.558308.com-彩票33软件下载| www.wp.cc-福彩快三甘肃| www.45bf.com-什么购彩平台好不好| www.150540.com-快三软件计划手机版| www.284655.com-彩票行业-| www.080145.com-体彩七星彩中奖玩法| www.423423.com-七乐彩同尾号走势图| www.536963.com-中国福利彩票双色珑| www.677866.com-南方双彩网手机安卓| www.757902.com-体彩是不是一个骗局| www.822988.com-凤凰彩票fh-| www.899188.cc-彩票双色球开奖详情| www.974127.com-双色球江苏彩民中奖| www.xw.cc-中国体彩网官方网| www.ly16.com-甘肃快三技巧有哪些| www.371383.com-826彩票开奖网站| www.491911.com-疯狂的黑彩-| www.cs14.com-绝密彩票网166| www.598508.com-今天七星彩号码多少| www.690230.com-最新足彩分析14场| www.782564.com-快三哪些是正规的| www.853103.com-澳彩网登录-| www.911099.com-安徽快三最新预测| www.964682.com-竞彩篮球推荐捷报| 凤凰彩票www.88266r.com| www.728940.com-双彩论坛福彩3d| www.518596.com-辽宁福彩直主任网| www.23165.com-彩神争8网页手| www.50pg.com-新快三外围庄家| www.26xh.com-领彩票需要身份证吗| www.958990.com-518时时彩链接| www.ul43.com-福彩3d阴阳走势| www.0348.cc-搜狗彩票平台| www.950771.com-极速彩票下载| VIP彩票www.263988.com| www.3383.pw-中3彩票平台| www.808380.com-优彩彩票怎样充值的| www.9802.cc-彩票开奖查询下载| www.909158.com-大发快三助手一分钟| www.594978.com-京东彩票客户端| www.665747.com-七百万彩票网| www.731203.com-王牌彩票怎么玩| www.793363.com-合法赌博彩票机| www.859752.com-⑧彩票论坛-| www.931912.com-中彩首席导师金振国| www.979241.com-好彩柠檬双爆珠价格| www.a13.top-中国福彩标志| www.403483.com-苏宁彩票微信平台| www.881123.com-大乐透彩票幸运选号| www.77025.com-彩票开奖走势图排三| www.117656.com-足彩14场最新预测| www.684652.com-新彩吧福彩图谜| www.912533.com-七乐彩杀号公式最准| www.db08.com-人人彩票网靠谱吗| www.009646.com-手机彩膜制作机器| www.095954.com-现在买彩金的人多吗| www.738002.com-福利彩票微信骗局| www.290108.com-机选3d彩票一注| www.378199.com-福彩出啥号-| www.551268.com-彩票合买搭建| www.78276.com-足球彩票即使比分| www.008952.com-福彩3d模拟器投注| www.208422.com-彩票专业彩吧助手| www.550641.com-中了彩票一千万| www.092502.com-彩九c9com平台| www.878792.com-足彩判断平局公式| www.ej4.com-时时彩走势图彩| www.281694.com-新浪双色球彩票预测| www.986811.com-七乐彩专家推荐汇总| www.bb98.cc-快三360-| www.ub98.com-快三顺子456多钱| www.01od.com-用彩虹是说一句话| www.9494.online体彩排例三泰虎字谜| www.480300.com-福彩3d算法必中| www.592200.com-体育彩票站如何盈利| www.693910.com-国外彩票app下载| www.795228.com-高频彩开奖直播现场| www.900639.com-彩吧彩报第四版| www.982068.com-江西彩票助手合法吗| www.cg00.com-怎么看极速快三走势| www.569873.com-山东好彩快3| www.0663.xyz-赛马赛果及派彩丶| www.0307.vip-彩票貪污案-| www.72kq.com-爱乐彩电脑版| www.579055.com-日本彩票哪里查询| www.533858.com-七乐彩摇奖出球顺序| www.299608.com-陕西体彩爱彩乐| www.418088.com-一号彩票安卓版下载| www.508760.com-彩铅画教程风景|