[vorbis-dev] Re: SIMD instructions
Felix von Leitner
felix-vorbis at fefe.de
Fri Feb 7 19:06:35 PST 2003
Thus spake Monty (xiphmont at xiph.org):
> You get slightly different rounding. It doesn't matter one bit
> (actually... it matters considerably less than one bit). No aspect of
> Vorbis for which an arithmetic result is roundoff-sensitive uses
Why does the vorbis code then set the rouding mode all the time?
Anyway, I just "completed" my simd patch. It is probably still not ripe
for inclusion, but it should not harm either, because it will only
activate if you either #define simd_3dn (for 3dnow!) or use gcc 3 or
icc and compile for a target with SSE support (i.e. use -march=pentium3
-msse) for gcc 3. Please note that you need a bleeding edge gcc version
to use the SSE stuff, I just noticed that my gcc 3.1.1 is still broken
in this respect.
I only hacked the decoder, I have not looked at the encoder at all.
The SSE code is about thrice as large and complex as it needs to because
the passed data structures are not 16-byte aligned. That really is a
big hindrance, and I suggest libvorbis should make sure its data is
16-byte aligned anyway, for cache efficiency reasons.
The easiest way is to malloc 12 bytes more and then add (16-(ptr&15)) to
the char* ptr.
The patch is at http://www.fefe.de/libvorbis-1.0-simd.diff.bz2
On my Athlon XP, "ogg123 -d null -q" of my test song went from 3.62s to
2.84s, which is 20% less time. Not as much as I had hoped for, but
quite significant nonetheless. The 3dnow diff saves about 10% time,
because 3dnow operates on 2 floats at a time while SSE works on 4.
One bad aspect of the patch is that it just compiles the instructions
in. A better way for a generic library would be to select the
instructions at run-time based on the CPU flags, but I'm too lazy to do
that now. ;)
PS: Feedback welcome!
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev