⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gauss_example_16s32f.txt

📁 Intel开发的IPP库的应用实例
💻 TXT
📖 第 1 页 / 共 2 页
字号:
//
//                        INTEL CORPORATION PROPRIETARY INFORMATION
//        This software is supplied under the terms of the 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.
//
//

        Simple program to illustrate vector Gaussian mixture
        calculation and feature vectors processing
        Mixed integer and float point calculations
        Short means, variances, features and float probabilities


        gauss_main.cpp file

The main program contains several calls of Fake_Decoder_Test function with different
arguments. Probabilities and features calculated while running the test could be
logged (last two arguments).


        Fake_Decoder class

Imitates time-synchronous tree decoder requests for state likelihoods (log
probabilities). Each state corresponds to a Gaussian mixtue. Active states and the
length of state activity interval are chosen randomly. Required active states number
is defined for each frame. State activity interval length is uniformly distributed in
[1,max_live]. Probability of the active state is requested for the current frame once
per frame only. The real decoder could request the same probability several times per
frame and could request probabilities for some following frames if acoustic look-ahead
is used.

Fake_Decoder(int state_number, int max_live)
                                     - constructor
~Fake_Decoder(void)                  - destructor
int Init_Decoder(void)               - internal structures initialization
                                       >= 0 if OK, otherwise failed
bool Attach_Cache(Prob_Cache *cache) - attach ready-to-use probability cache
                                       cache state number should not be less
                                       than decoder state number
                                       true if OK, otherwise failed
int Init_LogFile(char *prob_log)     - opens log file for probabilities
                                       each probability used by decoder
                                       is written to this file as float value
                                       file is closed in
                                       this feature is useful to compare
                                       different modes of probability calculation
                                       >= 0 if OK, otherwise failed

After successful constructor, Init_Decoder and Attach_Cache calls decoder is ready

bool Ready(void)                     - true if decoder is ready, false otherwise
bool Decode_Frame(int act_num)       - process frame with act_num active states
                                       real number of active states could differ
                                       from requested (eg if it was more for
                                       previous frame and no activity intervals
                                       is finished)
                                       true if the frame is not last one
void Close_Decoder(void)             - stop decoder and fix statistics
void Get_Statistics(Len_Stat *stat)  - extract statistics data: all requests,
                                       repeated requests (0 now), number of
                                       state activity intervals of length [1,256]

int Get_Probability(int state, float *prob) -
                                       request for state probability for current
                                       frame passed to cache and statistics collected
                                       if probability is accessible 0 is returned and
                                       it is written to prob[0]
                                       if probability is not accessible 1 is returned

int Use_Probability(int state, float *prob) -
                                       use of calculated probability (imitation of
                                       calculated probability use in decoder)
                                       0 is returned

int Activity_Interval(int max_len)   - random length of state activity interval




        Prob_Cache class

Simplified SDT probability cache class. Supplies probabilities for the current frame.
If the value is not in cache up to vec_length values are requested from probability
calculator. Cache has size state_number*vec_length and crawls forward one element per
frame. After frame_num frames it is moved to the beginning.

Prob_Cache(int state_number, int vec_length, int frame_num)
                                     - constructor
~Prob_Cache(void)                    - destructor
int Init_Cache(void)                 - internal structures initialization
                                       >= 0 if OK, otherwise failed
bool Attach_Calc(Prob_Calc *calc)    - attach ready-to-use probability calculator
                                       cache state number should not be less
                                       than calculator state number
                                       true if OK, otherwise failed

After successful constructor, Init_Cache and Attach_Calc calls cache is ready

bool Ready(void)                     - true if cache is ready, false otherwise
bool Step_Forward(void)              - step to the next frame, values for the
                                       previous frame are lost
                                       true if the next frame exists
void Detach_Calc(void)               - detach probability calculator
                                       after successful Attach_Calc cache could
                                       work with other calculator
void Get_Statistics(Len_Stat *stat)  - extract statistics data: unused values,
                                       calculated vectors of length [1,vec_length]

float Get_Probability(int state)     - request for state probability for current frame
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.
Mixture parameters are read from the parameter file. Float means and vars are
normalized to balance absolute values of mean and var vector coordinates and so to
provide better precision for integer Mahalanobis distance calculation and then are
converted to shorts. Float vector of factors is formed and passed to feature
producer for DeltaMul ipp function. Float dets and weights are used. Or fake
calculator is created (max_gauss components in all mixtures, zero means, identity
vars, equal weights, space_dim dets).


Prob_Calc (int mf, int vf, Calc_Hint hint) - constructor
                                       hint - method of calculations
                                       vf - scale factor for vars
                                       mf - scale factor for means
                                       calcVect - vector (LogGauss_Scaled+LogAdd)
                                       calcVecM - vector (LogGauss_Scaled+Max)
                                       calcMix  - mixture (LogGaussMixture_Scaled)
                                       calcVectLow - vector (LogGauss_LowScaled+LogAdd)
                                                     with lower precision
                                       calcVecMLow - vector (LogGauss_LowScaled+Max)
                                                     with lower precision
                                       calcMixLow  - mixture (LogGaussMixture)_LowScaled
                                                     with lower precision
                                       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)
int Init_Calc_Short(char* file, int max_len, int min_len)
                                     - internal structures initialization for fake
                                       and file based probability calculators
                                       Mixture parameter file structure is
                                       described in feat_calc.cpp file
                                       If file with float mean and var is used
                                       file with short normalized means and vars
                                       parameters is produced
                                       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
                                       delta mul vector is passed to feature producer
                                       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
                                       features are divided by factor vector before
                                       logging to be the same as in float example
                                       >= 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -