Hello,

In an FLOSS project of my employer, in which I'm involved in, we need an FLOSS 
implementation of a
MPEG2 decoder. We're thinking of using libmpeg2, as it is widely used (MPlayer, 
VLC, libxine,
etc.), and it has clean code.

While determining the way the external projects use libmpeg2, I quickly saw 
some internal copies
of libmpeg2, Therefore, I looked for differences with upstream... and there are 
indeed
differences.

In this series of patches, I'm sending:
* two patches from MPlayer, which do not add MPlayer-specific features to 
libmpeg2 (AFAICT);
* a patch to reduce the (already quite low, actually - good job !) number of 
warnings triggered by
rather uncommon compiler switches -W and -Wshadow.


Regards, Lionel Debroux.


      
____________________________________________________________________________________________
Yahoo! Mail innove : interface hyper pratique, messenger intégré, couleurs - 
http://mail.yahoo.fr
>From 8b4f3a843ec77021ab11f5c14c45324e72ddeba0 Mon Sep 17 00:00:00 2001
From: Lionel Debroux <[EMAIL PROTECTED]>
Date: Wed, 28 Nov 2007 10:25:50 +0100
Subject: PPC compilation fixes (from MPlayer SVN repo, revisions 21550 & 21587).

---
 trunk/libmpeg2/cpu_state.c    |   16 ++++++++--------
 trunk/libmpeg2/idct.c         |    2 +-
 trunk/libmpeg2/idct_altivec.c |    8 ++++----
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/trunk/libmpeg2/cpu_state.c b/trunk/libmpeg2/cpu_state.c
index 90710b9..0e4e311 100644
--- a/trunk/libmpeg2/cpu_state.c
+++ b/trunk/libmpeg2/cpu_state.c
@@ -43,19 +43,19 @@ static void state_restore_mmx (cpu_state_t * state)
 }
 #endif
 
-#ifdef ARCH_PPC
-#ifdef HAVE_ALTIVEC_H	/* gnu */
-#define LI(a,b) "li " #a "," #b "\n\t"
-#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
-#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
-#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
-#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
-#else			/* apple */
+#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
+#if defined( __APPLE_CC__ ) && defined( __APPLE_ALTIVEC__ )	/* apple */
 #define LI(a,b) "li r" #a "," #b "\n\t"
 #define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t"
 #define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t"
 #define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t"
 #define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t"
+#else			/* gnu */
+#define LI(a,b) "li " #a "," #b "\n\t"
+#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
+#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
+#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
+#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
 #endif
 
 static void state_save_altivec (cpu_state_t * state)
diff --git a/trunk/libmpeg2/idct.c b/trunk/libmpeg2/idct.c
index 0a05ad3..c5ba39b 100644
--- a/trunk/libmpeg2/idct.c
+++ b/trunk/libmpeg2/idct.c
@@ -246,7 +246,7 @@ void mpeg2_idct_init (uint32_t accel)
 	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;
diff --git a/trunk/libmpeg2/idct_altivec.c b/trunk/libmpeg2/idct_altivec.c
index 6b1b858..3eec6b4 100644
--- a/trunk/libmpeg2/idct_altivec.c
+++ b/trunk/libmpeg2/idct_altivec.c
@@ -41,7 +41,7 @@ typedef vector unsigned short vector_u16_t;
 typedef vector signed int vector_s32_t;
 typedef vector unsigned int vector_u32_t;
 
-#if defined(HAVE_ALTIVEC_H) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
+#if defined( HAVE_ALTIVEC_H ) && !defined( __APPLE_ALTIVEC__ ) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
 /* work around gcc <3.3 vec_mergel bug */
 static inline vector_s16_t my_vec_mergel (vector_s16_t const A,
 					  vector_s16_t const B)
@@ -56,10 +56,10 @@ static inline vector_s16_t my_vec_mergel (vector_s16_t const A,
 #define vec_mergel my_vec_mergel
 #endif
 
-#ifdef HAVE_ALTIVEC_H	/* gnu */
-#define VEC_S16(a,b,c,d,e,f,g,h) {a, b, c, d, e, f, g, h}
-#else			/* apple */
+#if defined( __APPLE_CC__ ) && defined( __APPLE_ALTIVEC__ ) /* apple */
 #define VEC_S16(a,b,c,d,e,f,g,h) (vector_s16_t) (a, b, c, d, e, f, g, h)
+#else			/* gnu */
+#define VEC_S16(a,b,c,d,e,f,g,h) {a, b, c, d, e, f, g, h}
 #endif
 
 static const vector_s16_t constants ATTR_ALIGN(16) =
-- 
1.5.3.4

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Libmpeg2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel

Reply via email to