X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fsmallft.c;h=6d528af423dcd8eb205eaccb74c94a7fbfb051b3;hb=c78405727f8c5fcc9d1a8d23d57f16fc4c7dface;hp=c75e451ea6dc69e82922a3c7927b932f6c6047f3;hpb=f894be654bb8b1a79e7a49cecdb8580064f831f1;p=platform%2Fupstream%2Flibvorbis.git diff --git a/lib/smallft.c b/lib/smallft.c index c75e451..6d528af 100644 --- a/lib/smallft.c +++ b/lib/smallft.c @@ -1,20 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * - * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * - * PLEASE READ THESE TERMS DISTRIBUTING. * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * 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 OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty 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.8 2000/03/10 13:21:18 xiphmont Exp $ -********************************************************************/ + ********************************************************************/ /* FFT implementation from OggSquish, minus cosine transforms, * minus all but radix 2/4 case. In Vorbis we only need this @@ -33,12 +31,13 @@ #include #include #include "smallft.h" +#include "os.h" #include "misc.h" -static void drfti1(int n, double *wa, int *ifac){ +static void drfti1(int n, float *wa, int *ifac){ static int ntryh[4] = { 4,2,3,5 }; - static double tpi = 6.28318530717958647692528676655900577; - double arg,argh,argld,fi; + static float tpi = 6.28318530717958648f; + float arg,argh,argld,fi; int ntry=0,i,j=-1; int k1, l1, l2, ib; int ld, ii, ip, is, nq, nr; @@ -91,13 +90,13 @@ static void drfti1(int n, double *wa, int *ifac){ for (j=0;j>1; @@ -405,8 +404,8 @@ L119: } } - ar1=1.; - ai1=0.; + ar1=1.f; + ai1=0.f; t1=0; t2=ipp2*idl1; t3=(ip-1)*idl1; @@ -570,7 +569,7 @@ L119: } } -static void drftf1(int n,double *c,double *ch,double *wa,int *ifac){ +static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){ int i,k1,l1,l2; int na,kh,nf; int ip,iw,ido,idl1,ix2,ix3; @@ -631,12 +630,12 @@ static void drftf1(int n,double *c,double *ch,double *wa,int *ifac){ for(i=0;i>1; ipp2=ip; ipph=(ip+1)>>1; if(idon==1)return; drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } -void drft_backward(drft_lookup *l,double *data){ +void drft_backward(drft_lookup *l,float *data){ if (l->n==1)return; drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } void drft_init(drft_lookup *l,int n){ l->n=n; - l->trigcache=calloc(3*n,sizeof(double)); - l->splitcache=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); } void drft_clear(drft_lookup *l){ if(l){ - if(l->trigcache)free(l->trigcache); - if(l->splitcache)free(l->splitcache); - memset(l,0,sizeof(drft_lookup)); + if(l->trigcache)_ogg_free(l->trigcache); + if(l->splitcache)_ogg_free(l->splitcache); + memset(l,0,sizeof(*l)); } }