00001 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef TDSPFILTERMAP_H 00019 #define TDSPFILTERMAP_H 00020 00021 #include <TDSPMatrix.h> 00022 #include <TDSPSignal.h> 00023 #include <TDSPOperator.h> 00024 #include <TDSPBlockOperation.h> 00025 #include <TDSPFilterBank.h> 00026 00031 #define OPT_MY_SYNTHESIS_FILTERBANK 0x1 00032 #define OPT_MY_ANALYSIS_FILTERBANK 0x2 00033 00034 class TDSPFilterMap : public TDSPOperator, public TDSPBlockOperation { 00035 00036 private: 00037 Bool_t _isMySynthesisBank() { return fOpt&OPT_MY_SYNTHESIS_FILTERBANK;}; 00038 Bool_t _isMyAnalysisBank() { return fOpt&OPT_MY_ANALYSIS_FILTERBANK;}; 00039 void _enableMySynthesisBank() { fOpt|=OPT_MY_SYNTHESIS_FILTERBANK;}; 00040 void _enableMyAnalysisBank() { fOpt|=OPT_MY_ANALYSIS_FILTERBANK;}; 00041 void _disableMySynthesisBank() { fOpt&=(!OPT_MY_SYNTHESIS_FILTERBANK);}; 00042 void _disableMyAnalysisBank() { fOpt&=(!OPT_MY_ANALYSIS_FILTERBANK);}; 00043 void _cleanSynthesisBank(); 00044 void _cleanAnalysisBank(); 00045 void _createMySynthesisBank(); 00046 void _createMyAnalysisBank(); 00047 void _provideBanks(); 00048 00049 protected: 00050 00051 UInt_t fOpt; // Options 00052 00053 // Filterbanks 00054 00055 TDSPFilterBank* fSynthesisBank; 00056 TDSPFilterBank* fAnalysisBank; 00057 00058 // My Signals 00059 00060 TString Signal_Update; 00061 TString Signal_InverseUpdate; 00062 00063 // My Slots 00064 00065 TString Slot_Update; 00066 TString Slot_InverseUpdate; 00067 00068 00069 TDSPSignal* fSignal; // The Output Signal return by a Apply-Call 00070 TDSPSignal* fInverseSignal; // The Output Signal return by a InverseApply-Call 00071 00072 public: 00073 00074 TDSPFilterMap(char *name = NULL); 00075 ~TDSPFilterMap(); 00076 00077 TDSPSignal* GetSignal() const { return fSignal; }; 00078 TDSPSignal* GetInverseSignal() const { return fInverseSignal;}; 00079 00080 // Configure the filterbank 00081 00082 void SetNumFilters(UInt_t n); 00083 UInt_t GetNumFilters(); 00084 00085 void SetSubSamplings(UInt_t s); 00086 void SetTimePad(UInt_t s) { SetSubSamplings(s);}; 00087 UInt_t GetTimePad() { return GetSubSamplings();}; 00088 void SetFreqPad(UInt_t); 00089 UInt_t GetFreqPad(); 00090 Double_t GetBandWidthEfficiency(); 00091 UInt_t GetSubSamplings(); 00092 void Activate(UInt_t s); 00093 void Deactivate(UInt_t s); 00094 TDSPVector* GetSynthesisFilter(UInt_t s); 00095 TDSPVector* GetAnalysisFilter(UInt_t s); 00096 UInt_t GetNumActiveSynthesisFilters(); 00097 UInt_t GetNumActiveAnalysisFilters(); 00098 00099 // Get/Set the filterbank 00100 00101 void SetAnalysisBank(TDSPFilterBank *m); 00102 void SetSynthesisBank(TDSPFilterBank *m); 00103 TDSPFilterBank* GetAnalysisBank() const { return fAnalysisBank;}; 00104 TDSPFilterBank* GetSynthesisBank() const { return fSynthesisBank;}; 00105 00106 Int_t GetBlockLen() { return GetNumActiveSynthesisFilters();}; 00107 00108 // Get/Set the filtermatrix directly 00109 00110 void SetMatrix(TDSPMatrix *a); 00111 TDSPMatrix* GetMatrix(); 00112 void SetInverseMatrix(TDSPMatrix *a); 00113 TDSPMatrix* GetInverseMatrix(); 00114 00115 TDSPVector* Synthesize(TDSPVector *input, TDSPVector *output=NULL); 00116 TDSPVector* Analyze(TDSPVector *input, TDSPVector *output=NULL); 00117 00118 void LoadAndInitFromProtoType(Option_t *method, char *fname); 00119 virtual void Print(); 00120 00121 // Slots 00122 00123 TDSPSignal* Update(TDSPSignal *input); // Calls Synthesize and Emits "Update(TDSPSignal*)" 00124 TDSPSignal* InverseUpdate(TDSPSignal *input); // Calls Analyse and Emits "InverseUpdate(TDSPSignal*)" 00125 00126 ClassDef(TDSPFilterMap,1) 00127 00128 }; 00129 00130 inline TDSPSignal* TDSPFilterMap::Update(TDSPSignal *input) { 00131 CheckInitialization(); 00132 Synthesize(input,fSignal); 00133 Emit(Signal_Update,fSignal); 00134 return fSignal; 00135 } 00136 00137 inline TDSPSignal* TDSPFilterMap::InverseUpdate(TDSPSignal *input) { 00138 CheckInitialization(); 00139 Analyze(input,fInverseSignal); 00140 Emit(Signal_InverseUpdate,fInverseSignal); 00141 return fInverseSignal; 00142 } 00143 00144 00145 00146 #endif
1.3.2