annotate src/Modules/Features/ModuleGaussians.h @ 611:0fbaf443ec82

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