PocketSphinx  5prealpha
ms_gauden.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 1999-2004 Carnegie Mellon University. All rights
4  * reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * This work was supported in part by funding from the Defense Advanced
19  * Research Projects Agency and the National Science Foundation of the
20  * United States of America, and the CMU Sphinx Speech Consortium.
21  *
22  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * ====================================================================
35  *
36  */
37 
38 #ifndef _LIBFBS_GAUDEN_H_
39 #define _LIBFBS_GAUDEN_H_
40 
53 /* SphinxBase headers. */
54 #include <sphinxbase/feat.h>
55 #include <sphinxbase/logmath.h>
56 #include <sphinxbase/cmd_ln.h>
57 
58 /* Local headers. */
59 #include "vector.h"
60 #include "pocketsphinx_internal.h"
61 #include "hmm.h"
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
71 typedef struct {
72  int32 id;
73  mfcc_t dist;
77 
82 typedef struct {
83  mfcc_t ****mean;
84  mfcc_t ****var;
85  mfcc_t ***det;
87  logmath_t *lmath;
88  int32 n_mgau;
89  int32 n_feat;
90  int32 n_density;
91  int32 *featlen;
92 } gauden_t;
93 
94 
101 gauden_t *
102 gauden_init (char const *meanfile,
103  char const *varfile,
104  float32 varfloor,
105  logmath_t *lmath
106  );
107 
109 void gauden_free(gauden_t *g);
112 int32 gauden_mllr_transform(gauden_t *s, ps_mllr_t *mllr, cmd_ln_t *config);
113 
120 int32
121 gauden_dist (gauden_t *g,
122  int mgau,
124  int n_top,
125  mfcc_t **obs,
126  gauden_dist_t **out_dist
131  );
132 
136 void gauden_dump (const gauden_t *g
137  );
138 
142 void gauden_dump_ind (const gauden_t *g,
143  int senidx
144  );
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* GAUDEN_H */
void gauden_dump(const gauden_t *g)
Dump the definitionn of Gaussian distribution.
Definition: ms_gauden.c:58
Internal implementation of PocketSphinx decoder.
logmath_t * lmath
log math computation
Definition: ms_gauden.h:87
int32 n_density
Number gaussian densities in each codebook-feature stream.
Definition: ms_gauden.h:90
void gauden_free(gauden_t *g)
Release memory allocated by gauden_init.
Definition: ms_gauden.c:358
int32 id
Index of codeword (gaussian density)
Definition: ms_gauden.h:72
mfcc_t *** det
log(determinant) for each variance vector; actually, log(sqrt(2*pi*det))
Definition: ms_gauden.h:85
Structure to store distance (density) values for a given input observation wrt density values in some...
Definition: ms_gauden.h:71
int32 gauden_mllr_transform(gauden_t *s, ps_mllr_t *mllr, cmd_ln_t *config)
Transform Gaussians according to an MLLR matrix (or, eventually, more).
Definition: ms_gauden.c:509
gauden_t * gauden_init(char const *meanfile, char const *varfile, float32 varfloor, logmath_t *lmath)
Read mixture gaussian codebooks from the given files.
Definition: ms_gauden.c:311
Implementation of HMM base structure.
int32 * featlen
feature length for each feature
Definition: ms_gauden.h:91
int32 n_mgau
Number codebooks.
Definition: ms_gauden.h:88
Feature space linear transform structure.
Definition: acmod.h:82
mfcc_t **** mean
mean[codebook][feature][codeword] vector
Definition: ms_gauden.h:83
int32 n_feat
Number feature streams in each codebook.
Definition: ms_gauden.h:89
mfcc_t dist
Density value for input observation wrt above codeword; NOTE: result in logs3 domain...
Definition: ms_gauden.h:73
void gauden_dump_ind(const gauden_t *g, int senidx)
Dump the definition of Gaussian distribution of a particular index to the standard output stream...
Definition: ms_gauden.c:68
Multivariate gaussian mixture density parameters.
Definition: ms_gauden.h:82
int32 gauden_dist(gauden_t *g, int mgau, int n_top, mfcc_t **obs, gauden_dist_t **out_dist)
Compute gaussian density values for the given input observation vector wrt the specified mixture gaus...
mfcc_t **** var
like mean; diagonal covariance vector only
Definition: ms_gauden.h:84