[Theora-dev] patch to build theora-mmx on AMD64

Ralph Giles giles at xiph.org
Tue May 2 23:40:12 PDT 2006


On Wed, May 03, 2006 at 02:16:16AM -0400, Dan Lenski wrote:

> Agreed.  libogg provides an ogg_int64_t, but no ogg_uint64_t for some
> reason... any idea who I should talk to about getting this included?

Here is probably fine, but you could bring it up on ogg-dev if you 
wanted.

IIRC we were just lazy. The libogg api doesn't actually require a uint64 
type, so we didn't supply one to reduce the portability burden. Of 
course doing it this way introduces a dependency on a newer libogg, but 
we can also provide a configure fallback for that if necessary.

> Yeah, in this case I think it would unfortunately muddy up the code a
> lot.  It seems clearer to have arch-specific code in its own
> directory.  For example, somebody might want to add AltiVec support,
> and then there could be i386, x86_64, and ppc64 directories.

Ok. Where it's just changing some register names, the defines seemed 
cleaner, but otherwise I agree.

> I'll try to get things to build correctly on any architecture ... it's
> past time for me to read up on automake/autoconf anyway.

Try the attached patch and see if that builds for you. With this patch 
it builds and runs for me on i686, but doesn't produce correct output.

If it doesn't detect your cpu correctly, add a line to match the output 
of ./config.guess to the new case statement the patch adds to 
configure.ac.

 -r
-------------- next part --------------
Index: configure.ac
===================================================================
--- configure.ac	(revision 11333)
+++ configure.ac	(working copy)
@@ -4,7 +4,7 @@
 dnl Initialization and Versioning
 dnl ------------------------------------------------
 
-AC_INIT(libtheora-mmx,[1.0alpha5])
+AC_INIT(libtheora-mmx,[1.0alpha6-svn])
 
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
@@ -95,13 +95,20 @@
 
         case $host in 
         *)
-                DEBUG="-g -W -D__NO_MATH_INLINES"
+                DEBUG="-g -Wall -D__NO_MATH_INLINES"
                 CFLAGS="-Wall -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
-                PROFILE="-W -pg -g -O3 -fno-inline-functions";;
+                PROFILE="-Wall -pg -g -O3 -fno-inline-functions";;
         esac
 fi
 CFLAGS="$CFLAGS $cflags_save"
 
+cpu_x86_64=no
+case $target in
+	x86_64-*)
+		cpu_x86_64=yes ;;
+esac
+AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
+
 # Test whenever ld supports -version-script
 AC_PROG_LD
 AC_PROG_LD_GNU
Index: lib/Makefile.am
===================================================================
--- lib/Makefile.am	(revision 11333)
+++ lib/Makefile.am	(working copy)
@@ -1,6 +1,12 @@
 INCLUDES = -I$(top_srcdir)/include
 
-EXTRA_DIST = Version_script.in
+EXTRA_DIST = Version_script.in \
+	i386/dsp_mmxext.c \
+	i386/recon_mmx.c \
+	i386/fdct_mmx.c \
+	x86_64/dsp_mmxext.c \
+	x86_64/recon_mmx.c \
+	x86_64/fdct_mmx.c
 
 lib_LTLIBRARIES = libtheora.la
 
@@ -10,6 +16,12 @@
 encoder_sources = dct_encode.c encode.c encoder_toplevel.c
 endif
 
+if CPU_x86_64
+arch_dir = x86_64
+else
+arch_dir = i386
+endif
+
 libtheora_la_SOURCES = \
 	blockmap.c \
 	comment.c \
@@ -30,10 +42,9 @@
 	toplevel.c \
 	cpu.c \
 	dsp.c \
-	i386/dsp_mmx.c \
-	i386/dsp_mmxext.c \
- 	i386/recon_mmx.c \
-	i386/fdct_mmx.c \
+	$(arch_dir)/dsp_mmxext.c \
+	$(arch_dir)/recon_mmx.c \
+	$(arch_dir)/fdct_mmx.c \
 	$(encoder_sources)
 
 noinst_HEADERS = \


More information about the Theora-dev mailing list