This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit ba793127c413ba27386cea4c23db021b1eaa8d56
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sat Mar 14 23:28:45 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Thu Mar 19 14:44:40 2026 +0100

    avcodec/x86/mpeg4videodsp: Use SSE2 emulated_edge_mc
    
    Possible now that this function is no longer MMX.
    
    Old benchmarks:
    gmc_edge_emulation_c:                                  782.3 ( 1.00x)
    gmc_edge_emulation_ssse3:                              220.3 ( 3.55x)
    
    New benchmarks:
    gmc_edge_emulation_c:                                  770.9 ( 1.00x)
    gmc_edge_emulation_ssse3:                              111.0 ( 6.94x)
    
    Reviewed-by: Lynne <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/videodsp.c                   |  4 ++--
 libavcodec/videodsp.h                   |  8 --------
 libavcodec/videodsp_template.c          | 15 ++++++---------
 libavcodec/x86/mpeg4videodsp.c          |  5 +++--
 libavcodec/{exrdsp.h => x86/videodsp.h} | 20 +++++++++-----------
 libavcodec/x86/videodsp_init.c          | 15 ++++++++-------
 6 files changed, 28 insertions(+), 39 deletions(-)

diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
index c66757ce83..230a1bfb74 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -40,9 +40,9 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
 {
     ctx->prefetch = just_return;
     if (bpc <= 8) {
-        ctx->emulated_edge_mc = ff_emulated_edge_mc_8;
+        ctx->emulated_edge_mc = emulated_edge_mc_8;
     } else {
-        ctx->emulated_edge_mc = ff_emulated_edge_mc_16;
+        ctx->emulated_edge_mc = emulated_edge_mc_16;
     }
 
 #if ARCH_AARCH64
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h
index 1be3188d09..4f081e0869 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -29,14 +29,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#define EMULATED_EDGE(depth) \
-void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \
-                                   ptrdiff_t dst_stride, ptrdiff_t src_stride, 
\
-                                   int block_w, int block_h,\
-                                   int src_x, int src_y, int w, int h);
-
-EMULATED_EDGE(8)
-
 typedef struct VideoDSPContext {
     /**
      * Copy a rectangular area of samples to a temporary buffer and replicate
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
index d653f4d524..2475366157 100644
--- a/libavcodec/videodsp_template.c
+++ b/libavcodec/videodsp_template.c
@@ -20,15 +20,12 @@
  */
 
 #include "bit_depth_template.c"
-#if BIT_DEPTH != 8
-// ff_emulated_edge_mc_8 is used by the x86 MpegVideoDSP API.
-static
-#endif
-void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
-                               ptrdiff_t buf_linesize,
-                               ptrdiff_t src_linesize,
-                               int block_w, int block_h,
-                               int src_x, int src_y, int w, int h)
+
+static void FUNC(emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
+                                   ptrdiff_t buf_linesize,
+                                   ptrdiff_t src_linesize,
+                                   int block_w, int block_h,
+                                   int src_x, int src_y, int w, int h)
 {
     int x, y;
     int start_y, start_x, end_y, end_x;
diff --git a/libavcodec/x86/mpeg4videodsp.c b/libavcodec/x86/mpeg4videodsp.c
index f3f7036157..47fd413da7 100644
--- a/libavcodec/x86/mpeg4videodsp.c
+++ b/libavcodec/x86/mpeg4videodsp.c
@@ -23,7 +23,7 @@
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/mpeg4videodsp.h"
-#include "libavcodec/videodsp.h"
+#include "videodsp.h"
 
 #if HAVE_SSSE3_INLINE
 
@@ -83,7 +83,8 @@ static void gmc_ssse3(uint8_t *dst, const uint8_t *src,
     const ptrdiff_t dst_stride = stride;
     ptrdiff_t src_stride = stride;
     if (need_emu) {
-        ff_emulated_edge_mc_8(edge_buf, src, EDGE_EMU_STRIDE, src_stride, w + 
1, h + 1, ix, iy, width, height);
+        ff_emulated_edge_mc_sse2(edge_buf, src, EDGE_EMU_STRIDE, src_stride,
+                                 w + 1, h + 1, ix, iy, width, height);
         src        = edge_buf;
         src_stride = EDGE_EMU_STRIDE;
     }
diff --git a/libavcodec/exrdsp.h b/libavcodec/x86/videodsp.h
similarity index 65%
copy from libavcodec/exrdsp.h
copy to libavcodec/x86/videodsp.h
index ea37c8b08e..5d58108c98 100644
--- a/libavcodec/exrdsp.h
+++ b/libavcodec/x86/videodsp.h
@@ -16,19 +16,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVCODEC_EXRDSP_H
-#define AVCODEC_EXRDSP_H
+#ifndef AVCODEC_X86_VIDEODSP_H
+#define AVCODEC_X86_VIDEODSP_H
 
 #include <stddef.h>
 #include <stdint.h>
 
-typedef struct ExrDSPContext {
-    void (*reorder_pixels)(uint8_t *dst, const uint8_t *src, ptrdiff_t size);
-    void (*predictor)(uint8_t *src, ptrdiff_t size);
-} ExrDSPContext;
+void ff_emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src,
+                              ptrdiff_t buf_stride,
+                              ptrdiff_t src_stride,
+                              int block_w, int block_h,
+                              int src_x, int src_y, int w,
+                              int h);
 
-void ff_exrdsp_init(ExrDSPContext *c);
-void ff_exrdsp_init_riscv(ExrDSPContext *c);
-void ff_exrdsp_init_x86(ExrDSPContext *c);
-
-#endif /* AVCODEC_EXRDSP_H */
+#endif /* AVCODEC_X86_VIDEODSP_H */
diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c
index 7f3c837227..e40482e1d0 100644
--- a/libavcodec/x86/videodsp_init.c
+++ b/libavcodec/x86/videodsp_init.c
@@ -27,6 +27,7 @@
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/videodsp.h"
+#include "videodsp.h"
 
 typedef void emu_edge_vfix_func(uint8_t *dst, x86_reg dst_stride,
                                 const uint8_t *src, x86_reg src_stride,
@@ -187,12 +188,12 @@ static av_always_inline void emulated_edge_mc(uint8_t 
*dst, const uint8_t *src,
     }
 }
 
-static av_noinline void emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src,
-                                              ptrdiff_t buf_stride,
-                                              ptrdiff_t src_stride,
-                                              int block_w, int block_h,
-                                              int src_x, int src_y, int w,
-                                              int h)
+void ff_emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src,
+                              ptrdiff_t buf_stride,
+                              ptrdiff_t src_stride,
+                              int block_w, int block_h,
+                              int src_x, int src_y, int w,
+                              int h)
 {
     emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
                      src_x, src_y, w, h, vfixtbl_sse2, &ff_emu_edge_vvar_sse,
@@ -223,7 +224,7 @@ av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int 
bpc)
         ctx->prefetch = ff_prefetch_mmxext;
     }
     if (EXTERNAL_SSE2(cpu_flags) && bpc <= 8) {
-        ctx->emulated_edge_mc = emulated_edge_mc_sse2;
+        ctx->emulated_edge_mc = ff_emulated_edge_mc_sse2;
     }
 #if HAVE_AVX2_EXTERNAL
     if (EXTERNAL_AVX2(cpu_flags) && bpc <= 8) {

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to