[MPlayer-dev-eng] [PATCH] fixes for gcc4

Gianluigi Tiesi mplayer at netfarm.it
Sat Feb 26 21:51:10 CET 2005


Bernhard Rosenkraenzer sent me patches to fix STRTAB and mmx.h
I've tried it with gcc-2.95 gcc-3.3.5 and gcc-4.0 snapshot, and compiles
fine. Please take a look on mmx code, Bernhard's seams to be ok but
I have no clue on mmx asm.

Bye
-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
Index: mmx.h
===================================================================
RCS file: /cvsroot/mplayer/main/mmx.h,v
retrieving revision 1.1
diff -u -r1.1 mmx.h
--- mmx.h	28 Oct 2001 11:47:21 -0000	1.1
+++ mmx.h	26 Feb 2005 20:47:22 -0000
@@ -353,7 +353,7 @@
 #define	mmx_m2r(op, mem, reg) \
 	__asm__ __volatile__ (#op " %0, %%" #reg \
 			      : /* nothing */ \
-			      : "X" (mem))
+			      : "m" (mem))
 
 #define	mmx_r2m(op, reg, mem) \
 	__asm__ __volatile__ (#op " %%" #reg ", %0" \
Index: liba52/imdct.c
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/imdct.c,v
retrieving revision 1.25
diff -u -r1.25 imdct.c
--- liba52/imdct.c	26 Apr 2004 19:47:50 -0000	1.25
+++ liba52/imdct.c	26 Feb 2005 20:47:22 -0000
@@ -766,6 +766,8 @@
     int m;
     int two_m;
     int two_m_plus_one;
+    static complex_t *buf2;
+    static two_m_plus_one_sh;
 
 /*  sample_t tmp_a_i;
     sample_t tmp_a_r;
@@ -934,6 +936,8 @@
     for (m=3; m < 7; m++) {
 	two_m = (1 << m);
 	two_m_plus_one = two_m<<1;
+	buf2 = buf+128;
+	two_m_plus_one_sh = two_m_plus_one<<3;
 	asm volatile(
 		"movl %0, %%esi				\n\t"
 		".balign 16				\n\t"
@@ -959,7 +963,7 @@
 		"addl %2, %%esi				\n\t"
 		"cmpl %1, %%esi				\n\t"
 		" jb 1b					\n\t"
-		:: "g" (buf), "m" (buf+128), "m" (two_m_plus_one<<3), "r" (two_m<<3),
+		:: "g" (buf), "m" (buf2), "m" (two_m_plus_one_sh), "r" (two_m<<3),
 		   "r" (sseW[m])
 		: "%esi", "%edi", "%edx"
 	);
Index: libmpdemux/frequencies.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/frequencies.h,v
retrieving revision 1.1
diff -u -r1.1 frequencies.h
--- libmpdemux/frequencies.h	16 Nov 2001 22:06:48 -0000	1.1
+++ libmpdemux/frequencies.h	26 Feb 2005 20:47:22 -0000
@@ -104,7 +104,7 @@
 /* --------------------------------------------------------------------- */
 
 extern struct CHANLISTS   chanlists[];
-extern struct STRTAB chanlist_names[];
+extern struct STRTAB   *chanlist_names;
 
 extern int                chantab;
 extern struct CHANLIST   *chanlist;
Index: libvo/vo_jpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_jpeg.c,v
retrieving revision 1.25
diff -u -r1.25 vo_jpeg.c
--- libvo/vo_jpeg.c	19 Jan 2005 17:10:20 -0000	1.25
+++ libvo/vo_jpeg.c	26 Feb 2005 20:47:22 -0000
@@ -316,7 +316,7 @@
 /** \brief Validation function for maxfiles > 0
  */
 
-static int int_pos(int *mf)
+static int jpeg_int_pos(int *mf)
 {
     if ( *mf > 0 )
         return 1;
@@ -336,7 +336,7 @@
                                                 (opt_test_f)int_zero_hundred},
         {"outdir",      OPT_ARG_MSTRZ,  &jpeg_outdir,           NULL},
         {"subdirs",     OPT_ARG_MSTRZ,  &jpeg_subdirs,          NULL},
-        {"maxfiles",    OPT_ARG_INT,    &jpeg_maxfiles, (opt_test_f)int_pos},
+        {"maxfiles",    OPT_ARG_INT,    &jpeg_maxfiles, (opt_test_f)jpeg_int_pos},
         {NULL}
     };
     const char *info_message = NULL;
