Mercurial > hg > x
comparison fft.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 | 5f3c32dc6e17 |
children |
comparison
equal
deleted
inserted
replaced
10:c6528c38b23c | 11:977f541d6683 |
---|---|
1 /* | |
2 Harmonic sinusoidal modelling and tools | |
3 | |
4 C++ code package for harmonic sinusoidal modelling and relevant signal processing. | |
5 Centre for Digital Music, Queen Mary, University of London. | |
6 This file copyright 2011 Wen Xue. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. | |
12 */ | |
1 //--------------------------------------------------------------------------- | 13 //--------------------------------------------------------------------------- |
2 | 14 |
3 #include <string.h> | 15 #include <string.h> |
4 #include <stdlib.h> | 16 #include <stdlib.h> |
5 #include "fft.h" | 17 #include "fft.h" |
15 double Atan2(double y, double x) | 27 double Atan2(double y, double x) |
16 { | 28 { |
17 if (x==0 && y==0) return 0; | 29 if (x==0 && y==0) return 0; |
18 else return atan2(y, x); | 30 else return atan2(y, x); |
19 }//Atan2 | 31 }//Atan2 |
32 | |
33 /** | |
34 function Log2: Log2 | |
35 | |
36 Returns x for Log2(2^x) if x is integer. | |
37 */ | |
38 int Log2(int x) | |
39 { | |
40 return floor(log(x)/log(2)+0.5); | |
41 }//Log2 | |
20 | 42 |
21 /** | 43 /** |
22 function BitInv: inverse bit order of Value within an $Order-bit expression. | 44 function BitInv: inverse bit order of Value within an $Order-bit expression. |
23 | 45 |
24 In: integer Value smaller than 2^Order | 46 In: integer Value smaller than 2^Order |