cannam@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
cannam@0
|
2
|
cannam@0
|
3 /*
|
cannam@0
|
4 QM DSP Library
|
cannam@0
|
5
|
cannam@0
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@84
|
7 This file 2005-2006 Christian Landone.
|
Chris@84
|
8
|
mathieu@96
|
9 Modifications:
|
mathieu@96
|
10
|
mathieu@96
|
11 - delta threshold
|
mathieu@96
|
12 Description: add delta threshold used as offset in the smoothed
|
mathieu@96
|
13 detection function
|
mathieu@96
|
14 Author: Mathieu Barthet
|
mathieu@96
|
15 Date: June 2010
|
mathieu@96
|
16
|
Chris@84
|
17 This program is free software; you can redistribute it and/or
|
Chris@84
|
18 modify it under the terms of the GNU General Public License as
|
Chris@84
|
19 published by the Free Software Foundation; either version 2 of the
|
Chris@84
|
20 License, or (at your option) any later version. See the file
|
Chris@84
|
21 COPYING included with this distribution for more information.
|
cannam@0
|
22 */
|
cannam@0
|
23
|
cannam@0
|
24 #ifndef CDFPROCESS_H
|
cannam@0
|
25 #define CDFPROCESS_H
|
cannam@0
|
26
|
cannam@0
|
27 #include <stdio.h>
|
cannam@0
|
28 #include "FiltFilt.h"
|
cannam@0
|
29
|
cannam@0
|
30 struct DFProcConfig{
|
cannam@0
|
31 unsigned int length;
|
cannam@0
|
32 unsigned int LPOrd;
|
cannam@0
|
33 double *LPACoeffs;
|
cannam@0
|
34 double *LPBCoeffs;
|
cannam@0
|
35 unsigned int winPre;
|
cannam@0
|
36 unsigned int winPost;
|
cannam@0
|
37 double AlphaNormParam;
|
cannam@12
|
38 bool isMedianPositive;
|
Chris@185
|
39 float delta; //delta threshold used as an offset when computing the smoothed detection function
|
Chris@185
|
40
|
Chris@185
|
41 DFProcConfig() :
|
Chris@185
|
42 length(0),
|
Chris@185
|
43 LPOrd(0),
|
Chris@185
|
44 LPACoeffs(NULL),
|
Chris@185
|
45 LPBCoeffs(NULL),
|
Chris@185
|
46 winPre(0),
|
Chris@185
|
47 winPost(0),
|
Chris@185
|
48 AlphaNormParam(0),
|
Chris@185
|
49 isMedianPositive(false),
|
Chris@185
|
50 delta(0)
|
Chris@185
|
51 {
|
Chris@185
|
52 }
|
cannam@12
|
53 };
|
cannam@0
|
54
|
cannam@0
|
55 class DFProcess
|
cannam@0
|
56 {
|
cannam@0
|
57 public:
|
cannam@0
|
58 DFProcess( DFProcConfig Config );
|
cannam@0
|
59 virtual ~DFProcess();
|
cannam@0
|
60
|
cannam@0
|
61 void process( double* src, double* dst );
|
cannam@0
|
62
|
cannam@0
|
63
|
cannam@0
|
64 private:
|
cannam@0
|
65 void initialise( DFProcConfig Config );
|
cannam@0
|
66 void deInitialise();
|
cannam@0
|
67 void removeDCNormalize( double *src, double*dst );
|
cannam@0
|
68 void medianFilter( double* src, double* dst );
|
cannam@0
|
69
|
cannam@74
|
70 int m_length;
|
cannam@74
|
71 int m_FFOrd;
|
cannam@0
|
72
|
cannam@74
|
73 int m_winPre;
|
cannam@74
|
74 int m_winPost;
|
cannam@0
|
75
|
cannam@0
|
76 double m_alphaNormParam;
|
cannam@0
|
77
|
cannam@0
|
78 double* filtSrc;
|
cannam@0
|
79 double* filtDst;
|
cannam@0
|
80
|
cannam@0
|
81 double* m_filtScratchIn;
|
cannam@0
|
82 double* m_filtScratchOut;
|
cannam@0
|
83
|
Chris@153
|
84 FilterConfig m_FilterConfigParams;
|
cannam@0
|
85
|
cannam@0
|
86 FiltFilt* m_FiltFilt;
|
cannam@0
|
87
|
cannam@0
|
88 bool m_isMedianPositive;
|
Chris@185
|
89 float m_delta; //add delta threshold
|
cannam@0
|
90 };
|
cannam@0
|
91
|
cannam@0
|
92 #endif
|