avutil/x86/Makefile: Only compile ASM init files when X86ASM is enabled

To do so, simply add these init files to X86ASM-OBJS instead of OBJS
in the Makefile. The former is already used for the actual assembly
files, but using them for the C init files just works, because the build
system uses file extensions to derive whether it is a C or a NASM file.

This avoids compiling unused function stubs and also reduces our
reliance on DCE: We don't add %if checks to the asm files except
for AVX, AVX2, FMA3, FMA4, XOP and AVX512, so all the MMX-SSE4
functions will be available. It also allows to remove HAVE_X86ASM checks
in these init files.

Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-11-30 22:20:13 +01:00
parent d5a47bf2b3
commit 59d75bf9e4
7 changed files with 16 additions and 25 deletions
+1 -1
View File
@@ -237,7 +237,7 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
a->rounds = rounds;
a->crypt = decrypt ? aes_decrypt : aes_encrypt;
#if ARCH_X86
#if ARCH_X86 && HAVE_X86ASM
ff_init_aes_x86(a, decrypt);
#endif
+1 -1
View File
@@ -165,7 +165,7 @@ AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact)
#if ARCH_RISCV
ff_fixed_dsp_init_riscv(fdsp);
#elif ARCH_X86
#elif ARCH_X86 && HAVE_X86ASM
ff_fixed_dsp_init_x86(fdsp);
#endif
+1 -1
View File
@@ -159,7 +159,7 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
ff_float_dsp_init_ppc(fdsp, bit_exact);
#elif ARCH_RISCV
ff_float_dsp_init_riscv(fdsp);
#elif ARCH_X86
#elif ARCH_X86 && HAVE_X86ASM
ff_float_dsp_init_x86(fdsp);
#elif ARCH_MIPS
ff_float_dsp_init_mips(fdsp);
+1 -1
View File
@@ -362,7 +362,7 @@ void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
{
int ret = -1;
#if ARCH_X86
#if ARCH_X86 && HAVE_X86ASM
ret = ff_image_copy_plane_uc_from_x86(dst, dst_linesize, src, src_linesize,
bytewidth, height);
#endif
+1 -1
View File
@@ -114,7 +114,7 @@ av_cold void avpriv_init_lls(LLSModel *m, int indep_count)
m->evaluate_lls = evaluate_lls;
#if ARCH_RISCV
ff_init_lls_riscv(m);
#elif ARCH_X86
#elif ARCH_X86 && HAVE_X86ASM
ff_init_lls_x86(m);
#endif
}
+1 -1
View File
@@ -86,7 +86,7 @@ av_pixelutils_sad_fn av_pixelutils_get_sad_fn(int w_bits, int h_bits, int aligne
if (w_bits != h_bits) // only squared sad for now
return NULL;
#if ARCH_X86
#if ARCH_X86 && HAVE_X86ASM
ff_pixelutils_sad_init_x86(sad, aligned);
#endif
+10 -19
View File
@@ -1,23 +1,14 @@
OBJS += x86/aes_init.o \
x86/cpu.o \
x86/fixed_dsp_init.o \
x86/float_dsp_init.o \
x86/imgutils_init.o \
x86/lls_init.o \
OBJS-$(HAVE_X86ASM) += x86/tx_float_init.o \
OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils_init.o \
OBJS += x86/cpu.o \
EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o
X86ASM-OBJS += x86/aes.o \
x86/cpuid.o \
$(EMMS_OBJS__yes_) \
x86/fixed_dsp.o \
x86/float_dsp.o \
x86/imgutils.o \
x86/lls.o \
x86/tx_float.o \
X86ASM-OBJS += x86/aes.o x86/aes_init.o \
x86/cpuid.o \
$(EMMS_OBJS__yes_) \
x86/fixed_dsp.o x86/fixed_dsp_init.o \
x86/float_dsp.o x86/float_dsp_init.o \
x86/imgutils.o x86/imgutils_init.o \
x86/lls.o x86/lls_init.o \
x86/tx_float.o x86/tx_float_init.o \
X86ASM-OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils.o \
X86ASM-OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils.o x86/pixelutils_init.o