# Application.mk in the jni directory that contains:
# APP_ABI := armeabi-v7a
#
+# By default libvpx will detect at runtime the existance of NEON extension.
+# For this we import the 'cpufeatures' module from the NDK sources.
+# libvpx can also be configured without this runtime detection method.
+# Configuring with --disable-runtime-cpu-detect will assume presence of NEON.
+# Configuring with --disable-runtime-cpu-detect --disable-neon will remove any
+# NEON dependency.
+
# To change to building armeabi, run ./libvpx/configure again, but with
-# --target=arm5te-android-gcc and and modify the Application.mk file to
+# --target=arm5te-android-gcc and modify the Application.mk file to
# set APP_ABI := armeabi
#
# Running ndk-build will build libvpx and include it in your project.
LOCAL_LDLIBS := -llog
-LOCAL_STATIC_LIBRARIES := cpufeatures
+ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
+ LOCAL_STATIC_LIBRARIES := cpufeatures
+endif
$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_rtcd.h
$(LIBVPX_PATH)/vp8/encoder/asm_enc_offsets.c))
endif
+ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
$(call import-module,cpufeatures)
+endif
+
check_add_asflags --defsym ARCHITECTURE=${arch_int}
tune_cflags="-mtune="
if [ ${tgt_isa} == "armv7" ]; then
+ check_add_cflags -march=armv7-a -mfloat-abi=softfp
+ check_add_asflags -march=armv7-a -mfloat-abi=softfp
+
if enabled neon
then
check_add_cflags -mfpu=neon #-ftree-vectorize
check_add_asflags -mfpu=neon
fi
- check_add_cflags -march=armv7-a -mcpu=cortex-a8 -mfloat-abi=softfp
- check_add_asflags -mcpu=cortex-a8 -mfloat-abi=softfp #-march=armv7-a
+
+ if [ -z "${tune_cpu}" ]; then
+ tune_cpu=cortex-a8
+ fi
else
check_add_cflags -march=${tgt_isa}
check_add_asflags -march=${tgt_isa}
fi
+
enabled debug && add_asflags -g
asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
;;
add_cflags "--sysroot=${alt_libc}"
add_ldflags "--sysroot=${alt_libc}"
- add_cflags "-I${SDK_PATH}/sources/android/cpufeatures/"
+ # linker flag that routes around a CPU bug in some
+ # Cortex-A8 implementations (NDK Dev Guide)
+ add_ldflags "-Wl,--fix-cortex-a8"
enable pic
soft_enable realtime_only
if [ ${tgt_isa} == "armv7" ]; then
- enable runtime_cpu_detect
+ soft_enable runtime_cpu_detect
+ fi
+ if enabled runtime_cpu_detect; then
+ add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
fi
;;
return env && *env ? (int)strtol(env, NULL, 0) : ~0;
}
+#if !CONFIG_RUNTIME_CPU_DETECT
-#if defined(_MSC_VER)
+int arm_cpu_caps(void)
+{
+ int flags;
+ int mask;
+ if (!arm_cpu_env_flags(&flags))
+ {
+ return flags;
+ }
+ mask = arm_cpu_env_mask();
+#if defined(HAVE_EDSP)
+ flags |= HAS_EDSP;
+#endif
+#if defined(HAVE_MEDIA)
+ flags |= HAS_MEDIA;
+#endif
+#if defined(HAVE_NEON)
+ flags |= HAS_NEON;
+#endif
+ return flags & mask;
+}
+
+#elif defined(_MSC_VER)
/*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
return flags & mask;
}
#endif // defined(__linux__)
-#elif !CONFIG_RUNTIME_CPU_DETECT
-
-int arm_cpu_caps(void)
-{
- int flags;
- int mask;
- if (!arm_cpu_env_flags(&flags))
- {
- return flags;
- }
- mask = arm_cpu_env_mask();
-#if defined(HAVE_EDSP)
- flags |= HAS_EDSP;
-#endif
-#if defined(HAVE_MEDIA)
- flags |= HAS_MEDIA;
-#endif
-#if defined(HAVE_NEON)
- flags |= HAS_NEON;
-#endif
- return flags & mask;
-}
-
#else
#error "--enable-runtime-cpu-detect selected, but no CPU detection method " \
- "available for your platform. Reconfigure without --enable-runtime-cpu-detect."
+ "available for your platform. Reconfigure with --disable-runtime-cpu-detect."
#endif