[FFmpeg-cvslog] x86/dsputilenc: bury inline asm under HAVE_INLINE_ASM.

Ronald S. Bultje git at videolan.org
Wed Aug 1 23:40:11 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Jul 25 20:30:19 2012 -0700| [53dfaedc014ba6bd073fece6582da1805b3c44c2] | committer: Ronald S. Bultje

x86/dsputilenc: bury inline asm under HAVE_INLINE_ASM.

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

 libavcodec/x86/dsputilenc_mmx.c |   80 +++++++++++++++++++++++----------------
 libavcodec/x86/fdct_mmx.c       |    4 ++
 libavcodec/x86/motion_est_mmx.c |    6 +++
 libavcodec/x86/mpegvideo_mmx.c  |    6 +++
 4 files changed, 63 insertions(+), 33 deletions(-)

diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
index 47fa5ca..3cac979 100644
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ b/libavcodec/x86/dsputilenc_mmx.c
@@ -30,6 +30,8 @@
 #include "dsputil_mmx.h"
 
 
+#if HAVE_INLINE_ASM
+
 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
 {
     __asm__ volatile(
@@ -323,8 +325,6 @@ static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int
     return tmp;
 }
 
-int ff_sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-
 static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) {
     int tmp;
   __asm__ volatile (
@@ -925,17 +925,6 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, c
     "paddusw "#t", "#a"               \n\t"\
     "movd "#a", "#dst"                \n\t"\
 
-#define hadamard_func(cpu) \
-int ff_hadamard8_diff_##cpu  (void *s, uint8_t *src1, uint8_t *src2, \
-                              int stride, int h); \
-int ff_hadamard8_diff16_##cpu(void *s, uint8_t *src1, uint8_t *src2, \
-                              int stride, int h);
-
-hadamard_func(mmx)
-hadamard_func(mmx2)
-hadamard_func(sse2)
-hadamard_func(ssse3)
-
 #define DCT_SAD4(m,mm,o)\
     "mov"#m" "#o"+ 0(%1), "#mm"2      \n\t"\
     "mov"#m" "#o"+16(%1), "#mm"3      \n\t"\
@@ -1094,10 +1083,26 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
 #undef PHADDD
 #endif //HAVE_SSSE3
 
+#endif /* HAVE_INLINE_ASM */
+
+int ff_sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
+
+#define hadamard_func(cpu) \
+int ff_hadamard8_diff_##cpu  (void *s, uint8_t *src1, uint8_t *src2, \
+                              int stride, int h); \
+int ff_hadamard8_diff16_##cpu(void *s, uint8_t *src1, uint8_t *src2, \
+                              int stride, int h);
+
+hadamard_func(mmx)
+hadamard_func(mmx2)
+hadamard_func(sse2)
+hadamard_func(ssse3)
 
 void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
 {
     int mm_flags = av_get_cpu_flags();
+
+#if HAVE_INLINE_ASM
     int bit_depth = avctx->bits_per_raw_sample;
 
     if (mm_flags & AV_CPU_FLAG_MMX) {
@@ -1121,11 +1126,6 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
         c->diff_bytes= diff_bytes_mmx;
         c->sum_abs_dctelem= sum_abs_dctelem_mmx;
 
-#if HAVE_YASM
-        c->hadamard8_diff[0]= ff_hadamard8_diff16_mmx;
-        c->hadamard8_diff[1]= ff_hadamard8_diff_mmx;
-#endif
-
         c->pix_norm1 = pix_norm1_mmx;
         c->sse[0] = sse16_mmx;
         c->sse[1] = sse8_mmx;
@@ -1146,10 +1146,6 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
 
 
         if (mm_flags & AV_CPU_FLAG_MMX2) {
-#if HAVE_YASM
-            c->hadamard8_diff[0]= ff_hadamard8_diff16_mmx2;
-            c->hadamard8_diff[1]= ff_hadamard8_diff_mmx2;
-#endif
             c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
             c->vsad[4]= vsad_intra16_mmx2;
 
@@ -1164,13 +1160,6 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
             if (bit_depth <= 8)
                 c->get_pixels = get_pixels_sse2;
             c->sum_abs_dctelem= sum_abs_dctelem_sse2;
-#if HAVE_YASM
-            c->sse[0] = ff_sse16_sse2;
-#if HAVE_ALIGNED_STACK
-            c->hadamard8_diff[0]= ff_hadamard8_diff16_sse2;
-            c->hadamard8_diff[1]= ff_hadamard8_diff_sse2;
-#endif
-#endif
         }
 
 #if HAVE_SSSE3
@@ -1180,10 +1169,6 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
             }
             c->add_8x8basis= add_8x8basis_ssse3;
             c->sum_abs_dctelem= sum_abs_dctelem_ssse3;
-#if HAVE_YASM && HAVE_ALIGNED_STACK
-            c->hadamard8_diff[0]= ff_hadamard8_diff16_ssse3;
-            c->hadamard8_diff[1]= ff_hadamard8_diff_ssse3;
-#endif
         }
 #endif
 
