Files
ffmpeg/libswscale/x86/Makefile
T
Niklas Haas 6deae052a2 swscale/x86/uops: generate NASM macros using uops_macros.h
Rather than hard-coding a separate set of NASM macros, or generating them
with a separate function, we can just leverage the C preprocessor to generate
a NASM source file *from* the existing ops macros.

This is maybe a bit unorthodox, but it avoids unnecessary overhead from
re-generating the macros twice, avoids manual updating of the NASM macros,
and generally does not come with any real downside except being a bit ugly.

The main source of ugliness is the fact that the C preprocessor expands
everything into a single line, whereas NASM expects separate statements to
be on separate lines. Very fortunately, we can work around this by writing a
another NASM macro to take its arguments and dump them onto multiple lines.

It may seem premature, but I went ahead and defined all the macros, since
it was easy enough to do.

I added the %include in this commit to trigger build errors that occur only
as a result of introducing this file in the same commit that introduces it.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00

33 lines
1.6 KiB
Makefile

OBJS += x86/rgb2rgb.o \
x86/swscale.o \
x86/yuv2rgb.o \
OBJS-$(HAVE_MMXEXT_INLINE) += x86/hscale_fast_bilinear_simd.o \
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
X86ASM-OBJS += x86/input.o \
x86/output.o \
x86/scale.o \
x86/scale_avx2.o \
x86/range_convert.o \
x86/rgb_2_rgb.o \
x86/yuv_2_rgb.o \
x86/yuv2yuvX.o \
SKIPHEADERS += x86/uops_macros.asm.h
ifdef ARCH_X86_64
X86ASM-OBJS-$(CONFIG_UNSTABLE) += x86/ops_common.o \
x86/ops_int.o \
x86/ops_float.o \
x86/ops.o
$(SUBDIR)x86/ops_common.o: $(SUBDIR)x86/uops_macros.gen.asm
$(SUBDIR)x86/ops_int.o: $(SUBDIR)x86/uops_macros.gen.asm
$(SUBDIR)x86/ops_float.o: $(SUBDIR)x86/uops_macros.gen.asm
$(SUBDIR)x86/uops_macros.gen.asm: $(SRC_PATH)/libswscale/x86/uops_macros.asm.h \
$(SRC_PATH)/libswscale/uops_macros.h
$(HOSTCC) $(CC_E) $(CPPFLAGS) $<
endif