When the 3DNOW version of vector_fmul_add was preferred over SSE the code 
was substantially more complex than it is now. Would someone with an AMD chip 
that supports both SSE and 3DNOW be willing to benchmark them and see which is 
current faster?

Thanks,

Alex

---
 libavcodec/Makefile          |    2 +-
 libavcodec/x86/dsputil_mmx.c |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 36e07a9..bfc81ab 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -669,7 +669,7 @@ SKIPHEADERS-$(CONFIG_XVMC)             += xvmc.h
 EXAMPLES = api
 
 TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder
-TESTPROGS-$(HAVE_MMX) += motion
+TESTPROGS-$(HAVE_MMX) += motion x86/dsputil_mmx
 TESTOBJS = dctref.o
 
 HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen      \
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 2fb75cb..5ff47a2 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2930,3 +2930,41 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext 
*avctx)
     if (CONFIG_ENCODERS)
         dsputilenc_init_mmx(c, avctx);
 }
+
+#ifdef TEST
+#include "libavutil/lfg.h"
+#include "libavutil/timer.h"
+#undef printf
+int main(void) {
+    float *dstsse, *dst3dnow, *src0, *src1;
+    int i;
+    const int len = 1024, iters = 128;
+    AVLFG lfg;
+    av_lfg_init(&lfg, 1);
+    dstsse = av_mallocz(len);
+    dst3dnow = av_mallocz(len);
+    src0 = av_malloc(len);
+    src1 = av_malloc(len);
+
+    for (i = 0; i < len; i++) {
+        src0[i] = av_lfg_get(&lfg) / (float)UINT_MAX;
+        src1[i] = av_lfg_get(&lfg) / (float)UINT_MAX;
+    }
+
+    {
+        START_TIMER
+        for (i = 0; i < iters; i++) {
+            vector_fmul_3dnow(dst3dnow, src0, src1, len);
+        }
+        STOP_TIMER("3DNOW")
+    }
+
+    {
+        START_TIMER
+        for (i = 0; i < iters; i++) {
+            vector_fmul_sse  (dstsse,   src0, src1, len);
+        }
+        STOP_TIMER("SSE")
+    }
+}
+#endif
-- 
1.7.3.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to