[MPlayer-cvslog] r27554 - in trunk/libmpeg2: idct.c libmpeg-0.4.1.diff motion_comp.c

diego subversion at mplayerhq.hu
Tue Sep 9 12:56:51 CEST 2008


Author: diego
Date: Tue Sep  9 12:56:51 2008
New Revision: 27554

Log:
Use preprocessor conditionals to disable CPU-extension-specific code. We cannot
rely on libmpeg2's internal CPU extension handling, it leads to link failures
with our build system. Fixes Bugzilla #1188.


Modified:
   trunk/libmpeg2/idct.c
   trunk/libmpeg2/libmpeg-0.4.1.diff
   trunk/libmpeg2/motion_comp.c

Modified: trunk/libmpeg2/idct.c
==============================================================================
--- trunk/libmpeg2/idct.c	(original)
+++ trunk/libmpeg2/idct.c	Tue Sep  9 12:56:51 2008
@@ -239,16 +239,20 @@ static void mpeg2_idct_add_c (const int 
 
 void mpeg2_idct_init (uint32_t accel)
 {
-#ifdef ARCH_X86
+#ifdef HAVE_SSE2
     if (accel & MPEG2_ACCEL_X86_SSE2) {
 	mpeg2_idct_copy = mpeg2_idct_copy_sse2;
 	mpeg2_idct_add = mpeg2_idct_add_sse2;
 	mpeg2_idct_mmx_init ();
-    } else if (accel & MPEG2_ACCEL_X86_MMXEXT) {
+    } else
+#elif HAVE_MMX2
+    if (accel & MPEG2_ACCEL_X86_MMXEXT) {
 	mpeg2_idct_copy = mpeg2_idct_copy_mmxext;
 	mpeg2_idct_add = mpeg2_idct_add_mmxext;
 	mpeg2_idct_mmx_init ();
-    } else if (accel & MPEG2_ACCEL_X86_MMX) {
+    } else
+#elif HAVE_MMX
+    if (accel & MPEG2_ACCEL_X86_MMX) {
 	mpeg2_idct_copy = mpeg2_idct_copy_mmx;
 	mpeg2_idct_add = mpeg2_idct_add_mmx;
 	mpeg2_idct_mmx_init ();
@@ -261,12 +265,14 @@ void mpeg2_idct_init (uint32_t accel)
 	mpeg2_idct_altivec_init ();
     } else
 #endif
-#ifdef ARCH_ALPHA
+#ifdef HAVE_VIS
     if (accel & MPEG2_ACCEL_ALPHA_MVI) {
 	mpeg2_idct_copy = mpeg2_idct_copy_mvi;
 	mpeg2_idct_add = mpeg2_idct_add_mvi;
 	mpeg2_idct_alpha_init ();
-    } else if (accel & MPEG2_ACCEL_ALPHA) {
+    } else
+#elif ARCH_ALPHA
+    if (accel & MPEG2_ACCEL_ALPHA) {
 	int i;
 
 	mpeg2_idct_copy = mpeg2_idct_copy_alpha;

Modified: trunk/libmpeg2/libmpeg-0.4.1.diff
==============================================================================
--- trunk/libmpeg2/libmpeg-0.4.1.diff	(original)
+++ trunk/libmpeg2/libmpeg-0.4.1.diff	Tue Sep  9 12:56:51 2008
@@ -162,7 +162,28 @@
  		    k * mpeg2dec->quantizer_matrix[index][j];
 --- libmpeg2/idct.c	(revision 26652)
 +++ libmpeg2/idct.c	(working copy)
-@@ -250,7 +254,7 @@
+@@ -235,30 +239,40 @@
+ 
+ void mpeg2_idct_init (uint32_t accel)
+ {
+-#ifdef ARCH_X86
++#ifdef HAVE_SSE2
++    if (accel & MPEG2_ACCEL_X86_SSE2) {
++	mpeg2_idct_copy = mpeg2_idct_copy_sse2;
++	mpeg2_idct_add = mpeg2_idct_add_sse2;
++	mpeg2_idct_mmx_init ();
++    } else
++#elif HAVE_MMX2
+     if (accel & MPEG2_ACCEL_X86_MMXEXT) {
+ 	mpeg2_idct_copy = mpeg2_idct_copy_mmxext;
+ 	mpeg2_idct_add = mpeg2_idct_add_mmxext;
+ 	mpeg2_idct_mmx_init ();
+-    } else if (accel & MPEG2_ACCEL_X86_MMX) {
++    } else
++#elif HAVE_MMX
++    if (accel & MPEG2_ACCEL_X86_MMX) {
+ 	mpeg2_idct_copy = mpeg2_idct_copy_mmx;
+ 	mpeg2_idct_add = mpeg2_idct_add_mmx;
  	mpeg2_idct_mmx_init ();
      } else
  #endif
@@ -171,6 +192,22 @@
      if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
  	mpeg2_idct_copy = mpeg2_idct_copy_altivec;
  	mpeg2_idct_add = mpeg2_idct_add_altivec;
+ 	mpeg2_idct_altivec_init ();
+     } else
+ #endif
+-#ifdef ARCH_ALPHA
++#ifdef HAVE_VIS
+     if (accel & MPEG2_ACCEL_ALPHA_MVI) {
+ 	mpeg2_idct_copy = mpeg2_idct_copy_mvi;
+ 	mpeg2_idct_add = mpeg2_idct_add_mvi;
+ 	mpeg2_idct_alpha_init ();
+-    } else if (accel & MPEG2_ACCEL_ALPHA) {
++    } else
++#elif ARCH_ALPHA
++    if (accel & MPEG2_ACCEL_ALPHA) {
+ 	int i;
+ 
+ 	mpeg2_idct_copy = mpeg2_idct_copy_alpha;
 --- libmpeg2/idct_mmx.c	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/idct_mmx.c	2006-06-16 20:12:50.000000000 +0200
 @@ -23,7 +27,7 @@
@@ -184,7 +221,25 @@
  
 --- libmpeg2/motion_comp.c	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/motion_comp.c	2006-06-16 20:12:50.000000000 +0200
-@@ -46,7 +46,7 @@
+@@ -33,16 +37,22 @@
+ 
+ void mpeg2_mc_init (uint32_t accel)
+ {
+-#ifdef ARCH_X86
++#ifdef HAVE_MMX2
+     if (accel & MPEG2_ACCEL_X86_MMXEXT)
+ 	mpeg2_mc = mpeg2_mc_mmxext;
+-    else if (accel & MPEG2_ACCEL_X86_3DNOW)
++    else
++#endif
++#ifdef HAVE_3DNOW
++    if (accel & MPEG2_ACCEL_X86_3DNOW)
+ 	mpeg2_mc = mpeg2_mc_3dnow;
+-    else if (accel & MPEG2_ACCEL_X86_MMX)
++    else
++#endif
++#ifdef HAVE_MMX
++    if (accel & MPEG2_ACCEL_X86_MMX)
  	mpeg2_mc = mpeg2_mc_mmx;
      else
  #endif
@@ -193,7 +248,13 @@
      if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
  	mpeg2_mc = mpeg2_mc_altivec;
      else
-@@ -61,6 +61,16 @@
+@@ -52,11 +62,21 @@
+ 	mpeg2_mc = mpeg2_mc_alpha;
+     else
+ #endif
+-#ifdef ARCH_SPARC
++#ifdef HAVE_VIS
+     if (accel & MPEG2_ACCEL_SPARC_VIS)
  	mpeg2_mc = mpeg2_mc_vis;
      else
  #endif

Modified: trunk/libmpeg2/motion_comp.c
==============================================================================
--- trunk/libmpeg2/motion_comp.c	(original)
+++ trunk/libmpeg2/motion_comp.c	Tue Sep  9 12:56:51 2008
@@ -37,12 +37,18 @@ mpeg2_mc_t mpeg2_mc;
 
 void mpeg2_mc_init (uint32_t accel)
 {
-#ifdef ARCH_X86
+#ifdef HAVE_MMX2
     if (accel & MPEG2_ACCEL_X86_MMXEXT)
 	mpeg2_mc = mpeg2_mc_mmxext;
-    else if (accel & MPEG2_ACCEL_X86_3DNOW)
+    else
+#endif
+#ifdef HAVE_3DNOW
+    if (accel & MPEG2_ACCEL_X86_3DNOW)
 	mpeg2_mc = mpeg2_mc_3dnow;
-    else if (accel & MPEG2_ACCEL_X86_MMX)
+    else
+#endif
+#ifdef HAVE_MMX
+    if (accel & MPEG2_ACCEL_X86_MMX)
 	mpeg2_mc = mpeg2_mc_mmx;
     else
 #endif
@@ -56,7 +62,7 @@ void mpeg2_mc_init (uint32_t accel)
 	mpeg2_mc = mpeg2_mc_alpha;
     else
 #endif
-#ifdef ARCH_SPARC
+#ifdef HAVE_VIS
     if (accel & MPEG2_ACCEL_SPARC_VIS)
 	mpeg2_mc = mpeg2_mc_vis;
     else



More information about the MPlayer-cvslog mailing list