[vorbis-dev] mdct as hardware

Segher Boessenkool segher at chello.nl
Tue Mar 19 16:12:19 PST 2002



Monty wrote:
> 
> On Wed, Mar 20, 2002 at 12:46:15AM +0100, Luis Azuara wrote:
> > Hi vorbis-dev!
> >
> > I'm working with Pattara in the oggonachip project, and wondering about
> > the implementation of mdct.c as hardware. According your recomendations
> > about using the floating point version, I would say, we have to implement
> > the integerized
> > version of mdct as a core, and use the fpu only to round the input
> > values. By doing
> > that, you think the result would be still acceptable?
> 
> You can use the MDCT in CVS as a fully fixed point implementation with
> no problems *if* you have a 32bit*32bit->64bit multiply.  It's a
> 32*32->32 multiply (which is really 16*16->32) that is an issue.  One
> of those things C only sort of provides.

The fp dct algorithm libvorbis uses, if implemented as fixed point,
needs 80-or-so bit words, if you use the same fixed point scaling
for all words, and need (only) 16-bit integer precision outputs.

> Segher has magic code using a union of two 32 bit ints as a 64 bit
> type that apparently newest versions of GCC will compile properly to
> 32*32->64 on platforms that have it.

It's hardly magic.  And gcc doesn't cope well with it on all platforms.
The platforms I know of that handle it well are x86, ppc, alpha, arm.

> Other than that, no real caveats in that code.

For fixed point, you really really really want a different dct algorithm.
(Mostly because, although fp multiplies are fast on most hardware,
integer multiplies are slooooow).
Especially if you implement it in hardware.  You can easily get away
with a word size of only 18, for example, (for output size 16 bit), if
you assume no values >= 65536 will happen (that's twice the legal output
range), or you do some pre-clipping on the dct inputs.

<p>Segher

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