[MPlayer-dev-eng] [PATCH] AltiVec: dct64 for mp3lib, IMDCT for liba52, detection code

Romain Dolbeau dolbeaur at club-internet.fr
Thu Jan 16 20:38:27 CET 2003


> Cool, my code started breaking a few months ago and never recovered so I
> couldn't contribute it. :( Not that vectorized mp3 decoding has ever been
> one of my top priorities, but your implementation is really nice (though
> Darwin specific).

The only Darwin/MacOSX specific bit is the AltiVec detection function,
borrowed from FFMpeg. Someday I'll write a similar one for linux/ppc.
Everything else is (should be :-) compliant with the Motorola PEM (or is
it PIM ?)

I didn't expect the mp3 stuff to be critical, but I profiled a run of
1024 frames from a movie and the dct64_1 function was one of the top CPU
eater. So I optimized it :-) On those 1024 frames I get a more than 3x
speed-up, and dct64_altivec is no longer in the top 10 :-)

> Hm, this code is certainly suboptimal because it'll only work with Darwin;
> what about simply executing an altivec instruction and catching the trap,
> I think libmpeg2 does that. An alternative would be checking the CPU
> capabilities directly but this requires root privileges.

Or write a clean, non-portable detection function for every supported OS
:-) Seriously, is there any OS except Darwin/OSX/Linux/NetBSD running on
PPC that can compile mplayer ?

> There's one problem: Depending on the compiler you're using which in turn
> depends on the version of Darwin you have, you might need a -mabi=altivec
> to ensure proper register saving over a context switch (not so much
> because of the other changes because you don't seem to pass vector
> registers as parameters or use varargs).

Maybe that's why mplayer segfaults on OSX 10.1 at work :-)

I have to say that this code has only been tested on OSX 10.2 so far, so
if anyone has any result on OSX 10.0 / 10.1 / Darwin <whatever> please
report.

-- 
DOLBEAU Romain               | The Gods made Heavy Metal
ENS Cachan / Ker Lann        |     and it's never gonna die
Thesard IRISA / CAPS         |           -- Manowar,
dolbeaur at club-internet.fr    |    'The Gods made Heavy Metal'


More information about the MPlayer-dev-eng mailing list