📄 gauss_example_32f_2threads.txt
字号:
from cache (only for state from queue)
int State_Number(void) - get state number in cache (state_number)
Prob_Calc class
Calculates the vector of Gaussian mixture probabilities. The model consists of
state_number states. Each state corresponds to Gaussian mixture with max_gauss or
less components. Weight, determinant, mean and var values are situated in separate
vectors in the same order. Mean and var vectors are aligned to 16 byte boundary.
Model parameters are read from SDT hmm.param file or fake calculator is created
(max_gauss components in all mixtures, zero means, identity vars, equal weights,
space_dim dets).
Prob_Calc (Calc_Hint hint) - constructor
hint - method of calculations
calcVect - vector (LogGauss_D2+LogAdd)
calcMix - mixture (LogGaussMixture)
calcNone - access to data only
~Prob_Calc(void) - destructor
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)
- internal structures initialization for fake
and SDT based probability calculators
Buffer for max_len features is reserved
Vectors of lengt [min_len,max_len] are
calculated (shorter at the utterance end)
>= 0 if OK, otherwise failed
bool Attach_Feat(Feat_Calc *feat) - attach ready-to-use feature producer
feature vector length should be the same as
for calculator
true if OK, otherwise failed
int Init_LogFile(char *feat_log) - opens log file for features
feature vectors really used by probability
calculator are written as HTK feature file
file is closed in desctuctor or while
feature producer detachment
>= 0 if OK, otherwise failed
After successful constructor, Init_Calc and Attach_Feat calls cache is ready
bool Ready(void) - true if calculator is ready, false otherwise
bool Step_Forward(void) - step to the next frame
true if the next frame exists
void Detach_Feat(void) - detach feature producer
after successful Attach_Feat calculator could
work with other producer
int Obv_Prob_Vec(int state, float *result, int len)
- calculate len probabilities from current
frame that are placed to result
less than len values could be calculated if
there are less than len features in the buffer
ot at the end of utterance
features are requested from feature producer
if less than min_len features are in buffer
calculator requests and takes into account
number of partially calculated features due
to delta calculation
number of calculated probabilities is returned
or -1 for wrong arguments
int State_Number(void) - get state number in calculator (state_number)
int Max_Gauss(void) - get maximal Gaussians in mixture (max_gauss)
int Feature_Length(void) - get feature vector length in calculator
float *Mean(int state) - get pointer to first element of first mean of state
float *Var(int state) - get pointer to first element of first var of state {return vars+space_dim4*states[state].index;}
float *Det(int state) - get pointer to first det of state
float *Weight(int state) - get pointer to first weight of state
void AddState(int t,int state,float* curbuf,int vec_length)
- add state to the queue
void CalcState(void) - calc probabilities for all states from the queue
void Sync(void) - reset counter of the queue (at the end of frame)
int ReadyState(void) - request the quantity of calculated states from the queue
void Stop(void) - stop the calculation of probabilities for states from the queue
Feat_Calc class
Calculates feature vectors for probability calculator. Fake producer provides zero
feature vectors. File producer takes data from HTK feature file with float data.
Delta or double delta are calculated if necessary.
Feat_Calc (int space_dim, int max_delay) - constructor
Each feature vector of length space_dim is
appended to the length (space_dim+3)&(~3)
for 16 byte alignment
max_delay is used to imitate low delay
feature producer - features are calculated by
portions of length no more than max_delay.
If deltas are calculated delta_delay =
delta_window*(delta_number+1) is added.
delta_delay is 0 for fake feature producer
If max_delay<=0 features for all utterance
could be calculated at once
Feature producer has no internal buffer and
calculates features in consumer's buffer
~Init_Feat(void) - destructor
int Init_Feat(int frame_number) - internal structures initialization for fake
int Init_Feat(char *file) and SDT based feature producers
Fake feature producer provides an utterance
of frame_number frames, each frame is zero
vector of length space_dim
HTK file based feature producer reads raw feature
vectors of length raw_dim from HTK feature file
Feature vector elements assumed to be floats.
space_dim should be equal to raw_dim, raw_dim*2,
raw_dim*3, (raw_dim-1), (raw_dim-1)*2 or
(raw_dim-1)*3. If necessary last element of
raw feature is deleted and deltas or double
deltas with delta_window=2 are calculated.
>= 0 if OK, otherwise failed
After successful constructor and Init_Feat calls producer is ready
bool Ready(void) - true if producer is ready, false otherwise
int Get_Feature(float *dst, int len, bool* end)
- puts calculated featurs to consumers buffer dst
len features is requested, the number of
fully calculated features is returned
if utterance is not ended they are followed by
delta_delay partially calculated feature vectors
The first partially calculated feature vector is
passed as dst for the next feature portion
if the calculated portion ends the utterance
end[0] is true otherwise false
int Feature_Length(void) - get output feature vector length
int Delta_Delay(void) - get delta_delay of feature producer
Probability calculator requests this number to
provide correct interaction with probability
calculator
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -