[x264-devel] [PATCH 24/32] Enable assembly templating for x86 architecture

Vittorio Giovara vittorio.giovara at gmail.com
Fri Jan 20 15:20:49 CET 2017


Use private_prefix to rename all internal asm symbols.
---
 Makefile  | 26 +++++++++++++++++++-------
 configure |  6 ------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index b0516e9..4ce4c60 100644
--- a/Makefile
+++ b/Makefile
@@ -84,12 +84,10 @@ endif
 ifneq ($(AS),)
 X86SRC0 = const-a.asm cabac-a.asm dct-a.asm deblock-a.asm mc-a.asm \
           mc-a2.asm pixel-a.asm predict-a.asm quant-a.asm \
-          cpu-a.asm dct-32.asm bitstream-a.asm
-ifneq ($(findstring HIGH_BIT_DEPTH, $(CONFIG)),)
-X86SRC0 += sad16-a.asm
-else
-X86SRC0 += sad-a.asm
-endif
+          dct-32.asm bitstream-a.asm
+ASMSRCCOMMON = common/x86/cpu-a.asm
+ASMSRC8 = common/x86/sad-a.asm
+ASMSRC10 = common/x86/sad16-a.asm
 X86SRC = $(X86SRC0:%=common/x86/%)
 
 ifeq ($(SYS_ARCH),X86)
@@ -104,7 +102,11 @@ endif
 
 ifdef ARCH_X86
 SRCS   += common/x86/mc-c.c common/x86/predict-c.c
-OBJASM  = $(ASMSRC:%.asm=%.o)
+
+OBJASM += $(ASMSRCCOMMON:%.asm=%.o)
+OBJASM += $(ASMSRC:%.asm=8bit/%.o) $(ASMSRC8:%.asm=8bit/%.o)
+OBJASM += $(ASMSRC:%.asm=10bit/%.o) $(ASMSRC10:%.asm=10bit/%.o)
+
 $(OBJASM): common/x86/x86inc.asm common/x86/x86util.asm
 OBJCHK += tools/checkasm-a.o
 endif
@@ -239,6 +241,16 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJEXAMPLE): .depend
 	$(AS) $(ASFLAGS) -o $@ $<
 	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
 
+8bit/%.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
+	@mkdir -p $(dir $@)
+	$(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -Dprivate_prefix=x264_8
+	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
+
+10bit/%.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
+	@mkdir -p $(dir $@)
+	$(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10 -Dprivate_prefix=x264_10
+	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
+
 %.o: %.S
 	$(AS) $(ASFLAGS) -o $@ $<
 	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
diff --git a/configure b/configure
index 4cead04..722a948 100755
--- a/configure
+++ b/configure
@@ -1245,19 +1245,13 @@ if [ $compiler = ICC -o $compiler = ICL ] ; then
 fi
 
 if [ "$bit_depth" -gt "8" ]; then
-    define HIGH_BIT_DEPTH
-    ASFLAGS="$ASFLAGS -DHIGH_BIT_DEPTH=1"
     opencl="no"
-else
-    ASFLAGS="$ASFLAGS -DHIGH_BIT_DEPTH=0"
 fi
 
 if [ "$chroma_format" != "all" ]; then
     define CHROMA_FORMAT CHROMA_$chroma_format
 fi
 
-ASFLAGS="$ASFLAGS -DBIT_DEPTH=$bit_depth"
-
 [ $gpl = yes ] && define HAVE_GPL && x264_gpl=1 || x264_gpl=0
 
 [ $interlaced = yes ] && define HAVE_INTERLACED && x264_interlaced=1 || x264_interlaced=0
-- 
2.10.0



More information about the x264-devel mailing list