[x264-devel] Re: x264 on big endians

Tuukka Toivonen tuukkat at ee.oulu.fi
Tue Jul 5 19:23:39 CEST 2005


On Tue, 5 Jul 2005, Loren Merritt wrote:

> You mean like x264/extras/getopt.[ch] ? (though I haven't tried compiling with
> them)

Wow, great. No need to add it then. The patch below adds support for x264
for UltraSparc (uname -m: sun4u) with Solaris. Seems to work well,
I tested with 
./x264 --frames 20 -o /tmp/out.264 paris-352x288.yuv
and the output was bit identical compared to x86/Linux output.

I didn't even try pthread even though we have here -- I think -- 8 CPU 
machine or something like that :)

It still needs GNU make for compilation (probably gcc too, or at least 
that is what I used). Also gmake clean doesn't work, I just get:
.depend:1: *** missing separator.  Stop.
but IIRC that happens occasionally on Linux too (but always on Solaris).

getopt.c didn't compile directly as __argv was not defined.

Even if standard libc has getopt (and getopt.c too, I presume), linking 
still succeeds. I suppose the weak symbols in libc get overridden
with ones from getopt.c.

Looks like correct getopt.h header is included as I didn't get any warning 
about missing getopt_long, but maybe that should be ensured with

#if HAVE_GETOPT_LONG
#include <getopt.h>
#else
#include "extras/getopt.h"
#endif

?

Index: encoder/ratecontrol.c
===================================================================
--- encoder/ratecontrol.c	(revision 270)
+++ encoder/ratecontrol.c	(working copy)
@@ -40,7 +40,7 @@
 #if defined(SYS_FREEBSD) || defined(SYS_BEOS)
 #define exp2f(x) powf( 2, (x) )
 #endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(SYS_SunOS)
 #define exp2f(x) pow( 2, (x) )
 #define sqrtf sqrt
 #endif
Index: configure
===================================================================
--- configure	(revision 270)
+++ configure	(working copy)
@@ -35,6 +35,7 @@
 CC="gcc"
 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
 LDFLAGS=""
+HAVE_GETOPT_LONG=1
 
 AS="nasm"
 ASFLAGS="-f elf"
@@ -73,6 +74,12 @@
     ASFLAGS="-f win32 -DPREFIX"
     EXE=".exe"
     ;;
+  SunOS)
+    SYS="SunOS"
+    CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
+    LDFLAGS="$LDFLAGS -lm"
+    HAVE_GETOPT_LONG=0
+    ;;
   *)
     echo "Unknown system $UNAMES, edit the configure"
     exit 1
@@ -100,6 +107,9 @@
       CFLAGS="$CFLAGS -maltivec -mabi=altivec"
     fi
     ;;
+  sun*)
+    ARCH="Sparc"
+    ;;
   *)
     echo "Unknown platform $UNAMEM, edit the configure"
     exit 1
@@ -204,6 +214,7 @@
 VFW=$vfw
 EXE=$EXE
 VIS=$vis
+HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
 EOF
 
 if [ "$vfw" = "yes" ]; then
Index: extras/getopt.c
===================================================================
--- extras/getopt.c	(revision 270)
+++ extras/getopt.c	(working copy)
@@ -63,11 +63,15 @@
 __weak_alias(getopt_long,_getopt_long)
 #endif
 
+#if 0
 #ifndef __CYGWIN__
 #define __progname __argv[0]
 #else
 extern char *__progname;
 #endif
+#else
+char *__progname = "x264";
+#endif
 
 #define IGNORE_FIRST	(*options == '-' || *options == '+')
 #define PRINT_ERROR	((opterr) && ((*options != ':') \
Index: Makefile
===================================================================
--- Makefile	(revision 270)
+++ Makefile	(working copy)
@@ -37,6 +37,13 @@
 SRCS += common/ppc/mc.c common/ppc/pixel.c common/ppc/dct.c
 endif
 
+ifneq ($(HAVE_GETOPT_LONG),1)
+SRCS += extras/getopt.c
+CFLAGS += -DHAVE_GETOPT_LONG=0
+else
+CFLAGS += -DHAVE_GETOPT_LONG=1
+endif
+
 OBJS = $(SRCS:%.c=%.o)
 DEP  = depend
 

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list