[xiph-commits] r10789 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Thu Feb 9 00:54:57 PST 2006


Author: jm
Date: 2006-02-09 00:54:52 -0800 (Thu, 09 Feb 2006)
New Revision: 10789

Modified:
   trunk/speex/libspeex/fftwrap.c
   trunk/speex/libspeex/mdf.c
   trunk/speex/libspeex/pcm_wrapper.c
   trunk/speex/libspeex/pseudofloat.h
   trunk/speex/libspeex/testenc_wb.c
Log:
fixed lots of warning/errors on retarded (non-C99) compilers


Modified: trunk/speex/libspeex/fftwrap.c
===================================================================
--- trunk/speex/libspeex/fftwrap.c	2006-02-09 00:49:35 UTC (rev 10788)
+++ trunk/speex/libspeex/fftwrap.c	2006-02-09 08:54:52 UTC (rev 10789)
@@ -248,9 +248,10 @@
       out[i] = _out[i];
    if (!fixed_point)
    {
+      float scale;
       struct drft_lookup t;
       spx_drft_init(&t, ((struct kiss_config *)table)->N);
-      float scale = 1./((struct kiss_config *)table)->N;
+      scale = 1./((struct kiss_config *)table)->N;
       for (i=0;i<((struct kiss_config *)table)->N;i++)
          out[i] = scale*in[i];
       spx_drft_forward(&t, out);

Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c	2006-02-09 00:49:35 UTC (rev 10788)
+++ trunk/speex/libspeex/mdf.c	2006-02-09 08:54:52 UTC (rev 10789)
@@ -123,6 +123,10 @@
    spx_word32_t *W;
    spx_word32_t *power;
    spx_float_t *power_1;
+   spx_word16_t *wtmp;
+#ifdef FIXED_POINT
+   spx_word16_t *wtmp2;
+#endif
    spx_word32_t *Rf;
    spx_word32_t *Yf;
    spx_word32_t *Xf;
@@ -300,7 +304,9 @@
    st->power = (spx_word32_t*)speex_alloc((frame_size+1)*sizeof(spx_word32_t));
    st->power_1 = (spx_float_t*)speex_alloc((frame_size+1)*sizeof(spx_float_t));
    st->window = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-#ifdef FIXED_POINT   
+   st->wtmp = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
+#ifdef FIXED_POINT
+   st->wtmp2 = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
    for (i=0;i<N>>1;i++)
    {
       st->window[i] = (16383-SHL16(spx_cos(DIV32_16(MULT16_16(25736,i<<1),N)),1));
@@ -375,7 +381,10 @@
    speex_free(st->power);
    speex_free(st->power_1);
    speex_free(st->window);
-
+   speex_free(st->wtmp);
+#ifdef FIXED_POINT
+   speex_free(st->wtmp2);
+#endif
    speex_free(st);
 }
 
@@ -626,31 +635,29 @@
       /* Remove the "if" to make this an MDF filter */
       if (j==M-1 || st->cancel_count%(M-1) == j)
       {
-         spx_word16_t w[N];
 #ifdef FIXED_POINT
-         spx_word16_t w2[N];
          for (i=0;i<N;i++)
-            w2[i] = PSHR32(st->W[j*N+i],NORMALIZE_SCALEDOWN+16);
-         spx_ifft(st->fft_table, w2, w);
+            st->wtmp2[i] = PSHR32(st->W[j*N+i],NORMALIZE_SCALEDOWN+16);
+         spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
          for (i=0;i<st->frame_size;i++)
          {
-            w[i]=0;
+            st->wtmp[i]=0;
          }
          for (i=st->frame_size;i<N;i++)
          {
-            w[i]=SHL(w[i],NORMALIZE_SCALEUP);
+            st->wtmp[i]=SHL(st->wtmp[i],NORMALIZE_SCALEUP);
          }
-         spx_fft(st->fft_table, w, w2);
+         spx_fft(st->fft_table, st->wtmp, st->wtmp2);
          /* The "-1" in the shift is a sort of kludge that trades less efficient update speed for decrease noise */
          for (i=0;i<N;i++)
-            st->W[j*N+i] -= SHL32(w2[i],16+NORMALIZE_SCALEDOWN-NORMALIZE_SCALEUP-1);
+            st->W[j*N+i] -= SHL32(st->wtmp2[i],16+NORMALIZE_SCALEDOWN-NORMALIZE_SCALEUP-1);
 #else
-         spx_ifft(st->fft_table, &st->W[j*N], w);
+         spx_ifft(st->fft_table, &st->W[j*N], st->wtmp);
          for (i=st->frame_size;i<N;i++)
          {
-            w[i]=0;
+            st->wtmp[i]=0;
          }
-         spx_fft(st->fft_table, w, &st->W[j*N]);
+         spx_fft(st->fft_table, st->wtmp, &st->W[j*N]);
 #endif
       }
    }

