tomwalters@282
|
1 // Copyright 2008-2010, Thomas Walters
|
tomwalters@268
|
2 //
|
tomwalters@268
|
3 // AIM-C: A C++ implementation of the Auditory Image Model
|
tomwalters@268
|
4 // http://www.acousticscale.org/AIMC
|
tomwalters@268
|
5 //
|
tomwalters@318
|
6 // Licensed under the Apache License, Version 2.0 (the "License");
|
tomwalters@318
|
7 // you may not use this file except in compliance with the License.
|
tomwalters@318
|
8 // You may obtain a copy of the License at
|
tomwalters@268
|
9 //
|
tomwalters@318
|
10 // http://www.apache.org/licenses/LICENSE-2.0
|
tomwalters@268
|
11 //
|
tomwalters@318
|
12 // Unless required by applicable law or agreed to in writing, software
|
tomwalters@318
|
13 // distributed under the License is distributed on an "AS IS" BASIS,
|
tomwalters@318
|
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
tomwalters@318
|
15 // See the License for the specific language governing permissions and
|
tomwalters@318
|
16 // limitations under the License.
|
tomwalters@268
|
17
|
tomwalters@268
|
18 /*! \file ModuleGaussians.h
|
tomwalters@268
|
19 * \brief Gaussian features
|
tomwalters@268
|
20 */
|
tomwalters@268
|
21
|
tomwalters@282
|
22 /*! \author Thomas Walters <tom@acousticscale.org>
|
tomwalters@268
|
23 * \date created 2008/06/23
|
tomwalters@296
|
24 * \version \$Id$
|
tomwalters@268
|
25 */
|
tomwalters@268
|
26
|
tomwalters@283
|
27 #ifndef AIMC_MODULES_FEATURES_GAUSSIANS_H_
|
tomwalters@283
|
28 #define AIMC_MODULES_FEATURES_GAUSSIANS_H_
|
tomwalters@268
|
29
|
tomwalters@268
|
30 #include <vector>
|
tomwalters@268
|
31
|
tomwalters@268
|
32 #include "Support/Module.h"
|
tomwalters@268
|
33 #include "Support/Parameters.h"
|
tomwalters@268
|
34 #include "Support/SignalBank.h"
|
tomwalters@268
|
35
|
tomwalters@268
|
36 namespace aimc {
|
tomwalters@268
|
37 using std::vector;
|
tomwalters@280
|
38 class ModuleGaussians : public Module {
|
tomwalters@268
|
39 public:
|
tomwalters@280
|
40 explicit ModuleGaussians(Parameters *pParam);
|
tomwalters@268
|
41 virtual ~ModuleGaussians();
|
tomwalters@268
|
42
|
tomwalters@280
|
43 /*! \brief Process a buffer
|
tomwalters@280
|
44 */
|
tomwalters@268
|
45 virtual void Process(const SignalBank &input);
|
tomwalters@268
|
46
|
tomwalters@275
|
47 private:
|
tomwalters@280
|
48 /*! \brief Reset the internal state of the module
|
tomwalters@280
|
49 */
|
tomwalters@275
|
50 virtual void ResetInternal();
|
tomwalters@268
|
51
|
tomwalters@275
|
52 /*! \brief Prepare the module
|
tomwalters@275
|
53 * \param input Input signal
|
tomwalters@275
|
54 * \param output true on success false on failure
|
tomwalters@275
|
55 */
|
tomwalters@268
|
56 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@268
|
57
|
tomwalters@268
|
58 bool RubberGMMCore(int iNumComponents, bool bDoInit);
|
tomwalters@268
|
59
|
tomwalters@268
|
60 /*! \brief Number of Gaussian Components
|
tomwalters@268
|
61 */
|
tomwalters@268
|
62 int m_iParamNComp;
|
tomwalters@268
|
63
|
tomwalters@268
|
64 /*! \brief Constant variance of Gaussians
|
tomwalters@268
|
65 */
|
tomwalters@280
|
66 float m_fParamVar;
|
tomwalters@268
|
67
|
tomwalters@268
|
68 /*! \brief posterior probability expansion exponent
|
tomwalters@268
|
69 */
|
tomwalters@280
|
70 float m_fParamPosteriorExp;
|
tomwalters@268
|
71
|
tomwalters@268
|
72 /*! \brief Maximum Number of iterations
|
tomwalters@268
|
73 */
|
tomwalters@273
|
74 int m_iParamMaxIt;
|
tomwalters@268
|
75
|
tomwalters@268
|
76 /*! \brief convergence criterion
|
tomwalters@268
|
77 */
|
tomwalters@365
|
78 float priors_converged_;
|
tomwalters@365
|
79
|
tomwalters@365
|
80 /*! \brief Output component positions as well as amplitudes
|
tomwalters@365
|
81 */
|
tomwalters@365
|
82 bool output_positions_;
|
tomwalters@365
|
83
|
tomwalters@365
|
84 /*! \brief Total number of values in the output
|
tomwalters@365
|
85 */
|
tomwalters@365
|
86 int output_component_count_;
|
tomwalters@268
|
87
|
tomwalters@268
|
88 /*! \brief The amplitudes of the components (priors)
|
tomwalters@268
|
89 */
|
tomwalters@280
|
90 vector<float> m_pA;
|
tomwalters@268
|
91
|
tomwalters@268
|
92 /*! \brief The means of the components (priors)
|
tomwalters@268
|
93 */
|
tomwalters@280
|
94 vector<float> m_pMu;
|
tomwalters@268
|
95
|
tomwalters@268
|
96 /*! \brief The spectral profile of the incoming buffer
|
tomwalters@268
|
97 */
|
tomwalters@280
|
98 vector<float> m_pSpectralProfile;
|
tomwalters@268
|
99
|
tomwalters@268
|
100 int m_iNumChannels;
|
tomwalters@268
|
101 };
|
tomwalters@268
|
102 } // namespace aimc
|
tomwalters@268
|
103
|
tomwalters@283
|
104 #endif // AIMC_MODULES_FEATURES_GAUSSIANS_H_
|