PocketSphinx  0.6
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 #if 0
67 } /* Fool Emacs into not indenting things. */
68 #endif
69 
74 typedef struct {
75  int32 id;
76  mfcc_t dist;
80 
85 typedef struct {
86  mfcc_t ****mean;
87  mfcc_t ****var;
88  mfcc_t ***det;
90  logmath_t *lmath;
91  int32 n_mgau;
92  int32 n_feat;
93  int32 n_density;
94  int32 *featlen;
95 } gauden_t;
96 
97 
104 gauden_t *
105 gauden_init (char const *meanfile,
106  char const *varfile,
107  float32 varfloor,
108  logmath_t *lmath
109  );
110 
112 void gauden_free(gauden_t *g);
115 int32 gauden_mllr_transform(gauden_t *s, ps_mllr_t *mllr, cmd_ln_t *config);
116 
123 int32
124 gauden_dist (gauden_t *g,
125  int mgau,
127  int n_top,
128  mfcc_t **obs,
129  gauden_dist_t **out_dist
134  );
135 
139 void gauden_dump (const gauden_t *g
140  );
141 
145 void gauden_dump_ind (const gauden_t *g,
146  int senidx
147  );
148 
149 #if 0
150 { /* Stop indent from complaining */
151 #endif
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif /* GAUDEN_H */
void gauden_dump(const gauden_t *g)
Dump the definitionn of Gaussian distribution.
Definition: ms_gauden.c:138
Internal implementation of PocketSphinx decoder.
logmath_t * lmath
log math computation
Definition: ms_gauden.h:90
int32 n_density
Number gaussian densities in each codebook-feature stream.
Definition: ms_gauden.h:93
void gauden_free(gauden_t *g)
Release memory allocated by gauden_init.
Definition: ms_gauden.c:399
int32 id
Index of codeword (gaussian density)
Definition: ms_gauden.h:75
mfcc_t *** det
log(determinant) for each variance vector; actually, log(sqrt(2*pi*det))
Definition: ms_gauden.h:88
Structure to store distance (density) values for a given input observation wrt density values in some...
Definition: ms_gauden.h:74
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:550
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:361
Implementation of HMM base structure.
int32 * featlen
feature length for each feature
Definition: ms_gauden.h:94
int32 n_mgau
Number codebooks.
Definition: ms_gauden.h:91
Feature space linear transform structure.
Definition: acmod.h:82
mfcc_t **** mean
mean[codebook][feature][codeword] vector
Definition: ms_gauden.h:86
int32 n_feat
Number feature streams in each codebook.
Definition: ms_gauden.h:92
mfcc_t dist
Density value for input observation wrt above codeword; NOTE: result in logs3 domain, but var_t used for speed.
Definition: ms_gauden.h:76
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:148
Multivariate gaussian mixture density parameters.
Definition: ms_gauden.h:85
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:87