Index: postproc/swscale_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_template.c,v
retrieving revision 1.112
diff -u -r1.112 swscale_template.c
--- postproc/swscale_template.c	16 Feb 2005 23:47:00 -0000	1.112
+++ postproc/swscale_template.c	26 Feb 2005 20:47:22 -0000
@@ -2044,6 +2044,7 @@
 				  int16_t *filter, int16_t *filterPos, int filterSize)
 {
 #ifdef HAVE_MMX
+	int ptr;
 	assert(filterSize % 4 == 0 && filterSize>0);
 	if(filterSize==4) // allways true for upscaling, sometimes for down too
 	{
@@ -2139,6 +2140,7 @@
 //		filter-= counter*filterSize/2;
 		filterPos-= counter/2;
 		dst-= counter/2;
+		ptr = ((int) src) + filterSize;
 		asm volatile(
 			"pxor %%mm7, %%mm7		\n\t"
 			"movq "MANGLE(w02)", %%mm6	\n\t"
@@ -2177,7 +2179,7 @@
 			" jnc 1b			\n\t"
 
 			: "+r" (counter), "+r" (filter)
-			: "m" (filterPos), "m" (dst), "m"(src+filterSize),
+			: "m" (filterPos), "m" (dst), "m"(ptr),
 			  "m" (src), "r" ((long)filterSize*2)
 			: "%"REG_b, "%"REG_a, "%"REG_c
 		);
@@ -2319,6 +2321,8 @@
 	else
 	{
 #endif
+	int x1 = xInc>>16;
+	int x2 = xInc&0xffff;
 	//NO MMX just normal asm ...
 	asm volatile(
 		"xor %%"REG_a", %%"REG_a"	\n\t" // i
@@ -2356,7 +2360,7 @@
 		" jb 1b				\n\t"
 
 
-		:: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc>>16), "m" (xInc&0xFFFF)
+		:: "r" (src), "m" (dst), "m" (dstWidth), "m" (x1), "m" (x2)
 		: "%"REG_a, "%"REG_b, "%ecx", "%"REG_D, "%esi"
 		);
 #ifdef HAVE_MMX2
@@ -2515,6 +2519,8 @@
 	else
 	{
 #endif
+	long x1 = (long)(xInc>>16);
+	int x2 = xInc&0xffff;
 	asm volatile(
 		"xor %%"REG_a", %%"REG_a"	\n\t" // i
 		"xor %%"REG_b", %%"REG_b"		\n\t" // xx
@@ -2548,7 +2554,7 @@
 		"cmp %2, %%"REG_a"		\n\t"
 		" jb 1b				\n\t"
 
-		:: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" ((long)(xInc>>16)), "m" ((xInc&0xFFFF)),
+		:: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (x1), "m" (x2),
 		"r" (src2)
 		: "%"REG_a, "%"REG_b, "%ecx", "%"REG_D, "%esi"
 		);
-------------- next part --------------
Index: avcodec.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/avcodec.h,v
retrieving revision 1.379
diff -u -r1.379 avcodec.h
--- avcodec.h	26 Feb 2005 03:36:03 -0000	1.379
+++ avcodec.h	26 Feb 2005 20:46:59 -0000
@@ -11,6 +11,42 @@
 extern "C" {
 #endif
 
+#include <inttypes.h>
+/**
+ * AVOption.
+ */
+typedef struct AVOption {
+    /** options' name */
+    const char *name; /* if name is NULL, it indicates a link to next */
+    /** short English text help or const struct AVOption* subpointer */
+    const char *help; //        const struct AVOption* sub;
+    /** offset to context structure where the parsed value should be stored */
+    int offset;
+    /** options' type */
+    int type;
+#define FF_OPT_TYPE_BOOL 1      ///< boolean - true,1,on  (or simply presence)
+#define FF_OPT_TYPE_DOUBLE 2    ///< double
+#define FF_OPT_TYPE_INT 3       ///< integer
+#define FF_OPT_TYPE_STRING 4    ///< string (finished with \0)
+#define FF_OPT_TYPE_MASK 0x1f   ///< mask for types - upper bits are various flags
+//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
+#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
+#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
+    /** min value  (min == max   ->  no limits) */
+    double min;
+    /** maximum value for double/int */
+    double max;
+    /** default boo [0,1]l/double/int value */
+    double defval;
+    /**
+     * default string value (with optional semicolon delimited extra option-list
+     * i.e.   option1;option2;option3
+     * defval might select other then first argument as default
+     */
+    const char *defstr;
+#define FF_OPT_MAX_DEPTH 10
+} AVOption;
+
 #include "common.h"
 #include "rational.h"
 #include <sys/types.h> /* size_t */
@@ -1782,41 +1818,6 @@
 
 
 /**
- * AVOption.
- */
-typedef struct AVOption {
-    /** options' name */
-    const char *name; /* if name is NULL, it indicates a link to next */
-    /** short English text help or const struct AVOption* subpointer */
-    const char *help; //	const struct AVOption* sub;
-    /** offset to context structure where the parsed value should be stored */
-    int offset;
-    /** options' type */
-    int type;
-#define FF_OPT_TYPE_BOOL 1      ///< boolean - true,1,on  (or simply presence)
-#define FF_OPT_TYPE_DOUBLE 2    ///< double
-#define FF_OPT_TYPE_INT 3       ///< integer
-#define FF_OPT_TYPE_STRING 4    ///< string (finished with \0)
-#define FF_OPT_TYPE_MASK 0x1f	///< mask for types - upper bits are various flags
-//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
-#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
-#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
-    /** min value  (min == max   ->  no limits) */
-    double min;
-    /** maximum value for double/int */
-    double max;
-    /** default boo [0,1]l/double/int value */
-    double defval;
-    /**
-     * default string value (with optional semicolon delimited extra option-list
-     * i.e.   option1;option2;option3
-     * defval might select other then first argument as default
-     */
-    const char *defstr;
-#define FF_OPT_MAX_DEPTH 10
-} AVOption;
-
-/**
  * Parse option(s) and sets fields in passed structure
  * @param strct	structure where the parsed results will be written
  * @param list  list with AVOptions
Index: common.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/common.h,v
retrieving revision 1.146
diff -u -r1.146 common.h
--- common.h	24 Feb 2005 19:08:49 -0000	1.146
+++ common.h	26 Feb 2005 20:46:59 -0000
@@ -6,6 +6,8 @@
 #ifndef COMMON_H
 #define COMMON_H
 
+#include "avcodec.h"
+
 #if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
 #    define CONFIG_WIN32
 #endif
@@ -54,7 +56,6 @@
 #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr }
 #define AVOPTION_END() AVOPTION_SUB(NULL)
 
-struct AVOption;
 #ifdef HAVE_MMX
 extern const struct AVOption avoptions_common[3 + 5];
 #else
Index: libpostproc/postprocess_template.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/libpostproc/postprocess_template.c,v
retrieving revision 1.92
diff -u -r1.92 postprocess_template.c
--- libpostproc/postprocess_template.c	12 Oct 2004 07:16:14 -0000	1.92
+++ libpostproc/postprocess_template.c	26 Feb 2005 20:46:59 -0000
@@ -2646,7 +2646,7 @@
  * accurate deblock filter
  */
 static always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, PPContext *c){
-	int64_t dc_mask, eq_mask;
+	int64_t dc_mask, eq_mask, mask;
 	int64_t sums[10*8*2];
 	src+= step*3; // src points to begin of the 8x8 Block
 //START_TIMER
@@ -2897,6 +2897,7 @@
 		);
 
 		src+= step; // src points to begin of the 8x8 Block
+		mask = dc_mask & eq_mask;
 
 		asm volatile(
 		"movq %4, %%mm6					\n\t"
@@ -2930,7 +2931,7 @@
 		" js 1b						\n\t"
 
 		: "+r"(offset), "+r"(temp_sums)
-		: "r" ((long)step), "r"(src - offset), "m"(dc_mask & eq_mask)
+		: "r" ((long)step), "r"(src - offset), "m"(mask)
 		);
 	}else
 		src+= step; // src points to begin of the 8x8 Block


More information about the MPlayer-dev-eng mailing list