Skip to content
Snippets Groups Projects
Commit 7d54e0f0 authored by Johann Koenig's avatar Johann Koenig
Browse files

Android NDK support for x86 and mips

This does not do the full toolchain setup like the arm builds. It only
allows for ndk-builds. See the instructions in tests/android/README or
the webm jnin bindings project:
https://chromium.googlesource.com/webm/bindings/+/master/JNI/README.Android

Because this support is not quite polished, the build targets must be
forced. Please use
--force-target=x86-android-gcc --disable-ssse3 --disable-sse4_1 --disable-avx2
--force-target-mips-android-gcc

Change-Id: Ie2b6623f71ac816e3965c39bf97097e9d30b6e94
parent ac8c0691
No related branches found
No related tags found
No related merge requests found
...@@ -53,12 +53,20 @@ LIBVPX_PATH := $(LOCAL_PATH)/libvpx ...@@ -53,12 +53,20 @@ LIBVPX_PATH := $(LOCAL_PATH)/libvpx
ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas
ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL) ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL)
# Makefiles created by the libvpx configure process # Use the makefiles generated by upstream configure to determine which files to
# This will need to be fixed to handle x86. # build. Also set any architecture-specific flags.
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
include $(CONFIG_DIR)libs-armv7-android-gcc.mk 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 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 endif
# Rule that is normally in Makefile created by libvpx # Rule that is normally in Makefile created by libvpx
...@@ -72,10 +80,13 @@ SRC_PATH_BARE := $(LIBVPX_PATH) ...@@ -72,10 +80,13 @@ SRC_PATH_BARE := $(LIBVPX_PATH)
# Include the list of files to be built # Include the list of files to be built
include $(LIBVPX_PATH)/libs.mk include $(LIBVPX_PATH)/libs.mk
# Want arm, not thumb, optimized # Optimise the code. May want to revisit this setting in the future.
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS := -O3 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 # Template : asm_offsets_template
# Arguments : 1: assembly offsets file to be created # Arguments : 1: assembly offsets file to be created
...@@ -109,7 +120,7 @@ $(1) : $$(_OBJ) $(2) ...@@ -109,7 +120,7 @@ $(1) : $$(_OBJ) $(2)
@grep $(OFFSET_PATTERN) $$< | tr -d '\#' | $(CONFIG_DIR)$(ASM_CONVERSION) > $$@ @grep $(OFFSET_PATTERN) $$< | tr -d '\#' | $(CONFIG_DIR)$(ASM_CONVERSION) > $$@
endef 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 # puts the processed file under $(ASM_CNV_PATH). Local clean rule
# to handle removing these # to handle removing these
ifeq ($(CONFIG_VP8_ENCODER), yes) ifeq ($(CONFIG_VP8_ENCODER), yes)
...@@ -146,18 +157,26 @@ LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file).neon) ...@@ -146,18 +157,26 @@ LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file).neon)
# Pull out assembly files, splitting NEON from the rest. This is # Pull out assembly files, splitting NEON from the rest. This is
# done to specify that the NEON assembly files use NEON assembler flags. # done to specify that the NEON assembly files use NEON assembler flags.
CODEC_SRCS_ASM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE)) # x86 assembly matches %.asm, arm matches %.asm.s
CODEC_SRCS_ASM = $(foreach v, \
$(CODEC_SRCS_ASM_ALL), \ # x86:
$(if $(findstring neon,$(v)),,$(v)))
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, \ CODEC_SRCS_ASM_ADS2GAS = $(patsubst %.s, \
$(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \ $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
$(CODEC_SRCS_ASM)) $(CODEC_SRCS_ASM_ARM))
LOCAL_SRC_FILES += $(CODEC_SRCS_ASM_ADS2GAS) LOCAL_SRC_FILES += $(CODEC_SRCS_ASM_ADS2GAS)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
CODEC_SRCS_ASM_NEON = $(foreach v, \ CODEC_SRCS_ASM_NEON = $(foreach v, \
$(CODEC_SRCS_ASM_ALL),\ $(CODEC_SRCS_ASM_ARM_ALL),\
$(if $(findstring neon,$(v)),$(v),)) $(if $(findstring neon,$(v)),$(v),))
CODEC_SRCS_ASM_NEON_ADS2GAS = $(patsubst %.s, \ CODEC_SRCS_ASM_NEON_ADS2GAS = $(patsubst %.s, \
$(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \ $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
...@@ -189,6 +208,10 @@ $(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vp9_rtcd.h ...@@ -189,6 +208,10 @@ $(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vp9_rtcd.h
endif endif
$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_scale_rtcd.h $(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 .PHONY: clean
clean: clean:
@echo "Clean: ads2gas files [$(TARGET_ARCH_ABI)]" @echo "Clean: ads2gas files [$(TARGET_ARCH_ABI)]"
......
...@@ -3,7 +3,7 @@ Android.mk will build vpx unittests on android. ...@@ -3,7 +3,7 @@ Android.mk will build vpx unittests on android.
./libvpx/configure --target=armv7-android-gcc --enable-external-build \ ./libvpx/configure --target=armv7-android-gcc --enable-external-build \
--enable-postproc --disable-install-srcs --enable-multi-res-encoding \ --enable-postproc --disable-install-srcs --enable-multi-res-encoding \
--enable-temporal-denoising --disable-unit-tests --disable-install-docs \ --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: 2) From the parent directory, invoke ndk-build:
NDK_PROJECT_PATH=. ndk-build APP_BUILD_SCRIPT=./libvpx/test/android/Android.mk \ NDK_PROJECT_PATH=. ndk-build APP_BUILD_SCRIPT=./libvpx/test/android/Android.mk \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment