[FFmpeg-devel] [PATCH] x86/dsputil: remove redundant global motion compensation code
James Almer
jamrial at gmail.com
Mon Jun 23 01:34:14 CEST 2014
The SSE version has been no different than the mmx one since commit a41bf09d
Signed-off-by: James Almer <jamrial at gmail.com>
---
Alternatively, emulated_edge_mc_mmx and emulated_edge_mc_sse from videodsp could
be shared and the changes from commit a41bf09d undone, but for this I'd rather
wait until we merge the libav's split of this function into the new mpegvideodsp
context.
libavcodec/x86/dsputil_init.c | 15 +------------
libavcodec/x86/dsputil_mmx.c | 49 ++++++-------------------------------------
libavcodec/x86/dsputil_x86.h | 5 -----
3 files changed, 7 insertions(+), 62 deletions(-)
diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c
index ed58598..89f26e6 100644
--- a/libavcodec/x86/dsputil_init.c
+++ b/libavcodec/x86/dsputil_init.c
@@ -61,7 +61,7 @@ static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx,
}
}
-#if CONFIG_VIDEODSP && (ARCH_X86_32 || !HAVE_YASM)
+#if CONFIG_VIDEODSP
c->gmc = ff_gmc_mmx;
#endif
#endif /* HAVE_MMX_INLINE */
@@ -83,16 +83,6 @@ static av_cold void dsputil_init_mmxext(DSPContext *c, AVCodecContext *avctx,
#endif /* HAVE_MMXEXT_INLINE */
}
-static av_cold void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx,
- int cpu_flags, unsigned high_bit_depth)
-{
-#if HAVE_YASM
-#if HAVE_INLINE_ASM && CONFIG_VIDEODSP
- c->gmc = ff_gmc_sse;
-#endif
-#endif /* HAVE_YASM */
-}
-
static av_cold void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
int cpu_flags, unsigned high_bit_depth)
{
@@ -130,9 +120,6 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
if (X86_MMXEXT(cpu_flags))
dsputil_init_mmxext(c, avctx, cpu_flags, high_bit_depth);
- if (X86_SSE(cpu_flags))
- dsputil_init_sse(c, avctx, cpu_flags, high_bit_depth);
-
if (X86_SSE2(cpu_flags))
dsputil_init_sse2(c, avctx, cpu_flags, high_bit_depth);
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 54aba38..3100399 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -247,17 +247,11 @@ void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height,
}
}
-typedef void emulated_edge_mc_func(uint8_t *dst, const uint8_t *src,
- ptrdiff_t dst_stride,
- ptrdiff_t src_linesize,
- int block_w, int block_h,
- int src_x, int src_y, int w, int h);
-
-static av_always_inline void gmc(uint8_t *dst, uint8_t *src,
- int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy,
- int shift, int r, int width, int height,
- emulated_edge_mc_func *emu_edge_fn)
+#if CONFIG_VIDEODSP
+void ff_gmc_mmx(uint8_t *dst, uint8_t *src,
+ int stride, int h, int ox, int oy,
+ int dxx, int dxy, int dyx, int dyy,
+ int shift, int r, int width, int height)
{
const int w = 8;
const int ix = ox >> (16 + shift);
@@ -298,7 +292,7 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src,
src += ix + iy * stride;
if (need_emu) {
- emu_edge_fn(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height);
+ ff_emulated_edge_mc_8(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height);
src = edge_buf;
}
@@ -375,36 +369,5 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src,
src += 4 - h * stride;
}
}
-
-#if CONFIG_VIDEODSP
-#if HAVE_YASM
-#if ARCH_X86_32
-void ff_gmc_mmx(uint8_t *dst, uint8_t *src,
- int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy,
- int shift, int r, int width, int height)
-{
- gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
- width, height, &ff_emulated_edge_mc_8);
-}
-#endif
-void ff_gmc_sse(uint8_t *dst, uint8_t *src,
- int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy,
- int shift, int r, int width, int height)
-{
- gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
- width, height, &ff_emulated_edge_mc_8);
-}
-#else
-void ff_gmc_mmx(uint8_t *dst, uint8_t *src,
- int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy,
- int shift, int r, int width, int height)
-{
- gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
- width, height, &ff_emulated_edge_mc_8);
-}
-#endif
#endif
#endif /* HAVE_INLINE_ASM */
diff --git a/libavcodec/x86/dsputil_x86.h b/libavcodec/x86/dsputil_x86.h
index b5d7291..14b7482 100644
--- a/libavcodec/x86/dsputil_x86.h
+++ b/libavcodec/x86/dsputil_x86.h
@@ -48,11 +48,6 @@ void ff_gmc_mmx(uint8_t *dst, uint8_t *src,
int dxx, int dxy, int dyx, int dyy,
int shift, int r, int width, int height);
-void ff_gmc_sse(uint8_t *dst, uint8_t *src,
- int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy,
- int shift, int r, int width, int height);
-
void ff_mmx_idct(int16_t *block);
void ff_mmxext_idct(int16_t *block);
--
1.8.5.5
More information about the ffmpeg-devel
mailing list