00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _GRHILBERT_H_
00025 #define _GRHILBERT_H_
00026
00027 #include <VrHistoryProc.h>
00028 #include <VrComplex.h>
00029 #include <gr_fir.h>
00030 #include <gr_firdes.h>
00031
00032 template<class iType>
00033 class GrHilbert : public VrHistoryProc<iType,VrComplex> {
00034 private:
00035 gr_fir<float,iType,float> hilb;
00036 unsigned int taps;
00037 public:
00038 virtual const char *name() { return "GrHilbert"; }
00039 virtual int work(VrSampleRange output, void *o[],
00040 VrSampleRange inputs[], void *i[]);
00041 GrHilbert(unsigned int taps);
00042 };
00043
00044 template<class iType> int
00045 GrHilbert<iType>::work(VrSampleRange output, void *ao[],
00046 VrSampleRange inputs[], void *ai[])
00047 {
00048 iType **i = (iType **)ai;
00049 VrComplex **o = (VrComplex **)ao;
00050 int size = output.size;
00051 for(int x = 0; x<size; x++)
00052 {
00053 o[0][x].real(i[0][x+taps/2]);
00054 o[0][x].imag(hilb.filter(&i[0][x]));
00055 }
00056 return output.size;
00057 }
00058
00059 template<class iType>
00060 GrHilbert<iType>::GrHilbert(unsigned int taps)
00061 : VrHistoryProc<iType,VrComplex>(1),
00062 hilb(gr_firdes::hilbert(taps)),taps(taps)
00063 {
00064 history = taps;
00065 }
00066 #endif