11b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_PATH := $(call my-dir) 21b362b15af34006e6a11974088a46d42b903418eJohanninclude $(CLEAR_VARS) 31b362b15af34006e6a11974088a46d42b903418eJohann 41b362b15af34006e6a11974088a46d42b903418eJohannifeq ($(ARCH_ARM_HAVE_NEON),true) 51b362b15af34006e6a11974088a46d42b903418eJohann libvpx_target := armv7a-neon 61b362b15af34006e6a11974088a46d42b903418eJohann libvpx_asm := .asm.s 71b362b15af34006e6a11974088a46d42b903418eJohannelse ifeq ($(ARCH_ARM_HAVE_ARMV7A),true) 81b362b15af34006e6a11974088a46d42b903418eJohann libvpx_target := armv7a 91b362b15af34006e6a11974088a46d42b903418eJohann libvpx_asm := .asm.s 101b362b15af34006e6a11974088a46d42b903418eJohannendif 111b362b15af34006e6a11974088a46d42b903418eJohann 121b362b15af34006e6a11974088a46d42b903418eJohannifeq ($(TARGET_ARCH),mips) 131b362b15af34006e6a11974088a46d42b903418eJohann ifneq ($(ARCH_HAS_BIGENDIAN),true) 141b362b15af34006e6a11974088a46d42b903418eJohann ifeq ($(ARCH_MIPS_DSP_REV),2) 151b362b15af34006e6a11974088a46d42b903418eJohann libvpx_target := mips-dspr2 161b362b15af34006e6a11974088a46d42b903418eJohann LOCAL_CFLAGS += -DMIPS_DSP_REV=$(ARCH_MIPS_DSP_REV) 171b362b15af34006e6a11974088a46d42b903418eJohann else 181b362b15af34006e6a11974088a46d42b903418eJohann libvpx_target := mips 191b362b15af34006e6a11974088a46d42b903418eJohann ifeq ($(ARCH_MIPS_DSP_REV),1) 201b362b15af34006e6a11974088a46d42b903418eJohann LOCAL_CFLAGS += -DMIPS_DSP_REV=$(ARCH_MIPS_DSP_REV) 211b362b15af34006e6a11974088a46d42b903418eJohann else 221b362b15af34006e6a11974088a46d42b903418eJohann LOCAL_CFLAGS += -DMIPS_DSP_REV=0 231b362b15af34006e6a11974088a46d42b903418eJohann endif #mips_dsp_rev1 241b362b15af34006e6a11974088a46d42b903418eJohann endif #mips_dsp_rev2 251b362b15af34006e6a11974088a46d42b903418eJohann endif #bigendian 261b362b15af34006e6a11974088a46d42b903418eJohannendif #mips 271b362b15af34006e6a11974088a46d42b903418eJohann 281b362b15af34006e6a11974088a46d42b903418eJohann# Un-optimized targets 291b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_target ?= generic 301b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm ?= .asm 311b362b15af34006e6a11974088a46d42b903418eJohann 321b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_config_dir := $(LOCAL_PATH)/$(libvpx_target) 331b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_source_dir := $(LOCAL_PATH)/libvpx 341b362b15af34006e6a11974088a46d42b903418eJohann 351b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs := $(shell cat $(libvpx_config_dir)/libvpx_srcs.txt) 361b362b15af34006e6a11974088a46d42b903418eJohann 371b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_CFLAGS := -DHAVE_CONFIG_H=vpx_config.h 381b362b15af34006e6a11974088a46d42b903418eJohann 391b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_MODULE := libvpx 401b362b15af34006e6a11974088a46d42b903418eJohann 411b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_MODULE_CLASS := STATIC_LIBRARIES 421b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_intermediates := $(call local-intermediates-dir) 431b362b15af34006e6a11974088a46d42b903418eJohann 441b362b15af34006e6a11974088a46d42b903418eJohann# Extract the C files from the list and add them to LOCAL_SRC_FILES. 451b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs_unique := $(sort $(libvpx_codec_srcs)) 461b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs_c := $(filter %.c, $(libvpx_codec_srcs_unique)) 471b362b15af34006e6a11974088a46d42b903418eJohann# vpx_config.c is an auto-generated file in $(config_dir) 481b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs_c_static := $(filter-out vpx_config.c, $(libvpx_codec_srcs_c)) 491b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_SRC_FILES += $(addprefix libvpx/, $(libvpx_codec_srcs_c_static)) 501b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_SRC_FILES += $(libvpx_target)/vpx_config.c 511b362b15af34006e6a11974088a46d42b903418eJohann 521b362b15af34006e6a11974088a46d42b903418eJohann# ARM and x86 use an 'offsets' file in the assembly. It is generated by 531b362b15af34006e6a11974088a46d42b903418eJohann# tricking the compiler and generating non-functional output which is then 541b362b15af34006e6a11974088a46d42b903418eJohann# processed with grep. For ARM, this must be additionally converted from 551b362b15af34006e6a11974088a46d42b903418eJohann# RVCT (ARM's in-house compiler) format to GNU Assembler Format for gcc. 561b362b15af34006e6a11974088a46d42b903418eJohann 571b362b15af34006e6a11974088a46d42b903418eJohann# Offset files are currently used in vpx_scale for NEON and some encoder 581b362b15af34006e6a11974088a46d42b903418eJohann# functions used in both ARM and x86. These files can not be compiled and need 591b362b15af34006e6a11974088a46d42b903418eJohann# to be named accordingly to avoid auto-build rules. The encoder files are not 601b362b15af34006e6a11974088a46d42b903418eJohann# used yet but are included in the comments for future reference. 611b362b15af34006e6a11974088a46d42b903418eJohann 621b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm_offsets_intermediates := \ 63ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang vp8/encoder/vp8_asm_enc_offsets.intermediate \ 64ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang vpx_scale/vpx_scale_asm_offsets.intermediate \ 651b362b15af34006e6a11974088a46d42b903418eJohann 661b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm_offsets_files := \ 67ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang vp8/encoder/vp8_asm_enc_offsets.asm \ 68ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang vpx_scale/vpx_scale_asm_offsets.asm \ 691b362b15af34006e6a11974088a46d42b903418eJohann 701b362b15af34006e6a11974088a46d42b903418eJohann# Build the S files with inline assembly. 711b362b15af34006e6a11974088a46d42b903418eJohannCOMPILE_TO_S := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_intermediates)) 721b362b15af34006e6a11974088a46d42b903418eJohann$(COMPILE_TO_S) : PRIVATE_INTERMEDIATES := $(libvpx_intermediates) 731b362b15af34006e6a11974088a46d42b903418eJohann$(COMPILE_TO_S) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 741b362b15af34006e6a11974088a46d42b903418eJohann$(COMPILE_TO_S) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir) 751b362b15af34006e6a11974088a46d42b903418eJohann$(COMPILE_TO_S) : PRIVATE_CUSTOM_TOOL = $(TARGET_CC) -S $(addprefix -I, $(TARGET_C_INCLUDES)) -I $(PRIVATE_INTERMEDIATES) -I $(PRIVATE_SOURCE_DIR) -I $(PRIVATE_CONFIG_DIR) -DINLINE_ASM -o $@ $< 761b362b15af34006e6a11974088a46d42b903418eJohann$(COMPILE_TO_S) : $(libvpx_intermediates)/%.intermediate : $(libvpx_source_dir)/%.c 771b362b15af34006e6a11974088a46d42b903418eJohann $(transform-generated-source) 781b362b15af34006e6a11974088a46d42b903418eJohann 791b362b15af34006e6a11974088a46d42b903418eJohann# Extract the offsets from the inline assembly. 801b362b15af34006e6a11974088a46d42b903418eJohannOFFSETS_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_files)) 811b362b15af34006e6a11974088a46d42b903418eJohann$(OFFSETS_GEN) : PRIVATE_OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU' 821b362b15af34006e6a11974088a46d42b903418eJohann$(OFFSETS_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 831b362b15af34006e6a11974088a46d42b903418eJohann$(OFFSETS_GEN) : PRIVATE_CUSTOM_TOOL = grep $(PRIVATE_OFFSET_PATTERN) $< | tr -d '$$\#' | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ 841b362b15af34006e6a11974088a46d42b903418eJohann$(OFFSETS_GEN) : %.asm : %.intermediate 851b362b15af34006e6a11974088a46d42b903418eJohann $(transform-generated-source) 861b362b15af34006e6a11974088a46d42b903418eJohann 871b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_GENERATED_SOURCES += $(OFFSETS_GEN) 881b362b15af34006e6a11974088a46d42b903418eJohann 891b362b15af34006e6a11974088a46d42b903418eJohann# This step is only required for ARM. MIPS uses intrinsics and x86 requires an 901b362b15af34006e6a11974088a46d42b903418eJohann# assembler to pre-process its assembly files. 911b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm_srcs := $(filter %.asm.s, $(libvpx_codec_srcs_unique)) 921b362b15af34006e6a11974088a46d42b903418eJohann 931b362b15af34006e6a11974088a46d42b903418eJohann# The ARM assembly sources must be converted from ADS to GAS compatible format. 941b362b15af34006e6a11974088a46d42b903418eJohannVPX_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_srcs)) 951b362b15af34006e6a11974088a46d42b903418eJohann$(VPX_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 961b362b15af34006e6a11974088a46d42b903418eJohann$(VPX_GEN) : PRIVATE_CUSTOM_TOOL = cat $< | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ 971b362b15af34006e6a11974088a46d42b903418eJohann$(VPX_GEN) : $(libvpx_intermediates)/%.s : $(libvpx_source_dir)/% 981b362b15af34006e6a11974088a46d42b903418eJohann $(transform-generated-source) 991b362b15af34006e6a11974088a46d42b903418eJohann 1001b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_GENERATED_SOURCES += $(VPX_GEN) 1011b362b15af34006e6a11974088a46d42b903418eJohann 1021b362b15af34006e6a11974088a46d42b903418eJohannLOCAL_C_INCLUDES := \ 1031b362b15af34006e6a11974088a46d42b903418eJohann $(libvpx_source_dir) \ 1041b362b15af34006e6a11974088a46d42b903418eJohann $(libvpx_config_dir) \ 1051b362b15af34006e6a11974088a46d42b903418eJohann $(libvpx_intermediates)/vp8/common \ 1061b362b15af34006e6a11974088a46d42b903418eJohann $(libvpx_intermediates)/vp8/decoder \ 107ca15b5fc158a9df465aaf1acfe38d8cb5042c81bKunter Gultekin $(libvpx_intermediates)/vp8/encoder \ 108ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang $(libvpx_intermediates)/vpx_scale \ 1091b362b15af34006e6a11974088a46d42b903418eJohann 1101b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_target := 1111b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm := 1121b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_config_dir := 1131b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_source_dir := 1141b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs := 1151b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_intermediates := 1161b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs_unique := 1171b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs_c := 1181b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_codec_srcs_c_static := 1191b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm_offsets_intermediates := 1201b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm_offsets_files := 1211b362b15af34006e6a11974088a46d42b903418eJohannlibvpx_asm_srcs := 1221b362b15af34006e6a11974088a46d42b903418eJohann 1231b362b15af34006e6a11974088a46d42b903418eJohanninclude $(BUILD_STATIC_LIBRARY) 124