@@ -1194,6 +1179,35 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
             c->add_8x8basis= add_8x8basis_3dnow;
         }
     }
+#endif /* HAVE_INLINE_ASM */
+
+#if HAVE_YASM
+    if (mm_flags & AV_CPU_FLAG_MMX) {
+        c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx;
+        c->hadamard8_diff[1] = ff_hadamard8_diff_mmx;
+
+        if (mm_flags & AV_CPU_FLAG_MMX2) {
+            c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx2;
+            c->hadamard8_diff[1] = ff_hadamard8_diff_mmx2;
+        }
+
+        if (mm_flags & AV_CPU_FLAG_SSE2){
+            c->sse[0] = ff_sse16_sse2;
+
+#if HAVE_ALIGNED_STACK
+            c->hadamard8_diff[0] = ff_hadamard8_diff16_sse2;
+            c->hadamard8_diff[1] = ff_hadamard8_diff_sse2;
+#endif
+        }
+
+#if HAVE_SSSE3 && HAVE_ALIGNED_STACK
+        if (mm_flags & AV_CPU_FLAG_SSSE3) {
+            c->hadamard8_diff[0] = ff_hadamard8_diff16_ssse3;
+            c->hadamard8_diff[1] = ff_hadamard8_diff_ssse3;
+        }
+#endif
+    }
+#endif /* HAVE_YASM */
 
     ff_dsputil_init_pix_mmx(c, avctx);
 }
diff --git a/libavcodec/x86/fdct_mmx.c b/libavcodec/x86/fdct_mmx.c
index cc3036b..3614fd1 100644
--- a/libavcodec/x86/fdct_mmx.c
+++ b/libavcodec/x86/fdct_mmx.c
@@ -34,6 +34,8 @@
 #include "libavutil/x86_cpu.h"
 #include "libavcodec/dsputil.h"
 
+#if HAVE_INLINE_ASM
+
 //////////////////////////////////////////////////////////////////////
 //
 // constants for the forward DCT
@@ -579,3 +581,5 @@ void ff_fdct_sse2(int16_t *block)
     fdct_col_sse2(block, block1, 0);
     fdct_row_sse2(block1, block);
 }
+
+#endif /* HAVE_INLINE_ASM */
diff --git a/libavcodec/x86/motion_est_mmx.c b/libavcodec/x86/motion_est_mmx.c
index a522a5e..5aed655 100644
--- a/libavcodec/x86/motion_est_mmx.c
+++ b/libavcodec/x86/motion_est_mmx.c
@@ -26,6 +26,8 @@
 #include "libavcodec/dsputil.h"
 #include "dsputil_mmx.h"
 
+#if HAVE_INLINE_ASM
+
 DECLARE_ASM_CONST(8, uint64_t, round_tab)[3]={
 0x0000000000000000ULL,
 0x0001000100010001ULL,
@@ -422,8 +424,11 @@ static int sad16_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride,
 PIX_SAD(mmx)
 PIX_SAD(mmx2)
 
+#endif /* HAVE_INLINE_ASM */
+
 void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx)
 {
+#if HAVE_INLINE_ASM
     int mm_flags = av_get_cpu_flags();
 
     if (mm_flags & AV_CPU_FLAG_MMX) {
@@ -458,4 +463,5 @@ void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx)
     if ((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW) && avctx->codec_id != CODEC_ID_SNOW) {
         c->sad[0]= sad16_sse2;
     }
+#endif /* HAVE_INLINE_ASM */
 }
diff --git a/libavcodec/x86/mpegvideo_mmx.c b/libavcodec/x86/mpegvideo_mmx.c
index dcce486..a242c19 100644
--- a/libavcodec/x86/mpegvideo_mmx.c
+++ b/libavcodec/x86/mpegvideo_mmx.c
@@ -29,6 +29,8 @@
 #include "libavcodec/mpegvideo.h"
 #include "dsputil_mmx.h"
 
+#if HAVE_INLINE_ASM
+
 extern uint16_t ff_inv_zigzag_direct16[64];
 
 
@@ -626,8 +628,11 @@ static void  denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
 #include "mpegvideo_mmx_template.c"
 #endif
 
+#endif /* HAVE_INLINE_ASM */
+
 void ff_MPV_common_init_mmx(MpegEncContext *s)
 {
+#if HAVE_INLINE_ASM
     int mm_flags = av_get_cpu_flags();
 
     if (mm_flags & AV_CPU_FLAG_MMX) {
@@ -662,4 +667,5 @@ void ff_MPV_common_init_mmx(MpegEncContext *s)
             }
         }
     }
+#endif /* HAVE_INLINE_ASM */
 }



More information about the ffmpeg-cvslog mailing list