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

jm at svn.xiph.org jm at svn.xiph.org
Thu Jun 15 05:01:22 PDT 2006


Author: jm
Date: 2006-06-15 05:01:18 -0700 (Thu, 15 Jun 2006)
New Revision: 11579

Modified:
   trunk/speex/libspeex/_kiss_fft_guts.h
   trunk/speex/libspeex/kiss_fft.c
   trunk/speex/libspeex/kiss_fft.h
   trunk/speex/libspeex/kiss_fftr.c
   trunk/speex/libspeex/kiss_fftr.h
Log:
cleaned up kiss_fft explicit dependencies on libc


Modified: trunk/speex/libspeex/_kiss_fft_guts.h
===================================================================
--- trunk/speex/libspeex/_kiss_fft_guts.h	2006-06-15 11:57:22 UTC (rev 11578)
+++ trunk/speex/libspeex/_kiss_fft_guts.h	2006-06-15 12:01:18 UTC (rev 11579)
@@ -20,7 +20,6 @@
    and defines
    typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
 #include "kiss_fft.h"
-#include <limits.h>
 
 #define MAXFACTORS 32
 /* e.g. an fft of length 128 has 4 factors 

Modified: trunk/speex/libspeex/kiss_fft.c
===================================================================
--- trunk/speex/libspeex/kiss_fft.c	2006-06-15 11:57:22 UTC (rev 11578)
+++ trunk/speex/libspeex/kiss_fft.c	2006-06-15 12:01:18 UTC (rev 11579)
@@ -32,7 +32,7 @@
 #define CHECKBUF(buf,nbuf,n) \
     do { \
         if ( nbuf < (size_t)(n) ) {\
-            free(buf); \
+            speex_free(buf); \
             buf = (kiss_fft_cpx*)KISS_FFT_MALLOC(sizeof(kiss_fft_cpx)*(n)); \
             nbuf = (size_t)(n); \
         } \
@@ -404,7 +404,7 @@
     if (fin == fout) {
         CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
         kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
-        memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft);
+        speex_move(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft);
     }else{
         kf_work( fout, fin, 1,in_stride, st->factors,st );
     }
@@ -421,10 +421,10 @@
  */ 
 void kiss_fft_cleanup(void)
 {
-    free(scratchbuf);
+    speex_free(scratchbuf);
     scratchbuf = NULL;
     nscratchbuf=0;
-    free(tmpbuf);
+    speex_free(tmpbuf);
     tmpbuf=NULL;
     ntmpbuf=0;
 }

Modified: trunk/speex/libspeex/kiss_fft.h
===================================================================
--- trunk/speex/libspeex/kiss_fft.h	2006-06-15 11:57:22 UTC (rev 11578)
+++ trunk/speex/libspeex/kiss_fft.h	2006-06-15 12:01:18 UTC (rev 11579)
@@ -2,10 +2,8 @@
 #define KISS_FFT_H
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <math.h>
-#include <memory.h>
-#include <malloc.h>
+#include "misc.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -29,7 +27,7 @@
 # define kiss_fft_scalar __m128
 #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes)
 #else	
-#define KISS_FFT_MALLOC malloc
+#define KISS_FFT_MALLOC speex_alloc
 #endif	
 
 
@@ -94,7 +92,7 @@
 
 /* If kiss_fft_alloc allocated a buffer, it is one contiguous 
    buffer and can be simply free()d when no longer needed*/
-#define kiss_fft_free free
+#define kiss_fft_free speex_free
 
 /*
  Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 

Modified: trunk/speex/libspeex/kiss_fftr.c
===================================================================
--- trunk/speex/libspeex/kiss_fftr.c	2006-06-15 11:57:22 UTC (rev 11578)
+++ trunk/speex/libspeex/kiss_fftr.c	2006-06-15 12:01:18 UTC (rev 11579)
@@ -35,7 +35,7 @@
     size_t subsize, memneeded;
 
     if (nfft & 1) {
-        fprintf(stderr,"Real FFT optimization must be even.\n");
+        speex_warning("Real FFT optimization must be even.\n");
         return NULL;
     }
     nfft >>= 1;
@@ -75,7 +75,7 @@
     kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc;
 
     if ( st->substate->inverse) {
-        fprintf(stderr,"kiss fft usage error: improper alloc\n");
+        speex_warning("kiss fft usage error: improper alloc\n");
         exit(1);
     }
 
@@ -130,7 +130,7 @@
     int k, ncfft;
 
     if (st->substate->inverse == 0) {
-        fprintf (stderr, "kiss fft usage error: improper alloc\n");
+        speex_warning ("kiss fft usage error: improper alloc\n");
         exit (1);
     }
 

Modified: trunk/speex/libspeex/kiss_fftr.h
===================================================================
--- trunk/speex/libspeex/kiss_fftr.h	2006-06-15 11:57:22 UTC (rev 11578)
+++ trunk/speex/libspeex/kiss_fftr.h	2006-06-15 12:01:18 UTC (rev 11579)
@@ -38,7 +38,7 @@
  output timedata has nfft scalar points
 */
 
-#define kiss_fftr_free free
+#define kiss_fftr_free speex_free
 
 #ifdef __cplusplus
 }



More information about the commits mailing list