[FFmpeg-cvslog] x86: allow using add_hfyu_median_prediction_cmov on any cpu with cmov

Mans Rullgard git at videolan.org
Sat Sep 8 13:01:28 CEST 2012


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sun Sep  2 16:05:56 2012 +0100| [5fe64d88f67637af6037fa864b1c66e41148597c] | committer: Mans Rullgard

x86: allow using add_hfyu_median_prediction_cmov on any cpu with cmov

For some reason add_hfyu_median_prediction_cmov is only selected
on 3Dnow-capable CPUs, even though it uses no 3Dnow instructions.
This patch allows it to be selected on any cpu with cmov with the
possibility of being overridden by the mmxext version.

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5fe64d88f67637af6037fa864b1c66e41148597c
---

 libavcodec/x86/dsputil_mmx.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 9a3cb49..0876cea 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2717,7 +2717,9 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx,
         c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_10_mmx2;
     }
 
-    c->add_hfyu_median_prediction   = ff_add_hfyu_median_prediction_mmx2;
+    /* slower than cmov version on AMD */
+    if (!(mm_flags & AV_CPU_FLAG_3DNOW))
+        c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2;
 
     c->scalarproduct_int16          = ff_scalarproduct_int16_mmx2;
     c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmx2;
@@ -2794,11 +2796,6 @@ static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx,
     }
 
     c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
-
-#if HAVE_7REGS
-    if (mm_flags & AV_CPU_FLAG_CMOV)
-        c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
-#endif
 #endif /* HAVE_INLINE_ASM */
 
 #if HAVE_YASM
@@ -3009,6 +3006,11 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
 {
     int mm_flags = av_get_cpu_flags();
 
+#if HAVE_7REGS && HAVE_INLINE_ASM
+    if (mm_flags & AV_CPU_FLAG_CMOV)
+        c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
+#endif
+
     if (mm_flags & AV_CPU_FLAG_MMX) {
 #if HAVE_INLINE_ASM
         const int idct_algo = avctx->idct_algo;



More information about the ffmpeg-cvslog mailing list