00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MARSYAS_TimeFreqPeakConnectivity_H
00020 #define MARSYAS_TimeFreqPeakConnectivity_H
00021
00022 #include "MarSystem.h"
00023
00024 class DoubleListEntries;
00025
00026 namespace Marsyas
00027 {
00045 class marsyas_EXPORT TimeFreqPeakConnectivity: public MarSystem
00046 {
00047 private:
00048
00050 void addControls();
00051
00053 void myUpdate(MarControlPtr sender);
00054
00055
00056 enum Direction_t
00057 {
00058 kFromDown,
00059 kFromLeft,
00060 kFromUp,
00061
00062 kNumDirections
00063 };
00064
00065 static inline mrs_real dtwFindMin (mrs_real *prevCost, unsigned char &tbIdx)
00066 {
00067 mrs_real min = 1e30;
00068 tbIdx = kFromLeft;
00069
00070 for (unsigned char i = 0; i < kNumDirections; i++)
00071 {
00072 if (prevCost[i] <= min)
00073 {
00074 min = prevCost[i];
00075 tbIdx = i;
00076 }
00077 }
00078 return min;
00079 };
00080
00081 void AllocMemory (mrs_natural numSamples);
00082 void FreeMemory ();
00083
00084 void SetOutput(mrs_realvec &out, const mrs_real cost, mrs_natural idxRowA, mrs_natural idxColA, mrs_natural idxRowB, mrs_natural idxColB);
00085 mrs_natural Freq2RowIdx (mrs_real barkFreq, mrs_real bres);
00086 void CalcDp (mrs_realvec &Matrix, mrs_natural startr, mrs_natural startc, mrs_natural stopr, mrs_natural stopc);
00087 void InitMatrix (mrs_realvec &Matrix, unsigned char **traceback, mrs_natural rowIdx, mrs_natural colIdx);
00088 MarControlPtr ctrl_reso_;
00089 mrs_realvec peakMatrix_,
00090 costMatrix_;
00091 mrs_real downFreq_,
00092 upFreq_;
00093 mrs_natural numBands_,
00094 textWinSize_;
00095 mrs_natural *path_,
00096 **peakIndices_;
00097 unsigned char** tracebackIdx_;
00098 DoubleListEntries *multipleIndices;
00099
00100 public:
00102 TimeFreqPeakConnectivity(std::string name);
00103
00105 TimeFreqPeakConnectivity(const TimeFreqPeakConnectivity& a);
00106
00108 ~TimeFreqPeakConnectivity();
00109
00111 MarSystem* clone() const;
00112
00114 void myProcess(realvec& in, realvec& out);
00115 };
00116
00117 }
00118
00119
00120 #endif
00121
00122