Merge "Android: only build dec_neon with NEON support"

This commit is contained in:
James Zern 2012-05-23 22:26:03 -07:00 committed by Gerrit Code Review
commit 4f067fb254
5 changed files with 18 additions and 6 deletions

View File

@ -15,7 +15,6 @@ LOCAL_SRC_FILES := \
src/dec/webp.c \ src/dec/webp.c \
src/dsp/cpu.c \ src/dsp/cpu.c \
src/dsp/dec.c \ src/dsp/dec.c \
src/dsp/dec_neon.c \
src/dsp/dec_sse2.c \ src/dsp/dec_sse2.c \
src/dsp/enc.c \ src/dsp/enc.c \
src/dsp/enc_sse2.c \ src/dsp/enc_sse2.c \
@ -56,7 +55,10 @@ LOCAL_CFLAGS := -Wall -DANDROID -DHAVE_MALLOC_H -DHAVE_PTHREAD \
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true # Setting LOCAL_ARM_NEON will enable -mfpu=neon which may cause illegal
# instructions to be generated for armv7a code. Instead target the neon code
# specifically.
LOCAL_SRC_FILES += src/dsp/dec_neon.c.neon
endif endif
LOCAL_STATIC_LIBRARIES := cpufeatures LOCAL_STATIC_LIBRARIES := cpufeatures

View File

@ -57,7 +57,7 @@ static int x86CPUInfo(CPUFeature feature) {
return 0; return 0;
} }
VP8CPUInfo VP8GetCPUInfo = x86CPUInfo; VP8CPUInfo VP8GetCPUInfo = x86CPUInfo;
#elif defined(__ANDROID__) #elif defined(WEBP_ANDROID_NEON)
static int AndroidCPUInfo(CPUFeature feature) { static int AndroidCPUInfo(CPUFeature feature) {
const AndroidCpuFamily cpu_family = android_getCpuFamily(); const AndroidCpuFamily cpu_family = android_getCpuFamily();
const uint64_t cpu_features = android_getCpuFeatures(); const uint64_t cpu_features = android_getCpuFeatures();

View File

@ -719,7 +719,7 @@ void VP8DspInit(void) {
if (VP8GetCPUInfo(kSSE2)) { if (VP8GetCPUInfo(kSSE2)) {
VP8DspInitSSE2(); VP8DspInitSSE2();
} }
#elif defined(__GNUC__) && defined(__ARM_NEON__) #elif defined(WEBP_USE_NEON)
if (VP8GetCPUInfo(kNEON)) { if (VP8GetCPUInfo(kNEON)) {
VP8DspInitNEON(); VP8DspInitNEON();
} }

View File

@ -10,7 +10,9 @@
// Authors: Somnath Banerjee (somnath@google.com) // Authors: Somnath Banerjee (somnath@google.com)
// Johann Koenig (johannkoenig@google.com) // Johann Koenig (johannkoenig@google.com)
#if defined(__GNUC__) && defined(__ARM_NEON__) #include "./dsp.h"
#if defined(WEBP_USE_NEON)
#include "../dec/vp8i.h" #include "../dec/vp8i.h"
@ -324,4 +326,4 @@ void VP8DspInitNEON(void) {
} // extern "C" } // extern "C"
#endif #endif
#endif // __GNUC__ && __ARM_NEON__ #endif // WEBP_USE_NEON

View File

@ -29,6 +29,14 @@ extern "C" {
#define WEBP_USE_SSE2 #define WEBP_USE_SSE2
#endif #endif
#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
#define WEBP_ANDROID_NEON // Android targets that might support NEON
#endif
#if defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON)
#define WEBP_USE_NEON
#endif
typedef enum { typedef enum {
kSSE2, kSSE2,
kSSE3, kSSE3,