How to enable VFP or NEON support in an Android app in C ++?

By default, Android NDK does not generate VFP (floating-point vector) or NEON code. How can I turn them on?

+4
source share
1 answer

There is documentation about this in the following files in Android NDK: docs / CPU-ARCH-ABIS.html and docs / CPU-ARM-NEON.html.

Basically you want to put

APP_ABI := armeabi armeabi-v7a 

to create two shared libraries, without targeting ARMv5TE and with support for VFP (targeting on ARMv7).

To create a .c / .cpp file with NEON support, add the suffix .neon to filename (for example: file.cpp.neon) to the Android.mk file. Or, to create all files with NEON enabled, put in the Android.mk file:

 LOCAL_ARM_NEON := true 

Be careful - not all ARMv7 devices support NEON (for example, Nvidia Tegra 2). It is better to detect it at runtime and choose a different encoding.

Read more in the documents.

+7
source

Source: https://habr.com/ru/post/1396986/


All Articles