shithub: opus

Download patch

ref: 6d584acd95ef267fd89da8e869577fa524b88354
parent: 9319e3e6dfbace947968bef8a4b2290d034f0b1e
author: Jean-Marc Valin <[email protected]>
date: Sat Nov 21 16:57:44 EST 2009

Renamed MDCT functions to avoid symbol clashes with Vorbis

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -333,7 +333,7 @@
    {
       const mdct_lookup *lookup = MDCT(mode);
       const int overlap = OVERLAP(mode);
-      mdct_forward(lookup, in, out, mode->window, overlap);
+      clt_mdct_forward(lookup, in, out, mode->window, overlap);
    } else {
       const mdct_lookup *lookup = MDCT(mode);
       const int overlap = OVERLAP(mode);
@@ -358,7 +358,7 @@
             int j;
             for (j=0;j<N+overlap;j++)
                x[j] = in[C*(b*N+j)+c];
-            mdct_forward(lookup, x, tmp, mode->window, overlap);
+            clt_mdct_forward(lookup, x, tmp, mode->window, overlap);
             /* Interleaving the sub-frames */
             for (j=0;j<N;j++)
                out[(j*B+b)+c*N*B] = tmp[j];
@@ -382,7 +382,7 @@
       int j;
       if (transient_shift==0 && C==1 && !shortBlocks) {
          const mdct_lookup *lookup = MDCT(mode);
-         mdct_backward(lookup, X, out_mem+C*(MAX_PERIOD-N-N4), mode->window, overlap);
+         clt_mdct_backward(lookup, X, out_mem+C*(MAX_PERIOD-N-N4), mode->window, overlap);
       } else {
          VARDECL(celt_word32, x);
          VARDECL(celt_word32, tmp);
@@ -411,7 +411,7 @@
             /* De-interleaving the sub-frames */
             for (j=0;j<N2;j++)
                tmp[j] = X[(j*B+b)+c*N2*B];
-            mdct_backward(lookup, tmp, x+n4offset+N2*b, mode->window, overlap);
+            clt_mdct_backward(lookup, tmp, x+n4offset+N2*b, mode->window, overlap);
          }
 
          if (transient_shift > 0)
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -58,7 +58,7 @@
 #define M_PI 3.141592653
 #endif
 
-void mdct_init(mdct_lookup *l,int N)
+void clt_mdct_init(mdct_lookup *l,int N)
 {
    int i;
    int N2;
@@ -87,13 +87,13 @@
 #endif
 }
 
-void mdct_clear(mdct_lookup *l)
+void clt_mdct_clear(mdct_lookup *l)
 {
    cpx32_fft_free(l->kfft);
    celt_free(l->trig);
 }
 
-void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16 *window, int overlap)
+void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16 *window, int overlap)
 {
    int i;
    int N, N2, N4;
@@ -184,7 +184,7 @@
 }
 
 
-void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16 * restrict window, int overlap)
+void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16 * restrict window, int overlap)
 {
    int i;
    int N, N2, N4;
--- a/libcelt/mdct.h
+++ b/libcelt/mdct.h
@@ -55,14 +55,14 @@
    kiss_twiddle_scalar * restrict trig;
 } mdct_lookup;
 
-void mdct_init(mdct_lookup *l,int N);
-void mdct_clear(mdct_lookup *l);
+void clt_mdct_init(mdct_lookup *l,int N);
+void clt_mdct_clear(mdct_lookup *l);
 
 /** Compute a forward MDCT and scale by 4/N */
-void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16 *window, int overlap);
+void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16 *window, int overlap);
 
 /** Compute a backward MDCT (no scaling) and performs weighted overlap-add 
     (scales implicitly by 1/2) */
-void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16 * restrict window, int overlap);
+void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16 * restrict window, int overlap);
 
 #endif
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -369,10 +369,10 @@
 
 #endif /* !STATIC_MODES */
 
-   mdct_init(&mode->mdct, 2*mode->mdctSize);
+   clt_mdct_init(&mode->mdct, 2*mode->mdctSize);
 
    mode->shortMdctSize = mode->mdctSize/mode->nbShortMdcts;
-   mdct_init(&mode->shortMdct, 2*mode->shortMdctSize);
+   clt_mdct_init(&mode->shortMdct, 2*mode->shortMdctSize);
    mode->shortWindow = mode->window;
    mode->prob = quant_prob_alloc(mode);
    if ((mode->mdct.trig==NULL) || (mode->shortMdct.trig==NULL)
@@ -436,8 +436,8 @@
    celt_free((celt_word16*)mode->window);
 
 #endif
-   mdct_clear(&mode->mdct);
-   mdct_clear(&mode->shortMdct);
+   clt_mdct_clear(&mode->mdct);
+   clt_mdct_clear(&mode->shortMdct);
    quant_prob_free(mode->prob);
    mode->marker_end = MODEFREED;
    celt_free((CELTMode *)mode);
--- a/tests/mdct-test.c
+++ b/tests/mdct-test.c
@@ -89,7 +89,7 @@
     celt_word16  * window= (celt_word16*)malloc(sizeof(celt_word16)*nfft/2);
     int k;
 
-    mdct_init(&cfg, nfft);
+    clt_mdct_init(&cfg, nfft);
     for (k=0;k<nfft;++k) {
         in[k] = (rand() % 32768) - 16384;
     }
@@ -116,10 +116,10 @@
     {
        for (k=0;k<nfft;++k)
           out[k] = 0;
-       mdct_backward(&cfg,in,out, window, nfft/2);
+       clt_mdct_backward(&cfg,in,out, window, nfft/2);
        check_inv(in,out,nfft,isinverse);
     } else {
-       mdct_forward(&cfg,in,out,window, nfft/2);
+       clt_mdct_forward(&cfg,in,out,window, nfft/2);
        check(in,out,nfft,isinverse);
     }
     /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/
@@ -127,7 +127,7 @@
 
     free(in);
     free(out);
-    mdct_clear(&cfg);
+    clt_mdct_clear(&cfg);
 }
 
 int main(int argc,char ** argv)