Mercurial > hg > x
diff procedures.cpp @ 11:977f541d6683
GPL and cosmetic changes
author | Wen X <xue.wen@elec.qmul.ac.uk> |
---|---|
date | Wed, 10 Aug 2011 12:33:35 +0100 |
parents | f0d2c9b5d3a3 |
children |
line wrap: on
line diff
--- a/procedures.cpp Thu Jul 28 10:36:57 2011 +0100 +++ b/procedures.cpp Wed Aug 10 12:33:35 2011 +0100 @@ -1,3 +1,15 @@ +/* + Harmonic sinusoidal modelling and tools + + C++ code package for harmonic sinusoidal modelling and relevant signal processing. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2011 Wen Xue. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. +*/ //--------------------------------------------------------------------------- #include <math.h> @@ -318,7 +330,7 @@ for (int i=0; i<Fr; i++) { - RFFTCW(&data[i*Offst+start], Window, 0, 0, log2(Wid), w, x); + RFFTCW(&data[i*Offst+start], Window, 0, 0, Log2(Wid), w, x); if (Spec) { @@ -658,7 +670,7 @@ */ void FFTConv(double* dest, double* source1, int size1, double* source2, int size2, int zero, double* pre_buffer, double* post_buffer) { - int order=log2(size2-1)+1+1; + int order=Log2(size2-1)+1+1; int Wid=1<<order; int HWid=Wid/2; int Fr=size1/HWid; @@ -799,7 +811,7 @@ void FFTConv(double* dest, double* source1, int size1, double* source2, int HWid, double* pre_buffer) { int Wid=HWid*2; - int order=log2(Wid); + int order=Log2(Wid); int Fr=size1/HWid; int res=size1-HWid*Fr; @@ -900,7 +912,7 @@ */ void FFTConv(unsigned char* dest, unsigned char* source1, int bps, int size1, double* source2, int size2, int zero, unsigned char* pre_buffer, unsigned char* post_buffer) { - int order=log2(size2-1)+1+1; + int order=Log2(size2-1)+1+1; int Wid=1<<order; int HWid=Wid/2; int Fr=size1/HWid; @@ -1038,7 +1050,7 @@ */ void FFTFilter(double* dataout, double* data, int Count, int Wid, int On, int Off) { - int Order=log2(Wid); + int Order=Log2(Wid); int HWid=Wid/2; int Fr=(Count-Wid)/HWid+1; AllocateFFTBuffer(Wid, ldata, w, x); @@ -1110,7 +1122,7 @@ AllocateFFTBuffer(Wid, spec, w, x); memset(x, 0, sizeof(cdouble)*Wid); for (int i=On+1; i<Off; i++) x[i].x=x[Wid-i].x=1-2*(i%2); - CIFFTR(x, log2(Wid), w, spec); + CIFFTR(x, Log2(Wid), w, spec); FFTConv(dataout, data, Count, spec, Wid, -Wid, pre_buffer, NULL); FreeFFTBuffer(spec); }//FFTFilterOLA @@ -1120,7 +1132,7 @@ AllocateFFTBuffer(Wid, spec, w, x); memset(x, 0, sizeof(cdouble)*Wid); for (int i=On+1; i<Off; i++) x[i].x=x[Wid-i].x=1-2*(i%2); - CIFFTR(x, log2(Wid), w, spec); + CIFFTR(x, Log2(Wid), w, spec); FFTConv(dataout, data, BytesPerSample, Count, spec, Wid, -Wid, pre_buffer, NULL); FreeFFTBuffer(spec); }//FFTFilterOLA @@ -1149,7 +1161,7 @@ x[Wid-i].y=-x[i].y; } x[HWid].x=amp[HWid], x[HWid].y=0; - CIFFTR(x, log2(Wid), w, spec); + CIFFTR(x, Log2(Wid), w, spec); FFTConv(dataout, data, Count, spec, Wid, -Wid, pre_buffer, NULL); FreeFFTBuffer(spec); }//FFTFilterOLA @@ -1167,7 +1179,7 @@ */ double FFTMask(double* dataout, double* data, int Count, int Wid, double DigiOn, double DigiOff, double maskcoef) { - int Order=log2(Wid); + int Order=Log2(Wid); int HWid=Wid/2; int Fr=(Count-Wid)/HWid+1; int On=Wid*DigiOn, Off=Wid*DigiOff; @@ -2037,7 +2049,7 @@ { double tmp, b2s, b2c, b2e; - RFFTC(Data, 0, 0, log2(FrameWidth), W, X, 0); + RFFTC(Data, 0, 0, Log2(FrameWidth), W, X, 0); for (int i=0; i<=FrameWidth/2; i++) Amps[i]=X[i].x*X[i].x+X[i].y*X[i].y; for (int i=0; i<NumBands; i++) @@ -2306,7 +2318,7 @@ memset(Amp, 0, sizeof(double)*Count*Pad); memcpy(&Amp[Count*(Pad-1)/2], data, sizeof(double)*Count); ApplyWindow(Amp, Amp, params->Amp, Count); - RFFTC(Amp, Amp, Arg, log2(Count*Pad), w, x, 0); + RFFTC(Amp, Amp, Arg, Log2(Count*Pad), w, x, 0); SmoothPhase(Arg, Count*Pad/2+1); double result=Arg[Count*Pad/2]-Arg[0]; @@ -2622,7 +2634,7 @@ { int HWid=Wid/2; int Fr=Count/HWid-1; - int Order=log2(Wid); + int Order=Log2(Wid); int** lspan=new int*[Fr]; double* lxspan=new double[Fr]; @@ -2742,7 +2754,7 @@ { int HWid=Wid/2; int Fr=Count/HWid-1; - int Order=log2(Wid); + int Order=Log2(Wid); int** lspan=new int*[Fr]; double* lxspan=new double[Fr];