• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*---------------------------------------------------------------------------*
2  *  specnorm.h  *
3  *                                                                           *
4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5  *                                                                           *
6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7  *  you may not use this file except in compliance with the License.         *
8  *                                                                           *
9  *  You may obtain a copy of the License at                                  *
10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
11  *                                                                           *
12  *  Unless required by applicable law or agreed to in writing, software      *
13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15  *  See the License for the specific language governing permissions and      *
16  *  limitations under the License.                                           *
17  *                                                                           *
18  *---------------------------------------------------------------------------*/
19 
20 
21 
22 #ifndef __specnorm_h
23 #define __specnorm_h
24 
25 #ifdef SET_RCSID
26 static const char specnorm_h[] = "$Id: specnorm.h,v 1.1.10.4 2007/08/31 17:44:53 dahan Exp $";
27 #endif
28 
29 
30 
31 #include "hmm_type.h"
32 
33 
34 #define USE_MEDIAN 0
35 #define USE_MEAN 1
36 
37 #define C0_MARGIN 19
38 #define MEDIAN_SPREAD 20
39 #define MIN_COUNT 1 /* was 20 */
40 
41 #define SV6_TO_MEAN 30 /* units of C0 */
42 
43 #define UNIT_SIZE 1
44 
45 /**
46  * @todo document
47  */
48 typedef struct
49 {
50   int  gain_used;
51   int  offset;
52   int  forget_factor;
53   int  estimate_period;
54   long count;
55   long *hist;
56   int  low_entry;
57   int  high_entry;
58   long high_counts;
59   long low_counts;
60   int  perc_high;
61   int  estimate_percentile;
62   int  sv6_margin;
63   int  sv6;
64   int  median;
65   int  mean;
66   int  devn;
67   long mean_count;
68   long running_total;
69   long running_total_devn;
70 }
71 spect_dist_info;
72 
73 spect_dist_info *create_spectrum_distribution(int offset, int initial_median,
74     int low_entry, int high_entry,
75     int forget_factor,
76     int estimate_period, int estimate_percentile,
77     int sv6_margin);
78 
79 void destroy_spectrum_distribution(spect_dist_info *spec);
80 void clear_distribution_counts(spect_dist_info *spec);
81 void clear_mean_counts(spect_dist_info *spec);
82 void forget_distribution_counts(spect_dist_info *spec, int forget_factor);
83 void shift_distribution_counts(spect_dist_info *spec, int shift);
84 int  add_distribution_data(spect_dist_info *spec, int spec_val);
85 void evaluate_parameters(spect_dist_info *spec);
86 int  estimate_percentile(spect_dist_info *spec, int percentile);
87 void estimate_mean(spect_dist_info *spec, int forget_factor);
88 void estimate_sv6(spect_dist_info *spec);
89 int  median_normalize_data(spect_dist_info *spec, int spec_val);
90 int  mean_normalize_data(spect_dist_info *spec, int spec_val);
91 int  sv6_normalize_data(spect_dist_info *spec, int spec_val);
92 void shift_parameters(spect_dist_info *spec, int shift);
93 
94 
95 #endif
96