changeset 3910:db1d556fcf58

runtime cpudetect the liba52 way part 2 (downmix.c)
author michael
date Sun, 30 Dec 2001 21:53:56 +0000
parents ef32c8bdee81
children 0c1e7b47d35c
files liba52/a52_internal.h liba52/downmix.c liba52/parse.c
diffstat 3 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/liba52/a52_internal.h	Sun Dec 30 21:44:10 2001 +0000
+++ b/liba52/a52_internal.h	Sun Dec 30 21:53:56 2001 +0000
@@ -43,6 +43,7 @@
 
 int downmix_init (int input, int flags, sample_t * level,
 		  sample_t clev, sample_t slev);
+void downmix_accel_init(uint32_t mm_accel);
 int downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
 		   sample_t clev, sample_t slev);
 extern void (*downmix) (sample_t * samples, int acmod, int output, sample_t bias,
--- a/liba52/downmix.c	Sun Dec 30 21:44:10 2001 +0000
+++ b/liba52/downmix.c	Sun Dec 30 21:53:56 2001 +0000
@@ -24,18 +24,16 @@
  */
 
 #include "config.h"
-#include "../cpudetect.h"
 
 #include <string.h>
 #include <inttypes.h>
 
 #include "a52.h"
 #include "a52_internal.h"
+#include "mm_accel.h"
 
 #define CONVERT(acmod,output) (((output) << 3) + (acmod))
 
-//#undef HAVE_SSE
-//#undef HAVE_MMX
 
 void (*downmix)(sample_t * samples, int acmod, int output, sample_t bias,
 	      sample_t clev, sample_t slev)= NULL;
@@ -47,7 +45,17 @@
 	      sample_t clev, sample_t slev);
 static void upmix_MMX (sample_t * samples, int acmod, int output);
 static void upmix_C (sample_t * samples, int acmod, int output);
-      
+
+void downmix_accel_init(uint32_t mm_accel)
+{
+    upmix= upmix_C;
+    downmix= downmix_C;
+#ifdef ARCH_X86    
+    if(mm_accel & MM_ACCEL_X86_MMX) upmix= upmix_MMX;
+    if(mm_accel & MM_ACCEL_X86_SSE) downmix= downmix_SSE;
+#endif
+}
+   
 int downmix_init (int input, int flags, sample_t * level,
 		  sample_t clev, sample_t slev)
 {
@@ -77,13 +85,6 @@
     };
     int output;
 
-    upmix= upmix_C;
-    downmix= downmix_C;
-#ifdef ARCH_X86    
-    if(gCpuCaps.hasMMX) upmix= upmix_MMX;
-    if(gCpuCaps.hasSSE) downmix= downmix_SSE;
-#endif
-
     output = flags & A52_CHANNEL_MASK;
     if (output > A52_DOLBY)
 	return -1;
--- a/liba52/parse.c	Sun Dec 30 21:44:10 2001 +0000
+++ b/liba52/parse.c	Sun Dec 30 21:53:56 2001 +0000
@@ -57,6 +57,7 @@
     int i;
 
     imdct_init (mm_accel);
+    downmix_accel_init(mm_accel);
 
     samples = memalign (16, 256 * 12 * sizeof (sample_t));
     if (samples == NULL)