[vorbis-dev] Modification requests / question
Frank Klemm
pfk at fuchs.offl.uni-jena.de
Tue Dec 26 07:19:53 PST 2000
::
:: >> #define vorbis_ftoi(f) ((int)(f+.5f))
:: >>
:: >Is f always >= 0 ?
:: >
:: >If no, the function is works wrong.
:: >If yes, the name of the function is dangerous.
:: >
:: >May be someone can call it with vorbis_ftoi(-2.1) and gets a -1.
::
:: No, it's not always called with f >= 0. However, it's used only in two
:: places - in one, it compensates for this problem appropriately, so it's not
:: a problem.
::
:: In the other, it isn't sensitive to slightly-off results (and errors here
:: can't propogate any further) - the speed difference seems worthwhile in
:: practice.
::
My experiences say that such "it's enough for the current purpose" are seeds
for long term bugs. They are hardly to find.
If you really need fast code, use good code, not such hacks. The time you
need to find errors which are a result of such hacks you can investigate in
real optimization.
BTW: There's code available, which is:
- 5 times faster (on Intel)
- works always correct (0.5 => 0, 0.51 => 1, 1.5 => 2, -1.5 => -2)
--
Mit freundlichen Grüßen
Frank Klemm
eMail | pfk at uni-jena.de home: pfk at schnecke.offl.uni-jena.de
phone | +49 (3641) 64-2721 home: +49 (3641) 390545
sMail | R.-Breitscheid-Str. 43, 07747 Jena, Germany
--- >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
mailing list