~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to noatun/noatun/library/fft.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef FFT_H
 
2
#define FFT_H
 
3
 
 
4
 
 
5
 
 
6
/* this is from ddcmath.h */
 
7
 
 
8
#define  DDC_PI  (3.14159265358979323846)
 
9
 
 
10
/*============================================================================
 
11
 
 
12
       fourier.h  -  Don Cross <dcross@intersrv.com>
 
13
 
 
14
       http://www.intersrv.com/~dcross/fft.html
 
15
 
 
16
       Contains definitions for doing Fourier transforms
 
17
       and inverse Fourier transforms.
 
18
 
 
19
============================================================================*/
 
20
 
 
21
#ifdef __cplusplus
 
22
extern "C" {
 
23
#endif
 
24
 
 
25
/*
 
26
**   If you change anything here, make sure to check if
 
27
**   the offsets used in the asm version of BandPass() are affected
 
28
*/
 
29
struct BandPassInfo
 
30
{
 
31
        float center;
 
32
        float bandwidth;
 
33
 
 
34
        float C, D;
 
35
        float a[3], b[2];
 
36
 
 
37
        float bufferX[2];
 
38
        float bufferY[2];
 
39
 
 
40
};
 
41
 
 
42
void BandPassInit(struct BandPassInfo *i, float center, float bw);
 
43
void BandPass(struct BandPassInfo *ip, float *inbuffer, float *outbuffer, unsigned long samples);
 
44
 
 
45
/*
 
46
**   fft() computes the Fourier transform or inverse transform
 
47
**   of the complex inputs to produce the complex outputs.
 
48
**   The number of samples must be a power of two to do the
 
49
**   recursive decomposition of the FFT algorithm.
 
50
**   See Chapter 12 of "Numerical Recipes in FORTRAN" by
 
51
**   Press, Teukolsky, Vetterling, and Flannery,
 
52
**   Cambridge University Press.
 
53
**
 
54
**   Notes:  If you pass ImaginaryIn = NULL, this function will "pretend"
 
55
**           that it is an array of all zeroes.  This is convenient for
 
56
**           transforming digital samples of real number data without
 
57
**           wasting memory.
 
58
*/
 
59
 
 
60
void fft_float (
 
61
    unsigned  NumSamples,          /* must be a power of 2 */
 
62
    int       InverseTransform,    /* 0=forward FFT, 1=inverse FFT */
 
63
    float    *RealIn,              /* array of input's real samples */
 
64
    float    *ImaginaryIn,         /* array of input's imag samples */
 
65
    float    *RealOut,             /* array of output's reals */
 
66
    float    *ImaginaryOut );      /* array of output's imaginaries */
 
67
 
 
68
 
 
69
/*
 
70
int IsPowerOfTwo ( unsigned x );
 
71
unsigned NumberOfBitsNeeded ( unsigned PowerOfTwo );
 
72
unsigned ReverseBits ( unsigned index, unsigned NumBits );
 
73
*/
 
74
 
 
75
/*
 
76
**   The following function returns an "abstract frequency" of a
 
77
**   given index into a buffer with a given number of frequency samples.
 
78
**   Multiply return value by sampling rate to get frequency expressed in Hz.
 
79
*/
 
80
/*
 
81
double Index_to_frequency ( unsigned NumSamples, unsigned Index );
 
82
*/
 
83
 
 
84
#ifdef __cplusplus
 
85
}
 
86
#endif
 
87
#endif /* FFT_H */