Modified: trunk/speex/libspeex/pcm_wrapper.c
===================================================================
--- trunk/speex/libspeex/pcm_wrapper.c	2006-02-09 00:49:35 UTC (rev 10788)
+++ trunk/speex/libspeex/pcm_wrapper.c	2006-02-09 08:54:52 UTC (rev 10789)
@@ -53,7 +53,7 @@
    PCMState *st = (PCMState*)speex_alloc(sizeof(PCMState));
    st->mode = m;
    st->frame_size = 64;
-   
+   return st;
 }
 
 /** De-allocates encoder state resources*/
@@ -74,6 +74,7 @@
       x = in[i];
       speex_bits_pack(bits, x, 16);
    }
+   return 0;
 }
 
 /** Initializes decoder state*/
@@ -81,7 +82,8 @@
 {
    PCMState *st = (PCMState*)speex_alloc(sizeof(PCMState));
    st->mode = m;
-   st->frame_size = 64;   
+   st->frame_size = 64;
+   return st;
 }
 
 /** De-allocates decoder state resources*/
@@ -102,6 +104,7 @@
       x = speex_bits_unpack_signed(bits, 16);
       out[i] = x;
    }
+   return 0;
 }
 
 /** ioctl-like function for controlling a narrowband encoder */
@@ -121,6 +124,7 @@
          speex_warning_int("Unknown nb_ctl request: ", request);
          return -1;
    }
+   return 0;
 }
 
 /** ioctl-like function for controlling a narrowband decoder */
@@ -139,8 +143,8 @@
       default:
          speex_warning_int("Unknown nb_ctl request: ", request);
          return -1;
-
    }
+   return 0;
 }
 
 typedef struct {
@@ -150,7 +154,7 @@
 
 int pcm_mode_query(const void *mode, int request, void *ptr)
 {
-   const PCMMode *m = (const PCMMode*)mode;
+   /*const PCMMode *m = (const PCMMode*)mode;*/
    
    switch (request)
    {
@@ -177,4 +181,4 @@
    &pcm_decoder_ctl,
 };
 
-const SpeexMode *speex_pcm_wrapper = &pcm_wrapper_mode;
\ No newline at end of file
+const SpeexMode *speex_pcm_wrapper = &pcm_wrapper_mode;

Modified: trunk/speex/libspeex/pseudofloat.h
===================================================================
--- trunk/speex/libspeex/pseudofloat.h	2006-02-09 00:49:35 UTC (rev 10788)
+++ trunk/speex/libspeex/pseudofloat.h	2006-02-09 08:54:52 UTC (rev 10789)
@@ -79,18 +79,15 @@
       return (spx_float_t) {x,e};
 }
 
-static inline float REALFLOAT(spx_float_t a)
-{
-   return a.m * pow(2,a.e);
-}
 
 static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b)
 {
+   spx_float_t r;
    if (a.m==0)
       return b;
    else if (b.m==0)
       return a;
-   spx_float_t r = (a).e > (b).e ? (spx_float_t) {((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1)),(a).e+1} : (spx_float_t) {((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1)),(b).e+1};
+   r = (a).e > (b).e ? (spx_float_t) {((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1)),(a).e+1} : (spx_float_t) {((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1)),(b).e+1};
    if (r.m>0)
    {
       if (r.m<16384)
@@ -111,11 +108,12 @@
 
 static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b)
 {
+   spx_float_t r;
    if (a.m==0)
       return b;
    else if (b.m==0)
       return a;
-   spx_float_t r = (a).e > (b).e ? (spx_float_t) {((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1)),(a).e+1} : (spx_float_t) {((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1) ,(b).e+1};
+   r = (a).e > (b).e ? (spx_float_t) {((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1)),(a).e+1} : (spx_float_t) {((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1) ,(b).e+1};
    if (r.m>0)
    {
       if (r.m<16384)
@@ -173,10 +171,6 @@
    return r;   
 }
 
-static inline spx_float_t FLOAT_SHR(spx_float_t a, int b)
-{
-   return (spx_float_t) {a.m,a.e-b};
-}
 
 static inline spx_float_t FLOAT_SHL(spx_float_t a, int b)
 {
@@ -191,14 +185,6 @@
       return a.m<<a.e;
 }
 
-static inline spx_int32_t FLOAT_EXTRACT32(spx_float_t a)
-{
-   if (a.e<0)
-      return ((spx_int32_t)a.m+(1<<(-a.e-1)))>>-a.e;
-   else
-      return ((spx_int32_t)a.m)<<a.e;
-}
-
 static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b)
 {
    if (a.e<-15)

Modified: trunk/speex/libspeex/testenc_wb.c
===================================================================
--- trunk/speex/libspeex/testenc_wb.c	2006-02-09 00:49:35 UTC (rev 10788)
+++ trunk/speex/libspeex/testenc_wb.c	2006-02-09 08:54:52 UTC (rev 10789)
@@ -108,6 +108,7 @@
    fprintf (stderr, "Total encoded size: %d bits\n", bitCount);
    speex_encoder_destroy(st);
    speex_decoder_destroy(dec);
+   speex_bits_destroy(&bits);
 
    rewind(fin);
    rewind(fout);



More information about the commits mailing list