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

Dan Lenski dlenski at gmail.com
Tue May 2 21:48:45 PDT 2006


Hi all, I've patched theora-mmx to build on x86_64.  The patch against
SVN is attached.

Basically all I did was to copy lib/i386 to lib/x86_64 and tweak the
assembler code a bit:
* added to each file: typedef unsigned long int ogg_uint64_t
* converted all asm inputs to 64-bit in: dsp_mmxext.c,  fdct_mmx.c,  recon_mmx.c
* left all asm outputs at 32-bit
* I didn't patch dsp_mmx.c, since all x86_64 processors have SSE, thus
there's no need for the old mmx version

I also made minor modifications to cpu.c to get CPUID working
correctly on x86_64.

I've tested the patch using dump_video and encoder_example on a short
16-second clip which I grabbed off Google Videos.  It's a screenshot
from some 80s video game, and I've posted it at
http://tonquil.homeip.net:888/~dlenski/TeeterTortureVerySho.ogg if
anyone wants to compare results.

Decoding with either the baseline C dsp routines or my version of
mmxext gives *identical* md5sums.  Encoding doesn't give the same
md5sum (derf_ on IRC told me this was okay), but the video looks
identical to the original as far as I can tell.  Either way, things
seem to run about >2X as fast (on my 2.2 ghz Athlon 64 w/512 kB L2
cache).

A couple things that need improvement:
* I don't know automake/autoconf that well, so I don't know how to
make it automatically choose i386/x86_64 in the Makefile.  I did make
it so that cpu.c will choose the appropriate cpuid routine based on
#if defined(__x86_64__)
* Lots of 32-bit integers still get passed back and forth to the DSP
routines, which is of course inefficient on a 64-bit system.
* I can't figure out how to build a shared lib.  I get errors about
un-relocatable symbols.  Maybe some shared lib guru can help me with
this.

Please let me know if you get this patch working!  Any
suggestions/questions/hate mail would be appreciated.

Dan Lenski

On 3/30/06, Stefan de Konink <skinkie at xs4all.nl> wrote:
> Dan Lenski wrote:
> > I've googled reports of theora-mmx on AMD64... and have found some
> > hazy results suggesting that people have got theora-mmx working on
> > AMD64.  Can anyone give me any tips on getting it to work?  Thanks a
> > lot,
>
>  From what I understand of it, the idea is to make a linux32 bit chroot
> envirionment and compile theora-mmx in there. So you actually are in
> 32bit mode and mmx will just work fine :)
>
>
> Stefan
>
> _______________________________________________
> Theora-dev mailing list
> Theora-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora-dev
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drl_x86_64.diff.gz
Type: application/x-gzip
Size: 7749 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/theora-dev/attachments/20060503/e24f3a76/drl_x86_64.diff.bin


More information about the Theora-dev mailing list