shithub: libvpx

Download patch

ref: 09cbb6c1f7ebca28f46c4f183747edfb60b62623
parent: fffeaa395c9c0bd1cb220b2c20fc30ff2585c275
parent: 7d54e0f0935f9130de457ea74c7bad30bc0d4a78
author: Johann <[email protected]>
date: Wed May 7 04:54:13 EDT 2014

Merge "Android NDK support for x86 and mips"

--- a/build/make/Android.mk
+++ b/build/make/Android.mk
@@ -53,12 +53,20 @@
 ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas
 ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL)
 
-# Makefiles created by the libvpx configure process
-# This will need to be fixed to handle x86.
+# Use the makefiles generated by upstream configure to determine which files to
+# build. Also set any architecture-specific flags.
 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
   include $(CONFIG_DIR)libs-armv7-android-gcc.mk
-else
+  LOCAL_ARM_MODE := arm
+else ifeq  ($(TARGET_ARCH_ABI),armeabi)
   include $(CONFIG_DIR)libs-armv5te-android-gcc.mk
+  LOCAL_ARM_MODE := arm
+else ifeq ($(TARGET_ARCH_ABI),x86)
+  include $(CONFIG_DIR)libs-x86-android-gcc.mk
+else ifeq ($(TARGET_ARCH_ABI),mips)
+  include $(CONFIG_DIR)libs-mips-android-gcc.mk
+else
+  $(error Not a supported TARGET_ARCH_ABI: $(TARGET_ARCH_ABI))
 endif
 
 # Rule that is normally in Makefile created by libvpx
@@ -72,10 +80,13 @@
 # Include the list of files to be built
 include $(LIBVPX_PATH)/libs.mk
 
-# Want arm, not thumb, optimized
-LOCAL_ARM_MODE := arm
+# Optimise the code. May want to revisit this setting in the future.
 LOCAL_CFLAGS := -O3
 
+# For x86, include the source code in the search path so it will find files
+# like x86inc.asm and x86_abi_support.asm
+LOCAL_ASMFLAGS := -I$(LIBVPX_PATH)
+
 # -----------------------------------------------------------------------------
 # Template  : asm_offsets_template
 # Arguments : 1: assembly offsets file to be created
@@ -109,7 +120,7 @@
 	@grep $(OFFSET_PATTERN) $$< | tr -d '\#' | $(CONFIG_DIR)$(ASM_CONVERSION) > $$@
 endef
 
-# Use ads2gas script to convert from RVCT format to GAS format.  This passes
+# Use ads2gas script to convert from RVCT format to GAS format.  This
 #  puts the processed file under $(ASM_CNV_PATH).  Local clean rule
 #  to handle removing these
 ifeq ($(CONFIG_VP8_ENCODER), yes)
@@ -146,18 +157,26 @@
 
 # Pull out assembly files, splitting NEON from the rest.  This is
 # done to specify that the NEON assembly files use NEON assembler flags.
-CODEC_SRCS_ASM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE))
-CODEC_SRCS_ASM = $(foreach v, \
-                 $(CODEC_SRCS_ASM_ALL), \
-                 $(if $(findstring neon,$(v)),,$(v)))
+# x86 assembly matches %.asm, arm matches %.asm.s
+
+# x86:
+
+CODEC_SRCS_ASM_X86 = $(filter %.asm, $(CODEC_SRCS_UNIQUE))
+LOCAL_SRC_FILES += $(foreach file, $(CODEC_SRCS_ASM_X86), libvpx/$(file))
+
+# arm:
+CODEC_SRCS_ASM_ARM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE))
+CODEC_SRCS_ASM_ARM = $(foreach v, \
+                     $(CODEC_SRCS_ASM_ARM_ALL), \
+                     $(if $(findstring neon,$(v)),,$(v)))
 CODEC_SRCS_ASM_ADS2GAS = $(patsubst %.s, \
                          $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
-                         $(CODEC_SRCS_ASM))
+                         $(CODEC_SRCS_ASM_ARM))
 LOCAL_SRC_FILES += $(CODEC_SRCS_ASM_ADS2GAS)
 
 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
   CODEC_SRCS_ASM_NEON = $(foreach v, \
-                        $(CODEC_SRCS_ASM_ALL),\
+                        $(CODEC_SRCS_ASM_ARM_ALL),\
                         $(if $(findstring neon,$(v)),$(v),))
   CODEC_SRCS_ASM_NEON_ADS2GAS = $(patsubst %.s, \
                                 $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
@@ -188,6 +207,10 @@
 $(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vp9_rtcd.h
 endif
 $(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_scale_rtcd.h
+
+ifeq ($(TARGET_ARCH_ABI),x86)
+$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_config.asm
+endif
 
 .PHONY: clean
 clean:
--- a/test/android/README
+++ b/test/android/README
@@ -3,7 +3,7 @@
 ./libvpx/configure --target=armv7-android-gcc --enable-external-build \
   --enable-postproc --disable-install-srcs --enable-multi-res-encoding \
   --enable-temporal-denoising --disable-unit-tests --disable-install-docs \
-  --disable-examples --disable-runtime-cpu-detect --sdk=$NDK
+  --disable-examples --disable-runtime-cpu-detect --sdk-path=$NDK
 
 2) From the parent directory, invoke ndk-build:
 NDK_PROJECT_PATH=. ndk-build APP_BUILD_SCRIPT=./libvpx/test/android/Android.mk \