Remove svn $Id$ header.
[platform/upstream/libvorbis.git] / lib / smallft.c
index b07a6ad..6d528af 100644 (file)
@@ -1,20 +1,18 @@
 /********************************************************************
  *                                                                  *
  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
- * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
- * http://www.xiph.org/                                             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.12 2000/12/21 21:04:41 xiphmont Exp $
 
-********************************************************************/
+ ********************************************************************/
 
 /* FFT implementation from OggSquish, minus cosine transforms,
  * minus all but radix 2/4 case.  In Vorbis we only need this
@@ -33,6 +31,7 @@
 #include <string.h>
 #include <math.h>
 #include "smallft.h"
+#include "os.h"
 #include "misc.h"
 
 static void drfti1(int n, float *wa, int *ifac){
@@ -94,10 +93,10 @@ static void drfti1(int n, float *wa, int *ifac){
       argld=(float)ld*argh;
       fi=0.f;
       for (ii=2;ii<ido;ii+=2){
-       fi+=1.f;
-       arg=fi*argld;
-       wa[i++]=cos(arg);
-       wa[i++]=sin(arg);
+        fi+=1.f;
+        arg=fi*argld;
+        wa[i++]=cos(arg);
+        wa[i++]=sin(arg);
       }
       is+=ido;
     }
@@ -125,7 +124,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
     t1+=ido;
     t2+=ido;
   }
-    
+
   if(ido<2)return;
   if(ido==2)goto L105;
 
@@ -167,12 +166,12 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
 }
 
 static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
-           float *wa2,float *wa3){
+            float *wa2,float *wa3){
   static float hsqt2 = .70710678118654752f;
   int i,k,t0,t1,t2,t3,t4,t5,t6;
   float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
   t0=l1*ido;
-  
+
   t1=t0;
   t4=t1<<1;
   t2=t1+(t1<<1);
@@ -244,7 +243,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
   if(ido&1)return;
 
  L105:
-  
+
   t2=(t1=t0+ido-1)+(t0<<1);
   t3=ido<<2;
   t4=ido;
@@ -278,7 +277,7 @@ static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
   int nbd;
   float dcp,arg,dsp,ar1h,ar2h;
   int idp2,ipp2;
-  
+
   arg=tpi/(float)ip;
   dcp=cos(arg);
   dsp=sin(arg);
@@ -636,7 +635,7 @@ static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
   float ti2,tr2;
 
   t0=l1*ido;
-  
+
   t1=0;
   t2=0;
   t3=(ido<<1)-1;
@@ -747,12 +746,12 @@ static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
 }
 
 static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
-                         float *wa2,float *wa3){
+                          float *wa2,float *wa3){
   static float sqrt2=1.414213562373095f;
   int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
   float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
   t0=l1*ido;
-  
+
   t1=0;
   t2=ido<<2;
   t3=0;
@@ -761,7 +760,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
     t4=t3+t6;
     t5=t1;
     tr3=cc[t4-1]+cc[t4-1];
-    tr4=cc[t4]+cc[t4]; 
+    tr4=cc[t4]+cc[t4];
     tr1=cc[t3]-cc[(t4+=t6)-1];
     tr2=cc[t3]+cc[t4-1];
     ch[t5]=tr2+tr3;
@@ -856,7 +855,7 @@ static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
   ipp2=ip;
   ipph=(ip+1)>>1;
   if(ido<l1)goto L103;
-  
+
   t1=0;
   t2=0;
   for(k=0;k<l1;k++){
@@ -1241,8 +1240,8 @@ void drft_backward(drft_lookup *l,float *data){
 
 void drft_init(drft_lookup *l,int n){
   l->n=n;
-  l->trigcache=_ogg_calloc(3*n,sizeof(float));
-  l->splitcache=_ogg_calloc(32,sizeof(int));
+  l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache));
+  l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache));
   fdrffti(n, l->trigcache, l->splitcache);
 }
 
@@ -1250,6 +1249,6 @@ void drft_clear(drft_lookup *l){
   if(l){
     if(l->trigcache)_ogg_free(l->trigcache);
     if(l->splitcache)_ogg_free(l->splitcache);
-    memset(l,0,sizeof(drft_lookup));
+    memset(l,0,sizeof(*l));
   }
 }