changeset 26282:79ab4ecba54a

Revert local changes that pointlessly add #ifdefs all over libmpeg2 to disable code depending on CPU capabilities. Instead, rely on libmpeg2's builtin CPU capability handling.
author diego
date Tue, 01 Apr 2008 17:31:37 +0000
parents 6eb659782586
children 62abac0c8637
files libmpeg2/cpu_accel.c libmpeg2/cpu_state.c libmpeg2/idct.c libmpeg2/libmpeg-0.4.1.diff libmpeg2/motion_comp.c
diffstat 5 files changed, 27 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/libmpeg2/cpu_accel.c	Tue Apr 01 15:24:53 2008 +0000
+++ b/libmpeg2/cpu_accel.c	Tue Apr 01 17:31:37 2008 +0000
@@ -137,7 +137,7 @@
 }
 #endif /* ARCH_X86 || ARCH_X86_64 */
 
-#if defined(ARCH_PPC) || (defined(ARCH_SPARC) && defined(HAVE_VIS))
+#if defined(ARCH_PPC) || defined(ARCH_SPARC)
 #include <signal.h>
 #include <setjmp.h>
 
--- a/libmpeg2/cpu_state.c	Tue Apr 01 15:24:53 2008 +0000
+++ b/libmpeg2/cpu_state.c	Tue Apr 01 17:31:37 2008 +0000
@@ -124,7 +124,7 @@
 	mpeg2_cpu_state_restore = state_restore_mmx;
     }
 #endif
-#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
+#ifdef ARCH_PPC
     if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
 	mpeg2_cpu_state_save = state_save_altivec;
 	mpeg2_cpu_state_restore = state_restore_altivec;
