[vorbis] Setting up the trig tables.

Govind Kharbanda govind.kharbanda at sli-institute.ac.uk
Fri Aug 16 06:36:10 PDT 2002



As some of you know, I'm creating a hardware MDCT core.  At the moment
I'm working out the best way to create a lookup table for the trig
values, as set up in mdct_init:

/* trig lookups... */

  for(i=0;i<n/4;i++){
    T[i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i)));
    T[i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i)));
    T[n2+i*2]=FLOAT_CONV(cos((M_PI/(2*n))*(2*i+1)));
    T[n2+i*2+1]=FLOAT_CONV(sin((M_PI/(2*n))*(2*i+1)));
  }
  for(i=0;i<n/8;i++){
    T[n+i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i+2))*.5);
    T[n+i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i+2))*.5);
  }

I'd like to work out how big this table is to put it in hardware, could
someone confirm the following assumptions:

Assumption 1: n = 256 or n = 2048 only (the two window sizes).  There is
something in the Vorbis spec about any power of two being allowed as a
block size?

Assumption 2: Values are assigned not from T[0] to T[n-1] but from T[0]
to T[n + (n/4) - 1], e.g. if n = 256, then values assigned from T[0] to
T[319], and if n = 2048, then values assigned from T[0] to T[2559]

Assumption 3: Each value is 4 bytes by default (if floats - I know I'll
have to integerize it soon!) so storage space required is 320*4 bytes =
1280 bytes for n=256, or 2560*4 bytes = 10240 bytes for n=2048.

Assumption 3: M_PI is just PI, i.e. 3.1415....

Consider n=256, then n2=n>>1=128, n/4=64, n/8=32

first loop:
(i=0)
T[0]
T[1]
T[128]
T[129]

i=63 (last value)
T[126]
T[127]
T[254]
T[255]

econd loop:

i=0
T[256]
T[257]

i=31 (final value)
T[318]
T[319]

<p><p>
-- 
Govind S Kharbanda                Institute for System Level Integration
MSc Course Rep.                        Alba Campus, Livingston, EH54 7EG
http://www.sli-institute.ac.uk/~gk/                    Tel: 01506 469340
--- >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-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 mailing list