[vorbis-dev] More mdct questions

Segher Boessenkool segher at wanadoo.nl
Mon Oct 23 15:54:48 PDT 2000



"Dave, Anish" wrote:
> 
> Sorry for starting another topic, this is actually a reply to Segher's post
> on Sun Oct 22 on the 'mdct question' topic.  I wasn't subscribed properly
> and so I didn't get email confirmation and thus can't add to that thread.
> 
> So Segher, if the equation is indeed what you say it is, then replacing
> mdct_backward with this version should work, but it doesn't.
> Am I applying it incorrectly?

Maybe, can't see how you call it.

> 
> void mdct_backward(mdct_lookup *init, double *in, double *out) // I call
> this with in != out
> {
> 
>     // For 256 size blocks, coef are in[0..127]
>     // For 2048 size blocks, coef are in[0..1023]
>     int N = init->n / 4;
>     for( int j = 0; j < 4*N; j++ )
>     {
>         double sum = 0;
>         for( int k = 0; k < 2*N; k++ )
>         {
>             sum += in[k]*cos(M_PI*(2*j+1+N)*(2*k+1)/8/N);

It can be -N instead of +N. Don't know right now. Maybe my formula has a mistake;
look at any of the mpeg layer III techdocs on the web to find the
correct formula.

Maybe you are applying the window in one of your test cases, but not in
the other.
Maybe init->n is not what you think; when I was doing my mdct
optimizations, I
thought the value of init->n was a bit illogical.

>         }
>         out[j] = sum;
>     }
> }
> 
> > It just a normal shifted mdct, like the one used in mpeg layer 3.
> > it's equations are:
> > (time domain: a_j, freq domain: b_k; w_j is the window)
> > forward:
> > b_k = sum(j=0..4N-1) a_j * w_j * cos( (2k+1)(2j+1+-N) / 8N ) // forward
> > a_j = w_j * sum(k=0..2N-1) a_j * cos( (2k+1)(2j+1+-N) / 8N ) // backward
> (missing PI in the cos, and a_j should be b_k in summation)

I'm too lazy to write PI in my own notes. And a cut'n'paste error as well.
Ouch. Sorry.

> > where +- means: I'm not sure whether it is + or -, but I think it is +
> > (forward as well as backward).
> > k is 0..2N-1, j is 0..4N-1.

Dagdag,

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