Mercurial > hg > x
diff quickspec.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 | 9b1c0825cc77 |
children |
line wrap: on
line diff
--- a/quickspec.cpp Thu Jul 28 10:36:57 2011 +0100 +++ b/quickspec.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> #include <memory.h> @@ -123,8 +135,8 @@ */ void CalculateSpectrum(void* Data, int BytesPerSample, double* win, QSPEC_FORMAT* Amp, QSPEC_FORMAT* Arg, int Wid, cdouble* w, cdouble* x, int* hbi) { - if (BytesPerSample==2) RFFTCW((__int16*)Data, win, 0, 0, log2(Wid), w, x, hbi); - else {IntToDouble((double*)x, Data, BytesPerSample, Wid); RFFTCW((double*)x, win, 0, 0, log2(Wid), w, x, hbi);} + if (BytesPerSample==2) RFFTCW((__int16*)Data, win, 0, 0, Log2(Wid), w, x, hbi); + else {IntToDouble((double*)x, Data, BytesPerSample, Wid); RFFTCW((double*)x, win, 0, 0, Log2(Wid), w, x, hbi);} for (int j=0; j<=Wid/2; j++) { Amp[j]=sqrt(x[j].x*x[j].x+x[j].y*x[j].y); @@ -157,7 +169,7 @@ { double* doublex=(double*)x; IntToDouble(doublex, Data, BytesPerSample, eff); memset(&doublex[eff], 0, sizeof(double)*(Wid-eff)); - RFFTCW(doublex, win, 0, 0, log2(Wid), w, x, hbi); + RFFTCW(doublex, win, 0, 0, Log2(Wid), w, x, hbi); for (int j=0; j<=Wid/2; j++) { Amp[j]=sqrt(x[j].x*x[j].x+x[j].y*x[j].y); @@ -190,7 +202,7 @@ free8(fw); free(fhbi); fw=(cdouble*)malloc8(sizeof(cdouble)*Wid*1.5); SetTwiddleFactors(Wid, fw); fx=&fw[Wid/2]; - fhbi=CreateBitInvTable(log2(Wid)-1); + fhbi=CreateBitInvTable(Log2(Wid)-1); } if (Wid!=fWid || WinType!=fwt || WinParam!=fwdp) { //then update internal window function to the new window type