Porting transcode and xvid to amd64
AMD64 is an extremely attractive platform for transcoding digital video,
a highly processor-intensive operation.
The main open source tool for this is transcode, which integrates
numerous modules from a range of projects.
These modules don't currently take advantage of the multimedia
capabilities of the AMD64 architecture, and porting them is not trivial.
We now know that gcc from 3.3.4 onwards should be handling the
multimedia parts of amd64 correctly.
Of the video encoding projects, xvid is the most useful -- an
open-source implementation of mpeg4, a branch of the Mayo project.
Transcode and xvid are not in debian sid, though libxvidencore0 is used
by avifile-xvid-plugin (contrib). The packages have for the last few
years been expertly provided by Christian Marillat (I'm happy to give
him an amd64 account if he wants one).
Mike Phillips did some work on porting xvid back in November, getting
the framerate on an mpeg2 to xvid downsampling to about 20fps, not quite
realtime. If somebody wants to pick up the ball, there's a tarball of
his source tree at
For details, see the letter below.
I'm making a single post to those involved; please don't
indiscriminately cc any replies.
I think something like
85% of it compiles now. I have no idea if it will work though, I could
be off by one in the assmebly somewhere as it will ruin the video. I
read all the background on the transforms being done and the math is not
trivial to say the least. (Made me dig up all my matrix learning from
x86_64 uses a completely different (and actually easier) way of dealing
with -fPIC code, you reference everything relative to the %rip register.
Regular 32bit x86 code figures the reloc's out itself, but we have to
specifically tell it how to find the data its looking for.
Most of the 32bit stuff you can just dump straight over once you've got
this sorted out as long as you let gcc know how to send the function
parameters across, i.e. via the stack rather then using registers.
The stuff that catches you out straight away is the push/pop
instructions, you can't do 32 bit stack values, you have to change the
registers to their 64bit counterparts, i.e. rax instead of eax.
If you're interested in this I'd recommend downloading the chipset dev
docs from amd's site, you can get the pdf's for free.
If you want to play, I've put up the source tree that I was working on:
Be careful playing with configure, I had to manually change some of the
files to make it work. And you'll need to grab a copy of yasm too.
In the meantime, the box is so fast in 32bit mode, I'd just use the
32bit binaries and associated modules and go with that.