/** * <p>Calculates polynomial from roots.</p> * * @param rtr * Real roots. * @param rti * Imaginary roots. * @param m * Number of roots stored in <CODE>rtr</CODE> and <CODE>rti</CODE>. * @param ar * Pointer to resulting real polynomial coefficients. * @param ai * Pointer to resulting imaginary polynomial coefficients (or <code>NULL</code>). * @return <code>O_K</code> if successful, a (negative) error code otherwise */ INT16 dlm_poly(FLOAT64 rtr[], FLOAT64 rti[], INT16 m, FLOAT64 ar[], FLOAT64 ai[]) { INT16 i = 0; INT16 j = 0; FLOAT64* arp = NULL; FLOAT64* aip = NULL; if ((!ar) || (!rtr) || (!rti)) return NOT_EXEC; if (ai == NULL) { aip = (FLOAT64*) dlp_calloc(m+1, sizeof(FLOAT64)); if (!aip) return ERR_MEM; arp = ar; } else { aip = ai; arp = ar; } dlp_memset(arp, 0L, (m + 1) * sizeof(FLOAT64)); dlp_memset(aip, 0L, (m + 1) * sizeof(FLOAT64)); arp[0] = 1.0; for (i = 0; i < m; i++) { for (j = i; j >= 0; j--) { arp[j + 1] = arp[j + 1] - rtr[i] * arp[j] + rti[i] * aip[j]; aip[j + 1] = aip[j + 1] - rti[i] * arp[j] - rtr[i] * aip[j]; } } if (ai == NULL) dlp_free(aip); return O_K; }
INT16 CFvrtools_GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_SINGLETON; #ifdef __cplusplus lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CFvrtools::CreateInstance; lpClassWord->ex.fct.lpfInstall = CFvrtools::InstallProc; #else /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CFvrtools_CreateInstance; lpClassWord->ex.fct.lpfInstall = CFvrtools_InstallProc; #endif /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpProject = "fvrtools"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "FST-based feature-value relation processing tools"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CFvrtools"; lpClassWord->ex.fct.lpAuthor = "Matthias Wolff, Werner Meyer"; dlp_strcpy(lpClassWord->lpName ,"fvrtools"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0.0"); return O_K; }
INT16 CDlpFile_GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOINSTANCE; #ifdef __cplusplus lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CDlpFile::CreateInstance; lpClassWord->ex.fct.lpfInstall = CDlpFile::InstallProc; #else /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CDlpFile_CreateInstance; lpClassWord->ex.fct.lpfInstall = CDlpFile_InstallProc; #endif /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpProject = "file"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "File list processor and import/export filters"; lpClassWord->ex.fct.lpAutoname = "stdfile"; lpClassWord->ex.fct.lpCname = "CDlpFile"; lpClassWord->ex.fct.lpAuthor = "M. Wolff, M. Eichner and M. Cuevas"; dlp_strcpy(lpClassWord->lpName ,"file"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.1.2"); return O_K; }
/** * Base class implementation of the class information function. * The base class implementation does nothing. * * @param lpWord Pointer to a SWord structure which will receive the * information * @return O_K if successful, an error code otherwise */ INT16 CDlpObject_GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; #ifdef __cplusplus lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CDlpObject::CreateInstance; lpClassWord->ex.fct.lpfInstall = CDlpObject::InstallProc; #else /* #ifdef __cplusplus */ lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CDlpObject_CreateInstance; lpClassWord->ex.fct.lpfInstall = CDlpObject_InstallProc; #endif /* #ifdef __cplusplus */ lpClassWord->ex.fct.lpProject = "dlpobject"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "Generic object"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CDlpObject"; lpClassWord->ex.fct.lpAuthor = "Matthias Wolff"; dlp_strcpy(lpClassWord->lpName ,"object"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"2.5.1"); return O_K; }
INT16 CFsttools_GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; #ifdef __cplusplus lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CFsttools::CreateInstance; lpClassWord->ex.fct.lpfInstall = CFsttools::InstallProc; #else /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CFsttools_CreateInstance; lpClassWord->ex.fct.lpfInstall = CFsttools_InstallProc; #endif /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpProject = "fsttools"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "Tools for FST modification"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CFsttools"; lpClassWord->ex.fct.lpAuthor = "frank.duckhorn"; dlp_strcpy(lpClassWord->lpName ,"fsttools"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.00 DLC22"); return O_K; }
INT16 CHelloworld_GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; #ifdef __cplusplus lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CHelloworld::CreateInstance; lpClassWord->ex.fct.lpfInstall = CHelloworld::InstallProc; #else /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CHelloworld_CreateInstance; lpClassWord->ex.fct.lpfInstall = CHelloworld_InstallProc; #endif /* #ifdef __DLP_CSCOPE */ lpClassWord->ex.fct.lpProject = "helloworld"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "Simple example for a dLabPro class"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CHelloworld"; lpClassWord->ex.fct.lpAuthor = "m.eichner"; dlp_strcpy(lpClassWord->lpName ,"Helloworld"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.00 SLC22"); return O_K; }
/** * Prints the instance in text mode (exactly one component of type 1). */ INT16 CGEN_PRIVATE CData_PrintText(CData* _this) { INT32 nR = 0; /* Current record */ INT32 nXR = 0; /* Number of records */ char* tx = NULL; /* Auxilary char pointer #1 */ char* tx0 = NULL; /* Pointer to string */ char* ty = NULL; /* Auxilary char pointer #2 */ char* ty0 = NULL; /* Pointer to last white space */ INT32 nCtr = 0; /* Line counter */ char sBuf[255]; /* Printing buffer */ /* Initialize */ /* --------------------------------- */ nXR = CData_GetNRecs(_this); /* Get number of records */ /* Print data contents as text */ /* --------------------------------- */ DLPASSERT(FMSG("ALPHA: String mode not tested yet")); /* TODO: Remove after debugging */ printf("\n String Mode"); dlp_inc_printlines(1); /* Protocol */ tx0=tx=(char*)CData_XAddr(_this,0,0); /* Initialize char pointers */ if (!*tx) /* Empty string */ { /* >> */ printf("\n [empty]"); /* Protocol */ dlp_inc_printlines(1); /* Adjust no. of printed lines */ } /* << */ else while (*tx) /* Loop over characters */ { /* >> */ /* Make line breaks */ /* - - - - - - - - - - - - - - - - */ for (ty=tx,ty0=NULL; *ty && ty<tx0+nXR; ) /* Do until end of string */ { /* >> */ while (*ty && ty<tx0+nXR && !iswspace(*ty)) ty++; /* Seek next white space */ while (*ty && ty<tx0+nXR && iswspace(*ty)) ty++; /* Skip following white spaces */ ty0=ty; /* Remember previous white spc. */ if (ty>tx+dlp_maxprintcols()-16) break; /* Line full */ } /* << */ if (ty0) ty=ty0; /* Go back to last white space */ /* Print one line */ /* - - - - - - - - - - - - - - - - */ dlp_memset(sBuf,0,255); /* Clear printing buffer */ dlp_memmove(sBuf,tx,ty-tx); /* Copy characters in */ printf("\n %4d(%06d): %s",(int)nCtr,(int)(tx-tx0),sBuf); /* Print 'em */ dlp_inc_printlines(1); /* Adjust no. of printed lines */ if (dlp_if_printstop()) break; /* Break listing */ /* End-of-line actions */ /* - - - - - - - - - - - - - - - - */ DLPASSERT(ty>tx); /* Should have made some progress */ tx=ty; /* Move to end of printed line */ nCtr++; /* Increment line counter */ } /* << */ if (nR>=nXR) printf("\n No more data - Stop."); /* Protocol */ else printf("\n Cancelled - Stop."); /* Protocol */ return O_K; /* Ok */ }
/** * <p>Calculates polynomial from roots.</p> * * @param rt * Pointer to roots. * @param m * Number of roots stored in <CODE>rt</CODE>. * @param a * Pointer to resulting complex polynomial coefficients. * @return <code>O_K</code> if successful, a (negative) error code otherwise */ INT16 dlm_polyC(COMPLEX64* rt, INT16 m, COMPLEX64* a) { INT16 i = 0; INT16 j = 0; if ((!a) || (!rt)) return NOT_EXEC; dlp_memset(a, 0L, (m + 1) * sizeof(COMPLEX64)); a[0].x = 1.0; for (i = 0; i < m; i++) { for (j = i; j >= 0; j--) { a[j + 1].x = a[j + 1].x - rt[i].x * a[j].x + rt[i].y * a[j].y; a[j + 1].y = a[j + 1].y - rt[i].y * a[j].x - rt[i].x * a[j].y; } } return O_K; }
/** * Get data initializer '{ ... }' from command line and store into token list * lpsInit. * <h3>Note</h3> * <p>You must setup the method invocation context <code>m_lpMic</code> (see * <a href="dlpinst.html"><code class="link">CDlpInstance</code></a>) before * calling this method. Otherwise it will do noting.</p> * * @param lpsInit Pointer to character buffer to store initializer in. The * tokens will be separated by nulls '\0', opening and closing * curly braces will not be included! The token list will be * terminated with a double null "\0\0". * @param nLen Maximal number of characters to place on lpsInit (including * the terminal double null) * @param bForce If TRUE the method does not seek for the opening curly brace * but starts reading initializers until it encounters a closing * curly brace '}'. A leading opening curly brace will, however, * be tolerated. If FALSE the method <i>expects</i> an opening * curly brace and does not read any initializers if no leading * opening brace is found. * @return The number of initializers read */ INT32 CGEN_PROTECTED CData_ReadInitializer ( CData* _this, char* lpsInit, INT32 nLen, BOOL bForce ) { const char* lpsToken; /* Current token */ INT32 nCnt; /* Token counter */ INT32 nPos; /* Position in output buffer */ BOOL bStor; /* Store next token */ /* Initialize */ /* --------------------------------- */ if (!CDlpObject_MicGet(BASEINST(_this))) return 0; /* Need invocation context */ if (!lpsInit) return 0; /* Need output buffer */ dlp_memset(lpsInit,0,nLen); /* Clear output buffer */ /* Do initializers follow? */ /* --------------------------------- */ lpsToken = MIC_NEXTTOKEN_FORCE; /* Ruthlessly get next token */ if (!lpsToken || dlp_strcmp(lpsToken,"{")!=0) /* No or not the "{" token */ { /* >> */ if (bForce) IERROR(_this,DATA_NOTFOUND,"Constant initializer ","'{'",0); /* If there should be some-> error */ if (lpsToken) MIC_REFUSETOKEN; /* Wrong token -> push it back */ return 0; /* Now get out'a here */ } /* << */ /* Get 'em tokens */ /* --------------------------------- */ for (nCnt=0,nPos=0,bStor=TRUE; ; nCnt++) /* Infinitely ... */ { /* >> */ lpsToken = MIC_NEXTTOKEN_FORCE; /* Ruthlessly get next token */ if (!lpsToken) return IERROR(_this,DATA_HERESCAN,"}",0,0); /* No more tokens -> forget it */ if (dlp_strcmp(lpsToken,"}")==0) break; /* End token -> get out'a here */ if (nLen<nPos+(INT32)dlp_strlen(lpsToken)+2) bStor = FALSE; /* Cannot store more tokens :( */ if (!bStor) continue; /* Ignore ALL following tokens */ dlp_strcpy(&lpsInit[nPos],lpsToken); /* Store token */ nPos+=(INT32)dlp_strlen(&lpsInit[nPos])+1; /* Set next token pointer */ } /* << */ return nCnt; /* Return number of tokens read */ }
/** * Changes the current working directory. If <code>bCreate</code> is * <code>TRUE</code> and the directory does not exists, <code>dlp_chdir</code> * will create the directory. <code>dlp_chdir</code> is capable of creating a * tree of non-existing directories at once. * * @param lpsDirname Destination directory * @param bCreate Create directory if not exists * @return 0 if successful, an error code (or -1) if not sucessful */ INT16 dlp_chdir(const char* lpsDirname, BOOL bCreate) { char lpsDir[L_PATH]; char* tx; INT16 nError; if (dlp_strlen(lpsDirname)==0) return 0; nError = (INT16)chdir(lpsDirname); if (nError == 0 || !bCreate) return nError; /* Try to create path */ dlp_memset(lpsDir,0,L_PATH); dlp_strcpy(lpsDir,lpsDirname); /* Change into the furthest existing directory */ tx = &lpsDir[dlp_strlen(lpsDir)-1]; while (tx != lpsDir) { while (tx!=lpsDir && *tx != '\\' && *tx != '/') tx--; if (tx!=lpsDir) *tx=0; if (chdir(lpsDir) == 0) break; } if (tx!=lpsDir) tx++; /* Create remaining sub directories */ while (tx[1]) { #if (defined __MSOS || defined __WIN32) nError = (INT16)mkdir(tx); #else nError = (INT16)mkdir(tx,0xFFFF); #endif if (nError) return nError; nError = (INT16)chdir(tx); if (nError) return nError; while (*tx++); } /* Should have worked... */ return 0; }
INT16 CHFAproc::GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CHFAproc::CreateInstance; lpClassWord->ex.fct.lpfInstall = CHFAproc::InstallProc; lpClassWord->ex.fct.lpProject = "HFAproc"; lpClassWord->ex.fct.lpBaseClass = "FBAproc"; lpClassWord->lpComment = "Harmonicity based feature analysis"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CHFAproc"; lpClassWord->ex.fct.lpAuthor = "Rico Petrick, Mike Lorenz"; dlp_strcpy(lpClassWord->lpName ,"HFAproc"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0"); return O_K; }
INT16 CLPCproc::GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CLPCproc::CreateInstance; lpClassWord->ex.fct.lpfInstall = CLPCproc::InstallProc; lpClassWord->ex.fct.lpProject = "LPCproc"; lpClassWord->ex.fct.lpBaseClass = "FBAproc"; lpClassWord->lpComment = "Linear prediction coding (LPC) analysis and synthesis"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CLPCproc"; lpClassWord->ex.fct.lpAuthor = "Guntram Strecha"; dlp_strcpy(lpClassWord->lpName ,"LPCproc"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0 DLP"); return O_K; }
INT16 CDgen::GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CDgen::CreateInstance; lpClassWord->ex.fct.lpfInstall = CDgen::InstallProc; lpClassWord->ex.fct.lpProject = "dgen"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "Document parser and generator"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CDgen"; lpClassWord->ex.fct.lpAuthor = "Matthias Wolff"; dlp_strcpy(lpClassWord->lpName ,"DGen"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0.1"); return O_K; }
INT16 CFWTproc::GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CFWTproc::CreateInstance; lpClassWord->ex.fct.lpfInstall = CFWTproc::InstallProc; lpClassWord->ex.fct.lpProject = "FWTproc"; lpClassWord->ex.fct.lpBaseClass = "FBAproc"; lpClassWord->lpComment = "Base class for fast discrete wavelet transformation."; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CFWTproc"; lpClassWord->ex.fct.lpAuthor = "Soeren Wittenberg"; dlp_strcpy(lpClassWord->lpName ,"FWTproc"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0"); return O_K; }
INT16 CPMproc::GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CPMproc::CreateInstance; lpClassWord->ex.fct.lpfInstall = CPMproc::InstallProc; lpClassWord->ex.fct.lpProject = "PMproc"; lpClassWord->ex.fct.lpBaseClass = "-"; lpClassWord->lpComment = "Base class for pitch calculation."; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CPMproc"; lpClassWord->ex.fct.lpAuthor = "Guntram Strecha"; dlp_strcpy(lpClassWord->lpName ,"PMproc"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0 DLP"); return O_K; }
INT16 CFFTproc::GetClassInfo(SWord* lpClassWord) { if (!lpClassWord) return NOT_EXEC; dlp_memset(lpClassWord,0,sizeof(SWord)); lpClassWord->nWordType = WL_TYPE_FACTORY; lpClassWord->nFlags = CS_AUTOACTIVATE; lpClassWord->ex.fct.lpfFactory = (LP_FACTORY_PROC)CFFTproc::CreateInstance; lpClassWord->ex.fct.lpfInstall = CFFTproc::InstallProc; lpClassWord->ex.fct.lpProject = "FFTproc"; lpClassWord->ex.fct.lpBaseClass = "FBAproc"; lpClassWord->lpComment = "FFT class based on FBAproc"; lpClassWord->ex.fct.lpAutoname = ""; lpClassWord->ex.fct.lpCname = "CFFTproc"; lpClassWord->ex.fct.lpAuthor = "Matthias Eichner"; dlp_strcpy(lpClassWord->lpName ,"FFTproc"); dlp_strcpy(lpClassWord->lpObsname ,""); dlp_strcpy(lpClassWord->ex.fct.version.no ,"1.0 DLP"); return O_K; }
/** * Adds three auxiliary components to the state table of this instance. These * components are used by {@link -compose CFst_Compose} and * {@link -best_n CFst_BestN} to associate a composed state with its source * states and an epsilon filter mode. The method sets the field * {@link ic_sd_aux m_nIcSdAux} to the first component added. * * @param _this Pointer to automaton instance * @see Cps_DelSdAux CFst_Cps_DelSdAux * @see Cps_SetSdAux CFst_Cps_SetSdAux * @see Cps_FindState CFst_Cps_FindState */ void CGEN_PRIVATE CFst_Cps_AddSdAux(CFst* _this) { /* Add auxiliary components to state table */ CData_AddComp(AS(CData,_this->sd),"X" ,DLP_TYPE(FST_ITYPE)); CData_AddComp(AS(CData,_this->sd),"Y" ,DLP_TYPE(FST_ITYPE)); CData_AddComp(AS(CData,_this->sd),"Flg",T_BYTE ); DLPASSERT((_this->m_nIcSdAux = CData_FindComp(AS(CData,_this->sd),"X" ))>=0); DLPASSERT( CData_FindComp(AS(CData,_this->sd),"Y" ) >=0); DLPASSERT( CData_FindComp(AS(CData,_this->sd),"Flg") >=0); /* Initialize hash node pool */ DLPASSERT(_this->m_lpCpsHnpool ==NULL); DLPASSERT(_this->m_nCpsHnpoolSize==0 ); _this->m_lpCpsHnpool = (void**)dlp_calloc(100,sizeof(hnode_t*)); _this->m_nCpsHnpoolSize = 0; dlp_memset(_this->m_lpCpsKeybuf,0,3*sizeof(FST_ITYPE)); /* Initialize composed state hash map */ DLPASSERT(_this->m_lpCpsHash==NULL); _this->m_lpCpsHash = hash_create(HASHCOUNT_T_MAX,CFst_Cps_HashCmp,CFst_Cps_HashFn,_this); hash_set_allocator((hash_t*)_this->m_lpCpsHash,CFst_Cps_HashAllocNode,CFst_Cps_HashFreeNode,_this); }
/** * Analyse * * Derived instances of FBAproc should override method * Analyse() to add the desired functionality * * @return O_K if successfull, NOT_EXEC otherwise */ INT16 CGEN_PUBLIC CCPproc::AnalyzeFrame() { INT16 ret = O_K; if(!strcmp(m_lpsType, "MelFilter")) { CData* idCep = NULL; CData* idMel = NULL; ICREATEEX(CData, idCep, "~idCep", NULL); ICREATEEX(CData, idMel, "~idMel", NULL); if((ret = CMELproc::AnalyzeFrame()) != O_K) return ret; idMel->Select(m_idRealFrame, 0, m_nCoeff); if((ret = Mf2mcep(idMel, idCep, m_nCoeff)) != O_K) return ret; dlp_memmove(m_idRealFrame->XAddr(0, 0), idCep->XAddr(0, 0), m_nCoeff * sizeof(FLOAT64)); IDESTROY(idMel); IDESTROY(idCep); } else { if(!strcmp(m_lpsWarptype, "time")) { if(!strcmp(m_lpsType, "BurgLPC")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_MLPC_BURG_MCEP); } else if(!strcmp(m_lpsType, "LevinsonLPC")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_MLPC_LEVI_MCEP); } else if(!strcmp(m_lpsType, "Uels")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nLen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_MCEP_UELS); } else if(!strcmp(m_lpsType, "LogFFT")) { dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64)); if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0),(FLOAT64*)m_idImagFrame->XAddr(0, 0),m_nLen,FALSE)) != O_K) { if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0); return NOT_EXEC; } LN(); if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, TRUE)) != O_K) { if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0); return NOT_EXEC; } for(INT32 i = 1; i < m_nCoeff; i++) { ((FLOAT64*)m_idRealFrame->XAddr(0, 0))[i] *= 2.0; } } else { IERROR(this,ERR_NULLINST,0,0,0); return NOT_EXEC; } } else { if(!strcmp(m_lpsType, "BurgLPC")) { if(!strcmp(m_lpsWarptype, "lpc")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_BURG_MLPC_MCEP); } else if(!strcmp(m_lpsWarptype, "cepstrum")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_BURG_CEP_MCEP); } else if(!strcmp(m_lpsWarptype, "none")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_BURG_CEP); } else { IERROR(this, CP_WARPTYPE, m_lpsWarptype, 0, 0); return NOT_EXEC; } } else if(!strcmp(m_lpsType, "LevinsonLPC")) { if(!strcmp(m_lpsWarptype, "lpc")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_LEVI_MLPC_MCEP); } else if(!strcmp(m_lpsWarptype, "cepstrum")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen / 2, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_LEVI_CEP_MCEP); } else if(!strcmp(m_lpsWarptype, "none")) { dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_LEVI_CEP); } else { IERROR(this, CP_WARPTYPE, m_lpsWarptype, 0, 0); return NOT_EXEC; } } else if(!strcmp(m_lpsType, "Uels")) { if((ret = dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nLen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, m_nPfaLambda, exp(-m_nMinLog), DLM_CALCCEP_METHOD_S_MCEP_UELS)) != O_K) { return NOT_EXEC; } } else if(!strcmp(m_lpsType, "LogFFT")) { dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64)); if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, FALSE)) != O_K) { if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0); return NOT_EXEC; } LN(); if(!strcmp(m_lpsWarptype, "lpc")) { IERROR(this, CP_WARPTYPE, m_lpsWarptype, 0, 0); return NOT_EXEC; } else if(!strcmp(m_lpsWarptype, "cepstrum")) { dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64)); if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, TRUE)) != O_K) { if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0); return NOT_EXEC; } dlm_cep2mcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nLen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, m_nPfaLambda, NULL); } else if(!strcmp(m_lpsWarptype, "spectrum")) { WARP(); dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64)); if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, TRUE)) != O_K) { if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0); return NOT_EXEC; } } else if(!strcmp(m_lpsWarptype, "none")) { dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64)); if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, TRUE)) != O_K) { if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0); return NOT_EXEC; } } else { IERROR(this,ERR_NULLINST,0,0,0); } for(INT32 i = 1; i < m_nCoeff; i++) { ((FLOAT64*)m_idRealFrame->XAddr(0, 0))[i] *= 2.0; } } else if(strcmp(m_lpsWarptype, "none")) { IERROR(this,ERR_NULLINST,0,0,0); } } } return O_K; }