[vorbis-dev] vorbisfile close and memory callbacks

Segher Boessenkool segher at wanadoo.nl
Mon Oct 23 16:53:01 PDT 2000



Monty wrote:
> 
> >
> > > ...which was absolutely necessary to alleviate pressure on the data
> > > cache, not
> > > just an interface nicety.  And I'm still, a month later, dealing with
> > > occasional fallout from that change.  Double->float took two hours.
> > > Repairing
> > > two vital encode algorithms to not choke on the reduced resolution took
> >
> > Was there much loss in quality due to this changeover?
> 
> No, none.  There were three reasons I used doubles to begin with:
> 
> a) Two of the LSP generation algs required double resolution; I've replaced one
> algorithm (higher computational complexity, but slighly faster at our filter
> sizes) and redesigend the other.
> 
> b) 'Double' is to an extent more 'native' to C than float.  Floats are often
> promoted to doubles within code (sometimes unexpectedly) and double constants
> are suffix-less.  Weak reason, sure.

What out for things like M_PI; it is a double, however you use it. And
stuff like

x*2

where x is a float, gets calculated in double as well, because 2 is
promoted to
double. Watch out for constants, if you want floats.

Oh, and write cosf() instead of cos(), etc. But I don't think this is portable.
It *does* require a lot less processor time.

> 
> c) Most processors these days handle double just as quickly (or faster) than
> float.

As you point out below, it is just as quickly for the ALU, but slower for
the memory.

> 
> As it turns out, Vorbis requires a good amount of working space, and floats
> take up half the space, thus placing less pressure on the cache.

Amen.

Segher

--- >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