--- a/libmpeg2/idct.c	Tue Apr 01 15:24:53 2008 +0000
+++ b/libmpeg2/idct.c	Tue Apr 01 17:31:37 2008 +0000
@@ -239,21 +239,18 @@
 
 void mpeg2_idct_init (uint32_t accel)
 {
-#ifdef HAVE_MMX2
+#ifdef ARCH_X86
     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
-#endif
-#ifdef HAVE_MMX
-    if (accel & MPEG2_ACCEL_X86_MMX) {
+    } else 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
-#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
+#ifdef ARCH_PPC
     if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
 	mpeg2_idct_copy = mpeg2_idct_copy_altivec;
 	mpeg2_idct_add = mpeg2_idct_add_altivec;
--- a/libmpeg2/libmpeg-0.4.1.diff	Tue Apr 01 15:24:53 2008 +0000
+++ b/libmpeg2/libmpeg-0.4.1.diff	Tue Apr 01 17:31:37 2008 +0000
@@ -27,7 +27,7 @@
      uint32_t eax, ebx, ecx, edx;
      int AMD;
      uint32_t caps;
-@@ -105,10 +118,24 @@
+@@ -105,7 +120,21 @@
  	caps |= MPEG2_ACCEL_X86_MMXEXT;
  
      return caps;
@@ -49,12 +49,8 @@
 -#endif /* ARCH_X86 */
 +#endif /* ARCH_X86 || ARCH_X86_64 */
  
--#if defined(ARCH_PPC) || defined(ARCH_SPARC)
-+#if defined(ARCH_PPC) || (defined(ARCH_SPARC) && defined(HAVE_VIS))
- #include <signal.h>
- #include <setjmp.h>
- 
-@@ -166,10 +166,10 @@
+ #if defined(ARCH_PPC) || defined(ARCH_SPARC)
+@@ -166,10 +168,10 @@
  
      canjump = 1;
  
@@ -68,7 +64,7 @@
  #endif
      asm volatile ("mtspr 256, %0\n\t"
  		  VAND (0, 0, 0)
-@@ -212,7 +243,7 @@
+@@ -212,7 +241,7 @@
  
      accel = 0;
  #ifdef ACCEL_DETECT
@@ -123,7 +119,7 @@
  #endif
  
  static void state_save_altivec (cpu_state_t * state)
-@@ -115,12 +119,12 @@
+@@ -115,9 +119,9 @@
  
  void mpeg2_cpu_state_init (uint32_t accel)
  {
@@ -133,11 +129,7 @@
  	mpeg2_cpu_state_restore = state_restore_mmx;
      }
  #endif
--#ifdef ARCH_PPC
-+#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
-     if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
- 	mpeg2_cpu_state_save = state_save_altivec;
- 	mpeg2_cpu_state_restore = state_restore_altivec;
+ #ifdef ARCH_PPC
 --- libmpeg2/decode.c	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/decode.c	2006-06-16 20:12:50.000000000 +0200
 @@ -351,6 +355,15 @@
@@ -184,26 +176,6 @@
  	    for (j = 0; j < 64; j++)
  		decoder->quantizer_prescale[index][i][j] =
  		    k * mpeg2dec->quantizer_matrix[index][j];
---- libmpeg2/idct.c	2006-06-16 20:12:26.000000000 +0200
-+++ libmpeg2/idct.c	2006-06-16 20:12:50.000000000 +0200
-@@ -239,12 +239,15 @@
- 
- void mpeg2_idct_init (uint32_t accel)
- {
--#ifdef ARCH_X86
-+#ifdef 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
-+#endif
-+#ifdef 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 ();
 --- 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 @@
@@ -217,55 +189,16 @@
  
 --- libmpeg2/motion_comp.c	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/motion_comp.c	2006-06-16 20:12:50.000000000 +0200
-@@ -37,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
--#ifdef ARCH_PPC
-+#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
-     if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
- 	mpeg2_mc = mpeg2_mc_altivec;
-     else
-@@ -52,7 +62,7 @@
- 	mpeg2_mc = mpeg2_mc_alpha;
-     else
- #endif
--#ifdef ARCH_SPARC
-+#if defined(ARCH_SPARC) && defined(HAVE_VIS)
-     if (accel & MPEG2_ACCEL_SPARC_VIS)
- 	mpeg2_mc = mpeg2_mc_vis;
-     else
-@@ -67,6 +67,16 @@
+@@ -67,6 +61,13 @@
  	mpeg2_mc = mpeg2_mc_vis;
      else
  #endif
 +#ifdef ARCH_ARM
-+    if (accel & MPEG2_ACCEL_ARM) {
-+#ifdef HAVE_IWMMXT
-+	if (accel & MPEG2_ACCEL_ARM_IWMMXT)
-+	    mpeg2_mc = mpeg2_mc_iwmmxt;
-+	else
-+#endif
-+	    mpeg2_mc = mpeg2_mc_arm;
-+    } else
++    if (accel & MPEG2_ACCEL_ARM_IWMMXT)
++	mpeg2_mc = mpeg2_mc_iwmmxt;
++    else if (accel & MPEG2_ACCEL_ARM)
++	mpeg2_mc = mpeg2_mc_arm;
++    else
 +#endif
  	mpeg2_mc = mpeg2_mc_c;
  }
@@ -389,17 +322,6 @@
  	decoder->motion_parser[4] = motion_reuse_420;
      } else if (decoder->picture_structure == FRAME_PICTURE) {
  	if (decoder->chroma_format == 0) {
---- libmpeg2/idct.c	2006-06-16 20:12:26.000000000 +0200
-+++ libmpeg2/idct.c	2006-06-16 20:12:50.000000000 +0200
-@@ -253,7 +253,7 @@
- 	mpeg2_idct_mmx_init ();
-     } else
- #endif
--#ifdef ARCH_PPC
-+#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
-     if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
- 	mpeg2_idct_copy = mpeg2_idct_copy_altivec;
- 	mpeg2_idct_add = mpeg2_idct_add_altivec;
 --- libmpeg2/idct_altivec.c	2004/08/02 11:26:43	12933
 +++ libmpeg2/idct_altivec.c	2005/05/15 20:11:34	15484
 @@ -41,7 +41,7 @@
--- a/libmpeg2/motion_comp.c	Tue Apr 01 15:24:53 2008 +0000
+++ b/libmpeg2/motion_comp.c	Tue Apr 01 17:31:37 2008 +0000
@@ -37,22 +37,16 @@
 
 void mpeg2_mc_init (uint32_t accel)
 {
-#ifdef HAVE_MMX2
+#ifdef ARCH_X86
     if (accel & MPEG2_ACCEL_X86_MMXEXT)
 	mpeg2_mc = mpeg2_mc_mmxext;
-    else
-#endif
-#ifdef HAVE_3DNOW
-    if (accel & MPEG2_ACCEL_X86_3DNOW)
+    else if (accel & MPEG2_ACCEL_X86_3DNOW)
 	mpeg2_mc = mpeg2_mc_3dnow;
-    else
-#endif
-#ifdef HAVE_MMX
-    if (accel & MPEG2_ACCEL_X86_MMX)
+    else if (accel & MPEG2_ACCEL_X86_MMX)
 	mpeg2_mc = mpeg2_mc_mmx;
     else
 #endif
-#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
+#ifdef ARCH_PPC
     if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
 	mpeg2_mc = mpeg2_mc_altivec;
     else
@@ -62,20 +56,17 @@
 	mpeg2_mc = mpeg2_mc_alpha;
     else
 #endif
-#if defined(ARCH_SPARC) && defined(HAVE_VIS)
+#ifdef ARCH_SPARC
     if (accel & MPEG2_ACCEL_SPARC_VIS)
 	mpeg2_mc = mpeg2_mc_vis;
     else
 #endif
 #ifdef ARCH_ARM
-    if (accel & MPEG2_ACCEL_ARM) {
-#ifdef HAVE_IWMMXT
-	if (accel & MPEG2_ACCEL_ARM_IWMMXT)
-	    mpeg2_mc = mpeg2_mc_iwmmxt;
-	else
-#endif
-	    mpeg2_mc = mpeg2_mc_arm;
-    } else
+    if (accel & MPEG2_ACCEL_ARM_IWMMXT)
+	mpeg2_mc = mpeg2_mc_iwmmxt;
+    else if (accel & MPEG2_ACCEL_ARM)
+	mpeg2_mc = mpeg2_mc_arm;
+    else
 #endif
 	mpeg2_mc = mpeg2_mc_c;
 }