This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2d3776b8cc97e605883b1352f6e798791e54cf06 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Mon Mar 9 12:36:05 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Tue Jun 23 19:15:57 2026 +0200 avutil/x86/emms: Unavpriv avpriv_emms_asm() This fallback function is used if external MMX is available, while inline MMX and intrinsics for emitting emms are unavailable. It is implemented as an avpriv function, which has several drawbacks for shared builds: 1. The function is so small (3 bytes; 16 with padding) that the overhead of exporting and importing it dwarfs the gains from code deduplication. 2. A call to an external library has more overhead than a library-internal one. 3. It may cause linking failures when a libavutil not exporting avpriv_emms_asm() is paired with a library needing it (if inline assembly and intrinsics were unavailable when building the dependent library). I am not aware of this ever happening. 4. We would be forced to keep avpriv_emms_asm() around for ABI stability even after it is no longer needed. This commit therefore uses the STLIBOBJS, SHLIBOBJS approach to duplicating it into each library on its own if needed. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/Makefile | 4 ++++ {libavutil => libavcodec}/x86/emms.asm | 13 +------------ libavfilter/x86/Makefile | 4 ++++ {libavutil => libavfilter}/x86/emms.asm | 13 +------------ libavutil/emms.h | 5 ++--- libavutil/x86/Makefile | 3 ++- libavutil/x86/emms.asm | 4 ++-- libswscale/x86/Makefile | 4 ++++ {libavutil => libswscale}/x86/emms.asm | 13 +------------ 9 files changed, 21 insertions(+), 42 deletions(-) diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index e87cb750f4..890ac15f2a 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -1,5 +1,9 @@ OBJS += x86/constants.o \ +EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o +# Add internal copy of ff_emms() to lavc for shared builds (if needed). +SHLIBOBJS += $(EMMS_OBJS__yes_) + # subsystems X86ASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o X86ASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o diff --git a/libavutil/x86/emms.asm b/libavcodec/x86/emms.asm similarity index 74% copy from libavutil/x86/emms.asm copy to libavcodec/x86/emms.asm index df84f2221b..513a0e9fd8 100644 --- a/libavutil/x86/emms.asm +++ b/libavcodec/x86/emms.asm @@ -1,6 +1,4 @@ ;***************************************************************************** -;* Copyright (C) 2013 Martin Storsjo -;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or @@ -18,13 +16,4 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86util.asm" - -SECTION .text - -;----------------------------------------------------------------------------- -; void avpriv_emms_asm(void) -;----------------------------------------------------------------------------- -cvisible emms_asm, 0, 0 - emms - RET +%include "libavutil/x86/emms.asm" diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile index ade0efc9ae..cfbed4317c 100644 --- a/libavfilter/x86/Makefile +++ b/libavfilter/x86/Makefile @@ -1,6 +1,10 @@ OBJS-$(CONFIG_NOISE_FILTER) += x86/vf_noise.o OBJS-$(CONFIG_SPP_FILTER) += x86/vf_spp.o +EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o +# Add internal copy of ff_emms() to libavfilter for shared builds (if needed). +SHLIBOBJS-$(CONFIG_FSPP_FILTER) += $(EMMS_OBJS__yes_) + X86ASM-OBJS-$(CONFIG_SCENE_SAD) += x86/scene_sad.o x86/scene_sad_init.o X86ASM-OBJS-$(CONFIG_AFIR_FILTER) += x86/af_afir.o x86/af_afir_init.o diff --git a/libavutil/x86/emms.asm b/libavfilter/x86/emms.asm similarity index 74% copy from libavutil/x86/emms.asm copy to libavfilter/x86/emms.asm index df84f2221b..513a0e9fd8 100644 --- a/libavutil/x86/emms.asm +++ b/libavfilter/x86/emms.asm @@ -1,6 +1,4 @@ ;***************************************************************************** -;* Copyright (C) 2013 Martin Storsjo -;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or @@ -18,13 +16,4 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86util.asm" - -SECTION .text - -;----------------------------------------------------------------------------- -; void avpriv_emms_asm(void) -;----------------------------------------------------------------------------- -cvisible emms_asm, 0, 0 - emms - RET +%include "libavutil/x86/emms.asm" diff --git a/libavutil/emms.h b/libavutil/emms.h index 2b9a456223..bad0bdbd9c 100644 --- a/libavutil/emms.h +++ b/libavutil/emms.h @@ -28,8 +28,6 @@ #if ARCH_X86 -void avpriv_emms_asm(void); - #if HAVE_MMX_INLINE #ifndef __MMX__ #include "libavutil/cpu.h" @@ -80,7 +78,8 @@ static inline void ff_assert0_fpu(const char *file, int line_number) # include <mmintrin.h> # define emms_c _mm_empty #elif HAVE_MMX_EXTERNAL -# define emms_c avpriv_emms_asm +void ff_emms_asm(void); +# define emms_c ff_emms_asm #endif /* HAVE_MMX_INLINE */ #endif /* ARCH_X86 */ diff --git a/libavutil/x86/Makefile b/libavutil/x86/Makefile index 590758ce78..a305503c0f 100644 --- a/libavutil/x86/Makefile +++ b/libavutil/x86/Makefile @@ -1,10 +1,11 @@ OBJS += x86/cpu.o \ EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o +# For static builds, libavutil provides ff_emms for all libraries (if needed). +STLIBOBJS += $(EMMS_OBJS__yes_) X86ASM-OBJS += x86/cpuid.o \ x86/crc.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 \ diff --git a/libavutil/x86/emms.asm b/libavutil/x86/emms.asm index df84f2221b..485fba4557 100644 --- a/libavutil/x86/emms.asm +++ b/libavutil/x86/emms.asm @@ -23,8 +23,8 @@ SECTION .text ;----------------------------------------------------------------------------- -; void avpriv_emms_asm(void) +; void ff_emms_asm(void) ;----------------------------------------------------------------------------- -cvisible emms_asm, 0, 0 +cglobal emms_asm, 0, 0 emms RET diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile index 2eeb2b2627..0f7a3dbf2d 100644 --- a/libswscale/x86/Makefile +++ b/libswscale/x86/Makefile @@ -6,6 +6,10 @@ OBJS-$(HAVE_MMXEXT_INLINE) += x86/hscale_fast_bilinear_simd.o \ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o +EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o +# Add internal copy of ff_emms() to swscale for shared builds (if needed). +SHLIBOBJS += $(EMMS_OBJS__yes_) + X86ASM-OBJS += x86/input.o \ x86/output.o \ x86/scale.o \ diff --git a/libavutil/x86/emms.asm b/libswscale/x86/emms.asm similarity index 74% copy from libavutil/x86/emms.asm copy to libswscale/x86/emms.asm index df84f2221b..513a0e9fd8 100644 --- a/libavutil/x86/emms.asm +++ b/libswscale/x86/emms.asm @@ -1,6 +1,4 @@ ;***************************************************************************** -;* Copyright (C) 2013 Martin Storsjo -;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or @@ -18,13 +16,4 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86util.asm" - -SECTION .text - -;----------------------------------------------------------------------------- -; void avpriv_emms_asm(void) -;----------------------------------------------------------------------------- -cvisible emms_asm, 0, 0 - emms - RET +%include "libavutil/x86/emms.asm" _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
