# HG changeset patch # User diego # Date 1220957811 0 # Node ID 1462a44ea6b9c522aa5a7adfd879c097180bba79 # Parent 09f068b67fc7fcb6ea66d1954fd615d1aacfafbd 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. diff -r 09f068b67fc7 -r 1462a44ea6b9 libmpeg2/idct.c --- a/libmpeg2/idct.c Tue Sep 09 10:52:47 2008 +0000 +++ b/libmpeg2/idct.c Tue Sep 09 10:56:51 2008 +0000 @@ -239,16 +239,20 @@ 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 @@ 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; diff -r 09f068b67fc7 -r 1462a44ea6b9 libmpeg2/libmpeg-0.4.1.diff --- a/libmpeg2/libmpeg-0.4.1.diff Tue Sep 09 10:52:47 2008 +0000 +++ b/libmpeg2/libmpeg-0.4.1.diff Tue Sep 09 10:56:51 2008 +0000 @@ -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 diff -r 09f068b67fc7 -r 1462a44ea6b9 libmpeg2/motion_comp.c --- a/libmpeg2/motion_comp.c Tue Sep 09 10:52:47 2008 +0000 +++ b/libmpeg2/motion_comp.c Tue Sep 09 10:56:51 2008 +0000 @@ -37,12 +37,18 @@ 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 @@ 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