00001 #pragma once 00002 00003 #ifdef WIN32 00004 #if defined _USRDLL 00005 #define DllExport _declspec(dllexport) 00006 #else 00007 #define DllExport _declspec(dllimport) 00008 #endif 00009 #endif 00010 00011 #include "HLabHMM.h" 00012 #include "HLabFeat.h" 00013 #include "HLabConst.h" 00014 00031 class DllExport CHLabViterbi 00032 { 00033 const CHLabHMM* m_pHMM; 00034 const CHLabFeat* m_pFeat; 00035 int m_iDim; 00036 00037 float m_afLikelihood[MAX_NUM_STATES]; 00038 int m_aiBackpointer[MAX_NUM_STATES]; 00039 00040 int m_iT; 00041 float m_fOutNonEmitSt_L; 00042 int m_iOutNonEmitBackPointer; 00043 00044 float GaussianPDF(int iTestFrameIndex, int iStateIndex); 00045 public: 00046 CHLabViterbi(void); 00047 virtual ~CHLabViterbi(void); 00048 00049 int Init(CHLabHMM* pHMM, CHLabFeat* pFeat); 00050 00051 float Run(float* pfOutLikelihood, int* piOutBackPointer, 00052 float* pfHighestLikelihood, 00053 float fInLikelihood, int iInBackPointer, float fTH = -HLab_INFINITY); 00054 00055 inline float GetNonEmissionStateProb(void) 00056 { 00057 return m_fOutNonEmitSt_L; 00058 } 00059 00060 inline int GetNonEmissionStateBackpointer(void) 00061 { 00062 return m_iOutNonEmitBackPointer; 00063 } 00064 00065 };