From 788b67cbde2bd89283ca403aa5a7dbddc4090711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Apr 2014 10:36:18 +0300 Subject: [PATCH 1/6] Fix the indentation of a line in targets.mk This would be avoided if the targets.mk files are updated by rerunning mktargets.sh instead of manually updating them. --- test/encoder/targets.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/encoder/targets.mk b/test/encoder/targets.mk index fb513129..eed9dc08 100644 --- a/test/encoder/targets.mk +++ b/test/encoder/targets.mk @@ -8,7 +8,7 @@ ENCODER_UNITTEST_CPP_SRCS=\ $(ENCODER_UNITTEST_SRCDIR)/EncUT_GetIntraPredictor.cpp\ $(ENCODER_UNITTEST_SRCDIR)/EncUT_MemoryAlloc.cpp\ $(ENCODER_UNITTEST_SRCDIR)/EncUT_MotionEstimate.cpp\ - $(ENCODER_UNITTEST_SRCDIR)/EncUT_Sample.cpp\ + $(ENCODER_UNITTEST_SRCDIR)/EncUT_Sample.cpp\ ENCODER_UNITTEST_OBJS += $(ENCODER_UNITTEST_CPP_SRCS:.cpp=.$(OBJ)) From 764f787dcbde7c608fe16f8fe9291dffedbde371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Apr 2014 10:44:44 +0300 Subject: [PATCH 2/6] Rename the makefile variable for arm assembly sources This is in preparation for adding support for the aarc64 assembly files as well. --- build/mktargets.py | 4 ++-- codec/common/targets.mk | 4 ++-- codec/decoder/targets.mk | 4 ++-- codec/encoder/targets.mk | 4 ++-- codec/processing/targets.mk | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/mktargets.py b/build/mktargets.py index 1b9054cf..a904b4fc 100755 --- a/build/mktargets.py +++ b/build/mktargets.py @@ -142,11 +142,11 @@ if len(asm) > 0: if len(sfiles) > 0: f.write("ifeq ($(ASM_ARCH), arm)\n") - f.write("%s_ASM_S_SRCS=\\\n"%(PREFIX)) + f.write("%s_ASM_ARM_SRCS=\\\n"%(PREFIX)) for c in sfiles: f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c)) f.write("\n") - f.write("%s_OBJS += $(%s_ASM_S_SRCS:.S=.$(OBJ))\n"%(PREFIX, PREFIX)) + f.write("%s_OBJS += $(%s_ASM_ARM_SRCS:.S=.$(OBJ))\n"%(PREFIX, PREFIX)) f.write("endif\n\n") f.write("OBJS += $(%s_OBJS)\n"%PREFIX) diff --git a/codec/common/targets.mk b/codec/common/targets.mk index 3dfb45bd..a942155d 100644 --- a/codec/common/targets.mk +++ b/codec/common/targets.mk @@ -25,13 +25,13 @@ COMMON_OBJS += $(COMMON_ASM_SRCS:.asm=.$(OBJ)) endif ifeq ($(ASM_ARCH), arm) -COMMON_ASM_S_SRCS=\ +COMMON_ASM_ARM_SRCS=\ $(COMMON_SRCDIR)/arm/copy_mb_neon.S\ $(COMMON_SRCDIR)/arm/deblocking_neon.S\ $(COMMON_SRCDIR)/arm/expand_picture_neon.S\ $(COMMON_SRCDIR)/arm/mc_neon.S\ -COMMON_OBJS += $(COMMON_ASM_S_SRCS:.S=.$(OBJ)) +COMMON_OBJS += $(COMMON_ASM_ARM_SRCS:.S=.$(OBJ)) endif OBJS += $(COMMON_OBJS) diff --git a/codec/decoder/targets.mk b/codec/decoder/targets.mk index c7aa029c..d6953b92 100644 --- a/codec/decoder/targets.mk +++ b/codec/decoder/targets.mk @@ -35,11 +35,11 @@ DECODER_OBJS += $(DECODER_ASM_SRCS:.asm=.$(OBJ)) endif ifeq ($(ASM_ARCH), arm) -DECODER_ASM_S_SRCS=\ +DECODER_ASM_ARM_SRCS=\ $(DECODER_SRCDIR)/core/arm/block_add_neon.S\ $(DECODER_SRCDIR)/core/arm/intra_pred_neon.S\ -DECODER_OBJS += $(DECODER_ASM_S_SRCS:.S=.$(OBJ)) +DECODER_OBJS += $(DECODER_ASM_ARM_SRCS:.S=.$(OBJ)) endif OBJS += $(DECODER_OBJS) diff --git a/codec/encoder/targets.mk b/codec/encoder/targets.mk index 028b0d0b..52d3324a 100644 --- a/codec/encoder/targets.mk +++ b/codec/encoder/targets.mk @@ -50,14 +50,14 @@ ENCODER_OBJS += $(ENCODER_ASM_SRCS:.asm=.$(OBJ)) endif ifeq ($(ASM_ARCH), arm) -ENCODER_ASM_S_SRCS=\ +ENCODER_ASM_ARM_SRCS=\ $(ENCODER_SRCDIR)/core/arm/intra_pred_neon.S\ $(ENCODER_SRCDIR)/core/arm/intra_pred_sad_3_opt_neon.S\ $(ENCODER_SRCDIR)/core/arm/memory_neon.S\ $(ENCODER_SRCDIR)/core/arm/pixel_neon.S\ $(ENCODER_SRCDIR)/core/arm/reconstruct_neon.S\ -ENCODER_OBJS += $(ENCODER_ASM_S_SRCS:.S=.$(OBJ)) +ENCODER_OBJS += $(ENCODER_ASM_ARM_SRCS:.S=.$(OBJ)) endif OBJS += $(ENCODER_OBJS) diff --git a/codec/processing/targets.mk b/codec/processing/targets.mk index fc3fbc10..c107d54c 100644 --- a/codec/processing/targets.mk +++ b/codec/processing/targets.mk @@ -31,13 +31,13 @@ PROCESSING_OBJS += $(PROCESSING_ASM_SRCS:.asm=.$(OBJ)) endif ifeq ($(ASM_ARCH), arm) -PROCESSING_ASM_S_SRCS=\ +PROCESSING_ASM_ARM_SRCS=\ $(PROCESSING_SRCDIR)/src/arm/adaptive_quantization.S\ $(PROCESSING_SRCDIR)/src/arm/down_sample_neon.S\ $(PROCESSING_SRCDIR)/src/arm/pixel_sad_neon.S\ $(PROCESSING_SRCDIR)/src/arm/vaa_calc_neon.S\ -PROCESSING_OBJS += $(PROCESSING_ASM_S_SRCS:.S=.$(OBJ)) +PROCESSING_OBJS += $(PROCESSING_ASM_ARM_SRCS:.S=.$(OBJ)) endif OBJS += $(PROCESSING_OBJS) From c8901c7dcd032cca6c2d083697585c3a8f51ff05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Apr 2014 10:49:30 +0300 Subject: [PATCH 3/6] Add support for arm64 assembly source files in mktargets.py Disambiguate between arm and arm64 sources by checking the directory names. The arm assembly sources can be assembled on arm64 and vice versa without any effect since all of the implementation is hidden behind the HAVE_NEON and HAVE_NEON_AARCH64 defines, but it still is cleaner to not build extra empty object files than to build all *.S files on all arm variants. (The iOS project files build all of the arm assembly files, regardless of the target architecture, since individual files can't easily be excluded based on the target architecture there.) --- build/mktargets.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/build/mktargets.py b/build/mktargets.py index a904b4fc..7be453c0 100755 --- a/build/mktargets.py +++ b/build/mktargets.py @@ -112,6 +112,14 @@ cpp = sorted(cpp, key=lambda s: s.lower()) asm = sorted(asm, key=lambda s: s.lower()) cfiles = sorted(cfiles, key=lambda s: s.lower()) sfiles = sorted(sfiles, key=lambda s: s.lower()) +armfiles = [] +arm64files = [] +for file in sfiles: + c = file.split('/') + if 'arm64' in c: + arm64files.append(file) + elif 'arm' in c: + armfiles.append(file) @@ -140,15 +148,24 @@ if len(asm) > 0: f.write("%s_OBJS += $(%s_ASM_SRCS:.asm=.$(OBJ))\n"%(PREFIX, PREFIX)) f.write("endif\n\n") -if len(sfiles) > 0: +if len(armfiles) > 0: f.write("ifeq ($(ASM_ARCH), arm)\n") f.write("%s_ASM_ARM_SRCS=\\\n"%(PREFIX)) - for c in sfiles: + for c in armfiles: f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c)) f.write("\n") f.write("%s_OBJS += $(%s_ASM_ARM_SRCS:.S=.$(OBJ))\n"%(PREFIX, PREFIX)) f.write("endif\n\n") +if len(arm64files) > 0: + f.write("ifeq ($(ASM_ARCH), arm64)\n") + f.write("%s_ASM_ARM64_SRCS=\\\n"%(PREFIX)) + for c in arm64files: + f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c)) + f.write("\n") + f.write("%s_OBJS += $(%s_ASM_ARM64_SRCS:.S=.$(OBJ))\n"%(PREFIX, PREFIX)) + f.write("endif\n\n") + f.write("OBJS += $(%s_OBJS)\n"%PREFIX) write_cpp_rule_pattern(f) From 84ff82ee24381a0863a4b145e12441b136ff645a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Apr 2014 10:51:21 +0300 Subject: [PATCH 4/6] Exclude the new arm64 include file --- build/mktargets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/mktargets.sh b/build/mktargets.sh index 6514b2be..e2e9de9f 100755 --- a/build/mktargets.sh +++ b/build/mktargets.sh @@ -2,7 +2,7 @@ cd "$(git rev-parse --show-toplevel 2>/dev/null)" >/dev/null 2>&1 python build/mktargets.py --directory codec/decoder --library decoder python build/mktargets.py --directory codec/encoder --library encoder --exclude DllEntry.cpp -python build/mktargets.py --directory codec/common --library common --exclude asm_inc.asm --exclude arm_arch_common_macro.S +python build/mktargets.py --directory codec/common --library common --exclude asm_inc.asm --exclude arm_arch_common_macro.S --exclude arm_arch64_common_macro.S python build/mktargets.py --directory codec/processing --library processing python build/mktargets.py --directory codec/console/dec --binary h264dec From 3c2e9cd7bf7fb266166e4cf4e3b900cebd7db8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Apr 2014 10:51:39 +0300 Subject: [PATCH 5/6] Regenerate makefiles to include the new arm64 assembly files --- codec/common/targets.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/codec/common/targets.mk b/codec/common/targets.mk index a942155d..1e17bb2f 100644 --- a/codec/common/targets.mk +++ b/codec/common/targets.mk @@ -34,6 +34,14 @@ COMMON_ASM_ARM_SRCS=\ COMMON_OBJS += $(COMMON_ASM_ARM_SRCS:.S=.$(OBJ)) endif +ifeq ($(ASM_ARCH), arm64) +COMMON_ASM_ARM64_SRCS=\ + $(COMMON_SRCDIR)/arm64/expand_picture_aarch64_neon.S\ + $(COMMON_SRCDIR)/arm64/mc_aarch64_neon.S\ + +COMMON_OBJS += $(COMMON_ASM_ARM64_SRCS:.S=.$(OBJ)) +endif + OBJS += $(COMMON_OBJS) $(COMMON_SRCDIR)/%.$(OBJ): $(COMMON_SRCDIR)/%.cpp $(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c $(CXX_O) $< From f1b2d51d8624431ca161f20149d157117c1c16f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Apr 2014 10:53:39 +0300 Subject: [PATCH 6/6] Add support for building the arm64 assembly in platform-arch.mk --- build/platform-arch.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/platform-arch.mk b/build/platform-arch.mk index 82dc0d33..185abc24 100644 --- a/build/platform-arch.mk +++ b/build/platform-arch.mk @@ -8,3 +8,10 @@ ASMFLAGS += -Icodec/common/arm/ CFLAGS += -DHAVE_NEON endif endif +ifneq ($(filter arm64 aarch64, $(ARCH)),) +ifeq ($(USE_ASM), Yes) +ASM_ARCH = arm64 +ASMFLAGS += -Icodec/common/arm64/ +CFLAGS += -DHAVE_NEON_AARCH64 +endif +endif