📄 prob_calc.h
字号:
/*
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright(c) 1999-2006 Intel Corporation. All Rights Reserved.
//
// Intel(R) Integrated Performance Primitives Gaussian Mixture Sample for Windows*
//
// By downloading and installing this sample, you hereby agree that the
// accompanying Materials are being provided to you under the terms and
// conditions of the End User License Agreement for the Intel(R) Integrated
// Performance Primitives product previously accepted by you. Please refer
// to the file ippEULA.rtf located in the root directory of your Intel(R) IPP
// product installation for more information.
//
//
// Gaussian Mixture Calculation Class
//
// Fake calculator has state_number mixtures of gauss_num Gaussians
// with zero means, identity vars, equal weights and space_dim dets
// SDT calculator is loaded from SDT param file
//
*/
#ifndef aaaPROB_CALC_Haaa
#define aaaPROB_CALC_Haaa
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int compNum; // component number
int compInd; // compInd of the first component
} Mixture;
typedef enum {
calcNone,
calcVect,
calcVecM,
calcMMix,
calcMix,
calcVectLow,
calcVecMLow,
calcMMixLow,
calcMixLow
} Calc_Hint;
class Feat_Calc;
class Prob_Calc {
protected:
int state_number; // states (mixtures) number
int space_dim; // feature space dimension
int gauss_num; // number of Gaussians in model
int max_gauss; // maximal Gaussians in mixture
int state_number4; // aligned states (mixtures) number
int space_dim4; // aligned feature space dimension
int gauss_num4; // aligned number of Gaussians in model
int max_len; // maximal feature buffer length
int min_len; // minimal feature buffer length
Calc_Hint type; // mixture calculation method
int delta_delay; // partially calculated features
bool sen_end; // sentence end
Feat_Calc *feat;
void *buffer; // mixture data buffer
Mixture *states; // mixture structures
float *weights; // Gaussian weights
float *dets; // Gaussian determinants
short *means; // Gaussian means
short *vars; // Gaussian variances
short *features; // input features vector
float *tmp_prob; // for probability calculation
float *mul_mean; // factors for means
short *curfeat; // current feature pointer
short *endfeat; // min_len features before end pointer
short *lastfeat; // last read feature pointer
int curidx; // current feature compInd
int lastidx; // last read feature compInd
float fake_sum; // for access to data without calculations
int ready; //
int mean_factor; // scale factor for means
int var_factor; // scale factor for vars
int sum_factor; // scale factor for sums in LogGauss
FILE *flog;
int Init_Arrays(void);
void Normalize_MeanVar(float *means_32f, float *vars_32f);
int Save_Short_File(char *file, void *header, void *exstates, void *weights, void *means,
void *vars, void *dets, void *mul_mean, void *trans);
public:
int Feature_Length(void) {return space_dim;}
int State_Number(void) {return state_number;}
int Max_Gauss(void) {return max_gauss;}
virtual short *Mean(int state) {return means+space_dim4*states[state].compInd;}
virtual short *Var(int state) {return vars+space_dim4*states[state].compInd;}
virtual float *Det(int state) {return dets+states[state].compInd;}
virtual float *Weight(int state) {return weights+states[state].compInd;}
virtual bool Ready(void) {return ready==0;}
int Obv_Prob_Vec(int state, float *result, int len);
bool Step_Forward(void);
bool Attach_Feat(Feat_Calc *feat);
bool Detach_Feat(void);
int Init_LogFile(char *feat_log);
int Init_Calc(int state_number, int max_gauss, int space_dim,
int max_len, int min_len);
int Init_Calc(char* file, int max_len, int min_len);
int Init_Calc_Short(char* file, int max_len, int min_len);
Prob_Calc (int mf, int vf, Calc_Hint hint);
virtual ~Prob_Calc(void);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -