?? dsp.h
字號:
fractional* srcSamps, /* ptr to input samples */
/* (x[n], 0 <= n < N) */
IIRTransposedStruct* filter /* Transposed biquad filter structure */
/* returns dstSamps */
);
extern void IIRTransposedInit ( /* Initialize filter structure */
IIRTransposedStruct* filter /* Transposed biquad filter structure */
);
/* ....................................................................... */
typedef struct {
int order; /* filter order (M) */
/* M <= N (see IIRLattice for N) */
fractional* kappaVals; /* ptr to lattice coefficients */
/* (k[m], 0 <= m <= M) */
/* either in X-Data or P-MEM */
fractional* gammaVals; /* ptr to ladder coeficients */
/* (g[m], 0 <= m <= M) */
/* either in X-Data or P-MEM */
/* NULL for all pole implementation */
int coeffsPage; /* page number of program memory if */
/* coefficients are in program memory */
/* COEFFS_IN_DATA if not */
fractional* delay; /* ptr to delay */
/* (d[m], 0 <= m <= M) */
/* only in Y-Data */
} IIRLatticeStruct; /* IIR Lattice filter structure */
extern fractional* IIRLattice ( /* IIR Lattice filtering */
int numSamps, /* number of input samples (N) */
fractional* dstSamps, /* ptr to output samples */
/* (y[n], 0 <= n < N) */
fractional* srcSamps, /* ptr to input samples */
/* (x[n], 0 <= n < N) */
IIRLatticeStruct* filter /* filter structure */
/* returns dstSamps */
);
extern void IIRLatticeInit ( /* Zero out dealy in filter structure */
IIRLatticeStruct* filter /* Lattice filter structure */
);
/* ....................................................................... */
/****************************************************************************
*
* Interface to transform operations.
*
* A set of linear discrete signal transformations (and some of the inverse
* transforms) are prototyped below. The first set applies a Discrete Fourier
* transform (or its inverse) to a complex data set. The second set applies
* a Type II Discrete Cosine Transform (DCT) to a real valued sequence.
*
* A complex valued sequence is represented by a vector in which every pair
* of values corresponds with a sequence element. The first value in the pair
* is the real part of the element, and the second its imaginary part (see
* the declaration of the 'fractcomplex' structure at the beginning of this
* file for further details). Both, the real and imaginary parts, are stored
* in memory using one word (two bytes) each, and must be interpreted as Q.15
* fractionals.
*
* The following transforms have been designed to either operate out-of-place,
* or in-place. The former type populates an output sequence with the results
* of the transformation. In the latter, the input sequence is (physically)
* replaced by the transformed sequence. For out-of-place operations, the user
* must provide with enough memory to accept the results of the computation.
* The input and output sequences to the FFT family of transforms must be
* allocated in Y-Data memopry.
*
* The transforms here described make use of transform factors which must be
* supplied to the transforming function during its invokation. These factors,
* which are complex data sets, are computed in floating point arithmetic,
* and then transformed into fractionals for use by the operations. To avoid
* excessive overhead when applying a transformation, and since for a given
* transform size the values of the factors are fixed, a particular set of
* transform factors could be generated once and used many times during the
* execution of the program. Thus, it is advisable to store the factors
* returned by any of the initialization operations in a permanent (static)
* vector. The factors to a transform may be allocated either in X-Data or
* program memory.
*
* Additional remarks.
*
* A) Operations which return a destination vector can be nested, so that
* for instance if:
*
* a = Op1 (b, c), with b = Op2 (d), and c = Op3 (e, f), then
*
* a = Op1 (Op2 (d), Op3 (e, f))
*
****************************************************************************/
/* Transform operation prototypes. */
extern fractcomplex* TwidFactorInit ( /* Initialize twiddle factors */
/* WN(k) = exp(i*2*pi*k/N) */
/* computed in floating point */
/* converted to fractionals */
int log2N, /* log2(N), N complex factors */
/* (although only N/2 are computed */
/* since only half of twiddle factors */
/* are used for I/FFT computation) */
fractcomplex* twidFactors, /* ptr to twiddle factors */
int conjFlag /* indicates whether to generate */
/* complex conjugates of twiddles */
/* 0 : no conjugates (default) */
/* 1 : conjugates */
/* twidfact returned */
/* only the first half: */
/* WN(0)...WN(N/2-1) */
/* (or their conjugates) */
);
/*...........................................................................*/
extern fractcomplex* BitReverseComplex ( /* Bit Reverse Ordering */
/* (complex) */
int log2N, /* log2(N), N is vector length */
fractcomplex* srcCV /* ptr to source complex vector */
/* MUST be N modulo aligned */
/* srcCV returned */
);
/*...........................................................................*/
extern fractcomplex* FFTComplex ( /* Fast Fourier Transform */
/* (complex, out-of-place) */
int log2N, /* log2(N), N-point transform */
fractcomplex* dstCV, /* ptr to destination complex vector */
/* with time samples */
/* in natural order */
/* MUST be N modulo aligned */
fractcomplex* srcCV, /* ptr to source complex vector */
/* with time samples */
/* in natural order */
fractcomplex* twidFactors, /* base address of twiddle factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* WN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
int factPage /* if in X data memory, set to */
/* defined value COEFFS_IN_DATA */
/* if in program memory, page number */
/* where factors are located */
/* (inline assembly psvpage ()) */
/* dstCV returned */
/* with frequency components */
/* in natural order */
/* and scaled by 1/(1<<log2N) */
);
/*...........................................................................*/
extern fractcomplex* FFTComplexIP ( /* Fast Fourier Transform */
/* (complex, in-place) */
int log2N, /* log2(N), N-point transform */
fractcomplex* srcCV, /* ptr to source complex vector */
/* with time samples */
/* in natural order */
fractcomplex* twidFactors, /* base address of twiddle factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* WN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
int factPage /* if in X data memory, set to */
/* defined value COEFFS_IN_DATA */
/* if in program memory, page number */
/* where factors are located */
/* (inline assembly psvpage ()) */
/* srcCV returned */
/* with frequency components */
/* in bit reverse order */
/* and scaled by 1/(1<<log2N) */
);
/*...........................................................................*/
extern fractcomplex* IFFTComplex ( /* Inverse Fast Fourier Transform */
/* (complex, out-of-place) */
int log2N, /* log2(N), N-point transform */
fractcomplex* dstCV, /* ptr to destination complex vector */
fractcomplex* srcCV, /* ptr to source complex vector */
/* with frequency components */
/* in natural order */
/* MUST be N modulo aligned */
fractcomplex* twidFactors, /* base address of twiddle factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* WN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
int factPage /* if in X data memory, set to */
/* defined value COEFFS_IN_DATA */
/* if in program memory, page number */
/* where factors are located */
/* (inline assembly psvpage ()) */
/* dstCV returned */
/* with time samples */
/* in natural order */
);
/*...........................................................................*/
extern fractcomplex* IFFTComplexIP ( /* Inverse Fast Fourier Transform */
/* (complex, in-place) */
int log2N, /* log2(N), N-point transform */
fractcomplex* srcCV, /* ptr to source complex vector */
/* with frequency components */
/* in bit reverse order */
/* MUST be N modulo aligned */
fractcomplex* twidFactors, /* base address of twiddle factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* WN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
int factPage /* if in X data memory, set to */
/* defined value COEFFS_IN_DATA */
/* if in program memory, page number */
/* where factors are located */
/* (inline assembly psvpage ()) */
/* srcCV returned */
/* with time samples */
/* in natural order */
);
/*...........................................................................*/
extern fractcomplex* CosFactorInit ( /* Initialize cosine factors */
/* CN(k) = exp(i*k*pi/(2*N)) */
/* computed in floating point */
/* converted to fractionals */
int log2N, /* log2(N), N complex factors */
/* (although only N/2 are computed */
/* since only half of cosine factors */
/* are used for DCT computation) */
fractcomplex* cosFactors /* ptr to cosine factors */
/* cosineFactors returned */
/* only the first half: */
/* CN(0)...CN(N/2-1) */
);
/*...........................................................................*/
extern fractional* DCT ( /* Type II Discrete Cosine Transform */
/* (out-of-place) */
int log2N, /* log2(N), N is transform length */
fractional* dstV, /* ptr to destination vector (2*N) */
/* (transform in first N samples) */
/* MUST be N modulo aligned */
fractional* srcV, /* ptr to source vector (N) in Y-Data */
/* MUST be zero padded to length 2*N */
fractcomplex* cosFactors, /* base address of cosine factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* CN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
/* a total of N/2 complex values: */
/* CN(k) = exp(i*k*pi/(2*N)) */
/* CN(0)...CN(N/2-1) */
fractcomplex* twidFactors, /* base address of complex conjugate */
/* twiddle factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* WN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
/* a total of N/2 complex values: */
/* WN(k) = exp(-i*2*pi*k/N) */
/* WN(0)...WN(N/2-1) */
int factPage /* if in X data memory, set to */
/* defined value COEFFS_IN_DATA */
/* if in program memory, page number */
/* where factors are located */
/* (inline assembly psvpage ()) */
/* Both, cosine and twiddle factors, */
/* MUST be allocated in the same */
/* memory space: both in X-Data, */
/* or both in program memory */
/* dstV returned */
/* Only first N elements represent */
/* DCT values scaled by 1/sqrt(2*N) */
);
/*...........................................................................*/
extern fractional* DCTIP ( /* Type II Discrete Cosine Transform */
/* (in-place) */
int log2N, /* log2(N), N is transform length */
fractional* srcV, /* ptr to source vector in Y-Data */
/* MUST be zero padded to length 2*N */
/* MUST be N modulo aligned */
fractcomplex* cosFactors, /* base address of cosine factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* CN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
/* a total of N/2 complex values: */
/* CN(k) = exp(i*k*pi/(2*N)) */
/* CN(0)...CN(N/2-1) */
fractcomplex* twidFactors, /* base address of complex conjugate */
/* twiddle factors */
/* either in X data or program memory */
/* if in X data memory, it points at */
/* WN(0).real */
/* if in program memory, base is the */
/* offset from program page boundary */
/* to address where factors located */
/* (inline assembly psvoffset ()) */
/* a total of N/2 complex values: */
/* WN(k) = exp(-i*2*pi*k/N) */
/* WN(0)...WN(N/2-1) */
int factPage /* if in X data memory, set to */
/* defined value COEFFS_IN_DATA */
/* if in program memory, page number */
/* where factors are located */
/* (inline assembly psvpage ()) */
/* Both, cosine and twiddle factors, */
/* MUST be allocated in the same */
/* memory space: both in X-Data, */
/* or both in program memory */
/* srcV returned */
/* Only first N elements represent */
/* DCT values scaled by 1/sqrt(2*N) */
);
/*...........................................................................*/
/***************************************************************************/
#endif /* ] __DSP_LIB__ */
/***************************************************************************/
/* EOF */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -