00001
00002 namespace SPUC {
00003 #ifndef RMZFIR
00004 #define RMZFIR
00005 #define BANDPASS 1
00006 #define DIFFERENTIATOR 2
00007 #define HILBERT 3
00008 #define NEGATIVE 0
00009 #define POSITIVE 1
00010 #define GRIDDENSITY 16
00011 #define MAXITERATIONS 40
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00049
00052
00053
00054 class remez_fir {
00055
00056 public:
00057 remez_fir() {}
00058
00059 private:
00060 static void createDenseGrid(int r, int numtaps, int numband, double bands[],
00061 double des[], double weight[], int gridSize,
00062 double grid[], double d[], double w[],
00063 int symmetry);
00064 static void initialGuess(int r, int ext[], int gridSize);
00065 static void calcParms(int r, int ext[], double grid[], double d[], double w[],
00066 double ad[], double x[], double y[]);
00067 static double computeA(double freq, int r, double ad[], double x[], double y[]);
00068 static void calcError(int r, double ad[], double x[], double y[],
00069 int gridSize, double grid[],
00070 double d[], double w[], double e[]);
00071 static void search(int r, int ext[], int gridSize, double e[]);
00072 static double* freqSample(double A[],int numtaps, int symm);
00073 static bool isDone(int r, int ext[], double e[]);
00074 public:
00075 static double* remez(int n, int numband,
00076 double bands[], double des[], double weight[], int type);
00077 };
00078 #endif
00079 }