Inverse MDCT formula missing from Specification

Foo Bar <[email protected]> Mon, 1 Aug 2011 14:05:02 +0100 (BST)
Newsgroups gmane.comp.multimedia.ogg.vorbis.devel
Message-ID <[email protected]>
Hi

The inverse MDCT formula seems to be missing from the vorbis specification. From reading the source code of stb_vorbis (http://nothings.org/stb_vorbis/) I've a good idea of what it might be, but cannot find the formula anywhere in the official specification (the one on http://xiph.org/vorbis/doc/Vorbis_I_spec.html ). I also understand that the formula stated in the eusipco_corrected.ps paper is incorrect (the link from the specification to the paper is also dead).

From the stb_vorbis.c source:

void inverse_mdct_slow(float *buffer, int n)
{
   int i,j;
   int n2 = n >> 1;
   float *x = (float *) malloc(sizeof(*x) * n2);
   memcpy(x, buffer, sizeof(*x) * n2);
   for (i=0; i < n; ++i) {
      float acc = 0;
      for (j=0; j < n2; ++j)
         // formula from paper:
         //acc += n/4.0f * x[j] * (float) cos(M_PI / 2 / n * (2 * i + 1 + n/2.0)*(2*j+1));
         // formula from wikipedia
         //acc += 2.0f / n2 * x[j] * (float) cos(M_PI/n2 * (i + 0.5 + n2/2)*(j + 0.5));
         // these are equivalent, except the formula from the paper inverts the multiplier!
         // however, what actually works is NO MULTIPLIER!?!
         //acc += 64 * 2.0f / n2 * x[j] * (float) cos(M_PI/n2 * (i + 0.5 + n2/2)*(j + 0.5));
         acc += x[j] * (float) cos(M_PI / 2 / n * (2 * i + 1 + n/2.0)*(2*j+1));
      buffer[i] = acc;
   }
   free(x);
}

Thanks
Liam Wilson

_______________________________________________
Vorbis-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/vorbis-dev