diff x86/cavsdsp_mmx.c @ 12356:1241c824de46 libavcodec

Move cavs dsp functions to their own struct
author mru
date Tue, 03 Aug 2010 20:59:00 +0000
parents fa452b243aa6
children fe78a4548d12
line wrap: on
line diff
--- a/x86/cavsdsp_mmx.c	Tue Aug 03 11:35:41 2010 +0000
+++ b/x86/cavsdsp_mmx.c	Tue Aug 03 20:59:00 2010 +0000
@@ -25,6 +25,7 @@
 #include "libavutil/common.h"
 #include "libavutil/x86_cpu.h"
 #include "libavcodec/dsputil.h"
+#include "libavcodec/cavsdsp.h"
 #include "dsputil_mmx.h"
 
 /*****************************************************************************
@@ -437,7 +438,7 @@
 CAVS_MC(avg_, 8, mmx2)
 CAVS_MC(avg_, 16,mmx2)
 
-void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx) {
+static void ff_cavsdsp_init_mmx2(CAVSDSPContext* c, AVCodecContext *avctx) {
 #define dspfunc(PFX, IDX, NUM) \
     c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \
     c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_mmx2; \
@@ -453,7 +454,7 @@
     c->cavs_idct8_add = cavs_idct8_add_mmx;
 }
 
-void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx) {
+static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) {
 #define dspfunc(PFX, IDX, NUM) \
     c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \
     c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_3dnow; \
@@ -468,3 +469,11 @@
 #undef dspfunc
     c->cavs_idct8_add = cavs_idct8_add_mmx;
 }
+
+void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx)
+{
+    int mm_flags = mm_support();
+
+    if (mm_flags & FF_MM_MMX2)  ff_cavsdsp_init_mmx2 (c, avctx);
+    if (mm_flags & FF_MM_3DNOW) ff_cavsdsp_init_3dnow(c, avctx);
+}