📄 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
} Calc_Hint;
typedef struct _Prob_List{
int t;
float *buf;
int len;
int next;
} Prob_List;
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
float *means; // Gaussian means
float *vars; // Gaussian variances
float *features; // input features vector
float *tmp_prob; // for probability calculation
float *curfeat; // current feature pointer
float *endfeat; // min_len features before end pointer
float *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 *length; //array of length of vectors of probability
int ready; //
Prob_List *in;
int in_start;
int in_end;
int tmp_counter;
bool running;
FILE *flog;
int Init_Arrays(void);
public:
int Feature_Length(void) {return space_dim;}
int State_Number(void) {return state_number;}
int Max_Gauss(void) {return max_gauss;}
virtual float *Mean(int state) {return means+space_dim4*states[state].compInd;}
virtual float *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;}
virtual int* Lengths(void) {return length;}
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);
void AddState(int t,int state,float* curbuf,int vec_length);
void CalcState(void);
void Sync(void);
int ReadyState(void);
void Stop(void);
Prob_Calc (Calc_Hint hint);
virtual ~Prob_Calc(void);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -