[FFmpeg-cvslog] x86/dsputil: move some mmx init code inside dsputil_init_mmx()

James Almer git at videolan.org
Fri Jun 6 05:47:16 CEST 2014


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Jun  5 22:01:46 2014 -0300| [ec98f80af47d2f463c5c3c59aa36c5aaf74204c5] | committer: Michael Niedermayer

x86/dsputil: move some mmx init code inside dsputil_init_mmx()

This reduces differences with the fork

Signed-off-by: James Almer <jamrial at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/x86/dsputil_init.c |   38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c
index bf4c7b7..40da2d3 100644
--- a/libavcodec/x86/dsputil_init.c
+++ b/libavcodec/x86/dsputil_init.c
@@ -31,7 +31,6 @@
 #include "dsputil_x86.h"
 #include "idct_xvid.h"
 
-
 int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2,
                                       int order);
 int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2,
@@ -60,6 +59,23 @@ static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx,
         c->draw_edges   = ff_draw_edges_mmx;
     }
 
+    if (avctx->lowres == 0 && !high_bit_depth) {
+        switch (avctx->idct_algo) {
+        case FF_IDCT_AUTO:
+        case FF_IDCT_SIMPLEMMX:
+            c->idct_put              = ff_simple_idct_put_mmx;
+            c->idct_add              = ff_simple_idct_add_mmx;
+            c->idct                  = ff_simple_idct_mmx;
+            c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
+            break;
+        case FF_IDCT_XVIDMMX:
+            c->idct_put              = ff_idct_xvid_mmx_put;
+            c->idct_add              = ff_idct_xvid_mmx_add;
+            c->idct                  = ff_idct_xvid_mmx;
+            break;
+        }
+    }
+
 #if CONFIG_VIDEODSP && (ARCH_X86_32 || !HAVE_YASM)
     c->gmc = ff_gmc_mmx;
 #endif
@@ -158,26 +174,8 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
 {
     int cpu_flags = av_get_cpu_flags();
 
-    if (X86_MMX(cpu_flags)) {
-#if HAVE_INLINE_ASM
-        const int idct_algo = avctx->idct_algo;
-
-        if (avctx->lowres == 0 && !high_bit_depth) {
-            if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {
-                c->idct_put              = ff_simple_idct_put_mmx;
-                c->idct_add              = ff_simple_idct_add_mmx;
-                c->idct                  = ff_simple_idct_mmx;
-                c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
-            } else if (idct_algo == FF_IDCT_XVIDMMX) {
-                c->idct_put              = ff_idct_xvid_mmx_put;
-                c->idct_add              = ff_idct_xvid_mmx_add;
-                c->idct                  = ff_idct_xvid_mmx;
-            }
-        }
-#endif /* HAVE_INLINE_ASM */
-
+    if (X86_MMX(cpu_flags))
         dsputil_init_mmx(c, avctx, cpu_flags, high_bit_depth);
-    }
 
     if (X86_MMXEXT(cpu_flags))
         dsputil_init_mmxext(c, avctx, cpu_flags, high_bit_depth);



More information about the ffmpeg-cvslog mailing list